@visactor/vrender-components 1.1.0-alpha.2 → 1.1.0-alpha.20

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 (110) hide show
  1. package/cjs/animation/axis-animate.d.ts +1 -0
  2. package/cjs/animation/axis-animate.js +11 -4
  3. package/cjs/animation/axis-animate.js.map +1 -1
  4. package/cjs/animation/exit-release.d.ts +13 -0
  5. package/cjs/animation/exit-release.js +39 -0
  6. package/cjs/animation/exit-release.js.map +1 -0
  7. package/cjs/animation/static-truth.d.ts +2 -0
  8. package/cjs/animation/static-truth.js +21 -0
  9. package/cjs/animation/static-truth.js.map +1 -0
  10. package/cjs/axis/animate/group-transition.d.ts +2 -2
  11. package/cjs/axis/animate/group-transition.js +7 -3
  12. package/cjs/axis/animate/group-transition.js.map +1 -1
  13. package/cjs/axis/base.d.ts +6 -2
  14. package/cjs/axis/base.js +80 -30
  15. package/cjs/axis/base.js.map +1 -1
  16. package/cjs/axis/line.d.ts +1 -1
  17. package/cjs/axis/line.js +2 -2
  18. package/cjs/axis/line.js.map +1 -1
  19. package/cjs/axis/util.js +1 -2
  20. package/cjs/brush/config.js +2 -1
  21. package/cjs/core/type.d.ts +7 -0
  22. package/cjs/core/type.js.map +1 -1
  23. package/cjs/crosshair/polygon-sector.js +1 -2
  24. package/cjs/crosshair/sector.js +2 -1
  25. package/cjs/empty-tip/register.js +1 -2
  26. package/cjs/index.d.ts +1 -1
  27. package/cjs/index.js +1 -1
  28. package/cjs/index.js.map +1 -1
  29. package/cjs/indicator/config.js +2 -1
  30. package/cjs/jsx/index.js +1 -1
  31. package/cjs/label/arc.js +1 -1
  32. package/cjs/label/base.d.ts +6 -1
  33. package/cjs/label/base.js +69 -3
  34. package/cjs/label/base.js.map +1 -1
  35. package/cjs/label/dataLabel.d.ts +5 -1
  36. package/cjs/label/dataLabel.js +46 -1
  37. package/cjs/label/dataLabel.js.map +1 -1
  38. package/cjs/legend/discrete/discrete.js +17 -9
  39. package/cjs/legend/discrete/discrete.js.map +1 -1
  40. package/cjs/marker/animate/call-in.js +6 -2
  41. package/cjs/marker/animate/call-in.js.map +1 -1
  42. package/cjs/marker/animate/clip-in.js +6 -2
  43. package/cjs/marker/animate/clip-in.js.map +1 -1
  44. package/cjs/marker/animate/common.js +14 -5
  45. package/cjs/marker/animate/common.js.map +1 -1
  46. package/cjs/marker/base.d.ts +6 -2
  47. package/cjs/marker/base.js +51 -9
  48. package/cjs/marker/base.js.map +1 -1
  49. package/cjs/marker/type.d.ts +2 -1
  50. package/cjs/marker/type.js.map +1 -1
  51. package/cjs/timeline/timeline.js +35 -12
  52. package/cjs/timeline/timeline.js.map +1 -1
  53. package/cjs/title/title.js +5 -2
  54. package/cjs/title/title.js.map +1 -1
  55. package/dist/index.es.js +1503 -270
  56. package/es/animation/axis-animate.d.ts +1 -0
  57. package/es/animation/axis-animate.js +12 -4
  58. package/es/animation/axis-animate.js.map +1 -1
  59. package/es/animation/exit-release.d.ts +13 -0
  60. package/es/animation/exit-release.js +31 -0
  61. package/es/animation/exit-release.js.map +1 -0
  62. package/es/animation/static-truth.d.ts +2 -0
  63. package/es/animation/static-truth.js +14 -0
  64. package/es/animation/static-truth.js.map +1 -0
  65. package/es/axis/animate/group-transition.d.ts +2 -2
  66. package/es/axis/animate/group-transition.js +7 -2
  67. package/es/axis/animate/group-transition.js.map +1 -1
  68. package/es/axis/base.d.ts +6 -2
  69. package/es/axis/base.js +81 -28
  70. package/es/axis/base.js.map +1 -1
  71. package/es/axis/line.d.ts +1 -1
  72. package/es/axis/line.js +2 -2
  73. package/es/axis/line.js.map +1 -1
  74. package/es/axis/util.js +1 -2
  75. package/es/brush/config.js +2 -1
  76. package/es/core/type.d.ts +7 -0
  77. package/es/core/type.js.map +1 -1
  78. package/es/crosshair/polygon-sector.js +1 -2
  79. package/es/crosshair/sector.js +2 -1
  80. package/es/empty-tip/register.js +1 -2
  81. package/es/index.d.ts +1 -1
  82. package/es/index.js +1 -1
  83. package/es/index.js.map +1 -1
  84. package/es/indicator/config.js +2 -1
  85. package/es/jsx/index.js +1 -1
  86. package/es/label/arc.js +1 -1
  87. package/es/label/base.d.ts +6 -1
  88. package/es/label/base.js +71 -2
  89. package/es/label/base.js.map +1 -1
  90. package/es/label/dataLabel.d.ts +5 -1
  91. package/es/label/dataLabel.js +46 -0
  92. package/es/label/dataLabel.js.map +1 -1
  93. package/es/legend/discrete/discrete.js +18 -8
  94. package/es/legend/discrete/discrete.js.map +1 -1
  95. package/es/marker/animate/call-in.js +7 -2
  96. package/es/marker/animate/call-in.js.map +1 -1
  97. package/es/marker/animate/clip-in.js +7 -2
  98. package/es/marker/animate/clip-in.js.map +1 -1
  99. package/es/marker/animate/common.js +10 -2
  100. package/es/marker/animate/common.js.map +1 -1
  101. package/es/marker/base.d.ts +6 -2
  102. package/es/marker/base.js +51 -8
  103. package/es/marker/base.js.map +1 -1
  104. package/es/marker/type.d.ts +2 -1
  105. package/es/marker/type.js.map +1 -1
  106. package/es/timeline/timeline.js +36 -11
  107. package/es/timeline/timeline.js.map +1 -1
  108. package/es/title/title.js +5 -2
  109. package/es/title/title.js.map +1 -1
  110. package/package.json +5 -5
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { EventEmitter, Logger, isBoolean, isObject, isFunction, tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, isArray, cos, sin, pi, isString, pointAt, isNumber, sqrt, isPointInLine, Color, isEqual, OBBBounds, isNil, normalTransform, isValidUrl, isBase64, getContextFont, rotatePoint, transformBoundsWithMatrix, clampAngleByRadian, asin, isNumberClose, TextMeasure, Bounds, getRectIntersect, isRectIntersect, arrayEqual, acos, isPlainObject as isPlainObject$3, merge, isValid, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct, isEmpty, array, rectInsideAnotherRect, radianToDegree, getAngleByPoint, polarToCartesian, normalizeAngle, isValidNumber, flattenArray, isRotateAABBIntersect, isLess, isGreater, aabbSeparation, obbSeparation, cloneDeep, get, last, mixin, interpolateString, minInArray, maxInArray, binaryFuzzySearchInNumberRange, pointInRect, calculateAnchorOfBounds, computeQuadrant, polygonContainPoint } from '@visactor/vutils';
1
+ import { EventEmitter, Logger, isBoolean, isObject, isFunction, tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, isArray, cos, sin, pi, isString, pointAt, isNumber, sqrt, isPointInLine, Color, OBBBounds, isEqual, isNil, normalTransform, isValidUrl, isBase64, getContextFont, rotatePoint, transformBoundsWithMatrix, clampAngleByRadian, asin, isNumberClose, TextMeasure, Bounds, getRectIntersect, isRectIntersect, arrayEqual, acos, isPlainObject as isPlainObject$3, merge, isValid, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct, isEmpty, array, rectInsideAnotherRect, radianToDegree, getAngleByPoint, polarToCartesian, normalizeAngle, isValidNumber, flattenArray, isRotateAABBIntersect, isLess, isGreater, aabbSeparation, obbSeparation, cloneDeep, get, last, mixin, interpolateString, minInArray, maxInArray, binaryFuzzySearchInNumberRange, pointInRect, calculateAnchorOfBounds, computeQuadrant, polygonContainPoint } from '@visactor/vutils';
2
2
  import { isContinuous, isDiscrete, LinearScale } from '@visactor/vscale';
3
3
 
4
4
  class Hook {
@@ -4800,9 +4800,172 @@ function classifyAttributeDelta(key, prev, next) {
4800
4800
  }
4801
4801
 
4802
4802
  const STAGE_PERF_MONITOR = Symbol("vrender.statePerfMonitor");
4803
+ function createReasonBreakdown() {
4804
+ return {
4805
+ config_disabled: 0,
4806
+ context_disabled: 0,
4807
+ non_batch_operation: 0,
4808
+ mixed_update_category: 0,
4809
+ resolver_unstable_keys: 0,
4810
+ graphic_unavailable: 0
4811
+ };
4812
+ }
4813
+ function createEmptyStatePerfSnapshot() {
4814
+ return {
4815
+ counters: {
4816
+ stateCommits: 0,
4817
+ sharedRefreshCommits: 0,
4818
+ deferredJobsCreated: 0,
4819
+ deferredJobsCompleted: 0,
4820
+ deferredJobsCancelled: 0,
4821
+ deferredJobsCoalesced: 0,
4822
+ deferredGraphicsCommitted: 0,
4823
+ deferredBudgetYields: 0,
4824
+ deferredIneligibleGraphics: 0
4825
+ },
4826
+ deferredIneligibleByReason: createReasonBreakdown(),
4827
+ categoryBreakdown: {
4828
+ paint: 0,
4829
+ transform: 0,
4830
+ shape: 0,
4831
+ bounds: 0,
4832
+ layout: 0,
4833
+ pick: 0
4834
+ },
4835
+ refresh: {
4836
+ queuedGraphics: 0,
4837
+ flushedGraphics: 0,
4838
+ ensureFreshCalls: 0,
4839
+ renderScheduled: 0
4840
+ },
4841
+ resolver: {
4842
+ cacheHits: 0,
4843
+ cacheMisses: 0,
4844
+ invalidations: 0
4845
+ },
4846
+ cost: {
4847
+ resolverTotalMs: 0,
4848
+ resolverMaxMs: 0,
4849
+ patchTotalMs: 0,
4850
+ patchMaxMs: 0,
4851
+ sharedRefreshTotalMs: 0,
4852
+ sharedRefreshMaxMs: 0,
4853
+ batchSliceTotalMs: 0,
4854
+ batchSliceMaxMs: 0
4855
+ },
4856
+ allocationHints: {
4857
+ patchObjectsCreated: 0,
4858
+ batchEntriesCreated: 0,
4859
+ refreshQueuePushes: 0
4860
+ },
4861
+ batch: {
4862
+ pendingJobs: 0,
4863
+ maxPendingJobs: 0,
4864
+ maxGraphicsInJob: 0,
4865
+ maxFrameSliceCost: 0
4866
+ },
4867
+ events: []
4868
+ };
4869
+ }
4870
+ function cloneSnapshot(snapshot) {
4871
+ return {
4872
+ counters: Object.assign({}, snapshot.counters),
4873
+ deferredIneligibleByReason: Object.assign({}, snapshot.deferredIneligibleByReason),
4874
+ categoryBreakdown: Object.assign({}, snapshot.categoryBreakdown),
4875
+ refresh: Object.assign({}, snapshot.refresh),
4876
+ resolver: Object.assign({}, snapshot.resolver),
4877
+ cost: Object.assign({}, snapshot.cost),
4878
+ allocationHints: Object.assign({}, snapshot.allocationHints),
4879
+ batch: Object.assign({}, snapshot.batch),
4880
+ events: snapshot.events ? snapshot.events.slice() : []
4881
+ };
4882
+ }
4883
+ class StatePerfMonitor {
4884
+ constructor(configSource) {
4885
+ this.configSource = configSource, this.snapshot = createEmptyStatePerfSnapshot();
4886
+ }
4887
+ setConfig(config) {
4888
+ this.configSource = config;
4889
+ }
4890
+ getSnapshot() {
4891
+ return cloneSnapshot(this.snapshot);
4892
+ }
4893
+ reset() {
4894
+ const next = createEmptyStatePerfSnapshot();
4895
+ Object.assign(this.snapshot.counters, next.counters), Object.assign(this.snapshot.deferredIneligibleByReason, next.deferredIneligibleByReason), Object.assign(this.snapshot.categoryBreakdown, next.categoryBreakdown), Object.assign(this.snapshot.refresh, next.refresh), Object.assign(this.snapshot.resolver, next.resolver), Object.assign(this.snapshot.cost, next.cost), Object.assign(this.snapshot.allocationHints, next.allocationHints), Object.assign(this.snapshot.batch, next.batch), this.snapshot.events = [];
4896
+ }
4897
+ incrementCounter(key, delta = 1) {
4898
+ this.isEnabled() && (this.snapshot.counters[key] += delta);
4899
+ }
4900
+ recordDeferredIneligible(reason, delta = 1) {
4901
+ this.isEnabled() && (this.snapshot.deferredIneligibleByReason[reason] += delta, this.snapshot.counters.deferredIneligibleGraphics += delta, this.recordEvent("deferred-ineligible", {
4902
+ reason: reason,
4903
+ count: delta
4904
+ }));
4905
+ }
4906
+ recordCategory(category) {
4907
+ this.isEnabled() && (category & UpdateCategory.PAINT && (this.snapshot.categoryBreakdown.paint += 1), category & UpdateCategory.TRANSFORM && (this.snapshot.categoryBreakdown.transform += 1), category & UpdateCategory.SHAPE && (this.snapshot.categoryBreakdown.shape += 1), category & UpdateCategory.BOUNDS && (this.snapshot.categoryBreakdown.bounds += 1), category & UpdateCategory.LAYOUT && (this.snapshot.categoryBreakdown.layout += 1), category & UpdateCategory.PICK && (this.snapshot.categoryBreakdown.pick += 1));
4908
+ }
4909
+ recordRefresh(key, delta = 1) {
4910
+ this.isEnabled() && (this.snapshot.refresh[key] += delta);
4911
+ }
4912
+ recordResolver(key, delta = 1) {
4913
+ this.isEnabled() && (this.snapshot.resolver[key] += delta);
4914
+ }
4915
+ recordCost(kind, durationMs) {
4916
+ if (this.isEnabled()) {
4917
+ if ("resolver" === kind) return this.snapshot.cost.resolverTotalMs += durationMs, void (this.snapshot.cost.resolverMaxMs = Math.max(this.snapshot.cost.resolverMaxMs, durationMs));
4918
+ if ("patch" === kind) return this.snapshot.cost.patchTotalMs += durationMs, void (this.snapshot.cost.patchMaxMs = Math.max(this.snapshot.cost.patchMaxMs, durationMs));
4919
+ if ("sharedRefresh" === kind) return this.snapshot.cost.sharedRefreshTotalMs += durationMs, void (this.snapshot.cost.sharedRefreshMaxMs = Math.max(this.snapshot.cost.sharedRefreshMaxMs, durationMs));
4920
+ this.snapshot.cost.batchSliceTotalMs += durationMs, this.snapshot.cost.batchSliceMaxMs = Math.max(this.snapshot.cost.batchSliceMaxMs, durationMs), this.snapshot.batch.maxFrameSliceCost = Math.max(this.snapshot.batch.maxFrameSliceCost, durationMs);
4921
+ }
4922
+ }
4923
+ recordAllocation(key, delta = 1) {
4924
+ this.isEnabled() && (this.snapshot.allocationHints[key] += delta);
4925
+ }
4926
+ updateBatchPending(pendingJobs) {
4927
+ this.isEnabled() && (this.snapshot.batch.pendingJobs = pendingJobs, this.snapshot.batch.maxPendingJobs = Math.max(this.snapshot.batch.maxPendingJobs, pendingJobs));
4928
+ }
4929
+ updateMaxGraphicsInJob(count) {
4930
+ this.isEnabled() && (this.snapshot.batch.maxGraphicsInJob = Math.max(this.snapshot.batch.maxGraphicsInJob, count));
4931
+ }
4932
+ recordEvent(type, detail) {
4933
+ var _a, _b, _c;
4934
+ if (!this.shouldRecordEvents()) return;
4935
+ const events = null !== (_a = this.snapshot.events) && void 0 !== _a ? _a : this.snapshot.events = [];
4936
+ events.push({
4937
+ type: type,
4938
+ at: Date.now(),
4939
+ detail: detail
4940
+ });
4941
+ const max = null !== (_c = null === (_b = this.getConfig()) || void 0 === _b ? void 0 : _b.maxEventRecords) && void 0 !== _c ? _c : 100;
4942
+ events.length > max && events.splice(0, events.length - max);
4943
+ }
4944
+ isEnabled() {
4945
+ var _a;
4946
+ return !0 === (null === (_a = this.getConfig()) || void 0 === _a ? void 0 : _a.enabled);
4947
+ }
4948
+ shouldRecordEvents() {
4949
+ const config = this.getConfig();
4950
+ return !!(null == config ? void 0 : config.enabled) && !!config.recordEvents;
4951
+ }
4952
+ getConfig() {
4953
+ return "function" == typeof this.configSource ? this.configSource() : this.configSource;
4954
+ }
4955
+ }
4956
+ function ensureStageStatePerfMonitor(stage) {
4957
+ const stageAny = stage;
4958
+ return stageAny[STAGE_PERF_MONITOR] || (stageAny[STAGE_PERF_MONITOR] = new StatePerfMonitor(() => stage.statePerfConfig)), stageAny[STAGE_PERF_MONITOR];
4959
+ }
4803
4960
  function getStageStatePerfMonitor(stage) {
4804
4961
  if (stage) return stage[STAGE_PERF_MONITOR];
4805
4962
  }
4963
+ function getActiveStageStatePerfMonitor(stage) {
4964
+ var _a;
4965
+ if (!stage) return;
4966
+ const current = getStageStatePerfMonitor(stage);
4967
+ return current || (!0 === (null === (_a = stage.statePerfConfig) || void 0 === _a ? void 0 : _a.enabled) ? ensureStageStatePerfMonitor(stage) : void 0);
4968
+ }
4806
4969
 
4807
4970
  function isPlainObject$1(value) {
4808
4971
  return null != value && "object" == typeof value && !Array.isArray(value);
@@ -4898,7 +5061,7 @@ class StateEngine {
4898
5061
  }
4899
5062
  invalidateResolverCache() {
4900
5063
  var _a, _b;
4901
- this.resolverPatchCache.clear(), this.resolverCacheKey = "", this.resolverCacheValid = !1, null === (_b = getStageStatePerfMonitor(null === (_a = this.graphic) || void 0 === _a ? void 0 : _a.stage)) || void 0 === _b || _b.recordResolver("invalidations");
5064
+ this.resolverPatchCache.clear(), this.resolverCacheKey = "", this.resolverCacheValid = !1, null === (_b = getActiveStageStatePerfMonitor(null === (_a = this.graphic) || void 0 === _a ? void 0 : _a.stage)) || void 0 === _b || _b.recordResolver("invalidations");
4902
5065
  }
4903
5066
  hasState(stateName) {
4904
5067
  return !!this._activeStates.length && (null == stateName || this._activeStates.includes(stateName));
@@ -4945,7 +5108,7 @@ class StateEngine {
4945
5108
  }
4946
5109
  recomputePatch(effectiveStates) {
4947
5110
  var _a;
4948
- const perfMonitor = getStageStatePerfMonitor(null === (_a = this.graphic) || void 0 === _a ? void 0 : _a.stage),
5111
+ const perfMonitor = getActiveStageStatePerfMonitor(null === (_a = this.graphic) || void 0 === _a ? void 0 : _a.stage),
4949
5112
  patchStart = perfMonitor ? performance.now() : 0;
4950
5113
  let resolverCost = 0;
4951
5114
  const cacheKey = effectiveStates.join(","),
@@ -5193,32 +5356,6 @@ class StateStyleResolver {
5193
5356
  }
5194
5357
  }), resolvedAttrs;
5195
5358
  }
5196
- resolveWithCompiled(normalAttrs, compiledDefinitions, stateProxy, effectiveStates, resolvedPatch) {
5197
- var _a, _b;
5198
- const mergeMode = null !== (_a = this.options.mergeMode) && void 0 !== _a ? _a : "shallow",
5199
- resolvedAttrs = null !== (_b = cloneValue(resolvedPatch)) && void 0 !== _b ? _b : {};
5200
- return effectiveStates.forEach(stateName => {
5201
- const proxyPatch = null == stateProxy ? void 0 : stateProxy(stateName, effectiveStates);
5202
- null != proxyPatch && Object.keys(proxyPatch).forEach(key => {
5203
- const nextValue = proxyPatch[key],
5204
- hasCompiledDefinition = compiledDefinitions.has(stateName);
5205
- if ("deep" === mergeMode && isPlainObject(nextValue) && (isPlainObject(resolvedAttrs[key]) || !hasCompiledDefinition && isPlainObject(normalAttrs[key]))) {
5206
- const baseValue = isPlainObject(resolvedAttrs[key]) ? resolvedAttrs[key] : isPlainObject(normalAttrs[key]) ? normalAttrs[key] : {};
5207
- resolvedAttrs[key] = deepMerge(baseValue, nextValue);
5208
- } else resolvedAttrs[key] = cloneValue(nextValue);
5209
- });
5210
- }), resolvedAttrs;
5211
- }
5212
- computeNormalAttrsBackup(normalAttrs, targetAttrs, finalAttribute) {
5213
- const nextNormalAttrs = {},
5214
- nextTargetAttrs = Object.assign({}, targetAttrs);
5215
- for (const key in targetAttrs) Object.prototype.hasOwnProperty.call(targetAttrs, key) && (nextNormalAttrs[key] = cloneValue(normalAttrs && key in normalAttrs ? normalAttrs[key] : finalAttribute[key]));
5216
- if (normalAttrs) for (const key in normalAttrs) Object.prototype.hasOwnProperty.call(normalAttrs, key) && !(key in targetAttrs) && (nextTargetAttrs[key] = cloneValue(normalAttrs[key]));
5217
- return {
5218
- attrs: nextTargetAttrs,
5219
- normalAttrs: nextNormalAttrs
5220
- };
5221
- }
5222
5359
  }
5223
5360
 
5224
5361
  function hasOwnKeys(value) {
@@ -5240,11 +5377,23 @@ class StateTransitionOrchestrator {
5240
5377
  if (!hasAnimation) return plan;
5241
5378
  const noWorkAnimateAttr = Object.assign(Object.assign({}, null !== (_a = options.noWorkAnimateAttr) && void 0 !== _a ? _a : {}), normalizeNoAnimateAttrConfig(null === (_b = options.animateConfig) || void 0 === _b ? void 0 : _b.noAnimateAttrs)),
5242
5379
  isClear = !0 === options.isClear,
5243
- getDefaultAttribute = options.getDefaultAttribute;
5380
+ getDefaultAttribute = options.getDefaultAttribute,
5381
+ shouldSkipDefaultAttribute = options.shouldSkipDefaultAttribute,
5382
+ assignTransitionAttr = (key, value) => {
5383
+ if (noWorkAnimateAttr[key]) return plan.jumpAttrs[key] = value, void (plan.noAnimateAttrs[key] = value);
5384
+ if (isClear && void 0 === value) {
5385
+ if (null == shouldSkipDefaultAttribute ? void 0 : shouldSkipDefaultAttribute(key, targetAttrs)) return;
5386
+ plan.animateAttrs[key] = getDefaultAttribute ? getDefaultAttribute(key) : value;
5387
+ } else plan.animateAttrs[key] = value;
5388
+ };
5244
5389
  for (const key in targetAttrs) {
5245
5390
  if (!Object.prototype.hasOwnProperty.call(targetAttrs, key)) continue;
5246
- const value = targetAttrs[key];
5247
- noWorkAnimateAttr[key] ? (plan.jumpAttrs[key] = value, plan.noAnimateAttrs[key] = value) : plan.animateAttrs[key] = isClear && void 0 === value && getDefaultAttribute ? getDefaultAttribute(key) : value;
5391
+ assignTransitionAttr(key, targetAttrs[key]);
5392
+ }
5393
+ const extraAnimateAttrs = options.extraAnimateAttrs;
5394
+ if (extraAnimateAttrs) for (const key in extraAnimateAttrs) {
5395
+ const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetAttrs, key);
5396
+ !Object.prototype.hasOwnProperty.call(extraAnimateAttrs, key) || hasTargetAttr && void 0 !== targetAttrs[key] || assignTransitionAttr(key, extraAnimateAttrs[key]);
5248
5397
  }
5249
5398
  return plan;
5250
5399
  }
@@ -5271,12 +5420,14 @@ class StateTransitionOrchestrator {
5271
5420
  }), plan;
5272
5421
  }
5273
5422
  applyClearTransition(graphic, targetAttrs, hasAnimation, stateNames, options = {}) {
5274
- var _a, _b;
5423
+ var _a, _b, _c, _d;
5275
5424
  const plan = this.analyzeTransition({}, targetAttrs, stateNames, hasAnimation, {
5276
5425
  noWorkAnimateAttr: null === (_a = graphic.getNoWorkAnimateAttr) || void 0 === _a ? void 0 : _a.call(graphic),
5277
5426
  isClear: !0,
5278
5427
  getDefaultAttribute: null === (_b = graphic.getDefaultAttribute) || void 0 === _b ? void 0 : _b.bind(graphic),
5279
- animateConfig: options.animateConfig
5428
+ shouldSkipDefaultAttribute: null !== (_c = options.shouldSkipDefaultAttribute) && void 0 !== _c ? _c : null === (_d = graphic.shouldSkipStateTransitionDefaultAttribute) || void 0 === _d ? void 0 : _d.bind(graphic),
5429
+ animateConfig: options.animateConfig,
5430
+ extraAnimateAttrs: options.extraAnimateAttrs
5280
5431
  });
5281
5432
  return this.applyTransition(graphic, plan, hasAnimation, options);
5282
5433
  }
@@ -5324,7 +5475,7 @@ function rebuildSharedStateScope(scope) {
5324
5475
  }
5325
5476
  function ensureSharedStateScopeFresh(scope) {
5326
5477
  var _a;
5327
- if (scope) return null === (_a = getStageStatePerfMonitor(scope.ownerStage)) || void 0 === _a || _a.recordRefresh("ensureFreshCalls"), scope.parentScope && ensureSharedStateScopeFresh(scope.parentScope), (scope.dirty || scope.parentScope && scope.parentRevisionAtBuild !== scope.parentScope.revision) && rebuildSharedStateScope(scope), scope;
5478
+ if (scope) return null === (_a = getActiveStageStatePerfMonitor(scope.ownerStage)) || void 0 === _a || _a.recordRefresh("ensureFreshCalls"), scope.parentScope && ensureSharedStateScopeFresh(scope.parentScope), (scope.dirty || scope.parentScope && scope.parentRevisionAtBuild !== scope.parentScope.revision) && rebuildSharedStateScope(scope), scope;
5328
5479
  }
5329
5480
  function collectSharedStateScopeChain(scope) {
5330
5481
  const chain = [];
@@ -5335,7 +5486,7 @@ function collectSharedStateScopeChain(scope) {
5335
5486
 
5336
5487
  function scheduleStageSharedStateRefresh(stage) {
5337
5488
  var _a;
5338
- stage && "released" !== stage.releaseStatus && (null === (_a = getStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordRefresh("renderScheduled"), stage.renderNextFrame());
5489
+ stage && "released" !== stage.releaseStatus && (null === (_a = getActiveStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordRefresh("renderScheduled"), stage.renderNextFrame());
5339
5490
  }
5340
5491
  function enqueueGraphicSharedStateRefresh(stage, graphic) {
5341
5492
  var _a;
@@ -5343,7 +5494,7 @@ function enqueueGraphicSharedStateRefresh(stage, graphic) {
5343
5494
  const pending = null !== (_a = stage._pendingSharedStateRefreshGraphics) && void 0 !== _a ? _a : stage._pendingSharedStateRefreshGraphics = new Set();
5344
5495
  if (!pending.has(graphic)) {
5345
5496
  pending.add(graphic);
5346
- const perfMonitor = getStageStatePerfMonitor(stage);
5497
+ const perfMonitor = getActiveStageStatePerfMonitor(stage);
5347
5498
  null == perfMonitor || perfMonitor.recordRefresh("queuedGraphics"), null == perfMonitor || perfMonitor.recordAllocation("refreshQueuePushes");
5348
5499
  }
5349
5500
  }
@@ -5363,9 +5514,12 @@ const tempConstantXYKey = ["x", "y"],
5363
5514
  tempConstantScaleXYKey = ["scaleX", "scaleY"],
5364
5515
  tempConstantAngleKey = ["angle"],
5365
5516
  builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
5366
- point = new Point();
5517
+ FULL_STATE_DEFINITION_KEYS = new Set(["name", "patch", "priority", "exclude", "suppress", "resolver", "declaredAffectedKeys"]),
5518
+ point = new Point(),
5519
+ EMPTY_STATE_NAMES = [],
5520
+ BROAD_UPDATE_CATEGORY = UpdateCategory.PAINT | UpdateCategory.SHAPE | UpdateCategory.BOUNDS | UpdateCategory.TRANSFORM | UpdateCategory.LAYOUT;
5367
5521
  function isPlainObjectValue(value) {
5368
- return "object" == typeof value && null != value && !isArray(value);
5522
+ return "object" == typeof value && null != value && !Array.isArray(value);
5369
5523
  }
5370
5524
  function cloneAttributeValue(value) {
5371
5525
  if (!isPlainObjectValue(value)) return value;
@@ -5376,12 +5530,6 @@ function cloneAttributeValue(value) {
5376
5530
  clone[key] = isPlainObjectValue(nextValue) ? cloneAttributeValue(nextValue) : nextValue;
5377
5531
  }), clone;
5378
5532
  }
5379
- function cloneSimpleAttributeRecord(value) {
5380
- return isPlainObjectValue(value) ? Object.assign({}, value) : value;
5381
- }
5382
- function shouldUseSimpleAttributeFastPath(value) {
5383
- return !!isPlainObjectValue(value) && !Object.keys(value).some(key => isPlainObjectValue(value[key]));
5384
- }
5385
5533
  function cloneAttributeSurface(value) {
5386
5534
  if (!isPlainObjectValue(value)) return value;
5387
5535
  const source = value,
@@ -5391,6 +5539,9 @@ function cloneAttributeSurface(value) {
5391
5539
  clone[key] = isPlainObjectValue(nextValue) ? Object.assign({}, nextValue) : nextValue;
5392
5540
  }), clone;
5393
5541
  }
5542
+ function areAttributeValuesEqual(left, right) {
5543
+ return left === right || !!(isPlainObjectValue(left) || isPlainObjectValue(right) || Array.isArray(left) || Array.isArray(right)) && isEqual(left, right);
5544
+ }
5394
5545
  function deepMergeAttributeValue(base, value) {
5395
5546
  var _a;
5396
5547
  const result = null !== (_a = cloneAttributeValue(base)) && void 0 !== _a ? _a : {};
@@ -5453,18 +5604,24 @@ class Graphic extends Node {
5453
5604
  get globalTransMatrix() {
5454
5605
  return this.tryUpdateGlobalTransMatrix(!0);
5455
5606
  }
5607
+ get baseAttributes() {
5608
+ var _a;
5609
+ return null !== (_a = this._baseAttributes) && void 0 !== _a ? _a : this.attribute;
5610
+ }
5611
+ set baseAttributes(value) {
5612
+ value !== this.attribute ? this._baseAttributes = value : this._baseAttributes = void 0;
5613
+ }
5456
5614
  constructor(params = {}) {
5457
5615
  var _a;
5458
- super(), this.resolverEpoch = 0, this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT;
5459
- const useSimpleAttributeFastPath = shouldUseSimpleAttributeFastPath(params),
5460
- initialBaseAttributes = useSimpleAttributeFastPath ? cloneSimpleAttributeRecord(params) : cloneAttributeValue(params);
5461
- this.baseAttributes = initialBaseAttributes, this.attribute = useSimpleAttributeFastPath ? cloneSimpleAttributeRecord(initialBaseAttributes) : cloneAttributeSurface(initialBaseAttributes), this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background && this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0), isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
5616
+ super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background && this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0), params.texture && isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
5462
5617
  }
5463
5618
  get normalAttrs() {
5464
5619
  return this.baseAttributes;
5465
5620
  }
5466
- set normalAttrs(value) {
5467
- this._deprecatedNormalAttrsView = null != value ? value : void 0;
5621
+ set normalAttrs(_value) {}
5622
+ getBaseAttributesStorage() {
5623
+ var _a;
5624
+ return null !== (_a = this._baseAttributes) && void 0 !== _a ? _a : this.attribute;
5468
5625
  }
5469
5626
  getGraphicService() {
5470
5627
  var _a, _b;
@@ -5495,10 +5652,18 @@ class Graphic extends Node {
5495
5652
  const nextScope = this.resolveBoundSharedStateScope();
5496
5653
  return this.boundSharedStateScope === nextScope ? (this.syncSharedStateActiveRegistrations(), !1) : (this.boundSharedStateScope = nextScope, this.boundSharedStateRevision = void 0, this.localFallbackCompiledDefinitions = void 0, this.compiledStateDefinitions = void 0, this.compiledStateDefinitionsCacheKey = void 0, this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0, this.stateEngineStateProxyModeKey = void 0, this.syncSharedStateActiveRegistrations(), markDirty && (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && this.markSharedStateDirty(), !0);
5497
5654
  }
5498
- syncSharedStateActiveRegistrations() {
5655
+ syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
5499
5656
  var _a, _b;
5500
- const nextScopes = (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && this.boundSharedStateScope ? new Set(collectSharedStateScopeChain(this.boundSharedStateScope)) : new Set();
5501
- (null !== (_b = this.registeredActiveScopes) && void 0 !== _b ? _b : new Set()).forEach(scope => {
5657
+ return !!((null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || this.boundSharedStateScope || (null === (_b = this.registeredActiveScopes) || void 0 === _b ? void 0 : _b.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingFromTree(markDirty);
5658
+ }
5659
+ syncSharedStateActiveRegistrations() {
5660
+ var _a;
5661
+ const previousScopes = this.registeredActiveScopes;
5662
+ if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach(scope => {
5663
+ scope.subtreeActiveDescendants.delete(this);
5664
+ }), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
5665
+ const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
5666
+ null == previousScopes || previousScopes.forEach(scope => {
5502
5667
  nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
5503
5668
  }), nextScopes.forEach(scope => {
5504
5669
  scope.subtreeActiveDescendants.add(this);
@@ -5514,15 +5679,13 @@ class Graphic extends Node {
5514
5679
  this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this), scheduleStageSharedStateRefresh(this.stage);
5515
5680
  }
5516
5681
  onParentSharedStateTreeChanged(stage, layer) {
5517
- this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingFromTree() : this.setStage(stage, layer);
5682
+ this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
5518
5683
  }
5519
5684
  refreshSharedStateBeforeRender() {
5520
5685
  var _a;
5521
5686
  (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) ? (this.syncSharedStateScopeBindingFromTree(!1), this.boundSharedStateScope && ensureSharedStateScopeFresh(this.boundSharedStateScope), this.recomputeCurrentStatePatch(), this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
5522
5687
  type: AttributeUpdateType.STATE
5523
- }), this._emitCustomEvent("afterStateUpdate", {
5524
- type: AttributeUpdateType.STATE
5525
- }), this.sharedStateDirty = !1) : this.sharedStateDirty = !1;
5688
+ }), this.emitStateUpdateEvent(), this.sharedStateDirty = !1) : this.sharedStateDirty = !1;
5526
5689
  }
5527
5690
  getLocalStatesVersion() {
5528
5691
  var _a, _b;
@@ -5572,15 +5735,13 @@ class Graphic extends Node {
5572
5735
  };
5573
5736
  }
5574
5737
  recomputeCurrentStatePatch() {
5575
- var _a, _b, _c, _d;
5738
+ var _a, _b;
5576
5739
  if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length)) return this.effectiveStates = [], this.resolvedStatePatch = void 0, void this.syncSharedStateActiveRegistrations();
5577
- const stateResolveBaseAttrs = null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : this.attribute,
5578
- stateModel = this.createStateModel();
5579
- null === (_c = this.stateEngine) || void 0 === _c || _c.setResolveContext(this, stateResolveBaseAttrs);
5580
- const transition = stateModel.useStates(this.currentStates),
5581
- effectiveStates = null !== (_d = transition.effectiveStates) && void 0 !== _d ? _d : transition.states,
5740
+ const stateResolveBaseAttrs = this.getStateResolveBaseAttrs(),
5741
+ transition = this.createStateModel(stateResolveBaseAttrs).useStates(this.currentStates),
5742
+ effectiveStates = null !== (_b = transition.effectiveStates) && void 0 !== _b ? _b : transition.states,
5582
5743
  resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
5583
- this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs), this.syncSharedStateActiveRegistrations();
5744
+ this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.syncSharedStateActiveRegistrations();
5584
5745
  }
5585
5746
  buildStaticAttributeSnapshot() {
5586
5747
  var _a;
@@ -5592,6 +5753,23 @@ class Graphic extends Node {
5592
5753
  "deep" === this.stateMergeMode && isPlainObjectValue(previousValue) && isPlainObjectValue(nextValue) ? snapshot[key] = deepMergeAttributeValue(previousValue, nextValue) : snapshot[key] = cloneAttributeValue(nextValue);
5593
5754
  }), snapshot) : snapshot;
5594
5755
  }
5756
+ buildRemovedStateAnimationAttrs(targetStateAttrs, previousResolvedStatePatch) {
5757
+ const extraAttrs = {};
5758
+ if (!previousResolvedStatePatch) return extraAttrs;
5759
+ const snapshot = this.buildStaticAttributeSnapshot(),
5760
+ staticTargetAttrs = snapshot;
5761
+ return Object.keys(previousResolvedStatePatch).forEach(key => {
5762
+ const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetStateAttrs, key);
5763
+ if (hasTargetAttr && void 0 !== targetStateAttrs[key]) return;
5764
+ const assignFallbackAttr = value => {
5765
+ void 0 === value && this.shouldSkipStateTransitionDefaultAttribute(key, staticTargetAttrs) || (extraAttrs[key] = void 0 === value ? value : cloneAttributeValue(value));
5766
+ };
5767
+ if (hasTargetAttr) assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));else if (Object.prototype.hasOwnProperty.call(snapshot, key)) {
5768
+ const snapshotValue = snapshot[key];
5769
+ assignFallbackAttr(void 0 === snapshotValue ? this.getStateTransitionDefaultAttribute(key, staticTargetAttrs) : snapshotValue);
5770
+ } else assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));
5771
+ }), extraAttrs;
5772
+ }
5595
5773
  syncObjectToSnapshot(target, snapshot) {
5596
5774
  const delta = new Map();
5597
5775
  return new Set([...Object.keys(target), ...Object.keys(snapshot)]).forEach(key => {
@@ -5602,16 +5780,17 @@ class Graphic extends Node {
5602
5780
  next: void 0
5603
5781
  }), delete target[key]));
5604
5782
  const nextValue = snapshot[key];
5605
- isEqual(previousValue, nextValue) || (delta.set(key, {
5783
+ areAttributeValuesEqual(previousValue, nextValue) || (delta.set(key, {
5606
5784
  prev: previousValue,
5607
5785
  next: nextValue
5608
5786
  }), target[key] = cloneAttributeValue(nextValue));
5609
5787
  }), delta;
5610
5788
  }
5611
5789
  _syncAttribute() {
5790
+ this.attribute === this.baseAttributes && this.resolvedStatePatch && this.detachAttributeFromBaseAttributes();
5612
5791
  const snapshot = this.buildStaticAttributeSnapshot(),
5613
5792
  delta = this.syncObjectToSnapshot(this.attribute, snapshot);
5614
- return this.valid = this.isValid(), delta;
5793
+ return this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, delta;
5615
5794
  }
5616
5795
  _syncFinalAttributeFromStaticTruth() {
5617
5796
  const target = this.finalAttribute;
@@ -5619,47 +5798,146 @@ class Graphic extends Node {
5619
5798
  const snapshot = this.buildStaticAttributeSnapshot();
5620
5799
  this.syncObjectToSnapshot(target, snapshot);
5621
5800
  }
5622
- submitUpdateByDelta(delta, forceUpdateTag = !1) {
5801
+ mergeAttributeDeltaCategory(category, key, prev, next) {
5802
+ var _a;
5803
+ let nextCategory = "stroke" === key || "shadowBlur" === key ? classifyAttributeDelta(key, prev, next) : null !== (_a = ATTRIBUTE_CATEGORY[key]) && void 0 !== _a ? _a : UpdateCategory.PAINT;
5804
+ return nextCategory & UpdateCategory.PICK && (nextCategory |= UpdateCategory.BOUNDS), nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key) && (nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS), category | nextCategory;
5805
+ }
5806
+ submitUpdateByCategory(category, forceUpdateTag = !1) {
5623
5807
  var _a;
5624
5808
  if (forceUpdateTag) return this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), void this.addUpdateLayoutTag();
5809
+ if (category !== UpdateCategory.NONE) {
5810
+ const stage = this.stage;
5811
+ stage && (null === (_a = getActiveStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordCategory(category));
5812
+ }
5813
+ (category & BROAD_UPDATE_CATEGORY) !== BROAD_UPDATE_CATEGORY ? (category & UpdateCategory.SHAPE ? this.addUpdateShapeAndBoundsTag() : category & UpdateCategory.BOUNDS && this.addUpdateBoundTag(), category & UpdateCategory.PAINT && this.addUpdatePaintTag(), category & UpdateCategory.TRANSFORM && this.addUpdatePositionTag(), category & UpdateCategory.LAYOUT && this.addUpdateLayoutTag()) : this.addBroadUpdateTag();
5814
+ }
5815
+ submitUpdateByDelta(delta, forceUpdateTag = !1) {
5625
5816
  let category = UpdateCategory.NONE;
5626
5817
  delta.forEach((entry, key) => {
5627
- let nextCategory = classifyAttributeDelta(key, entry.prev, entry.next);
5628
- nextCategory & UpdateCategory.PICK && (nextCategory |= UpdateCategory.BOUNDS), nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key) && (nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS), category |= nextCategory;
5629
- }), category !== UpdateCategory.NONE && (null === (_a = getStageStatePerfMonitor(this.stage)) || void 0 === _a || _a.recordCategory(category)), category & UpdateCategory.SHAPE ? this.addUpdateShapeAndBoundsTag() : category & UpdateCategory.BOUNDS && this.addUpdateBoundTag(), category & UpdateCategory.PAINT && this.addUpdatePaintTag(), category & UpdateCategory.TRANSFORM && this.addUpdatePositionTag(), category & UpdateCategory.LAYOUT && this.addUpdateLayoutTag();
5818
+ category = this.mergeAttributeDeltaCategory(category, key, entry.prev, entry.next);
5819
+ }), this.submitUpdateByCategory(category, forceUpdateTag);
5820
+ }
5821
+ submitTouchedKeyUpdate(keys, forceUpdateTag = !1) {
5822
+ this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTags(keys));
5823
+ }
5824
+ submitTouchedUpdate(needsShapeAndBounds) {
5825
+ !this.updateShapeAndBoundsTagSetted() && needsShapeAndBounds ? this.addUpdateShapeAndBoundsTag() : this.addUpdateBoundTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag();
5630
5826
  }
5631
5827
  commitBaseAttributeMutation(forceUpdateTag = !1, context) {
5632
- var _a, _b;
5633
- (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && (this.resolverEpoch += 1, null === (_b = this.stateEngine) || void 0 === _b || _b.invalidateResolverCache(), this.recomputeCurrentStatePatch());
5828
+ var _a, _b, _c;
5829
+ (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && (this.resolverEpoch = (null !== (_b = this.resolverEpoch) && void 0 !== _b ? _b : 0) + 1, null === (_c = this.stateEngine) || void 0 === _c || _c.invalidateResolverCache(), this.recomputeCurrentStatePatch());
5634
5830
  const delta = this._syncAttribute();
5635
5831
  this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
5636
5832
  }
5833
+ canCommitBaseAttributesByTouchedKeys() {
5834
+ var _a, _b;
5835
+ return !((null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || this.resolvedStatePatch || this.attributeMayContainTransientAttrs) && (!(null === (_b = this.animates) || void 0 === _b ? void 0 : _b.size) && !this._animationStateManager || !this.hasAnyTrackedAnimate());
5836
+ }
5837
+ detachAttributeFromBaseAttributes() {
5838
+ this.attribute === this.baseAttributes && (this._baseAttributes = this.attribute, this.attribute = cloneAttributeSurface(this.attribute));
5839
+ }
5840
+ commitInternalBaseAttributes(params, context) {
5841
+ params && Object.keys(params).length && (this.canCommitBaseAttributesByTouchedKeys() ? this.commitBaseAttributesByTouchedKeys(params, !1, context) : (this.detachAttributeFromBaseAttributes(), this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context)));
5842
+ }
5843
+ commitBaseAttributesByTouchedKeys(params, forceUpdateTag = !1, context) {
5844
+ const source = params,
5845
+ baseAttributes = this.getBaseAttributesStorage();
5846
+ let hasKeys = !1,
5847
+ needsShapeAndBounds = forceUpdateTag;
5848
+ for (const key in source) Object.prototype.hasOwnProperty.call(source, key) && (hasKeys = !0, baseAttributes[key] = source[key], !needsShapeAndBounds && this.needUpdateTag(key) && (needsShapeAndBounds = !0));
5849
+ hasKeys && (this.attribute = baseAttributes, this._baseAttributes = void 0, this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, this.submitTouchedUpdate(needsShapeAndBounds), this.onAttributeUpdate(context));
5850
+ }
5851
+ commitBaseAttributeBySingleKey(key, value, forceUpdateTag = !1, context) {
5852
+ this.getBaseAttributesStorage()[key] = value, this.attribute = this.getBaseAttributesStorage(), this._baseAttributes = void 0, this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTag(key)), this.onAttributeUpdate(context);
5853
+ }
5637
5854
  applyBaseAttributes(params) {
5638
5855
  const keys = Object.keys(params);
5639
5856
  for (let i = 0; i < keys.length; i++) {
5640
5857
  const key = keys[i];
5641
- this.baseAttributes[key] = cloneAttributeValue(params[key]);
5858
+ this.getBaseAttributesStorage()[key] = params[key];
5642
5859
  }
5643
5860
  }
5861
+ applyAnimationTransientAttributes(params, forceUpdateTag = !1, context) {
5862
+ const source = params;
5863
+ let target,
5864
+ needsShapeAndBounds = forceUpdateTag;
5865
+ for (const key in source) Object.prototype.hasOwnProperty.call(source, key) && (target || (this.detachAttributeFromBaseAttributes(), target = this.attribute), target[key] = source[key], !needsShapeAndBounds && this.needUpdateTag(key) && (needsShapeAndBounds = !0));
5866
+ target && (this.attributeMayContainTransientAttrs = !0, this.valid = this.isValid(), this.submitTouchedUpdate(needsShapeAndBounds), this.onAttributeUpdate(context));
5867
+ }
5644
5868
  applyTransientAttributes(params, forceUpdateTag = !1, context) {
5869
+ this.detachAttributeFromBaseAttributes();
5645
5870
  const delta = new Map(),
5646
5871
  keys = Object.keys(params);
5647
5872
  for (let i = 0; i < keys.length; i++) {
5648
5873
  const key = keys[i],
5649
5874
  previousValue = this.attribute[key],
5650
5875
  nextValue = params[key];
5651
- isEqual(previousValue, nextValue) || (delta.set(key, {
5876
+ areAttributeValuesEqual(previousValue, nextValue) || (delta.set(key, {
5652
5877
  prev: previousValue,
5653
5878
  next: nextValue
5654
- }), this.attribute[key] = cloneAttributeValue(nextValue));
5879
+ }), this.attribute[key] = nextValue);
5655
5880
  }
5656
- this.valid = this.isValid(), this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
5881
+ delta.size && (this.attributeMayContainTransientAttrs = !0), this.valid = this.isValid(), this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
5657
5882
  }
5658
5883
  _restoreAttributeFromStaticTruth(context) {
5659
5884
  this._syncFinalAttributeFromStaticTruth();
5660
5885
  const delta = this._syncAttribute();
5661
5886
  this.submitUpdateByDelta(delta), this.onAttributeUpdate(context);
5662
5887
  }
5888
+ collectStatePatchDeltaKeys(previousPatch, nextPatch) {
5889
+ const keys = previousPatch ? Object.keys(previousPatch) : [];
5890
+ if (!nextPatch) return keys;
5891
+ for (const key in nextPatch) Object.prototype.hasOwnProperty.call(nextPatch, key) && !Object.prototype.hasOwnProperty.call(null != previousPatch ? previousPatch : {}, key) && keys.push(key);
5892
+ return keys;
5893
+ }
5894
+ getStaticTruthValueForStateKey(key, nextPatch) {
5895
+ var _a;
5896
+ const baseAttributes = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : {},
5897
+ patch = nextPatch;
5898
+ if (patch && Object.prototype.hasOwnProperty.call(patch, key)) {
5899
+ const patchValue = patch[key],
5900
+ baseValue = baseAttributes[key];
5901
+ return "deep" === this.stateMergeMode && isPlainObjectValue(baseValue) && isPlainObjectValue(patchValue) ? {
5902
+ hasValue: !0,
5903
+ value: deepMergeAttributeValue(baseValue, patchValue)
5904
+ } : {
5905
+ hasValue: !0,
5906
+ value: patchValue
5907
+ };
5908
+ }
5909
+ return Object.prototype.hasOwnProperty.call(baseAttributes, key) ? {
5910
+ hasValue: !0,
5911
+ value: baseAttributes[key]
5912
+ } : {
5913
+ hasValue: !1,
5914
+ value: void 0
5915
+ };
5916
+ }
5917
+ syncStatePatchDeltaToTarget(target, keys, nextPatch, collectCategory = !1) {
5918
+ let category = UpdateCategory.NONE;
5919
+ for (let i = 0; i < keys.length; i++) {
5920
+ const key = keys[i],
5921
+ previousValue = target[key],
5922
+ next = this.getStaticTruthValueForStateKey(key, nextPatch);
5923
+ if (!next.hasValue) {
5924
+ Object.prototype.hasOwnProperty.call(target, key) && (delete target[key], collectCategory && (category = this.mergeAttributeDeltaCategory(category, key, previousValue, void 0)));
5925
+ continue;
5926
+ }
5927
+ if (areAttributeValuesEqual(previousValue, next.value)) continue;
5928
+ const nextValue = cloneAttributeValue(next.value);
5929
+ target[key] = nextValue, collectCategory && (category = this.mergeAttributeDeltaCategory(category, key, previousValue, nextValue));
5930
+ }
5931
+ return category;
5932
+ }
5933
+ restoreAttributeFromStatePatchDelta(previousPatch, nextPatch, context) {
5934
+ this.detachAttributeFromBaseAttributes();
5935
+ const keys = this.collectStatePatchDeltaKeys(previousPatch, nextPatch),
5936
+ finalAttribute = this.finalAttribute;
5937
+ finalAttribute && this.syncStatePatchDeltaToTarget(finalAttribute, keys, nextPatch, !1);
5938
+ const category = this.syncStatePatchDeltaToTarget(this.attribute, keys, nextPatch, !0);
5939
+ this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, this.submitUpdateByCategory(category), this.onAttributeUpdate(context);
5940
+ }
5663
5941
  setMode(mode) {
5664
5942
  "3d" === mode ? this.set3dMode() : this.set2dMode();
5665
5943
  }
@@ -5682,7 +5960,7 @@ class Graphic extends Node {
5682
5960
  return point;
5683
5961
  }
5684
5962
  onAnimateBind(animate) {
5685
- this._emitCustomEvent("animate-bind", animate);
5963
+ this.detachAttributeFromBaseAttributes(), this._emitCustomEvent("animate-bind", animate);
5686
5964
  }
5687
5965
  visitTrackedAnimates(cb) {
5688
5966
  const hook = this.forEachTrackedAnimate;
@@ -5695,8 +5973,22 @@ class Graphic extends Node {
5695
5973
  const getTrackedAnimates = this.getTrackedAnimates;
5696
5974
  return "function" == typeof getTrackedAnimates ? getTrackedAnimates.call(this).size > 0 : !!(null === (_a = this.animates) || void 0 === _a ? void 0 : _a.size);
5697
5975
  }
5976
+ mayHaveTrackedAnimates() {
5977
+ var _a;
5978
+ return !!(null === (_a = this.animates) || void 0 === _a ? void 0 : _a.size) || !!this._animationStateManager;
5979
+ }
5698
5980
  tryUpdateAABBBounds() {
5981
+ if (!(this.shadowRoot || this._updateTag & UpdateTag.UPDATE_BOUNDS)) return this._AABBBounds;
5699
5982
  const full = "imprecise" === this.attribute.boundsMode;
5983
+ if (!this.shadowRoot) {
5984
+ const graphicService = this.getGraphicService(),
5985
+ graphicTheme = this.getGraphicTheme();
5986
+ if (!graphicService.validCheck(this.attribute, graphicTheme, this._AABBBounds, this)) return this._AABBBounds;
5987
+ if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
5988
+ graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
5989
+ const bounds = this.doUpdateAABBBounds(full, graphicTheme);
5990
+ return graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
5991
+ }
5700
5992
  if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
5701
5993
  if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
5702
5994
  this.getGraphicService().beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
@@ -5769,14 +6061,14 @@ class Graphic extends Node {
5769
6061
  const _parsedPath = new CustomSymbolClass(symbolType, cache);
5770
6062
  return Graphic.userSymbolMap[symbolType] = _parsedPath, _parsedPath;
5771
6063
  }
5772
- doUpdateAABBBounds(full) {
6064
+ doUpdateAABBBounds(full, graphicTheme) {
5773
6065
  this.updateAABBBoundsStamp++;
5774
- const graphicTheme = this.getGraphicTheme();
6066
+ const resolvedGraphicTheme = null != graphicTheme ? graphicTheme : this.getGraphicTheme();
5775
6067
  this._AABBBounds.clear();
5776
6068
  const attribute = this.attribute,
5777
- bounds = this.updateAABBBounds(attribute, graphicTheme, this._AABBBounds, full),
6069
+ bounds = this.updateAABBBounds(attribute, resolvedGraphicTheme, this._AABBBounds, full),
5778
6070
  {
5779
- boundsPadding = graphicTheme.boundsPadding
6071
+ boundsPadding = resolvedGraphicTheme.boundsPadding
5780
6072
  } = attribute,
5781
6073
  paddingArray = parsePadding(boundsPadding);
5782
6074
  return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(), bounds;
@@ -5844,25 +6136,63 @@ class Graphic extends Node {
5844
6136
  this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
5845
6137
  }
5846
6138
  setAttributesAndPreventAnimate(params, forceUpdateTag = !1, context, ignorePriority) {
5847
- this.visitTrackedAnimates(animate => {
5848
- (animate.priority !== 1 / 0 || ignorePriority) && Object.keys(params).forEach(key => {
5849
- animate.preventAttr(key);
5850
- });
6139
+ if (!params) return;
6140
+ const keys = Object.keys(params);
6141
+ this.captureTransientFromAttrsBeforePreventAnimate(params, keys, context), this.visitTrackedAnimates(animate => {
6142
+ (animate.priority !== 1 / 0 || ignorePriority) && animate.preventAttrs(keys);
5851
6143
  }), this.applyTransientAttributes(params, forceUpdateTag, context);
5852
6144
  }
6145
+ captureTransientFromAttrsBeforePreventAnimate(params, keys, context) {
6146
+ var _a, _b;
6147
+ const graphicContext = this.context,
6148
+ diffAttrs = null !== (_a = null == graphicContext ? void 0 : graphicContext.diffAttrs) && void 0 !== _a ? _a : params,
6149
+ updateType = null == context ? void 0 : context.type;
6150
+ if (!keys.length || !diffAttrs || updateType === AttributeUpdateType.STATE || null != updateType && updateType >= AttributeUpdateType.ANIMATE_BIND && updateType <= AttributeUpdateType.ANIMATE_END) return;
6151
+ const sameDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs === diffAttrs;
6152
+ let fromAttrs = sameDiffAttrs && null !== (_b = this.transientFromAttrsBeforePreventAnimate) && void 0 !== _b ? _b : null;
6153
+ sameDiffAttrs || (this.transientFromAttrsBeforePreventAnimate = null, this.transientFromAttrsBeforePreventAnimateDiffAttrs = null);
6154
+ let captured = !1;
6155
+ for (let i = 0; i < keys.length; i++) {
6156
+ const key = keys[i];
6157
+ if (!Object.prototype.hasOwnProperty.call(diffAttrs, key)) continue;
6158
+ const previousValue = this.attribute[key],
6159
+ nextValue = params[key];
6160
+ isEqual(previousValue, nextValue) || (null != fromAttrs || (fromAttrs = {}), fromAttrs[key] = cloneAttributeValue(previousValue), captured = !0);
6161
+ }
6162
+ captured && (this.transientFromAttrsBeforePreventAnimate = fromAttrs, this.transientFromAttrsBeforePreventAnimateDiffAttrs = diffAttrs);
6163
+ }
6164
+ consumeTransientFromAttrsBeforePreventAnimate(diffAttrs) {
6165
+ const transientFromAttrs = this.transientFromAttrsBeforePreventAnimate,
6166
+ sourceDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs;
6167
+ if (!transientFromAttrs || !sourceDiffAttrs) return null;
6168
+ for (const key in diffAttrs) if (Object.prototype.hasOwnProperty.call(diffAttrs, key) && (!Object.prototype.hasOwnProperty.call(sourceDiffAttrs, key) || !isEqual(sourceDiffAttrs[key], diffAttrs[key]))) return null;
6169
+ let fromAttrs = null,
6170
+ remaining = !1;
6171
+ for (const key in transientFromAttrs) Object.prototype.hasOwnProperty.call(transientFromAttrs, key) && (Object.prototype.hasOwnProperty.call(diffAttrs, key) ? (null != fromAttrs || (fromAttrs = {}), fromAttrs[key] = transientFromAttrs[key]) : remaining = !0);
6172
+ if (remaining) {
6173
+ const nextTransientFromAttrs = {};
6174
+ for (const key in transientFromAttrs) Object.prototype.hasOwnProperty.call(transientFromAttrs, key) && !Object.prototype.hasOwnProperty.call(diffAttrs, key) && (nextTransientFromAttrs[key] = transientFromAttrs[key]);
6175
+ this.transientFromAttrsBeforePreventAnimate = nextTransientFromAttrs;
6176
+ } else this.transientFromAttrsBeforePreventAnimate = null, this.transientFromAttrsBeforePreventAnimateDiffAttrs = null;
6177
+ return fromAttrs;
6178
+ }
5853
6179
  setAttributes(params, forceUpdateTag = !1, context) {
5854
- params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background && this.loadImage(params.background, !0), isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
6180
+ params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background && this.loadImage(params.background, !0), params.texture && isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
5855
6181
  }
5856
6182
  _setAttributes(params, forceUpdateTag = !1, context) {
5857
- this.applyBaseAttributes(params), this.commitBaseAttributeMutation(forceUpdateTag, context);
6183
+ this.canCommitBaseAttributesByTouchedKeys() ? this.commitBaseAttributesByTouchedKeys(params, forceUpdateTag, context) : (this.detachAttributeFromBaseAttributes(), this.applyBaseAttributes(params), this.commitBaseAttributeMutation(forceUpdateTag, context));
5858
6184
  }
5859
6185
  setAttribute(key, value, forceUpdateTag, context) {
5860
6186
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
5861
6187
  [key]: value
5862
6188
  }, this.attribute, key, context);
5863
- params ? this._setAttributes(params, forceUpdateTag, context) : (this.applyBaseAttributes({
5864
- [key]: value
5865
- }), this.commitBaseAttributeMutation(!!forceUpdateTag, context)), "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
6189
+ if (params) this._setAttributes(params, forceUpdateTag, context);else if (this.canCommitBaseAttributesByTouchedKeys()) this.commitBaseAttributeBySingleKey(key, value, !!forceUpdateTag, context);else {
6190
+ const nextAttrs = {
6191
+ [key]: value
6192
+ };
6193
+ this.applyBaseAttributes(nextAttrs), this.commitBaseAttributeMutation(!!forceUpdateTag, context);
6194
+ }
6195
+ "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
5866
6196
  }
5867
6197
  needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
5868
6198
  for (let i = 0; i < k.length; i++) {
@@ -5881,7 +6211,7 @@ class Graphic extends Node {
5881
6211
  const context = {
5882
6212
  type: AttributeUpdateType.INIT
5883
6213
  };
5884
- params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.baseAttributes = cloneAttributeValue(params), this.attribute || (this.attribute = {}), this.resolvedStatePatch = void 0, this._syncAttribute(), params.background && this.loadImage(params.background, !0), isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
6214
+ params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, this._baseAttributes = void 0, this.resolvedStatePatch = void 0, this.attributeMayContainTransientAttrs = !1, this.valid = this.isValid(), params.background && this.loadImage(params.background, !0), params.texture && isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
5885
6215
  }
5886
6216
  translate(x, y) {
5887
6217
  var _a, _b;
@@ -5893,10 +6223,15 @@ class Graphic extends Node {
5893
6223
  x: x,
5894
6224
  y: y
5895
6225
  }, this.attribute, tempConstantXYKey, context);
5896
- params && (x = params.x, y = params.y, delete params.x, delete params.y, this.applyBaseAttributes(params));
6226
+ params && (x = params.x, y = params.y, delete params.x, delete params.y);
5897
6227
  const attribute = this.baseAttributes,
5898
- postMatrix = attribute.postMatrix;
5899
- return postMatrix ? application.transformUtil.fromMatrix(postMatrix, postMatrix).translate(x, y) : (attribute.x = (null !== (_a = attribute.x) && void 0 !== _a ? _a : DefaultTransform.x) + x, attribute.y = (null !== (_b = attribute.y) && void 0 !== _b ? _b : DefaultTransform.y) + y), this.commitBaseAttributeMutation(!1, context), this;
6228
+ postMatrix = attribute.postMatrix,
6229
+ nextAttrs = params || {};
6230
+ if (postMatrix) {
6231
+ const nextPostMatrix = postMatrix.clone();
6232
+ application.transformUtil.fromMatrix(nextPostMatrix, nextPostMatrix).translate(x, y), nextAttrs.postMatrix = nextPostMatrix;
6233
+ } else nextAttrs.x = (null !== (_a = attribute.x) && void 0 !== _a ? _a : DefaultTransform.x) + x, nextAttrs.y = (null !== (_b = attribute.y) && void 0 !== _b ? _b : DefaultTransform.y) + y;
6234
+ return this.commitInternalBaseAttributes(nextAttrs, context), this;
5900
6235
  }
5901
6236
  translateTo(x, y) {
5902
6237
  const attribute = this.baseAttributes;
@@ -5908,7 +6243,10 @@ class Graphic extends Node {
5908
6243
  x: x,
5909
6244
  y: y
5910
6245
  }, this.attribute, tempConstantXYKey, context);
5911
- return params ? (this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context), this) : (attribute.x = x, attribute.y = y, this.commitBaseAttributeMutation(!1, context), this);
6246
+ return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
6247
+ x: x,
6248
+ y: y
6249
+ }, context), this);
5912
6250
  }
5913
6251
  scale(scaleX, scaleY, scaleCenter) {
5914
6252
  var _a, _b;
@@ -5921,15 +6259,16 @@ class Graphic extends Node {
5921
6259
  scaleY: scaleY,
5922
6260
  scaleCenter: scaleCenter
5923
6261
  }, this.attribute, tempConstantScaleXYKey, context);
5924
- params && (scaleX = params.scaleX, scaleY = params.scaleY, delete params.scaleX, delete params.scaleY, this.applyBaseAttributes(params));
5925
- const attribute = this.baseAttributes;
6262
+ params && (scaleX = params.scaleX, scaleY = params.scaleY, delete params.scaleX, delete params.scaleY);
6263
+ const attribute = this.baseAttributes,
6264
+ nextAttrs = params || {};
5926
6265
  if (scaleCenter) {
5927
6266
  let {
5928
6267
  postMatrix: postMatrix
5929
- } = this.attribute;
5930
- postMatrix || (postMatrix = new Matrix(), attribute.postMatrix = postMatrix), application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter);
5931
- } else attribute.scaleX = (null !== (_a = attribute.scaleX) && void 0 !== _a ? _a : DefaultTransform.scaleX) * scaleX, attribute.scaleY = (null !== (_b = attribute.scaleY) && void 0 !== _b ? _b : DefaultTransform.scaleY) * scaleY;
5932
- return this.commitBaseAttributeMutation(!1, context), this;
6268
+ } = this.baseAttributes;
6269
+ postMatrix = postMatrix ? postMatrix.clone() : new Matrix(), application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter), nextAttrs.postMatrix = postMatrix;
6270
+ } else nextAttrs.scaleX = (null !== (_a = attribute.scaleX) && void 0 !== _a ? _a : DefaultTransform.scaleX) * scaleX, nextAttrs.scaleY = (null !== (_b = attribute.scaleY) && void 0 !== _b ? _b : DefaultTransform.scaleY) * scaleY;
6271
+ return this.commitInternalBaseAttributes(nextAttrs, context), this;
5933
6272
  }
5934
6273
  scaleTo(scaleX, scaleY) {
5935
6274
  const attribute = this.baseAttributes;
@@ -5941,7 +6280,10 @@ class Graphic extends Node {
5941
6280
  scaleX: scaleX,
5942
6281
  scaleY: scaleY
5943
6282
  }, this.attribute, tempConstantScaleXYKey, context);
5944
- return params ? (this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context), this) : (attribute.scaleX = scaleX, attribute.scaleY = scaleY, this.commitBaseAttributeMutation(!1, context), this);
6283
+ return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
6284
+ scaleX: scaleX,
6285
+ scaleY: scaleY
6286
+ }, context), this);
5945
6287
  }
5946
6288
  rotate(angle, rotateCenter) {
5947
6289
  var _a;
@@ -5953,24 +6295,26 @@ class Graphic extends Node {
5953
6295
  angle: angle,
5954
6296
  rotateCenter: rotateCenter
5955
6297
  }, this.attribute, tempConstantAngleKey, context);
5956
- params && (delete params.angle, this.applyBaseAttributes(params));
5957
- const attribute = this.baseAttributes;
6298
+ params && delete params.angle;
6299
+ const attribute = this.baseAttributes,
6300
+ nextAttrs = params || {};
5958
6301
  if (rotateCenter) {
5959
6302
  let {
5960
6303
  postMatrix: postMatrix
5961
6304
  } = this.baseAttributes;
5962
- postMatrix || (postMatrix = new Matrix(), this.baseAttributes.postMatrix = postMatrix), application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter);
5963
- } else attribute.angle = (null !== (_a = attribute.angle) && void 0 !== _a ? _a : DefaultTransform.angle) + angle;
5964
- return this.commitBaseAttributeMutation(!1, context), this;
6305
+ postMatrix = postMatrix ? postMatrix.clone() : new Matrix(), application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter), nextAttrs.postMatrix = postMatrix;
6306
+ } else nextAttrs.angle = (null !== (_a = attribute.angle) && void 0 !== _a ? _a : DefaultTransform.angle) + angle;
6307
+ return this.commitInternalBaseAttributes(nextAttrs, context), this;
5965
6308
  }
5966
6309
  rotateTo(angle) {
5967
- const attribute = this.baseAttributes;
5968
- if (attribute.angle === angle) return this;
6310
+ if (this.baseAttributes.angle === angle) return this;
5969
6311
  const context = {
5970
6312
  type: AttributeUpdateType.ROTATE_TO
5971
6313
  },
5972
6314
  params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(angle, this.attribute, tempConstantAngleKey, context);
5973
- return params ? (this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context), this) : (attribute.angle = angle, this.commitBaseAttributeMutation(!1, context), this);
6315
+ return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
6316
+ angle: angle
6317
+ }, context), this);
5974
6318
  }
5975
6319
  skewTo(b, c) {
5976
6320
  return this;
@@ -5988,7 +6332,15 @@ class Graphic extends Node {
5988
6332
  var _a;
5989
6333
  return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
5990
6334
  }
5991
- createStateModel() {
6335
+ getStateResolveBaseAttrs() {
6336
+ var _a;
6337
+ return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
6338
+ }
6339
+ syncStateResolveContext(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
6340
+ var _a;
6341
+ return null === (_a = this.stateEngine) || void 0 === _a || _a.setResolveContext(this, stateResolveBaseAttrs), stateResolveBaseAttrs;
6342
+ }
6343
+ createStateModel(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
5992
6344
  const {
5993
6345
  compiledDefinitions: compiledDefinitions,
5994
6346
  stateProxyEligibility: stateProxyEligibility,
@@ -6001,7 +6353,7 @@ class Graphic extends Node {
6001
6353
  stateProxyEligibility: stateProxyEligibility,
6002
6354
  states: this.states,
6003
6355
  mergeMode: this.stateMergeMode
6004
- }), this.stateEngineCompiledDefinitions = compiledDefinitions, this.stateEngineStateProxy = this.stateProxy, this.stateEngineStateSort = this.stateSort, this.stateEngineMergeMode = this.stateMergeMode, this.stateEngineStateProxyModeKey = stateProxyModeKey) : (this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0, this.stateEngineStateProxyModeKey = void 0), new StateModel({
6356
+ }), this.stateEngineCompiledDefinitions = compiledDefinitions, this.stateEngineStateProxy = this.stateProxy, this.stateEngineStateSort = this.stateSort, this.stateEngineMergeMode = this.stateMergeMode, this.stateEngineStateProxyModeKey = stateProxyModeKey) : (this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0, this.stateEngineStateProxyModeKey = void 0), this.syncStateResolveContext(stateResolveBaseAttrs), new StateModel({
6005
6357
  states: this.states,
6006
6358
  currentStates: this.currentStates,
6007
6359
  stateSort: this.stateSort,
@@ -6009,28 +6361,162 @@ class Graphic extends Node {
6009
6361
  stateEngine: this.stateEngine
6010
6362
  });
6011
6363
  }
6364
+ resolveSimpleLocalStateTransition(states, previousStates) {
6365
+ var _a;
6366
+ if (!this.states || this.stateProxy || this.stateSort || "deep" === this.stateMergeMode || this.parent || (null === (_a = this.stage) || void 0 === _a ? void 0 : _a.rootSharedStateScope) || this.boundSharedStateScope) return null;
6367
+ if (1 === states.length) {
6368
+ const stateName = states[0],
6369
+ hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName),
6370
+ nextStates = [stateName],
6371
+ changed = !this.sameStateNames(previousStates, nextStates),
6372
+ resolvedStateAttrs = {};
6373
+ if (hasDefinition) {
6374
+ const attrs = this.states[stateName];
6375
+ if (null != attrs) {
6376
+ if (!isPlainObjectValue(attrs)) return null;
6377
+ const keys = Object.keys(attrs);
6378
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
6379
+ const key = keys[keyIndex];
6380
+ if (FULL_STATE_DEFINITION_KEYS.has(key)) return null;
6381
+ const attrValue = attrs[key];
6382
+ resolvedStateAttrs[key] = isPlainObjectValue(attrValue) ? cloneAttributeValue(attrValue) : attrValue;
6383
+ }
6384
+ }
6385
+ }
6386
+ return {
6387
+ changed: changed,
6388
+ states: nextStates,
6389
+ effectiveStates: nextStates,
6390
+ resolvedStateAttrs: resolvedStateAttrs
6391
+ };
6392
+ }
6393
+ const uniqueStates = Array.from(new Set(states)),
6394
+ withDefinition = [],
6395
+ withoutDefinition = [];
6396
+ for (let i = 0; i < uniqueStates.length; i++) {
6397
+ const stateName = uniqueStates[i];
6398
+ Object.prototype.hasOwnProperty.call(this.states, stateName) ? withDefinition.push(stateName) : withoutDefinition.push(stateName);
6399
+ }
6400
+ withDefinition.sort((left, right) => left.localeCompare(right));
6401
+ const nextStates = withDefinition.concat(withoutDefinition),
6402
+ changed = !this.sameStateNames(previousStates, nextStates),
6403
+ resolvedStateAttrs = {};
6404
+ for (let i = 0; i < nextStates.length; i++) {
6405
+ const stateName = nextStates[i];
6406
+ if (!Object.prototype.hasOwnProperty.call(this.states, stateName)) continue;
6407
+ const attrs = this.states[stateName];
6408
+ if (null == attrs) continue;
6409
+ if (!isPlainObjectValue(attrs)) return null;
6410
+ const keys = Object.keys(attrs);
6411
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
6412
+ const key = keys[keyIndex];
6413
+ if (FULL_STATE_DEFINITION_KEYS.has(key)) return null;
6414
+ const attrValue = attrs[key];
6415
+ resolvedStateAttrs[key] = isPlainObjectValue(attrValue) ? cloneAttributeValue(attrValue) : attrValue;
6416
+ }
6417
+ }
6418
+ return {
6419
+ changed: changed,
6420
+ states: nextStates,
6421
+ effectiveStates: nextStates,
6422
+ resolvedStateAttrs: resolvedStateAttrs
6423
+ };
6424
+ }
6425
+ resolveGraphicStateTransition(states, previousStates, forceResolverRefresh = !1) {
6426
+ var _a, _b;
6427
+ let transition = this.resolveSimpleLocalStateTransition(states, previousStates);
6428
+ const isSimpleLocalTransition = !!transition;
6429
+ let resolvedStateAttrs;
6430
+ if (transition) resolvedStateAttrs = transition.resolvedStateAttrs;else {
6431
+ const stateResolveBaseAttrs = this.getStateResolveBaseAttrs(),
6432
+ stateModel = this.createStateModel(stateResolveBaseAttrs);
6433
+ forceResolverRefresh && (null === (_a = this.stateEngine) || void 0 === _a || _a.invalidateResolverCache()), transition = stateModel.useStates(states), resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
6434
+ }
6435
+ return {
6436
+ transition: transition,
6437
+ effectiveStates: null !== (_b = transition.effectiveStates) && void 0 !== _b ? _b : transition.states,
6438
+ resolvedStateAttrs: resolvedStateAttrs,
6439
+ isSimpleLocalTransition: isSimpleLocalTransition
6440
+ };
6441
+ }
6442
+ normalizeSetStatesOptions(options) {
6443
+ return options && "object" == typeof options ? {
6444
+ hasAnimation: options.animate,
6445
+ animateSameStatePatchChange: !0 === options.animateSameStatePatchChange,
6446
+ shouldRefreshSameStatePatch: !0
6447
+ } : {
6448
+ hasAnimation: "boolean" == typeof options ? options : void 0,
6449
+ animateSameStatePatchChange: !1,
6450
+ shouldRefreshSameStatePatch: !1
6451
+ };
6452
+ }
6453
+ sameStatePatches(left, right) {
6454
+ const leftRecord = null != left ? left : {},
6455
+ rightRecord = null != right ? right : {},
6456
+ keys = new Set([...Object.keys(leftRecord), ...Object.keys(rightRecord)]);
6457
+ for (const key of keys) {
6458
+ if (Object.prototype.hasOwnProperty.call(leftRecord, key) !== Object.prototype.hasOwnProperty.call(rightRecord, key)) return !1;
6459
+ if (!areAttributeValuesEqual(leftRecord[key], rightRecord[key])) return !1;
6460
+ }
6461
+ return !0;
6462
+ }
6463
+ commitSameStatePatchRefresh(states, hasAnimation, animateSameStatePatchChange = !1) {
6464
+ var _a;
6465
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
6466
+ previousResolvedStatePatch = this.resolvedStatePatch,
6467
+ {
6468
+ transition: transition,
6469
+ effectiveStates: effectiveStates,
6470
+ resolvedStateAttrs: resolvedStateAttrs,
6471
+ isSimpleLocalTransition: isSimpleLocalTransition
6472
+ } = this.resolveGraphicStateTransition(states, previousStates, !0),
6473
+ patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
6474
+ if ((!patchChanged || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) && (this.currentStates = transition.states, this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), patchChanged)) {
6475
+ if (this.stage) {
6476
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
6477
+ null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
6478
+ graphicId: this._uid,
6479
+ targetStates: [...transition.states]
6480
+ });
6481
+ }
6482
+ hasAnimation && animateSameStatePatchChange ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
6483
+ type: AttributeUpdateType.STATE
6484
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
6485
+ type: AttributeUpdateType.STATE
6486
+ }), this.emitStateUpdateEvent());
6487
+ }
6488
+ }
6012
6489
  resolveStateAnimateConfig(animateConfig) {
6013
6490
  var _a, _b, _c;
6014
6491
  return null !== (_c = null !== (_a = null != animateConfig ? animateConfig : this.stateAnimateConfig) && void 0 !== _a ? _a : null === (_b = this.context) || void 0 === _b ? void 0 : _b.stateAnimateConfig) && void 0 !== _c ? _c : DefaultStateAnimateConfig;
6015
6492
  }
6016
- applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig) {
6493
+ applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs) {
6017
6494
  const resolvedAnimateConfig = hasAnimation ? this.resolveStateAnimateConfig(animateConfig) : void 0,
6018
6495
  transitionOptions = resolvedAnimateConfig ? {
6019
- animateConfig: resolvedAnimateConfig
6496
+ animateConfig: resolvedAnimateConfig,
6497
+ extraAnimateAttrs: extraAnimateAttrs,
6498
+ shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
6020
6499
  } : void 0;
6021
6500
  if (isClear) return void this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, stateNames, transitionOptions);
6022
6501
  const plan = this.getStateTransitionOrchestrator().analyzeTransition({}, attrs, stateNames, hasAnimation, {
6023
6502
  noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
6024
- animateConfig: resolvedAnimateConfig
6503
+ animateConfig: resolvedAnimateConfig,
6504
+ extraAnimateAttrs: extraAnimateAttrs,
6505
+ shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
6025
6506
  });
6026
6507
  this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
6027
6508
  }
6028
- updateNormalAttrs(stateAttrs) {
6029
- this._deprecatedNormalAttrsView = cloneAttributeValue(this.baseAttributes);
6509
+ updateNormalAttrs(_stateAttrs) {}
6510
+ getStateTransitionDefaultAttribute(key, targetAttrs) {
6511
+ return this.getDefaultAttribute(key);
6512
+ }
6513
+ shouldSkipStateTransitionDefaultAttribute(_key, _targetAttrs) {
6514
+ return !1;
6030
6515
  }
6031
6516
  stopStateAnimates(type = "end") {
6032
6517
  const stopAnimationState = this.stopAnimationState;
6033
6518
  if ("function" == typeof stopAnimationState) return void stopAnimationState.call(this, "state", type);
6519
+ if (!this.mayHaveTrackedAnimates()) return;
6034
6520
  const stateAnimates = [];
6035
6521
  this.visitTrackedAnimates(animate => {
6036
6522
  animate.stateNames && stateAnimates.push(animate);
@@ -6043,18 +6529,25 @@ class Graphic extends Node {
6043
6529
  }
6044
6530
  clearStates(hasAnimation) {
6045
6531
  var _a, _b, _c;
6046
- const previousStates = this.currentStates ? this.currentStates.slice() : [],
6532
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
6533
+ previousResolvedStatePatch = this.resolvedStatePatch,
6047
6534
  transition = this.createStateModel().clearStates();
6048
6535
  if (!transition.changed && 0 === previousStates.length) return this.currentStates = [], this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, void this.clearSharedStateActiveRegistrations();
6049
- const resolvedStateAttrs = cloneAttributeValue(null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : {});
6050
- transition.changed && !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0) || (this.currentStates = transition.states, this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, this.clearSharedStateActiveRegistrations(), null === (_b = getStageStatePerfMonitor(this.stage)) || void 0 === _b || _b.incrementCounter("stateCommits"), null === (_c = getStageStatePerfMonitor(this.stage)) || void 0 === _c || _c.recordEvent("state-commit", {
6051
- graphicId: this._uid,
6052
- targetStates: []
6053
- }), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0)) : (this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
6054
- type: AttributeUpdateType.STATE
6055
- }), this._emitCustomEvent("afterStateUpdate", {
6056
- type: AttributeUpdateType.STATE
6057
- })));
6536
+ const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
6537
+ if (!transition.changed || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0)) {
6538
+ if (this.currentStates = transition.states, this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, this.clearSharedStateActiveRegistrations(), this.stage) {
6539
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
6540
+ null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
6541
+ graphicId: this._uid,
6542
+ targetStates: []
6543
+ });
6544
+ }
6545
+ hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
6546
+ type: AttributeUpdateType.STATE
6547
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
6548
+ type: AttributeUpdateType.STATE
6549
+ }), this.emitStateUpdateEvent());
6550
+ }
6058
6551
  }
6059
6552
  removeState(stateName, hasAnimation) {
6060
6553
  const transition = this.createStateModel().removeState(stateName);
@@ -6068,38 +6561,59 @@ class Graphic extends Node {
6068
6561
  const transition = this.createStateModel().addState(stateName, keepCurrentStates);
6069
6562
  transition.changed && this.useStates(transition.states, hasAnimation);
6070
6563
  }
6564
+ setStates(states, options) {
6565
+ var _a, _b, _c;
6566
+ const {
6567
+ hasAnimation: hasAnimation,
6568
+ animateSameStatePatchChange: animateSameStatePatchChange,
6569
+ shouldRefreshSameStatePatch: shouldRefreshSameStatePatch
6570
+ } = this.normalizeSetStatesOptions(options),
6571
+ nextStates = (null == states ? void 0 : states.length) ? states : EMPTY_STATE_NAMES,
6572
+ hasCurrentState = !!((null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || (null === (_b = this.effectiveStates) || void 0 === _b ? void 0 : _b.length) || this.resolvedStatePatch || (null === (_c = this.registeredActiveScopes) || void 0 === _c ? void 0 : _c.size));
6573
+ if (nextStates.length) {
6574
+ if (this.sameStateNames(this.currentStates, nextStates)) return shouldRefreshSameStatePatch ? void this.commitSameStatePatchRefresh(nextStates, hasAnimation, animateSameStatePatchChange) : void (this.sharedStateDirty && this.refreshSharedStateBeforeRender());
6575
+ this.useStates(nextStates, hasAnimation);
6576
+ } else {
6577
+ if (!hasCurrentState && !this.sharedStateDirty) return;
6578
+ this.clearStates(hasAnimation);
6579
+ }
6580
+ }
6071
6581
  useStates(states, hasAnimation) {
6072
- var _a, _b, _c, _d, _e;
6582
+ var _a;
6073
6583
  if (!states.length) return void this.clearStates(hasAnimation);
6074
- const previousStates = this.currentStates ? this.currentStates.slice() : [],
6075
- stateResolveBaseAttrs = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute,
6076
- stateModel = this.createStateModel();
6077
- null === (_b = this.stateEngine) || void 0 === _b || _b.setResolveContext(this, stateResolveBaseAttrs);
6078
- const transition = stateModel.useStates(states);
6079
- if (!transition.changed && this.sameStateNames(previousStates, transition.states)) return;
6080
- const effectiveStates = null !== (_c = transition.effectiveStates) && void 0 !== _c ? _c : transition.states,
6081
- resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
6082
- this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1) && (this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs), this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), null === (_d = getStageStatePerfMonitor(this.stage)) || void 0 === _d || _d.incrementCounter("stateCommits"), null === (_e = getStageStatePerfMonitor(this.stage)) || void 0 === _e || _e.recordEvent("state-commit", {
6083
- graphicId: this._uid,
6084
- targetStates: [...transition.states]
6085
- }), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation)) : (this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
6086
- type: AttributeUpdateType.STATE
6087
- }), this._emitCustomEvent("afterStateUpdate", {
6088
- type: AttributeUpdateType.STATE
6089
- })));
6584
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
6585
+ previousResolvedStatePatch = this.resolvedStatePatch,
6586
+ {
6587
+ transition: transition,
6588
+ effectiveStates: effectiveStates,
6589
+ resolvedStateAttrs: resolvedStateAttrs,
6590
+ isSimpleLocalTransition: isSimpleLocalTransition
6591
+ } = this.resolveGraphicStateTransition(states, previousStates);
6592
+ if ((transition.changed || !this.sameStateNames(previousStates, transition.states)) && this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) {
6593
+ if (this.currentStates = transition.states, this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stage) {
6594
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
6595
+ null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
6596
+ graphicId: this._uid,
6597
+ targetStates: [...transition.states]
6598
+ });
6599
+ }
6600
+ hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
6601
+ type: AttributeUpdateType.STATE
6602
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
6603
+ type: AttributeUpdateType.STATE
6604
+ }), this.emitStateUpdateEvent());
6605
+ }
6090
6606
  }
6091
6607
  invalidateResolver() {
6092
6608
  var _a, _b;
6093
6609
  if (!this.stateEngine || !(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.compiledStateDefinitions) return;
6094
- const stateResolveBaseAttrs = null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : this.attribute;
6095
- this.stateEngine.setResolveContext(this, stateResolveBaseAttrs), this.resolverEpoch += 1, this.stateEngine.invalidateResolverCache();
6610
+ this.syncStateResolveContext();
6611
+ this.resolverEpoch = (null !== (_b = this.resolverEpoch) && void 0 !== _b ? _b : 0) + 1, this.stateEngine.invalidateResolverCache();
6096
6612
  const transition = this.stateEngine.applyStates(this.currentStates),
6097
6613
  resolvedStateAttrs = Object.assign({}, this.stateEngine.resolvedPatch);
6098
- this.effectiveStates = [...transition.effectiveStates], this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs), this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
6614
+ this.effectiveStates = [...transition.effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
6099
6615
  type: AttributeUpdateType.STATE
6100
- }), this._emitCustomEvent("afterStateUpdate", {
6101
- type: AttributeUpdateType.STATE
6102
- });
6616
+ }), this.emitStateUpdateEvent();
6103
6617
  }
6104
6618
  sameStateNames(left, right) {
6105
6619
  const normalizedLeft = null != left ? left : [],
@@ -6120,6 +6634,9 @@ class Graphic extends Node {
6120
6634
  addUpdateShapeAndBoundsTag() {
6121
6635
  this._updateTag |= UpdateTag.UPDATE_SHAPE_AND_BOUNDS, this.parent && this.parent.addChildUpdateBoundTag(), this.glyphHost && this.glyphHost.addUpdateBoundTag();
6122
6636
  }
6637
+ addBroadUpdateTag() {
6638
+ this.shadowRoot && this.shadowRoot.addUpdateGlobalPositionTag(), this._updateTag |= UpdateTag.UPDATE_SHAPE_AND_BOUNDS | UpdateTag.UPDATE_PAINT | UpdateTag.UPDATE_GLOBAL_LOCAL_MATRIX | UpdateTag.UPDATE_LAYOUT, this.parent && this.parent.addChildUpdateBoundTag(), this.glyphHost && this.glyphHost.addUpdateBoundTag();
6639
+ }
6123
6640
  updateShapeAndBoundsTagSetted() {
6124
6641
  return (this._updateTag & UpdateTag.UPDATE_SHAPE_AND_BOUNDS) === UpdateTag.UPDATE_SHAPE_AND_BOUNDS;
6125
6642
  }
@@ -6207,13 +6724,13 @@ class Graphic extends Node {
6207
6724
  }
6208
6725
  }
6209
6726
  setStage(stage, layer) {
6210
- var _a, _b, _c, _d, _e, _f, _g, _h;
6727
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
6211
6728
  const graphicService = null !== (_c = null !== (_a = null == stage ? void 0 : stage.graphicService) && void 0 !== _a ? _a : null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService,
6212
6729
  previousStage = this.stage;
6213
6730
  if (this.stage !== stage || this.layer !== layer) {
6214
- if (this.stage = stage, this.layer = layer, this.syncSharedStateScopeBindingFromTree(!!(null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length)), this.setStageToShadowRoot(stage, layer), this.hasAnyTrackedAnimate()) {
6215
- const previousTimeline = null === (_e = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _e ? void 0 : _e.call(previousStage),
6216
- nextTimeline = null === (_f = null == stage ? void 0 : stage.getTimeline) || void 0 === _f ? void 0 : _f.call(stage),
6731
+ if (this.stage = stage, this.layer = layer, ((null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length) || this.boundSharedStateScope || (null === (_e = this.registeredActiveScopes) || void 0 === _e ? void 0 : _e.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0), this.setStageToShadowRoot(stage, layer), this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
6732
+ const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
6733
+ nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
6217
6734
  detachedStageAnimates = [];
6218
6735
  this.visitTrackedAnimates(a => {
6219
6736
  (!!previousTimeline && a.timeline === previousTimeline || a.timeline.isGlobal) && (nextTimeline ? a.timeline !== nextTimeline && (previousTimeline && a.timeline === previousTimeline && previousTimeline.removeAnimate(a, !1), a.setTimeline(nextTimeline), nextTimeline.addAnimate(a)) : previousTimeline && a.timeline === previousTimeline && (previousTimeline.removeAnimate(a, !1), detachedStageAnimates.push(a)));
@@ -6226,9 +6743,13 @@ class Graphic extends Node {
6226
6743
  type: AttributeUpdateType.ANIMATE_END
6227
6744
  }));
6228
6745
  }
6229
- return this._onSetStage && this._onSetStage(this, stage, layer), void (null === (_g = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _g || _g.call(graphicService, this, stage));
6746
+ return this._onSetStage && this._onSetStage(this, stage, layer), void (null === (_h = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _h || _h.call(graphicService, this, stage));
6230
6747
  }
6231
- this.syncSharedStateScopeBindingFromTree(!!(null === (_h = this.currentStates) || void 0 === _h ? void 0 : _h.length));
6748
+ ((null === (_j = this.currentStates) || void 0 === _j ? void 0 : _j.length) || this.boundSharedStateScope || (null === (_k = this.registeredActiveScopes) || void 0 === _k ? void 0 : _k.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0);
6749
+ }
6750
+ detachStageForRelease() {
6751
+ var _a, _b, _c;
6752
+ (null === (_a = this.registeredActiveScopes) || void 0 === _a ? void 0 : _a.size) && this.clearSharedStateActiveRegistrations(), (this.mayHaveTrackedAnimates() || this.shadowRoot) && this.stopAnimates(), this.boundSharedStateScope = void 0, this.boundSharedStateRevision = void 0, this.localFallbackCompiledDefinitions = void 0, this.compiledStateDefinitions = void 0, this.compiledStateDefinitionsCacheKey = void 0, this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0, this.stateEngineStateProxyModeKey = void 0, this.sharedStateDirty = !1, this.stage = null, this.layer = null, this.shadowRoot && (null === (_c = (_b = this.shadowRoot).detachStageForRelease) || void 0 === _c || _c.call(_b));
6232
6753
  }
6233
6754
  setStageToShadowRoot(stage, layer) {
6234
6755
  this.shadowRoot && this.shadowRoot.setStage(stage, layer);
@@ -6295,6 +6816,7 @@ class Graphic extends Node {
6295
6816
  res && (res.state = "fail", cb && cb());
6296
6817
  }
6297
6818
  _stopAnimates() {
6819
+ if (!this.mayHaveTrackedAnimates()) return;
6298
6820
  const animates = [];
6299
6821
  this.visitTrackedAnimates(animate => {
6300
6822
  animates.push(animate);
@@ -6308,14 +6830,17 @@ class Graphic extends Node {
6308
6830
  });
6309
6831
  }
6310
6832
  release() {
6311
- var _a, _b, _c;
6312
- this.releaseStatus = "released", this.clearSharedStateActiveRegistrations(), this.stopAnimates();
6313
- const graphicService = null !== (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.graphicService) && void 0 !== _b ? _b : application.graphicService;
6314
- null === (_c = null == graphicService ? void 0 : graphicService.onRelease) || void 0 === _c || _c.call(graphicService, this), super.release();
6833
+ var _a, _b, _c, _d;
6834
+ this.releaseStatus = "released", (null === (_a = this.registeredActiveScopes) || void 0 === _a ? void 0 : _a.size) && this.clearSharedStateActiveRegistrations(), (this.mayHaveTrackedAnimates() || this.shadowRoot) && this.stopAnimates();
6835
+ const graphicService = null !== (_c = null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService;
6836
+ null === (_d = null == graphicService ? void 0 : graphicService.onRelease) || void 0 === _d || _d.call(graphicService, this), super.release();
6837
+ }
6838
+ hasCustomEvent(type) {
6839
+ return !!this._events && type in this._events;
6315
6840
  }
6316
6841
  _dispatchCustomEvent(type, context) {
6317
6842
  var _a, _b;
6318
- if (this._events && type in this._events) {
6843
+ if (this.hasCustomEvent(type)) {
6319
6844
  const changeEvent = new CustomEvent(type, context);
6320
6845
  changeEvent.bubbles = !1;
6321
6846
  const manager = null === (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventSystem) || void 0 === _b ? void 0 : _b.manager;
@@ -6324,7 +6849,7 @@ class Graphic extends Node {
6324
6849
  return !0;
6325
6850
  }
6326
6851
  beforeStateUpdate(attrs, prevStates, nextStates, hasAnimation, isClear) {
6327
- return this._dispatchCustomEvent("beforeStateUpdate", {
6852
+ return !this.hasCustomEvent("beforeStateUpdate") || this._dispatchCustomEvent("beforeStateUpdate", {
6328
6853
  type: AttributeUpdateType.STATE,
6329
6854
  attrs: Object.assign({}, attrs),
6330
6855
  prevStates: prevStates.slice(),
@@ -6333,6 +6858,11 @@ class Graphic extends Node {
6333
6858
  isClear: !!isClear
6334
6859
  });
6335
6860
  }
6861
+ emitStateUpdateEvent() {
6862
+ this.hasCustomEvent("afterStateUpdate") && this._emitCustomEvent("afterStateUpdate", {
6863
+ type: AttributeUpdateType.STATE
6864
+ });
6865
+ }
6336
6866
  _emitCustomEvent(type, context) {
6337
6867
  this._dispatchCustomEvent(type, context);
6338
6868
  }
@@ -7501,6 +8031,52 @@ class Rect extends Graphic {
7501
8031
  needUpdateTag(key) {
7502
8032
  return super.needUpdateTag(key, RECT_UPDATE_TAG_KEY);
7503
8033
  }
8034
+ shouldSkipStateTransitionDefaultAttribute(key, targetAttrs) {
8035
+ var _a;
8036
+ const attrs = null !== (_a = null != targetAttrs ? targetAttrs : this.baseAttributes) && void 0 !== _a ? _a : this.attribute,
8037
+ hasValue = attrKey => null != attrs[attrKey],
8038
+ isNilValue = attrKey => null == attrs[attrKey];
8039
+ switch (key) {
8040
+ case "width":
8041
+ return isNilValue("width") && hasValue("x") && hasValue("x1");
8042
+ case "height":
8043
+ return isNilValue("height") && hasValue("y") && hasValue("y1");
8044
+ case "x1":
8045
+ return isNilValue("x1") && hasValue("x") && hasValue("width");
8046
+ case "y1":
8047
+ return isNilValue("y1") && hasValue("y") && hasValue("height");
8048
+ default:
8049
+ return !1;
8050
+ }
8051
+ }
8052
+ getStateTransitionDefaultAttribute(key, targetAttrs) {
8053
+ var _a;
8054
+ const attrs = null !== (_a = null != targetAttrs ? targetAttrs : this.baseAttributes) && void 0 !== _a ? _a : this.attribute,
8055
+ getNumber = attrKey => {
8056
+ const value = attrs[attrKey];
8057
+ return "number" == typeof value && Number.isFinite(value) ? value : void 0;
8058
+ },
8059
+ x = getNumber("x"),
8060
+ y = getNumber("y"),
8061
+ x1 = getNumber("x1"),
8062
+ y1 = getNumber("y1"),
8063
+ width = getNumber("width"),
8064
+ height = getNumber("height");
8065
+ switch (key) {
8066
+ case "width":
8067
+ if (null == width && null != x && null != x1) return x1 - x;
8068
+ break;
8069
+ case "height":
8070
+ if (null == height && null != y && null != y1) return y1 - y;
8071
+ break;
8072
+ case "x1":
8073
+ if (null == x1 && null != x && null != width) return x + width;
8074
+ break;
8075
+ case "y1":
8076
+ if (null == y1 && null != y && null != height) return y + height;
8077
+ }
8078
+ return super.getStateTransitionDefaultAttribute(key, targetAttrs);
8079
+ }
7504
8080
  toCustomPath() {
7505
8081
  let path = super.toCustomPath();
7506
8082
  if (path) return path;
@@ -8973,13 +9549,15 @@ var GroupUpdateAABBBoundsMode;
8973
9549
  }(GroupUpdateAABBBoundsMode || (GroupUpdateAABBBoundsMode = {}));
8974
9550
  class Group extends Graphic {
8975
9551
  constructor(params) {
8976
- super(params), this.type = "group", this.parent = null, this.isContainer = !0, this.numberType = GROUP_NUMBER_TYPE, this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
9552
+ super(params), this.type = "group", this.parent = null, this.isContainer = !0, this._hasSharedStateDefinitions = !1, this.numberType = GROUP_NUMBER_TYPE, this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
8977
9553
  }
8978
9554
  get sharedStateDefinitions() {
8979
9555
  return this._sharedStateDefinitions;
8980
9556
  }
8981
9557
  set sharedStateDefinitions(value) {
8982
- this._sharedStateDefinitions !== value && (this._sharedStateDefinitions = value, this.ensureSharedStateScopeBound(), this.sharedStateScope && (setSharedStateScopeLocalDefinitions(this.sharedStateScope, value), markScopeActiveDescendantsDirty(this.sharedStateScope, this.stage)));
9558
+ if (this._sharedStateDefinitions === value) return;
9559
+ const previousScope = this.sharedStateScope;
9560
+ this._sharedStateDefinitions = value, this._hasSharedStateDefinitions = !!value && Object.keys(value).length > 0, this.ensureSharedStateScopeBound(), this.sharedStateScope && (setSharedStateScopeLocalDefinitions(this.sharedStateScope, value), markScopeActiveDescendantsDirty(this.sharedStateScope, this.stage)), previousScope !== this.sharedStateScope && this.notifyChildrenSharedStateTreeChanged();
8983
9561
  }
8984
9562
  setMode(mode) {
8985
9563
  "3d" === mode ? this.set3dMode() : this.set2dMode();
@@ -9104,9 +9682,10 @@ class Group extends Graphic {
9104
9682
  insertInto(newNode, idx) {
9105
9683
  return this._updateChildToStage(super.insertInto(newNode, idx));
9106
9684
  }
9107
- removeChild(child) {
9685
+ removeChild(child, highPerformance = !1) {
9686
+ var _a;
9108
9687
  const data = super.removeChild(child);
9109
- return this.getGraphicService().onRemove(child), child.setStage(null, null), this.addUpdateBoundTag(), data;
9688
+ return data ? highPerformance ? (null === (_a = child.detachStageForRelease) || void 0 === _a || _a.call(child), data) : (this.getGraphicService().onRemove(child), child.setStage(null, null), this.addUpdateBoundTag(), data) : data;
9110
9689
  }
9111
9690
  removeAllChild(deep = !1) {
9112
9691
  const children = this.children.slice();
@@ -9118,11 +9697,13 @@ class Group extends Graphic {
9118
9697
  }
9119
9698
  setStage(stage, layer) {
9120
9699
  var _a, _b, _c, _d, _e, _f;
9121
- const graphicService = null !== (_c = null !== (_a = null == stage ? void 0 : stage.graphicService) && void 0 !== _a ? _a : null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService;
9122
- if (this.stage !== stage) return this.stage = stage, this.layer = layer, this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingFromTree(!!(null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length)), this.setStageToShadowRoot(stage, layer), this._onSetStage && this._onSetStage(this, stage, layer), null === (_e = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _e || _e.call(graphicService, this, stage), void this.forEachChildren(item => {
9700
+ const graphicService = null !== (_c = null !== (_a = null == stage ? void 0 : stage.graphicService) && void 0 !== _a ? _a : null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService,
9701
+ needsSharedStateTreeSync = this._hasSharedStateDefinitions || this.sharedStateScope || (null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length) || this.boundSharedStateScope || (null === (_e = this.registeredActiveScopes) || void 0 === _e ? void 0 : _e.size) || this.sharedStateDirty;
9702
+ if (this.stage !== stage) return this.stage = stage, this.layer = layer, needsSharedStateTreeSync && (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0)), this.setStageToShadowRoot(stage, layer), this._onSetStage && this._onSetStage(this, stage, layer), null === (_f = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _f || _f.call(graphicService, this, stage), void this.forEachChildren(item => {
9123
9703
  item.setStage(stage, this.layer);
9124
9704
  });
9125
- this.layer !== layer && (this.layer = layer), this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingFromTree(!!(null === (_f = this.currentStates) || void 0 === _f ? void 0 : _f.length)), this.forEachChildren(item => {
9705
+ const layerChanged = this.layer !== layer;
9706
+ layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.forEachChildren(item => {
9126
9707
  item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(stage, this.layer);
9127
9708
  });
9128
9709
  }
@@ -9169,15 +9750,29 @@ class Group extends Graphic {
9169
9750
  g.release(all);
9170
9751
  }), super.release();
9171
9752
  }
9753
+ detachStageForRelease() {
9754
+ super.detachStageForRelease(), this.sharedStateScope = void 0, this.forEachChildren(item => {
9755
+ var _a;
9756
+ null === (_a = item.detachStageForRelease) || void 0 === _a || _a.call(item);
9757
+ });
9758
+ }
9172
9759
  ensureSharedStateScopeBound() {
9173
9760
  var _a, _b, _c;
9761
+ if (!this.hasSharedStateDefinitions()) return void (this.sharedStateScope = void 0);
9174
9762
  const parentScope = null !== (_b = null === (_a = this.parent) || void 0 === _a ? void 0 : _a.sharedStateScope) && void 0 !== _b ? _b : null === (_c = this.stage) || void 0 === _c ? void 0 : _c.rootSharedStateScope;
9175
9763
  this.sharedStateScope ? (this.sharedStateScope.ownerGroup = this, this.sharedStateScope.ownerStage = this.stage, setSharedStateScopeParent(this.sharedStateScope, parentScope), this.sharedStateScope.localStateDefinitions !== this._sharedStateDefinitions && setSharedStateScopeLocalDefinitions(this.sharedStateScope, this._sharedStateDefinitions)) : this.sharedStateScope = createGroupSharedStateScope(this, parentScope, this._sharedStateDefinitions);
9176
9764
  }
9765
+ hasSharedStateDefinitions() {
9766
+ return this._hasSharedStateDefinitions;
9767
+ }
9768
+ notifyChildrenSharedStateTreeChanged() {
9769
+ this.forEachChildren(item => {
9770
+ item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(this.stage, this.layer);
9771
+ });
9772
+ }
9177
9773
  onParentSharedStateTreeChanged(stage, layer) {
9178
- this.stage === stage && this.layer === layer ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingFromTree(), this.forEachChildren(item => {
9179
- item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(stage, this.layer);
9180
- })) : this.setStage(stage, layer);
9774
+ var _a;
9775
+ this.stage === stage && this.layer === layer ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length)), this.notifyChildrenSharedStateTreeChanged()) : this.setStage(stage, layer);
9181
9776
  }
9182
9777
  }
9183
9778
  Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
@@ -9365,7 +9960,10 @@ class DefaultGraphicService {
9365
9960
  beforeUpdateAABBBounds: new SyncHook(["graphic", "stage", "willUpdate", "aabbBounds"]),
9366
9961
  afterUpdateAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds", "globalAABBBounds", "selfChange"]),
9367
9962
  clearAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds"])
9368
- }, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds();
9963
+ }, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds(), this.tempAABBBoundsResult = {
9964
+ tb1: this.tempAABBBounds1,
9965
+ tb2: this.tempAABBBounds2
9966
+ };
9369
9967
  }
9370
9968
  onAttributeUpdate(graphic) {
9371
9969
  this.hooks.onAttributeUpdate.taps.length && this.hooks.onAttributeUpdate.call(graphic);
@@ -9465,10 +10063,7 @@ class DefaultGraphicService {
9465
10063
  updateTempAABBBounds(aabbBounds) {
9466
10064
  const tb1 = this.tempAABBBounds1,
9467
10065
  tb2 = this.tempAABBBounds2;
9468
- return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), {
9469
- tb1: tb1,
9470
- tb2: tb2
9471
- };
10066
+ return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), this.tempAABBBoundsResult;
9472
10067
  }
9473
10068
  }
9474
10069
 
@@ -12858,7 +13453,11 @@ const result = {
12858
13453
  };
12859
13454
  class BaseRender {
12860
13455
  init(contributions) {
12861
- contributions && (this._renderContribitions = contributions.getContributions()), this._renderContribitions || (this._renderContribitions = []), this.builtinContributions || (this.builtinContributions = []), this.builtinContributions.push(defaultBaseClipRenderBeforeContribution), this.builtinContributions.push(defaultBaseClipRenderAfterContribution), this.builtinContributions.forEach(item => this._renderContribitions.push(item)), this._renderContribitions.length && (this._renderContribitions.sort((a, b) => b.order - a.order), this._beforeRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.beforeFillStroke), this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.afterFillStroke));
13456
+ this.builtinContributions || (this.builtinContributions = []), this._renderContribitions = contributions ? contributions.getContributions().slice() : [];
13457
+ const addContribution = item => {
13458
+ this._renderContribitions.includes(item) || this._renderContribitions.push(item);
13459
+ };
13460
+ this.builtinContributions.forEach(addContribution), addContribution(defaultBaseClipRenderBeforeContribution), addContribution(defaultBaseClipRenderAfterContribution), this._renderContribitions.length ? (this._renderContribitions.sort((a, b) => b.order - a.order), this._beforeRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.beforeFillStroke), this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.afterFillStroke)) : (this._beforeRenderContribitions = [], this._afterRenderContribitions = []);
12862
13461
  }
12863
13462
  reInit() {
12864
13463
  this.init(this.graphicRenderContributions);
@@ -18241,6 +18840,61 @@ class AnimateComponent extends AbstractComponent {
18241
18840
  }
18242
18841
  }
18243
18842
 
18843
+ function commitUpdateAnimationTarget(graphic, targetAttrs, startAttrs) {
18844
+ var _a, _b, _c, _d;
18845
+ if (!graphic || !targetAttrs) {
18846
+ return;
18847
+ }
18848
+ const committedTargetAttrs = cloneDeep(targetAttrs);
18849
+ const transientStartAttrs = cloneDeep(startAttrs !== null && startAttrs !== void 0 ? startAttrs : graphic.attribute);
18850
+ graphic.setAttributes(committedTargetAttrs);
18851
+ (_b = (_a = graphic).setFinalAttributes) === null || _b === void 0 ? void 0 : _b.call(_a, committedTargetAttrs);
18852
+ (_d = (_c = graphic).setAttributesAndPreventAnimate) === null || _d === void 0 ? void 0 : _d.call(_c, transientStartAttrs, false, {
18853
+ type: AttributeUpdateType.ANIMATE_BIND
18854
+ });
18855
+ }
18856
+
18857
+ function collectTrackedAnimates(graphic, animates = [], visited = new Set()) {
18858
+ var _a, _b, _c, _d, _e;
18859
+ const trackedAnimates = (_c = (_b = (_a = graphic).getTrackedAnimates) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : graphic.animates;
18860
+ trackedAnimates === null || trackedAnimates === void 0 ? void 0 : trackedAnimates.forEach((animate) => {
18861
+ if (animate && !visited.has(animate)) {
18862
+ visited.add(animate);
18863
+ animates.push(animate);
18864
+ }
18865
+ });
18866
+ (_e = (_d = graphic).forEachChildren) === null || _e === void 0 ? void 0 : _e.call(_d, (child) => {
18867
+ collectTrackedAnimates(child, animates, visited);
18868
+ });
18869
+ return animates;
18870
+ }
18871
+ function appendExitReleaseCallback(state, callback) {
18872
+ if (callback) {
18873
+ state === null || state === void 0 ? void 0 : state.onComplete.push(callback);
18874
+ }
18875
+ }
18876
+ function runExitReleaseCallbacks(callbacks) {
18877
+ callbacks.forEach(callback => {
18878
+ callback();
18879
+ });
18880
+ }
18881
+ function bindExitReleaseAnimates(exitAnimates, getState, finalize) {
18882
+ const finish = (animate) => {
18883
+ const state = getState();
18884
+ if (!state || state.finalized || !state.pendingAnimates.has(animate)) {
18885
+ return;
18886
+ }
18887
+ state.pendingAnimates.delete(animate);
18888
+ if (!state.pendingAnimates.size) {
18889
+ finalize();
18890
+ }
18891
+ };
18892
+ exitAnimates.forEach(animate => {
18893
+ animate.onEnd(() => finish(animate));
18894
+ animate.onRemove(() => finish(animate));
18895
+ });
18896
+ }
18897
+
18244
18898
  const DefaultAxisAnimation = {
18245
18899
  type: 'default',
18246
18900
  duration: 300,
@@ -18286,7 +18940,101 @@ class AxisBase extends AnimateComponent {
18286
18940
  this.attribute = currentAttribute;
18287
18941
  return offscreenGroup.AABBBounds;
18288
18942
  }
18943
+ _finalizeExitRelease() {
18944
+ var _a, _b;
18945
+ const state = this._exitReleaseState;
18946
+ if (state === null || state === void 0 ? void 0 : state.finalized) {
18947
+ return;
18948
+ }
18949
+ if (state) {
18950
+ state.finalized = true;
18951
+ }
18952
+ const parent = this.parent;
18953
+ const removeFromParent = !!(state === null || state === void 0 ? void 0 : state.removeFromParent);
18954
+ const callbacks = (_a = state === null || state === void 0 ? void 0 : state.onComplete) !== null && _a !== void 0 ? _a : [];
18955
+ this._exitReleaseState = undefined;
18956
+ this._prevInnerView = null;
18957
+ this._innerView = null;
18958
+ this.axisLabelsContainer = null;
18959
+ this.axisContainer = null;
18960
+ this.removeAllChild(true);
18961
+ super.release(true);
18962
+ if (removeFromParent) {
18963
+ (_b = (parent !== null && parent !== void 0 ? parent : this.parent)) === null || _b === void 0 ? void 0 : _b.removeChild(this);
18964
+ }
18965
+ runExitReleaseCallbacks(callbacks);
18966
+ }
18967
+ _runExitAnimationBeforeRelease(options = {}) {
18968
+ var _a, _b, _c;
18969
+ if (this._exitReleaseState && !this._exitReleaseState.finalized) {
18970
+ this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent;
18971
+ appendExitReleaseCallback(this._exitReleaseState, options.onComplete);
18972
+ return true;
18973
+ }
18974
+ if (!this.stage ||
18975
+ this.attribute.animation === false ||
18976
+ this.attribute.animationExit === false ||
18977
+ !this._innerView) {
18978
+ return false;
18979
+ }
18980
+ this._prepare();
18981
+ if (!((_a = this._animationConfig) === null || _a === void 0 ? void 0 : _a.exit)) {
18982
+ return false;
18983
+ }
18984
+ const exitTargets = new Set();
18985
+ traverseGroup(this._innerView, (el) => {
18986
+ if (el.type !== 'group') {
18987
+ exitTargets.add(el);
18988
+ }
18989
+ });
18990
+ if (!exitTargets.size) {
18991
+ return false;
18992
+ }
18993
+ const existingAnimates = collectTrackedAnimates(this);
18994
+ const { delay = 0, duration = DefaultAxisAnimation.duration, easing = DefaultAxisAnimation.easing } = this._animationConfig.exit;
18995
+ exitTargets.forEach(target => {
18996
+ var _a, _b, _c;
18997
+ const startAttrs = {
18998
+ opacity: (_a = target.attribute.opacity) !== null && _a !== void 0 ? _a : 1,
18999
+ fillOpacity: (_b = target.attribute.fillOpacity) !== null && _b !== void 0 ? _b : 1,
19000
+ strokeOpacity: (_c = target.attribute.strokeOpacity) !== null && _c !== void 0 ? _c : 1
19001
+ };
19002
+ const endAttrs = {
19003
+ opacity: 0,
19004
+ fillOpacity: 0,
19005
+ strokeOpacity: 0
19006
+ };
19007
+ commitUpdateAnimationTarget(target, endAttrs, startAttrs);
19008
+ target.animate().wait(delay).to(endAttrs, duration, easing);
19009
+ });
19010
+ const animates = collectTrackedAnimates(this);
19011
+ const exitAnimates = animates.filter(animate => !existingAnimates.includes(animate));
19012
+ if (!exitAnimates.length) {
19013
+ return false;
19014
+ }
19015
+ this.setAttribute('childrenPickable', false);
19016
+ (_c = (_b = this._innerView).removeAllEventListeners) === null || _c === void 0 ? void 0 : _c.call(_b);
19017
+ this.releaseStatus = 'willRelease';
19018
+ const pendingAnimates = new Set(exitAnimates);
19019
+ this._exitReleaseState = {
19020
+ pendingAnimates,
19021
+ finalized: false,
19022
+ removeFromParent: !!options.removeFromParent,
19023
+ onComplete: options.onComplete ? [options.onComplete] : []
19024
+ };
19025
+ bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease());
19026
+ return true;
19027
+ }
19028
+ releaseWithExitAnimation(options = {}) {
19029
+ if (this.releaseStatus === 'released') {
19030
+ return false;
19031
+ }
19032
+ return this._runExitAnimationBeforeRelease(options);
19033
+ }
18289
19034
  render() {
19035
+ if (this._exitReleaseState) {
19036
+ return;
19037
+ }
18290
19038
  this._prepare();
18291
19039
  this._prevInnerView = this._innerView && getElMap(this._innerView);
18292
19040
  this.removeAllChild(true);
@@ -18642,11 +19390,10 @@ class AxisBase extends AnimateComponent {
18642
19390
  var _a;
18643
19391
  if (el.type !== 'group' && el.id) {
18644
19392
  const oldEl = prevInnerView[el.id];
18645
- el.setFinalAttributes(el.attribute);
18646
19393
  if (oldEl) {
18647
19394
  oldEl.release();
18648
- const oldAttrs = oldEl.attribute;
18649
- const finalAttrs = el.getFinalAttribute();
19395
+ const oldAttrs = cloneDeep(oldEl.attribute);
19396
+ const finalAttrs = cloneDeep(el.attribute);
18650
19397
  const diffAttrs = diff(oldAttrs, finalAttrs);
18651
19398
  let hasDiff = Object.keys(diffAttrs).length > 0;
18652
19399
  if ('opacity' in oldAttrs && finalAttrs.opacity !== oldAttrs.opacity) {
@@ -18657,10 +19404,9 @@ class AxisBase extends AnimateComponent {
18657
19404
  this._newElementAttrMap[el.id] = {
18658
19405
  state: 'update',
18659
19406
  node: el,
18660
- attrs: el.attribute
19407
+ attrs: finalAttrs
18661
19408
  };
18662
- const oldAttrs = oldEl.attribute;
18663
- el.setAttributes(oldAttrs);
19409
+ commitUpdateAnimationTarget(el, finalAttrs, oldAttrs);
18664
19410
  el.applyAnimationState(['update'], [
18665
19411
  {
18666
19412
  name: 'update',
@@ -18694,8 +19440,18 @@ class AxisBase extends AnimateComponent {
18694
19440
  });
18695
19441
  }
18696
19442
  }
18697
- release() {
18698
- super.release();
19443
+ release(all) {
19444
+ if (this._exitReleaseState) {
19445
+ this._finalizeExitRelease();
19446
+ return;
19447
+ }
19448
+ if (all) {
19449
+ this.removeAllChild(true);
19450
+ }
19451
+ super.release(all);
19452
+ if (all) {
19453
+ this.removeAllChild(true);
19454
+ }
18699
19455
  this._prevInnerView = null;
18700
19456
  this._innerView = null;
18701
19457
  }
@@ -19387,7 +20143,42 @@ function commonInterpolateUpdate(key, from, to, ratio, step, target) {
19387
20143
  return !1;
19388
20144
  }
19389
20145
 
20146
+ const animateUpdateContext = {
20147
+ type: AttributeUpdateType.ANIMATE_UPDATE
20148
+ },
20149
+ animateBindContext = {
20150
+ type: AttributeUpdateType.ANIMATE_BIND
20151
+ },
20152
+ animateStartContext = {
20153
+ type: AttributeUpdateType.ANIMATE_START
20154
+ };
20155
+ function getAnimationContext(type) {
20156
+ switch (type) {
20157
+ case AttributeUpdateType.ANIMATE_UPDATE:
20158
+ return animateUpdateContext;
20159
+ case AttributeUpdateType.ANIMATE_BIND:
20160
+ return animateBindContext;
20161
+ case AttributeUpdateType.ANIMATE_START:
20162
+ return animateStartContext;
20163
+ default:
20164
+ return {
20165
+ type: type
20166
+ };
20167
+ }
20168
+ }
20169
+ function applyAnimationTransientAttributes(target, attributes, type = AttributeUpdateType.ANIMATE_UPDATE) {
20170
+ var _a;
20171
+ if (!attributes) return;
20172
+ const context = getAnimationContext(type),
20173
+ transientTarget = target;
20174
+ "function" != typeof transientTarget.applyAnimationTransientAttributes ? "function" != typeof transientTarget.applyTransientAttributes ? "function" != typeof transientTarget.setAttributesAndPreventAnimate ? (transientTarget.attribute || (transientTarget.attribute = {}), Object.assign(transientTarget.attribute, attributes), null === (_a = transientTarget.onAttributeUpdate) || void 0 === _a || _a.call(transientTarget, context)) : transientTarget.setAttributesAndPreventAnimate(attributes, !1, context) : transientTarget.applyTransientAttributes(attributes, !1, context) : transientTarget.applyAnimationTransientAttributes(attributes, !1, context);
20175
+ }
20176
+
19390
20177
  function noop() {}
20178
+ function includesKey$1(keys, key) {
20179
+ for (let i = 0; i < keys.length; i++) if (keys[i] === key) return !0;
20180
+ return !1;
20181
+ }
19391
20182
  class Step {
19392
20183
  constructor(type, props, duration, easing) {
19393
20184
  var _a;
@@ -19443,6 +20234,17 @@ class Step {
19443
20234
  onBind() {
19444
20235
  "glyph" === this.target.type && (this.syncAttributeUpdate = this._syncAttributeUpdate);
19445
20236
  }
20237
+ runInterpolateUpdate(fromProps, toProps, ratio) {
20238
+ if (this.animate.interpolateUpdateFunction) return void this.animate.interpolateUpdateFunction(fromProps, toProps, ratio, this, this.target);
20239
+ const funcs = this.interpolateUpdateFunctions,
20240
+ propKeys = this.propKeys;
20241
+ if (funcs && propKeys) for (let index = 0; index < funcs.length; index++) {
20242
+ const key = propKeys[index],
20243
+ fromValue = fromProps[key],
20244
+ toValue = toProps[key];
20245
+ funcs[index](key, fromValue, toValue, ratio, this, this.target);
20246
+ }
20247
+ }
19446
20248
  onFirstRun() {}
19447
20249
  onStart() {
19448
20250
  if (!this._hasFirstRun) {
@@ -19457,23 +20259,49 @@ class Step {
19457
20259
  tryPreventConflict() {
19458
20260
  var _a, _b;
19459
20261
  const animate = this.animate,
19460
- target = this.target;
19461
- (null !== (_b = null === (_a = target.forEachTrackedAnimate) || void 0 === _a ? void 0 : _a.bind(target)) && void 0 !== _b ? _b : cb => {
19462
- var _a;
19463
- null === (_a = target.animates) || void 0 === _a || _a.forEach(cb);
19464
- })(a => {
20262
+ target = this.target,
20263
+ forEachTrackedAnimate = null !== (_b = null === (_a = target.forEachTrackedAnimate) || void 0 === _a ? void 0 : _a.bind(target)) && void 0 !== _b ? _b : cb => {
20264
+ var _a;
20265
+ null === (_a = target.animates) || void 0 === _a || _a.forEach(cb);
20266
+ },
20267
+ propKeys = this.propKeys;
20268
+ forEachTrackedAnimate(a => {
19465
20269
  if (a === animate || a.priority > animate.priority || a.priority === 1 / 0) return;
19466
20270
  const fromProps = a.getStartProps();
19467
- this.propKeys.forEach(key => {
19468
- null != fromProps[key] && a.preventAttr(key);
19469
- });
20271
+ let conflictKeys = null;
20272
+ for (let i = 0; i < propKeys.length; i++) {
20273
+ const key = propKeys[i];
20274
+ null != fromProps[key] && (null != conflictKeys ? conflictKeys : conflictKeys = []).push(key);
20275
+ }
20276
+ conflictKeys && a.preventAttrs(conflictKeys);
19470
20277
  });
19471
20278
  }
20279
+ removeKeysFromRecord(record, keys) {
20280
+ if (!record) return record;
20281
+ let hasBlockedKey = !1;
20282
+ for (const key in record) if (Object.prototype.hasOwnProperty.call(record, key) && includesKey$1(keys, key)) {
20283
+ hasBlockedKey = !0;
20284
+ break;
20285
+ }
20286
+ if (!hasBlockedKey) return record;
20287
+ const nextRecord = {};
20288
+ for (const key in record) Object.prototype.hasOwnProperty.call(record, key) && !includesKey$1(keys, key) && (nextRecord[key] = record[key]);
20289
+ return nextRecord;
20290
+ }
19472
20291
  deleteSelfAttr(key) {
20292
+ this.deleteSelfAttrs([key]);
20293
+ }
20294
+ deleteSelfAttrs(keys) {
19473
20295
  var _a;
19474
- delete this.props[key], this.fromProps && delete this.fromProps[key];
19475
- const index = this.propKeys.indexOf(key);
19476
- -1 !== index && (this.propKeys.splice(index, 1), null === (_a = this.interpolateUpdateFunctions) || void 0 === _a || _a.splice(index, 1));
20296
+ if ((null == keys ? void 0 : keys.length) && (this.props = this.removeKeysFromRecord(this.props, keys), this.fromProps = this.removeKeysFromRecord(this.fromProps, keys), this.fromParsedProps = this.removeKeysFromRecord(this.fromParsedProps, keys), this.toParsedProps = this.removeKeysFromRecord(this.toParsedProps, keys), null === (_a = this.propKeys) || void 0 === _a ? void 0 : _a.length)) {
20297
+ const funcs = this.interpolateUpdateFunctions;
20298
+ let writeIndex = 0;
20299
+ for (let readIndex = 0; readIndex < this.propKeys.length; readIndex++) {
20300
+ const propKey = this.propKeys[readIndex];
20301
+ includesKey$1(keys, propKey) || (writeIndex !== readIndex && (this.propKeys[writeIndex] = propKey, funcs && (funcs[writeIndex] = funcs[readIndex])), writeIndex++);
20302
+ }
20303
+ this.propKeys.length = writeIndex, funcs && (funcs.length = writeIndex);
20304
+ }
19477
20305
  }
19478
20306
  trySyncStartProps() {
19479
20307
  this.propKeys.forEach(key => {
@@ -19483,11 +20311,7 @@ class Step {
19483
20311
  update(end, ratio, out) {
19484
20312
  if (this.onStart(), !this.props || !this.propKeys) return;
19485
20313
  const easedRatio = this.easing(ratio);
19486
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
19487
- if (!this.animate.validAttr(this.propKeys[index])) return;
19488
- const key = this.propKeys[index];
19489
- func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
19490
- }), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
20314
+ this.runInterpolateUpdate(this.fromProps, this.props, easedRatio), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
19491
20315
  }
19492
20316
  onUpdate(end, ratio, out) {}
19493
20317
  onEnd(cb) {
@@ -19512,7 +20336,7 @@ class WaitStep extends Step {
19512
20336
  onStart() {
19513
20337
  super.onStart();
19514
20338
  const fromProps = this.getFromProps();
19515
- this.target.setAttributes(fromProps);
20339
+ applyAnimationTransientAttributes(this.target, fromProps, AttributeUpdateType.ANIMATE_START);
19516
20340
  }
19517
20341
  update(end, ratio, out) {
19518
20342
  this.onStart();
@@ -19652,19 +20476,34 @@ class FromTo extends ACustomAnimate {
19652
20476
  }), this.applyTransientFromAttributes();
19653
20477
  }
19654
20478
  deleteSelfAttr(key) {
19655
- super.deleteSelfAttr(key), delete this.from[key];
20479
+ this.deleteSelfAttrs([key]);
20480
+ }
20481
+ deleteSelfAttrs(keys) {
20482
+ super.deleteSelfAttrs(keys), this.from = this.removeKeysFromRecord(this.from, keys);
19656
20483
  }
19657
20484
  update(end, ratio, out) {
19658
20485
  if (this.onStart(), !this.props || !this.propKeys) return;
19659
20486
  const easedRatio = this.easing(ratio);
19660
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.from, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
19661
- if (!this.animate.validAttr(this.propKeys[index])) return;
19662
- const key = this.propKeys[index];
19663
- func(key, this.from[key], this.props[key], easedRatio, this, this.target);
19664
- }), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
20487
+ this.runInterpolateUpdate(this.from, this.props, easedRatio), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
19665
20488
  }
19666
20489
  }
19667
20490
 
20491
+ function includesKey(keys, key) {
20492
+ for (let i = 0; i < keys.length; i++) if (keys[i] === key) return !0;
20493
+ return !1;
20494
+ }
20495
+ function removeKeysFromRecord(record, keys) {
20496
+ if (!record) return record;
20497
+ let hasBlockedKey = !1;
20498
+ for (const key in record) if (Object.prototype.hasOwnProperty.call(record, key) && includesKey(keys, key)) {
20499
+ hasBlockedKey = !0;
20500
+ break;
20501
+ }
20502
+ if (!hasBlockedKey) return record;
20503
+ const nextRecord = {};
20504
+ for (const key in record) Object.prototype.hasOwnProperty.call(record, key) && !includesKey(keys, key) && (nextRecord[key] = record[key]);
20505
+ return nextRecord;
20506
+ }
19668
20507
  class Animate {
19669
20508
  constructor(id = Generator.GenAutoIncrementId(), timeline = defaultTimeline, slience) {
19670
20509
  this.id = id, this.status = AnimateStatus.INITIAL, this._timeline = timeline, timeline.addAnimate(this), this.slience = slience, this._startTime = 0, this._duration = 0, this._totalDuration = 0, this._loopCount = 0, this._currentLoop = 0, this._bounce = !1, this._firstStep = null, this._lastStep = null, this._startProps = {}, this._endProps = {}, this._preventAttrs = new Set(), this.currentTime = 0, this.interpolateUpdateFunction = null, this.priority = 0;
@@ -19687,8 +20526,8 @@ class Animate {
19687
20526
  bind(target) {
19688
20527
  this.target = target;
19689
20528
  const trackerTarget = this.target;
19690
- return "function" == typeof trackerTarget.trackAnimate ? trackerTarget.trackAnimate(this) : (this.target.animates || (this.target.animates = new Map()), this.target.animates.set(this.id, this)), this.onRemove(() => {
19691
- this.stop(), "function" == typeof trackerTarget.restoreStaticAttribute && trackerTarget.restoreStaticAttribute(), "function" == typeof trackerTarget.untrackAnimate ? trackerTarget.untrackAnimate(this.id) : this.target.animates.delete(this.id);
20529
+ return "function" == typeof trackerTarget.detachAttributeFromBaseAttributes && trackerTarget.detachAttributeFromBaseAttributes(), "function" == typeof trackerTarget.trackAnimate ? trackerTarget.trackAnimate(this) : (this.target.animates || (this.target.animates = new Map()), this.target.animates.set(this.id, this)), this.onRemove(() => {
20530
+ this.stop(), this.__skipRestoreStaticAttributeOnRemove || "function" != typeof trackerTarget.restoreStaticAttribute || trackerTarget.restoreStaticAttribute(), "function" == typeof trackerTarget.untrackAnimate ? trackerTarget.untrackAnimate(this.id) : this.target.animates.delete(this.id);
19692
20531
  }), this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.target.animationAttribute || (this.target.animationAttribute = {}), this;
19693
20532
  }
19694
20533
  to(props, duration = 300, easing = "linear") {
@@ -19752,12 +20591,14 @@ class Animate {
19752
20591
  cb ? (this._onRemove || (this._onRemove = []), this._onRemove.push(cb)) : null === (_a = this._onRemove) || void 0 === _a || _a.forEach(cb => cb());
19753
20592
  }
19754
20593
  preventAttr(key) {
19755
- this._preventAttrs.add(key), delete this._startProps[key], delete this._endProps[key];
19756
- let step = this._firstStep;
19757
- for (; step;) step.deleteSelfAttr(key), step = step.next;
20594
+ this.preventAttrs([key]);
19758
20595
  }
19759
20596
  preventAttrs(keys) {
19760
- keys.forEach(key => this._preventAttrs.add(key));
20597
+ if (!(null == keys ? void 0 : keys.length)) return;
20598
+ for (let i = 0; i < keys.length; i++) this._preventAttrs.add(keys[i]);
20599
+ this._startProps = removeKeysFromRecord(this._startProps, keys), this._endProps = removeKeysFromRecord(this._endProps, keys);
20600
+ let step = this._firstStep;
20601
+ for (; step;) step.deleteSelfAttrs(keys), step = step.next;
19761
20602
  }
19762
20603
  validAttr(key) {
19763
20604
  return !this._preventAttrs.has(key);
@@ -19824,7 +20665,7 @@ class Animate {
19824
20665
  if (nextTime >= this._startTime + this._totalDuration) {
19825
20666
  null === (_a = this._lastStep) || void 0 === _a || _a.onUpdate(!0, 1, {}), null === (_b = this._lastStep) || void 0 === _b || _b.onEnd(), this.onEnd(), this.status = AnimateStatus.END;
19826
20667
  const trackerTarget = this.target;
19827
- return void ("function" == typeof (null == trackerTarget ? void 0 : trackerTarget.restoreStaticAttribute) && trackerTarget.restoreStaticAttribute());
20668
+ return "function" == typeof (null == trackerTarget ? void 0 : trackerTarget.restoreStaticAttribute) && trackerTarget.restoreStaticAttribute(), void (this.__skipRestoreStaticAttributeOnRemove = !0);
19828
20669
  }
19829
20670
  this.status = AnimateStatus.RUNNING, this.currentTime <= this._startTime && this.onStart(), this.currentTime = nextTime;
19830
20671
  let cycleTime = nextTime - this._startTime,
@@ -19835,7 +20676,7 @@ class Animate {
19835
20676
  const currentLoop = Math.floor((nextTime - this._startTime) / this._duration);
19836
20677
  newLoop = currentLoop > this._currentLoop, this._currentLoop = currentLoop, bounceTime = this._bounce && currentLoop % 2 == 1, bounceTime && (cycleTime = this._duration - cycleTime);
19837
20678
  }
19838
- newLoop && !bounceTime && this.target.setAttributes(this._startProps);
20679
+ newLoop && !bounceTime && applyAnimationTransientAttributes(this.target, this._startProps, AttributeUpdateType.ANIMATE_START);
19839
20680
  let targetStep = null;
19840
20681
  if (this._lastStep === this._firstStep) targetStep = this._firstStep;else {
19841
20682
  let currentStep = this._firstStep;
@@ -20070,6 +20911,9 @@ class AnimationTransitionRegistry {
20070
20911
  })), this.registerTransition("state", "*", () => ({
20071
20912
  allowTransition: !0,
20072
20913
  stopOriginalTransition: !1
20914
+ })), this.registerTransition("state", "state", () => ({
20915
+ allowTransition: !0,
20916
+ stopOriginalTransition: !0
20073
20917
  })), this.registerTransition("state", "disappear", () => ({
20074
20918
  allowTransition: !0,
20075
20919
  stopOriginalTransition: !0
@@ -20126,6 +20970,33 @@ class AnimateExecutor {
20126
20970
  cb();
20127
20971
  });
20128
20972
  }
20973
+ getActiveAttrKeys() {
20974
+ const keys = [];
20975
+ for (let i = 0; i < this._animates.length; i++) {
20976
+ const animate = this._animates[i];
20977
+ if (animate.status === AnimateStatus.END) continue;
20978
+ const endProps = animate.getEndProps();
20979
+ if (endProps) for (const key in endProps) Object.prototype.hasOwnProperty.call(endProps, key) && keys.indexOf(key) < 0 && keys.push(key);
20980
+ }
20981
+ return keys;
20982
+ }
20983
+ hasActiveAttrs() {
20984
+ for (let i = 0; i < this._animates.length; i++) {
20985
+ const animate = this._animates[i];
20986
+ if (animate.status === AnimateStatus.END) continue;
20987
+ const endProps = animate.getEndProps();
20988
+ if (endProps) for (const key in endProps) if (Object.prototype.hasOwnProperty.call(endProps, key)) return !0;
20989
+ }
20990
+ return !1;
20991
+ }
20992
+ preventAttrs(keys) {
20993
+ if (!(null == keys ? void 0 : keys.length)) return this.hasActiveAttrs();
20994
+ for (let i = 0; i < this._animates.length; i++) {
20995
+ const animate = this._animates[i];
20996
+ animate.status !== AnimateStatus.END && animate.preventAttrs(keys);
20997
+ }
20998
+ return this.hasActiveAttrs();
20999
+ }
20129
21000
  _trackAnimation(animate) {
20130
21001
  this._animates.push(animate), this._activeCount++, 1 !== this._activeCount || this._started || (this._started = !0, this.onStart()), animate.onEnd(() => {
20131
21002
  this._activeCount--;
@@ -20248,7 +21119,8 @@ class AnimateExecutor {
20248
21119
  let parsedFromProps = null,
20249
21120
  props = params.to,
20250
21121
  from = params.from;
20251
- props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from), parsedFromProps.attrOutChannel && graphic.setAttributes(parsedFromProps.attrOutChannel), this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
21122
+ const commitAttrOutChannel = this.shouldCommitAttrOutChannel(type);
21123
+ props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel)), from = parsedFromProps.from), parsedFromProps.attrOutChannel && graphic.setAttributes(parsedFromProps.attrOutChannel), this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
20252
21124
  let totalDelay = 0;
20253
21125
  oneByOneDelay && (totalDelay = oneByOneDelay * (count - index - 1));
20254
21126
  const delayAfterValue = isFunction(delayAfter) ? delayAfter(null === (_h = null === (_g = graphic.context) || void 0 === _g ? void 0 : _g.data) || void 0 === _h ? void 0 : _h[0], graphic, {}) : delayAfter;
@@ -20311,7 +21183,8 @@ class AnimateExecutor {
20311
21183
  let parsedFromProps = null,
20312
21184
  props = effect.to,
20313
21185
  from = effect.from;
20314
- props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from), parsedFromProps.attrOutChannel && graphic.setAttributes(parsedFromProps.attrOutChannel);
21186
+ const commitAttrOutChannel = this.shouldCommitAttrOutChannel(type);
21187
+ props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic, commitAttrOutChannel)), from = parsedFromProps.from), parsedFromProps.attrOutChannel && graphic.setAttributes(parsedFromProps.attrOutChannel);
20315
21188
  const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
20316
21189
  customType = effect.custom ? effect.customType : getCustomType(custom);
20317
21190
  this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
@@ -20325,11 +21198,14 @@ class AnimateExecutor {
20325
21198
  interpolator(ratio, from, to, step, target, animate.target, customParams);
20326
21199
  }, animate.to(props, duration, easing);
20327
21200
  }
21201
+ shouldCommitAttrOutChannel(type) {
21202
+ return "update" !== type;
21203
+ }
20328
21204
  createCustomAnimation(animate, CustomAnimateConstructor, from, props, duration, easing, customParams) {
20329
21205
  const customAnimate = new CustomAnimateConstructor(from, props, duration, easing, customParams);
20330
21206
  animate.play(customAnimate);
20331
21207
  }
20332
- createPropsFromChannel(channel, graphic) {
21208
+ createPropsFromChannel(channel, graphic, includeAttrOutChannel = !0) {
20333
21209
  var _a;
20334
21210
  const props = {};
20335
21211
  let from = null;
@@ -20338,7 +21214,7 @@ class AnimateExecutor {
20338
21214
  props: props,
20339
21215
  attrOutChannel: null
20340
21216
  };
20341
- const attrOutChannel = {};
21217
+ const attrOutChannel = includeAttrOutChannel ? {} : null;
20342
21218
  let hasAttrs = !1;
20343
21219
  const diffAttrs = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs;
20344
21220
  if (Array.isArray(channel) && (channel = channel.reduce((res, key) => (void 0 === diffAttrs[key] || (res[key] = {
@@ -20347,9 +21223,10 @@ class AnimateExecutor {
20347
21223
  var _a, _b, _c, _d;
20348
21224
  const config = channel[key];
20349
21225
  void 0 !== config.to && ("function" == typeof config.to ? props[key] = config.to(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : props[key] = config.to), void 0 !== config.from && (from || (from = {}), "function" == typeof config.from ? from[key] = config.from(null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, {}) : from[key] = config.from);
20350
- }), diffAttrs) for (const key in diffAttrs) {
21226
+ }), diffAttrs && attrOutChannel) for (const key in diffAttrs) {
20351
21227
  const value = diffAttrs[key];
20352
- void 0 !== value && (props.hasOwnProperty(key) || (attrOutChannel[key] = value, hasAttrs = !0));
21228
+ if (void 0 === value) continue;
21229
+ props.hasOwnProperty(key) || !!(null == from ? void 0 : from.hasOwnProperty(key)) || (attrOutChannel[key] = value, hasAttrs = !0);
20353
21230
  }
20354
21231
  return {
20355
21232
  from: from,
@@ -20374,7 +21251,7 @@ class AnimateExecutor {
20374
21251
  stop(type, callEnd = !0) {
20375
21252
  for (; this._animates.length > 0;) {
20376
21253
  const animate = this._animates.pop();
20377
- !1 === callEnd && (animate.status = AnimateStatus.END), null == animate || animate.stop(type);
21254
+ !1 === callEnd && (animate.status = AnimateStatus.END, animate.__skipRestoreStaticAttributeOnRemove = !0), null == animate || animate.stop(type);
20378
21255
  }
20379
21256
  this._animates = [], this._activeCount = 0, this._started && (this._started = !1, callEnd && this.onEnd());
20380
21257
  }
@@ -20425,8 +21302,22 @@ class AnimationStateManager {
20425
21302
  hasTrackedAnimate() {
20426
21303
  return this.trackedAnimates.size > 0;
20427
21304
  }
21305
+ hasStateInfo(list, target) {
21306
+ for (let i = 0; i < list.length; i++) if (list[i] === target) return !0;
21307
+ return !1;
21308
+ }
21309
+ takeOverUpdateAttrs(nextState, currentStates, shouldStopState) {
21310
+ if (nextState.state !== AnimationStates.UPDATE || !currentStates.length) return;
21311
+ const nextKeys = nextState.executor.getActiveAttrKeys();
21312
+ if (nextKeys.length) for (let i = 0; i < currentStates.length; i++) {
21313
+ const currentState = currentStates[i];
21314
+ currentState.state !== AnimationStates.UPDATE || currentState === nextState || this.hasStateInfo(shouldStopState, currentState) || currentState.executor.preventAttrs(nextKeys) || (currentState.executor.stop(null, !1), shouldStopState.push(currentState));
21315
+ }
21316
+ }
20428
21317
  applyState(nextState, animationConfig, callback) {
21318
+ var _a;
20429
21319
  const registry = AnimationTransitionRegistry.getInstance(),
21320
+ currentStateList = null !== (_a = this.stateList) && void 0 !== _a ? _a : [],
20430
21321
  shouldStopState = [],
20431
21322
  shouldApplyState = [];
20432
21323
  if (this.stateList && this.stateList.length ? nextState.forEach((state, index) => {
@@ -20434,14 +21325,14 @@ class AnimationStateManager {
20434
21325
  allowTransition: !0,
20435
21326
  stopOriginalTransition: !0
20436
21327
  };
20437
- this.stateList.forEach(currState => {
21328
+ currentStateList.forEach(currState => {
20438
21329
  const _result = registry.isTransitionAllowed(currState.state, state, this.graphic);
20439
21330
  result.allowTransition = result.allowTransition && _result.allowTransition;
20440
21331
  }), result.allowTransition && (shouldApplyState.push({
20441
21332
  state: state,
20442
21333
  animationConfig: isArray(animationConfig[index]) ? animationConfig[index].map(item => item.animation) : animationConfig[index].animation,
20443
21334
  executor: new AnimateExecutor(this.graphic)
20444
- }), this.stateList.forEach(currState => {
21335
+ }), currentStateList.forEach(currState => {
20445
21336
  registry.isTransitionAllowed(currState.state, state, this.graphic).stopOriginalTransition && shouldStopState.push(currState);
20446
21337
  }));
20447
21338
  }) : nextState.forEach((state, index) => {
@@ -20453,12 +21344,18 @@ class AnimationStateManager {
20453
21344
  }), shouldStopState.forEach(state => {
20454
21345
  state.executor.stop(null, !1);
20455
21346
  }), shouldApplyState.length) {
20456
- shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig);
21347
+ shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig), this.takeOverUpdateAttrs(shouldApplyState[0], currentStateList, shouldStopState);
20457
21348
  for (let i = 0; i < shouldApplyState.length; i++) {
20458
21349
  const nextState = shouldApplyState[i + 1],
20459
21350
  currentState = shouldApplyState[i];
20460
21351
  currentState.executor.onEnd(() => {
20461
- nextState && nextState.executor.execute(nextState.animationConfig), this.stateList = this.stateList.filter(state => state !== currentState), i === shouldApplyState.length - 1 && callback && callback(!1);
21352
+ var _a;
21353
+ if (nextState) {
21354
+ nextState.executor.execute(nextState.animationConfig);
21355
+ const stoppedStates = [];
21356
+ this.takeOverUpdateAttrs(nextState, null !== (_a = this.stateList) && void 0 !== _a ? _a : [], stoppedStates), stoppedStates.length && this.stateList && (this.stateList = this.stateList.filter(state => !this.hasStateInfo(stoppedStates, state)));
21357
+ }
21358
+ this.stateList = this.stateList.filter(state => state !== currentState), i === shouldApplyState.length - 1 && callback && callback(!1);
20462
21359
  });
20463
21360
  }
20464
21361
  } else callback && callback(!0);
@@ -20701,8 +21598,11 @@ class ComponentAnimator {
20701
21598
  }), this));
20702
21599
  }
20703
21600
  deleteSelfAttr(key) {
21601
+ this.deleteSelfAttrs([key]);
21602
+ }
21603
+ deleteSelfAttrs(keys) {
20704
21604
  this.tasks.forEach(task => {
20705
- task.animate && task.animate.forEach(animate => animate.preventAttr(key));
21605
+ task.animate && task.animate.forEach(animate => animate.preventAttrs(keys));
20706
21606
  });
20707
21607
  }
20708
21608
  stop(type) {
@@ -20807,7 +21707,9 @@ class IncreaseCount extends ACustomAnimate {
20807
21707
  const parts = formattedNumber.toString().split(".");
20808
21708
  parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","), formattedWithBasicFormat = parts.join(".");
20809
21709
  } else formattedWithBasicFormat = formattedNumber;
20810
- formattedText = this.formatTemplate ? this.formatTemplate.replace("{{var}}", formattedWithBasicFormat.toString()) : formattedWithBasicFormat, this.target.setAttribute("text", formattedText);
21710
+ formattedText = this.formatTemplate ? this.formatTemplate.replace("{{var}}", formattedWithBasicFormat.toString()) : formattedWithBasicFormat, applyAnimationTransientAttributes(this.target, {
21711
+ text: formattedText
21712
+ });
20811
21713
  }
20812
21714
  }
20813
21715
 
@@ -20827,7 +21729,7 @@ class AxisEnter extends AComponentAnimate {
20827
21729
  const point = getTickCoord(oldValue);
20828
21730
  const newX = this.target.attribute.x;
20829
21731
  const newY = this.target.attribute.y;
20830
- this.target.setAttributes({ x: point.x, y: point.y });
21732
+ commitUpdateAnimationTarget(this.target, { x: newX, y: newY }, { x: point.x, y: point.y });
20831
21733
  animator.animate(this.target, {
20832
21734
  type: 'to',
20833
21735
  to: { x: newX, y: newY },
@@ -20850,7 +21752,8 @@ class AxisUpdate extends AComponentAnimate {
20850
21752
  this._animator = animator;
20851
21753
  const duration = this.duration;
20852
21754
  const easing = this.easing;
20853
- const { config, diffAttrs } = this.params;
21755
+ const { diffAttrs } = this.params;
21756
+ commitUpdateAnimationTarget(this.target, Object.assign({}, diffAttrs));
20854
21757
  animator.animate(this.target, {
20855
21758
  type: 'to',
20856
21759
  to: Object.assign({}, diffAttrs),
@@ -20863,8 +21766,11 @@ class AxisUpdate extends AComponentAnimate {
20863
21766
  this.completeBind(animator);
20864
21767
  }
20865
21768
  deleteSelfAttr(key) {
20866
- super.deleteSelfAttr(key);
20867
- this._animator.deleteSelfAttr(key);
21769
+ this.deleteSelfAttrs([key]);
21770
+ }
21771
+ deleteSelfAttrs(keys) {
21772
+ super.deleteSelfAttrs(keys);
21773
+ this._animator.deleteSelfAttrs(keys);
20868
21774
  }
20869
21775
  tryPreventConflict() {
20870
21776
  return;
@@ -21559,8 +22465,8 @@ class LineAxis extends AxisBase {
21559
22465
  }
21560
22466
  return offset;
21561
22467
  }
21562
- release() {
21563
- super.release();
22468
+ release(all) {
22469
+ super.release(all);
21564
22470
  this._breaks = null;
21565
22471
  }
21566
22472
  }
@@ -21897,6 +22803,7 @@ class GroupTransition extends ACustomAnimate {
21897
22803
  this.mode = AnimateMode.NORMAL;
21898
22804
  }
21899
22805
  onBind() {
22806
+ this._started = false;
21900
22807
  const currentInnerView = this.target.getInnerView();
21901
22808
  const prevInnerView = this.target.getPrevInnerView();
21902
22809
  if (!prevInnerView) {
@@ -21915,7 +22822,7 @@ class GroupTransition extends ACustomAnimate {
21915
22822
  node: el,
21916
22823
  attrs: Object.assign(Object.assign({}, newProps), { opacity: (_a = newProps.opacity) !== null && _a !== void 0 ? _a : 1, fillOpacity: (_b = newProps.fillOpacity) !== null && _b !== void 0 ? _b : 1, strokeOpacity: (_c = newProps.strokeOpacity) !== null && _c !== void 0 ? _c : 1 })
21917
22824
  };
21918
- el.setAttributes(oldEl.attribute);
22825
+ commitUpdateAnimationTarget(el, this._newElementAttrMap[el.id].attrs, cloneDeep(oldEl.attribute));
21919
22826
  }
21920
22827
  }
21921
22828
  else {
@@ -21929,7 +22836,7 @@ class GroupTransition extends ACustomAnimate {
21929
22836
  node: el,
21930
22837
  attrs: finalOpacityAttrs
21931
22838
  };
21932
- el.setAttributes({
22839
+ commitUpdateAnimationTarget(el, finalOpacityAttrs, {
21933
22840
  opacity: 0,
21934
22841
  fillOpacity: 0,
21935
22842
  strokeOpacity: 0
@@ -21939,6 +22846,10 @@ class GroupTransition extends ACustomAnimate {
21939
22846
  });
21940
22847
  }
21941
22848
  onStart() {
22849
+ if (this._started) {
22850
+ return;
22851
+ }
22852
+ this._started = true;
21942
22853
  let duration = this.duration;
21943
22854
  let easing = this.easing;
21944
22855
  this._newElementAttrMap &&
@@ -23434,6 +24345,17 @@ function shiftY(texts, option) {
23434
24345
  }
23435
24346
 
23436
24347
  loadLabelComponent();
24348
+ function cloneAttributeSnapshot(value) {
24349
+ if (!isObject(value) || isArray(value)) {
24350
+ return value;
24351
+ }
24352
+ const snapshot = {};
24353
+ Object.keys(value).forEach(key => {
24354
+ const nextValue = value[key];
24355
+ snapshot[key] = isObject(nextValue) && !isArray(nextValue) ? cloneAttributeSnapshot(nextValue) : nextValue;
24356
+ });
24357
+ return snapshot;
24358
+ }
23437
24359
  class LabelBase extends AnimateComponent {
23438
24360
  setBitmap(bitmap) {
23439
24361
  this._bitmap = bitmap;
@@ -23532,7 +24454,92 @@ class LabelBase extends AnimateComponent {
23532
24454
  return lineGraphic;
23533
24455
  }
23534
24456
  }
24457
+ _finalizeExitRelease() {
24458
+ var _a, _b, _c, _d;
24459
+ const state = this._exitReleaseState;
24460
+ if (state === null || state === void 0 ? void 0 : state.finalized) {
24461
+ return;
24462
+ }
24463
+ if (state) {
24464
+ state.finalized = true;
24465
+ }
24466
+ const parent = this.parent;
24467
+ const removeFromParent = !!(state === null || state === void 0 ? void 0 : state.removeFromParent);
24468
+ const callbacks = (_a = state === null || state === void 0 ? void 0 : state.onComplete) !== null && _a !== void 0 ? _a : [];
24469
+ this._exitReleaseState = undefined;
24470
+ this._graphicToText = new Map();
24471
+ (_b = this._idToGraphic) === null || _b === void 0 ? void 0 : _b.clear();
24472
+ (_c = this._idToPoint) === null || _c === void 0 ? void 0 : _c.clear();
24473
+ this._baseMarks = undefined;
24474
+ this.removeAllChild(true);
24475
+ super.release(true);
24476
+ if (removeFromParent) {
24477
+ (_d = (parent !== null && parent !== void 0 ? parent : this.parent)) === null || _d === void 0 ? void 0 : _d.removeChild(this);
24478
+ }
24479
+ runExitReleaseCallbacks(callbacks);
24480
+ }
24481
+ _runExitAnimationBeforeRelease(options = {}) {
24482
+ var _a, _b;
24483
+ if (this._exitReleaseState && !this._exitReleaseState.finalized) {
24484
+ this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent;
24485
+ appendExitReleaseCallback(this._exitReleaseState, options.onComplete);
24486
+ return true;
24487
+ }
24488
+ if (!this.stage ||
24489
+ this.attribute.animation === false ||
24490
+ this.attribute.animationExit === false ||
24491
+ !((_a = this._graphicToText) === null || _a === void 0 ? void 0 : _a.size)) {
24492
+ return false;
24493
+ }
24494
+ this._prepareAnimate(DefaultLabelAnimation);
24495
+ if (!((_b = this._animationConfig) === null || _b === void 0 ? void 0 : _b.exit)) {
24496
+ return false;
24497
+ }
24498
+ const exitTargets = new Set();
24499
+ this._graphicToText.forEach(label => {
24500
+ (label === null || label === void 0 ? void 0 : label.text) && exitTargets.add(label.text);
24501
+ (label === null || label === void 0 ? void 0 : label.labelLine) && exitTargets.add(label.labelLine);
24502
+ });
24503
+ if (!exitTargets.size) {
24504
+ return false;
24505
+ }
24506
+ const existingAnimates = collectTrackedAnimates(this);
24507
+ exitTargets.forEach(target => {
24508
+ var _a;
24509
+ target.applyAnimationState(['exit'], [
24510
+ {
24511
+ name: 'exit',
24512
+ animation: Object.assign(Object.assign({}, this._animationConfig.exit), { type: (_a = this._animationConfig.exit.type) !== null && _a !== void 0 ? _a : 'fadeOut', selfOnly: true })
24513
+ }
24514
+ ]);
24515
+ });
24516
+ const animates = collectTrackedAnimates(this);
24517
+ const exitAnimates = animates.filter(animate => !existingAnimates.includes(animate));
24518
+ if (!exitAnimates.length) {
24519
+ return false;
24520
+ }
24521
+ this.setAttribute('childrenPickable', false);
24522
+ this.releaseStatus = 'willRelease';
24523
+ const pendingAnimates = new Set(exitAnimates);
24524
+ this._exitReleaseState = {
24525
+ pendingAnimates,
24526
+ finalized: false,
24527
+ removeFromParent: !!options.removeFromParent,
24528
+ onComplete: options.onComplete ? [options.onComplete] : []
24529
+ };
24530
+ bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease());
24531
+ return true;
24532
+ }
24533
+ releaseWithExitAnimation(options = {}) {
24534
+ if (this.releaseStatus === 'released') {
24535
+ return false;
24536
+ }
24537
+ return this._runExitAnimationBeforeRelease(options);
24538
+ }
23535
24539
  render() {
24540
+ if (this._exitReleaseState) {
24541
+ return;
24542
+ }
23536
24543
  this._prepare();
23537
24544
  if (isNil(this._idToGraphic) || (this._isCollectionBase && isNil(this._idToPoint))) {
23538
24545
  return;
@@ -23540,7 +24547,7 @@ class LabelBase extends AnimateComponent {
23540
24547
  const markAttributeList = [];
23541
24548
  if (this._enableAnimation !== false) {
23542
24549
  this._baseMarks.forEach(mark => {
23543
- markAttributeList.push(mark.attribute);
24550
+ markAttributeList.push(cloneAttributeSnapshot(mark.attribute));
23544
24551
  mark.initAttributes(mark.getAttributes(true));
23545
24552
  });
23546
24553
  }
@@ -24054,6 +25061,8 @@ class LabelBase extends AnimateComponent {
24054
25061
  _runUpdateAnimation(prevLabel, currentLabel) {
24055
25062
  const { text: prevText, labelLine: prevLabelLine } = prevLabel;
24056
25063
  const { text: curText, labelLine: curLabelLine } = currentLabel;
25064
+ commitUpdateAnimationTarget(prevText, curText === null || curText === void 0 ? void 0 : curText.attribute);
25065
+ commitUpdateAnimationTarget(prevLabelLine, curLabelLine === null || curLabelLine === void 0 ? void 0 : curLabelLine.attribute);
24057
25066
  prevText.applyAnimationState(['update'], [
24058
25067
  {
24059
25068
  name: 'update',
@@ -24085,7 +25094,7 @@ class LabelBase extends AnimateComponent {
24085
25094
  this.runEnterAnimation(text, labelLine);
24086
25095
  }
24087
25096
  _updateLabel(prevLabel, currentLabel) {
24088
- const { text: prevText, labelLine: prevLabelLine } = prevLabel;
25097
+ const { labelLine: prevLabelLine } = prevLabel;
24089
25098
  const { text: curText, labelLine: curLabelLine } = currentLabel;
24090
25099
  if (this._enableAnimation === false || this._animationConfig.update === false) {
24091
25100
  prevLabel.text.setAttributes(curText.attribute);
@@ -24220,6 +25229,21 @@ class LabelBase extends AnimateComponent {
24220
25229
  }
24221
25230
  return shapeBound.encloses(textBound);
24222
25231
  }
25232
+ release(all) {
25233
+ var _a, _b;
25234
+ if (this._exitReleaseState) {
25235
+ this._finalizeExitRelease();
25236
+ return;
25237
+ }
25238
+ if (all) {
25239
+ this.removeAllChild(true);
25240
+ }
25241
+ super.release(all);
25242
+ this._graphicToText = new Map();
25243
+ (_a = this._idToGraphic) === null || _a === void 0 ? void 0 : _a.clear();
25244
+ (_b = this._idToPoint) === null || _b === void 0 ? void 0 : _b.clear();
25245
+ this._baseMarks = undefined;
25246
+ }
24223
25247
  setLocation(point) {
24224
25248
  this.translateTo(point.x, point.y);
24225
25249
  }
@@ -25180,6 +26204,9 @@ class DataLabel extends AbstractComponent {
25180
26204
  }
25181
26205
  render() {
25182
26206
  var _a;
26207
+ if (this._exitReleaseState) {
26208
+ return;
26209
+ }
25183
26210
  const { dataLabels, size } = this.attribute;
25184
26211
  if (!dataLabels || dataLabels.length === 0) {
25185
26212
  return;
@@ -25228,6 +26255,101 @@ class DataLabel extends AbstractComponent {
25228
26255
  });
25229
26256
  this._componentMap = currentComponentMap;
25230
26257
  }
26258
+ _finalizeExitRelease() {
26259
+ var _a, _b, _c;
26260
+ const state = this._exitReleaseState;
26261
+ if (state === null || state === void 0 ? void 0 : state.finalized) {
26262
+ return;
26263
+ }
26264
+ if (state) {
26265
+ state.finalized = true;
26266
+ }
26267
+ const parent = this.parent;
26268
+ const removeFromParent = !!(state === null || state === void 0 ? void 0 : state.removeFromParent);
26269
+ const callbacks = (_a = state === null || state === void 0 ? void 0 : state.onComplete) !== null && _a !== void 0 ? _a : [];
26270
+ this._exitReleaseState = undefined;
26271
+ (_b = this._componentMap) === null || _b === void 0 ? void 0 : _b.clear();
26272
+ this.removeAllChild(true);
26273
+ super.release(true);
26274
+ if (removeFromParent) {
26275
+ (_c = (parent !== null && parent !== void 0 ? parent : this.parent)) === null || _c === void 0 ? void 0 : _c.removeChild(this);
26276
+ }
26277
+ runExitReleaseCallbacks(callbacks);
26278
+ }
26279
+ releaseWithExitAnimation(options = {}) {
26280
+ var _a;
26281
+ if (this.releaseStatus === 'released') {
26282
+ return false;
26283
+ }
26284
+ if (this._exitReleaseState && !this._exitReleaseState.finalized) {
26285
+ this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent;
26286
+ appendExitReleaseCallback(this._exitReleaseState, options.onComplete);
26287
+ return true;
26288
+ }
26289
+ if (!this.stage || !((_a = this._componentMap) === null || _a === void 0 ? void 0 : _a.size)) {
26290
+ return false;
26291
+ }
26292
+ const state = {
26293
+ pendingCount: 0,
26294
+ finalized: false,
26295
+ removeFromParent: !!options.removeFromParent,
26296
+ onComplete: options.onComplete ? [options.onComplete] : []
26297
+ };
26298
+ const exitingComponents = [];
26299
+ const fallbackComponents = [];
26300
+ let initializing = true;
26301
+ const finish = () => {
26302
+ if (state.finalized) {
26303
+ return;
26304
+ }
26305
+ state.pendingCount -= 1;
26306
+ if (state.pendingCount <= 0 && !initializing) {
26307
+ this._finalizeExitRelease();
26308
+ }
26309
+ };
26310
+ this._exitReleaseState = state;
26311
+ this._componentMap.forEach(component => {
26312
+ state.pendingCount += 1;
26313
+ const releasedWithExit = component.releaseWithExitAnimation({
26314
+ removeFromParent: false,
26315
+ onComplete: finish
26316
+ });
26317
+ if (releasedWithExit) {
26318
+ exitingComponents.push(component);
26319
+ }
26320
+ else {
26321
+ state.pendingCount -= 1;
26322
+ fallbackComponents.push(component);
26323
+ }
26324
+ });
26325
+ if (!exitingComponents.length) {
26326
+ this._exitReleaseState = undefined;
26327
+ return false;
26328
+ }
26329
+ fallbackComponents.forEach(component => {
26330
+ component.release(true);
26331
+ this.removeChild(component);
26332
+ });
26333
+ this.setAttribute('childrenPickable', false);
26334
+ this.releaseStatus = 'willRelease';
26335
+ initializing = false;
26336
+ if (state.pendingCount <= 0) {
26337
+ this._finalizeExitRelease();
26338
+ }
26339
+ return true;
26340
+ }
26341
+ release(all) {
26342
+ var _a;
26343
+ if (this._exitReleaseState) {
26344
+ this._finalizeExitRelease();
26345
+ return;
26346
+ }
26347
+ if (all) {
26348
+ this.removeAllChild(true);
26349
+ }
26350
+ super.release(all);
26351
+ (_a = this._componentMap) === null || _a === void 0 ? void 0 : _a.clear();
26352
+ }
25231
26353
  setLocation(point) {
25232
26354
  this.translateTo(point.x, point.y);
25233
26355
  }
@@ -26937,15 +28059,95 @@ class Marker extends AbstractComponent {
26937
28059
  y: clipInRange ? -((_b = limitRect.y) !== null && _b !== void 0 ? _b : 0) : 0
26938
28060
  });
26939
28061
  }
26940
- render() {
28062
+ _finalizeExitRelease() {
28063
+ var _a, _b;
28064
+ const state = this._exitReleaseState;
28065
+ if (state === null || state === void 0 ? void 0 : state.finalized) {
28066
+ return;
28067
+ }
28068
+ if (state) {
28069
+ state.finalized = true;
28070
+ }
28071
+ const parent = this.parent;
28072
+ const removeFromParent = !!(state === null || state === void 0 ? void 0 : state.removeFromParent);
28073
+ const releaseSelf = !!(state === null || state === void 0 ? void 0 : state.releaseSelf);
28074
+ const callbacks = (_a = state === null || state === void 0 ? void 0 : state.onComplete) !== null && _a !== void 0 ? _a : [];
28075
+ this._exitReleaseState = undefined;
28076
+ this._releaseEvent();
28077
+ this._container = null;
28078
+ this._containerClip = null;
28079
+ this.removeAllChild(true);
28080
+ if (releaseSelf) {
28081
+ super.release(true);
28082
+ if (removeFromParent) {
28083
+ (_b = (parent !== null && parent !== void 0 ? parent : this.parent)) === null || _b === void 0 ? void 0 : _b.removeChild(this);
28084
+ }
28085
+ }
28086
+ runExitReleaseCallbacks(callbacks);
28087
+ }
28088
+ _runExitAnimationBeforeCleanup(options = {}) {
26941
28089
  var _a;
28090
+ const releaseSelf = !!options.releaseSelf;
28091
+ if (this._exitReleaseState && !this._exitReleaseState.finalized) {
28092
+ this._exitReleaseState.releaseSelf = this._exitReleaseState.releaseSelf || releaseSelf;
28093
+ this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent;
28094
+ appendExitReleaseCallback(this._exitReleaseState, options.onComplete);
28095
+ return true;
28096
+ }
28097
+ if (!this.stage ||
28098
+ this.attribute.animation === false ||
28099
+ this.attribute.animationExit === false ||
28100
+ !this._container) {
28101
+ return false;
28102
+ }
28103
+ this.transAnimationConfig();
28104
+ if (!((_a = this._animationConfig) === null || _a === void 0 ? void 0 : _a.exit)) {
28105
+ return false;
28106
+ }
28107
+ const existingAnimates = collectTrackedAnimates(this);
28108
+ this.markerAnimate('exit');
28109
+ const animates = collectTrackedAnimates(this);
28110
+ const exitAnimates = animates.filter(animate => !existingAnimates.includes(animate));
28111
+ if (!exitAnimates.length) {
28112
+ return false;
28113
+ }
28114
+ this._releaseEvent();
28115
+ this.setAttribute('childrenPickable', false);
28116
+ if (releaseSelf) {
28117
+ this.releaseStatus = 'willRelease';
28118
+ }
28119
+ const pendingAnimates = new Set(exitAnimates);
28120
+ this._exitReleaseState = {
28121
+ pendingAnimates,
28122
+ finalized: false,
28123
+ releaseSelf,
28124
+ removeFromParent: !!options.removeFromParent,
28125
+ onComplete: options.onComplete ? [options.onComplete] : []
28126
+ };
28127
+ bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease());
28128
+ return true;
28129
+ }
28130
+ releaseWithExitAnimation(options = {}) {
28131
+ if (this.releaseStatus === 'released') {
28132
+ return false;
28133
+ }
28134
+ return this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({}, options), { releaseSelf: true }));
28135
+ }
28136
+ render() {
28137
+ var _a, _b;
28138
+ if ((_a = this._exitReleaseState) === null || _a === void 0 ? void 0 : _a.releaseSelf) {
28139
+ return;
28140
+ }
26942
28141
  this.transAnimationConfig();
26943
28142
  this.setAttribute('pickable', false);
26944
- const markerVisible = (_a = this.attribute.visible) !== null && _a !== void 0 ? _a : true;
28143
+ const markerVisible = (_b = this.attribute.visible) !== null && _b !== void 0 ? _b : true;
26945
28144
  if (this.attribute.interactive === false) {
26946
28145
  this.setAttribute('childrenPickable', false);
26947
28146
  }
26948
28147
  if (markerVisible && this.isValidPoints()) {
28148
+ if (this._exitReleaseState) {
28149
+ this._finalizeExitRelease();
28150
+ }
26949
28151
  if (!this._container) {
26950
28152
  this._initContainer();
26951
28153
  this.initMarker(this._container);
@@ -26958,18 +28160,30 @@ class Marker extends AbstractComponent {
26958
28160
  }
26959
28161
  }
26960
28162
  else {
26961
- this.markerAnimate('exit');
26962
- this._container = null;
26963
- this.removeAllChild(true);
28163
+ if (!this._runExitAnimationBeforeCleanup()) {
28164
+ this._container = null;
28165
+ this._containerClip = null;
28166
+ this.removeAllChild(true);
28167
+ }
26964
28168
  }
26965
28169
  this._releaseEvent();
26966
28170
  this._bindEvent();
26967
28171
  }
26968
- release() {
26969
- this.markerAnimate('exit');
26970
- super.release();
28172
+ release(all) {
28173
+ if (this._exitReleaseState) {
28174
+ this._finalizeExitRelease();
28175
+ return;
28176
+ }
28177
+ if (this.attribute.animation !== false && this.attribute.animationExit !== false) {
28178
+ this.markerAnimate('exit');
28179
+ }
28180
+ if (all) {
28181
+ this.removeAllChild(true);
28182
+ }
28183
+ super.release(all);
26971
28184
  this._releaseEvent();
26972
28185
  this._container = null;
28186
+ this._containerClip = null;
26973
28187
  }
26974
28188
  }
26975
28189
 
@@ -26981,7 +28195,10 @@ function graphicFadeIn(graphic, delay, duration, easing) {
26981
28195
  (_a = graphic === null || graphic === void 0 ? void 0 : graphic.animates) === null || _a === void 0 ? void 0 : _a.forEach(a => a.stop('end'));
26982
28196
  const fillOpacityConfig = (_c = (_b = graphic.attribute) === null || _b === void 0 ? void 0 : _b.fillOpacity) !== null && _c !== void 0 ? _c : 1;
26983
28197
  const strokeOpacityConfig = (_e = (_d = graphic.attribute) === null || _d === void 0 ? void 0 : _d.strokeOpacity) !== null && _e !== void 0 ? _e : 1;
26984
- graphic.setAttributes({
28198
+ commitUpdateAnimationTarget(graphic, {
28199
+ fillOpacity: fillOpacityConfig,
28200
+ strokeOpacity: strokeOpacityConfig
28201
+ }, {
26985
28202
  fillOpacity: 0,
26986
28203
  strokeOpacity: 0
26987
28204
  });
@@ -27011,7 +28228,10 @@ function graphicFadeOut(graphic, delay, duration, easing) {
27011
28228
  if (!graphic) {
27012
28229
  return;
27013
28230
  }
27014
- graphic.setAttributes({
28231
+ commitUpdateAnimationTarget(graphic, {
28232
+ fillOpacity: 0,
28233
+ strokeOpacity: 0
28234
+ }, {
27015
28235
  fillOpacity: (_b = (_a = graphic.attribute) === null || _a === void 0 ? void 0 : _a.fillOpacity) !== null && _b !== void 0 ? _b : 1,
27016
28236
  strokeOpacity: (_d = (_c = graphic.attribute) === null || _c === void 0 ? void 0 : _c.strokeOpacity) !== null && _d !== void 0 ? _d : 1
27017
28237
  });
@@ -27040,7 +28260,7 @@ function commonLineClipIn(line, label, duration, delay, easing) {
27040
28260
  const endSymbolDuration = 0.1 * duration;
27041
28261
  const labelDuration = 0.1 * duration;
27042
28262
  graphicFadeIn(line.startSymbol, delay, startSymbolDuration, easing);
27043
- line.lines.forEach(line => line.setAttribute('clipRange', 0));
28263
+ line.lines.forEach(line => commitUpdateAnimationTarget(line, { clipRange: 1 }, { clipRange: 0 }));
27044
28264
  line.lines.forEach((l, index) => {
27045
28265
  const stepDuration = lineDuration / line.lines.length;
27046
28266
  l.animate()
@@ -27123,7 +28343,7 @@ function pointCallIn(itemLine, decorativeLine, item, duration, delay, easing) {
27123
28343
  const endSymbolDuration = 0.1 * duration;
27124
28344
  const labelDuration = 0.1 * duration;
27125
28345
  graphicFadeIn(itemLine.startSymbol, delay, startSymbolDuration, easing);
27126
- itemLine.lines.forEach(line => line.setAttribute('clipRange', 0));
28346
+ itemLine.lines.forEach(line => commitUpdateAnimationTarget(line, { clipRange: 1 }, { clipRange: 0 }));
27127
28347
  itemLine.lines.forEach((l, index) => {
27128
28348
  const stepDuration = lineDuration / itemLine.lines.length;
27129
28349
  l.animate()
@@ -29470,8 +30690,10 @@ class DiscreteLegend extends LegendBase {
29470
30690
  ? this.attribute.item.width
29471
30691
  : innerGroupWidth + parsedPadding[1] + parsedPadding[3];
29472
30692
  const itemGroupHeight = this._itemHeightByUser || innerGroupHeight + parsedPadding[0] + parsedPadding[2];
29473
- itemGroup.attribute.width = itemGroupWidth;
29474
- itemGroup.attribute.height = itemGroupHeight;
30693
+ itemGroup.setAttributes({
30694
+ width: itemGroupWidth,
30695
+ height: itemGroupHeight
30696
+ });
29475
30697
  focusShape && focusShape.setAttribute('visible', false);
29476
30698
  innerGroup.translateTo(-innerGroupBounds.x1 + parsedPadding[3], -innerGroupBounds.y1 + parsedPadding[0]);
29477
30699
  return itemGroup;
@@ -29622,9 +30844,9 @@ class DiscreteLegend extends LegendBase {
29622
30844
  }
29623
30845
  if (!this._itemContext.isScrollbar) {
29624
30846
  if (animation) {
29625
- this._itemsContainer
29626
- .animate()
29627
- .to({ [channel]: -(newPage - 1) * pageSize }, animationDuration, animationEasing);
30847
+ const attrs = { [channel]: -(newPage - 1) * pageSize };
30848
+ commitUpdateAnimationTarget(this._itemsContainer, attrs);
30849
+ this._itemsContainer.animate().to(attrs, animationDuration, animationEasing);
29628
30850
  }
29629
30851
  else {
29630
30852
  this._itemsContainer.setAttribute(channel, -(newPage - 1) * pageSize);
@@ -29642,7 +30864,9 @@ class DiscreteLegend extends LegendBase {
29642
30864
  const startOffset = containerSize * start;
29643
30865
  this.updateScrollMask();
29644
30866
  if (animation) {
29645
- this._itemsContainer.animate().to({ [channel]: -startOffset }, animationDuration, animationEasing);
30867
+ const attrs = { [channel]: -startOffset };
30868
+ commitUpdateAnimationTarget(this._itemsContainer, attrs);
30869
+ this._itemsContainer.animate().to(attrs, animationDuration, animationEasing);
29646
30870
  }
29647
30871
  else {
29648
30872
  this._itemsContainer.setAttribute(channel, -startOffset);
@@ -31455,9 +32679,11 @@ class Title extends AbstractComponent {
31455
32679
  totalHeight = maxHeight;
31456
32680
  }
31457
32681
  }
31458
- group.attribute.width = totalWidth;
31459
- group.attribute.height = totalHeight;
31460
- group.attribute.boundsPadding = parsedPadding;
32682
+ group.setAttributes({
32683
+ width: totalWidth,
32684
+ height: totalHeight,
32685
+ boundsPadding: parsedPadding
32686
+ });
31461
32687
  if (this._mainTitle) {
31462
32688
  if (isValid(align) || isValid(textStyle.align)) {
31463
32689
  const mainTitleAlign = textStyle.align ? textStyle.align : align;
@@ -33595,6 +34821,7 @@ class Timeline extends AbstractComponent {
33595
34821
  setActive(symbolGroup, activeSymbolStyle);
33596
34822
  }
33597
34823
  appearAnimate(animateConfig) {
34824
+ var _a;
33598
34825
  const { duration = 1000, easing = 'quadOut' } = animateConfig;
33599
34826
  const { activeLabelStyle, activeSymbolStyle } = this.attribute;
33600
34827
  const percent = duration / 1000;
@@ -33605,30 +34832,33 @@ class Timeline extends AbstractComponent {
33605
34832
  const symbolDelay = percent * 100;
33606
34833
  const symbolNormalDelay = percent * 600;
33607
34834
  if (this._line) {
33608
- this._line.setAttributes({ clipRange: 0 });
34835
+ commitUpdateAnimationTarget(this._line, { clipRange: 1 }, { clipRange: 0 });
33609
34836
  this._line.animate().to({ clipRange: 1 }, lineDuration, easing);
33610
34837
  }
33611
34838
  if (this._activeLine) {
33612
- this._activeLine.setAttributes({ opacity: 0 });
34839
+ const opacity = (_a = this._activeLine.attribute.opacity) !== null && _a !== void 0 ? _a : 1;
34840
+ commitUpdateAnimationTarget(this._activeLine, { opacity }, { opacity: 0 });
33613
34841
  this._activeLine
33614
34842
  .animate()
33615
34843
  .wait(500)
33616
- .to({ opacity: 1 }, activeLineDuration, easing);
34844
+ .to({ opacity }, activeLineDuration, easing);
33617
34845
  }
33618
34846
  if (this._symbolGroup) {
33619
34847
  const size = this._symbolGroup.count - 1;
33620
34848
  const delay = percent * (size === 1 ? 0 : (500 - 100) / (size - 1));
33621
34849
  const delayNormal = percent * (size === 1 ? 0 : (400 - 160) / (size - 1));
33622
34850
  this._symbolGroup.forEachChildren((symbol, i) => {
34851
+ var _a;
33623
34852
  const originAttrs = {};
33624
34853
  Object.keys(activeSymbolStyle).forEach(k => {
33625
34854
  originAttrs[k] = symbol.attribute[k];
33626
34855
  });
33627
- symbol.setAttributes({ opacity: 0 });
34856
+ const opacity = (_a = symbol.attribute.opacity) !== null && _a !== void 0 ? _a : 1;
34857
+ commitUpdateAnimationTarget(symbol, { opacity }, { opacity: 0 });
33628
34858
  symbol
33629
34859
  .animate()
33630
34860
  .wait(symbolDelay + delay * i)
33631
- .to({ opacity: 1 }, perSymbolDuration, easing);
34861
+ .to({ opacity }, perSymbolDuration, easing);
33632
34862
  symbol
33633
34863
  .animate()
33634
34864
  .wait(symbolNormalDelay + delayNormal * i)
@@ -33641,15 +34871,17 @@ class Timeline extends AbstractComponent {
33641
34871
  const delay = percent * (size === 1 ? 0 : (500 - 100) / (size - 1));
33642
34872
  const delayNormal = percent * (size === 1 ? 0 : (400 - 160) / (size - 1));
33643
34873
  this._labelGroup.forEachChildren((label, i) => {
34874
+ var _a;
33644
34875
  const originAttrs = {};
33645
34876
  Object.keys(activeLabelStyle).forEach(k => {
33646
34877
  originAttrs[k] = label.attribute[k];
33647
34878
  });
33648
- label.setAttributes({ opacity: 0 });
34879
+ const opacity = (_a = label.attribute.opacity) !== null && _a !== void 0 ? _a : 1;
34880
+ commitUpdateAnimationTarget(label, { opacity }, { opacity: 0 });
33649
34881
  label
33650
34882
  .animate()
33651
34883
  .wait(symbolDelay + delay * i)
33652
- .to({ opacity: 1 }, perSymbolDuration, easing);
34884
+ .to({ opacity }, perSymbolDuration, easing);
33653
34885
  label
33654
34886
  .animate()
33655
34887
  .wait(symbolNormalDelay + delayNormal * i)
@@ -33689,6 +34921,7 @@ class Timeline extends AbstractComponent {
33689
34921
  const nextClipRange = flag > 0 ? this._timesPercent[i] || 1 : this._timesPercent[i - 1] || 0;
33690
34922
  if (animation) {
33691
34923
  const { duration = 1000, easing = 'quadOut' } = animateConfig;
34924
+ commitUpdateAnimationTarget(this, { clipRange: nextClipRange }, { clipRange });
33692
34925
  this.animate().to({ clipRange: nextClipRange }, duration, easing);
33693
34926
  }
33694
34927
  else {
@@ -35535,6 +36768,6 @@ TableSeriesNumber.defaultAttributes = {
35535
36768
  select: true
35536
36769
  };
35537
36770
 
35538
- const version = "1.1.0-alpha.2";
36771
+ const version = "1.1.0-alpha.20";
35539
36772
 
35540
36773
  export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IDataZoomEvent, IDataZoomInteractiveEvent, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PolygonSectorCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SeriesNumberCellStateValue, SeriesNumberEvent, SizeContinuousLegend, Slider, StoryLabelItem, Switch, SymbolLabel, TableSeriesNumber, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, WeatherBox, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, hasOverlap, htmlAttributeTransform, initTextMeasure, installPoptipToApp, installScrollbarToApp, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, loadScrollbar, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };