@visactor/vrender 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.
package/dist/index.js CHANGED
@@ -8214,6 +8214,12 @@
8214
8214
  function getStageStatePerfMonitor(stage) {
8215
8215
  if (stage) return stage[STAGE_PERF_MONITOR];
8216
8216
  }
8217
+ function getActiveStageStatePerfMonitor(stage) {
8218
+ var _a;
8219
+ if (!stage) return;
8220
+ const current = getStageStatePerfMonitor(stage);
8221
+ return current || (!0 === (null === (_a = stage.statePerfConfig) || void 0 === _a ? void 0 : _a.enabled) ? ensureStageStatePerfMonitor(stage) : void 0);
8222
+ }
8217
8223
 
8218
8224
  function isPlainObject$1(value) {
8219
8225
  return null != value && "object" == typeof value && !Array.isArray(value);
@@ -8309,7 +8315,7 @@
8309
8315
  }
8310
8316
  invalidateResolverCache() {
8311
8317
  var _a, _b;
8312
- 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");
8318
+ 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");
8313
8319
  }
8314
8320
  hasState(stateName) {
8315
8321
  return !!this._activeStates.length && (null == stateName || this._activeStates.includes(stateName));
@@ -8356,7 +8362,7 @@
8356
8362
  }
8357
8363
  recomputePatch(effectiveStates) {
8358
8364
  var _a;
8359
- const perfMonitor = getStageStatePerfMonitor(null === (_a = this.graphic) || void 0 === _a ? void 0 : _a.stage),
8365
+ const perfMonitor = getActiveStageStatePerfMonitor(null === (_a = this.graphic) || void 0 === _a ? void 0 : _a.stage),
8360
8366
  patchStart = perfMonitor ? performance.now() : 0;
8361
8367
  let resolverCost = 0;
8362
8368
  const cacheKey = effectiveStates.join(","),
@@ -8604,32 +8610,6 @@
8604
8610
  }
8605
8611
  }), resolvedAttrs;
8606
8612
  }
8607
- resolveWithCompiled(normalAttrs, compiledDefinitions, stateProxy, effectiveStates, resolvedPatch) {
8608
- var _a, _b;
8609
- const mergeMode = null !== (_a = this.options.mergeMode) && void 0 !== _a ? _a : "shallow",
8610
- resolvedAttrs = null !== (_b = cloneValue(resolvedPatch)) && void 0 !== _b ? _b : {};
8611
- return effectiveStates.forEach(stateName => {
8612
- const proxyPatch = null == stateProxy ? void 0 : stateProxy(stateName, effectiveStates);
8613
- null != proxyPatch && Object.keys(proxyPatch).forEach(key => {
8614
- const nextValue = proxyPatch[key],
8615
- hasCompiledDefinition = compiledDefinitions.has(stateName);
8616
- if ("deep" === mergeMode && isPlainObject(nextValue) && (isPlainObject(resolvedAttrs[key]) || !hasCompiledDefinition && isPlainObject(normalAttrs[key]))) {
8617
- const baseValue = isPlainObject(resolvedAttrs[key]) ? resolvedAttrs[key] : isPlainObject(normalAttrs[key]) ? normalAttrs[key] : {};
8618
- resolvedAttrs[key] = deepMerge(baseValue, nextValue);
8619
- } else resolvedAttrs[key] = cloneValue(nextValue);
8620
- });
8621
- }), resolvedAttrs;
8622
- }
8623
- computeNormalAttrsBackup(normalAttrs, targetAttrs, finalAttribute) {
8624
- const nextNormalAttrs = {},
8625
- nextTargetAttrs = Object.assign({}, targetAttrs);
8626
- for (const key in targetAttrs) Object.prototype.hasOwnProperty.call(targetAttrs, key) && (nextNormalAttrs[key] = cloneValue(normalAttrs && key in normalAttrs ? normalAttrs[key] : finalAttribute[key]));
8627
- if (normalAttrs) for (const key in normalAttrs) Object.prototype.hasOwnProperty.call(normalAttrs, key) && !(key in targetAttrs) && (nextTargetAttrs[key] = cloneValue(normalAttrs[key]));
8628
- return {
8629
- attrs: nextTargetAttrs,
8630
- normalAttrs: nextNormalAttrs
8631
- };
8632
- }
8633
8613
  }
8634
8614
 
8635
8615
  function hasOwnKeys(value) {
@@ -8651,11 +8631,23 @@
8651
8631
  if (!hasAnimation) return plan;
8652
8632
  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)),
8653
8633
  isClear = !0 === options.isClear,
8654
- getDefaultAttribute = options.getDefaultAttribute;
8634
+ getDefaultAttribute = options.getDefaultAttribute,
8635
+ shouldSkipDefaultAttribute = options.shouldSkipDefaultAttribute,
8636
+ assignTransitionAttr = (key, value) => {
8637
+ if (noWorkAnimateAttr[key]) return plan.jumpAttrs[key] = value, void (plan.noAnimateAttrs[key] = value);
8638
+ if (isClear && void 0 === value) {
8639
+ if (null == shouldSkipDefaultAttribute ? void 0 : shouldSkipDefaultAttribute(key, targetAttrs)) return;
8640
+ plan.animateAttrs[key] = getDefaultAttribute ? getDefaultAttribute(key) : value;
8641
+ } else plan.animateAttrs[key] = value;
8642
+ };
8655
8643
  for (const key in targetAttrs) {
8656
8644
  if (!Object.prototype.hasOwnProperty.call(targetAttrs, key)) continue;
8657
- const value = targetAttrs[key];
8658
- noWorkAnimateAttr[key] ? (plan.jumpAttrs[key] = value, plan.noAnimateAttrs[key] = value) : plan.animateAttrs[key] = isClear && void 0 === value && getDefaultAttribute ? getDefaultAttribute(key) : value;
8645
+ assignTransitionAttr(key, targetAttrs[key]);
8646
+ }
8647
+ const extraAnimateAttrs = options.extraAnimateAttrs;
8648
+ if (extraAnimateAttrs) for (const key in extraAnimateAttrs) {
8649
+ const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetAttrs, key);
8650
+ !Object.prototype.hasOwnProperty.call(extraAnimateAttrs, key) || hasTargetAttr && void 0 !== targetAttrs[key] || assignTransitionAttr(key, extraAnimateAttrs[key]);
8659
8651
  }
8660
8652
  return plan;
8661
8653
  }
@@ -8682,12 +8674,14 @@
8682
8674
  }), plan;
8683
8675
  }
8684
8676
  applyClearTransition(graphic, targetAttrs, hasAnimation, stateNames, options = {}) {
8685
- var _a, _b;
8677
+ var _a, _b, _c, _d;
8686
8678
  const plan = this.analyzeTransition({}, targetAttrs, stateNames, hasAnimation, {
8687
8679
  noWorkAnimateAttr: null === (_a = graphic.getNoWorkAnimateAttr) || void 0 === _a ? void 0 : _a.call(graphic),
8688
8680
  isClear: !0,
8689
8681
  getDefaultAttribute: null === (_b = graphic.getDefaultAttribute) || void 0 === _b ? void 0 : _b.bind(graphic),
8690
- animateConfig: options.animateConfig
8682
+ shouldSkipDefaultAttribute: null !== (_c = options.shouldSkipDefaultAttribute) && void 0 !== _c ? _c : null === (_d = graphic.shouldSkipStateTransitionDefaultAttribute) || void 0 === _d ? void 0 : _d.bind(graphic),
8683
+ animateConfig: options.animateConfig,
8684
+ extraAnimateAttrs: options.extraAnimateAttrs
8691
8685
  });
8692
8686
  return this.applyTransition(graphic, plan, hasAnimation, options);
8693
8687
  }
@@ -8750,7 +8744,7 @@
8750
8744
  }
8751
8745
  function ensureSharedStateScopeFresh(scope) {
8752
8746
  var _a;
8753
- 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;
8747
+ 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;
8754
8748
  }
8755
8749
  function collectSharedStateScopeChain(scope) {
8756
8750
  const chain = [];
@@ -8761,7 +8755,7 @@
8761
8755
 
8762
8756
  function scheduleStageSharedStateRefresh(stage) {
8763
8757
  var _a;
8764
- stage && "released" !== stage.releaseStatus && (null === (_a = getStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordRefresh("renderScheduled"), stage.renderNextFrame());
8758
+ stage && "released" !== stage.releaseStatus && (null === (_a = getActiveStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordRefresh("renderScheduled"), stage.renderNextFrame());
8765
8759
  }
8766
8760
  function enqueueGraphicSharedStateRefresh(stage, graphic) {
8767
8761
  var _a;
@@ -8769,7 +8763,7 @@
8769
8763
  const pending = null !== (_a = stage._pendingSharedStateRefreshGraphics) && void 0 !== _a ? _a : stage._pendingSharedStateRefreshGraphics = new Set();
8770
8764
  if (!pending.has(graphic)) {
8771
8765
  pending.add(graphic);
8772
- const perfMonitor = getStageStatePerfMonitor(stage);
8766
+ const perfMonitor = getActiveStageStatePerfMonitor(stage);
8773
8767
  null == perfMonitor || perfMonitor.recordRefresh("queuedGraphics"), null == perfMonitor || perfMonitor.recordAllocation("refreshQueuePushes");
8774
8768
  }
8775
8769
  }
@@ -8784,12 +8778,13 @@
8784
8778
  function flushStageSharedStateRefresh(stage) {
8785
8779
  const pending = stage._pendingSharedStateRefreshGraphics;
8786
8780
  if (!pending || !pending.size) return;
8787
- const perfMonitor = getStageStatePerfMonitor(stage),
8781
+ const perfMonitor = getActiveStageStatePerfMonitor(stage),
8788
8782
  start = perfMonitor ? performance.now() : 0,
8789
8783
  graphics = Array.from(pending.values());
8790
8784
  pending.clear(), null == perfMonitor || perfMonitor.recordRefresh("flushedGraphics", graphics.length), graphics.forEach(graphic => {
8791
8785
  if ("released" === graphic.releaseStatus) return;
8792
8786
  if (graphic.stage !== stage) return;
8787
+ if (!graphic.sharedStateDirty) return;
8793
8788
  const refresh = graphic.refreshSharedStateBeforeRender;
8794
8789
  "function" == typeof refresh && (refresh.call(graphic), null == perfMonitor || perfMonitor.incrementCounter("sharedRefreshCommits"));
8795
8790
  }), perfMonitor && (perfMonitor.recordCost("sharedRefresh", performance.now() - start), perfMonitor.recordEvent("shared-refresh-flush", {
@@ -8806,9 +8801,12 @@
8806
8801
  tempConstantScaleXYKey = ["scaleX", "scaleY"],
8807
8802
  tempConstantAngleKey = ["angle"],
8808
8803
  builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
8809
- point = new Point();
8804
+ FULL_STATE_DEFINITION_KEYS = new Set(["name", "patch", "priority", "exclude", "suppress", "resolver", "declaredAffectedKeys"]),
8805
+ point = new Point(),
8806
+ EMPTY_STATE_NAMES = [],
8807
+ BROAD_UPDATE_CATEGORY = UpdateCategory.PAINT | UpdateCategory.SHAPE | UpdateCategory.BOUNDS | UpdateCategory.TRANSFORM | UpdateCategory.LAYOUT;
8810
8808
  function isPlainObjectValue(value) {
8811
- return "object" == typeof value && null != value && !isArray$1(value);
8809
+ return "object" == typeof value && null != value && !Array.isArray(value);
8812
8810
  }
8813
8811
  function cloneAttributeValue(value) {
8814
8812
  if (!isPlainObjectValue(value)) return value;
@@ -8819,12 +8817,6 @@
8819
8817
  clone[key] = isPlainObjectValue(nextValue) ? cloneAttributeValue(nextValue) : nextValue;
8820
8818
  }), clone;
8821
8819
  }
8822
- function cloneSimpleAttributeRecord(value) {
8823
- return isPlainObjectValue(value) ? Object.assign({}, value) : value;
8824
- }
8825
- function shouldUseSimpleAttributeFastPath(value) {
8826
- return !!isPlainObjectValue(value) && !Object.keys(value).some(key => isPlainObjectValue(value[key]));
8827
- }
8828
8820
  function cloneAttributeSurface(value) {
8829
8821
  if (!isPlainObjectValue(value)) return value;
8830
8822
  const source = value,
@@ -8834,6 +8826,9 @@
8834
8826
  clone[key] = isPlainObjectValue(nextValue) ? Object.assign({}, nextValue) : nextValue;
8835
8827
  }), clone;
8836
8828
  }
8829
+ function areAttributeValuesEqual(left, right) {
8830
+ return left === right || !!(isPlainObjectValue(left) || isPlainObjectValue(right) || Array.isArray(left) || Array.isArray(right)) && isEqual(left, right);
8831
+ }
8837
8832
  function deepMergeAttributeValue(base, value) {
8838
8833
  var _a;
8839
8834
  const result = null !== (_a = cloneAttributeValue(base)) && void 0 !== _a ? _a : {};
@@ -8896,18 +8891,24 @@
8896
8891
  get globalTransMatrix() {
8897
8892
  return this.tryUpdateGlobalTransMatrix(!0);
8898
8893
  }
8894
+ get baseAttributes() {
8895
+ var _a;
8896
+ return null !== (_a = this._baseAttributes) && void 0 !== _a ? _a : this.attribute;
8897
+ }
8898
+ set baseAttributes(value) {
8899
+ value !== this.attribute ? this._baseAttributes = value : this._baseAttributes = void 0;
8900
+ }
8899
8901
  constructor(params = {}) {
8900
8902
  var _a;
8901
- super(), this.resolverEpoch = 0, this._AABBBounds = new AABBBounds(), this._updateTag = exports.UpdateTag.INIT;
8902
- const useSimpleAttributeFastPath = shouldUseSimpleAttributeFastPath(params),
8903
- initialBaseAttributes = useSimpleAttributeFastPath ? cloneSimpleAttributeRecord(params) : cloneAttributeValue(params);
8904
- 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);
8903
+ super(), this._AABBBounds = new AABBBounds(), this._updateTag = exports.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);
8905
8904
  }
8906
8905
  get normalAttrs() {
8907
8906
  return this.baseAttributes;
8908
8907
  }
8909
- set normalAttrs(value) {
8910
- this._deprecatedNormalAttrsView = null != value ? value : void 0;
8908
+ set normalAttrs(_value) {}
8909
+ getBaseAttributesStorage() {
8910
+ var _a;
8911
+ return null !== (_a = this._baseAttributes) && void 0 !== _a ? _a : this.attribute;
8911
8912
  }
8912
8913
  getGraphicService() {
8913
8914
  var _a, _b;
@@ -8938,10 +8939,18 @@
8938
8939
  const nextScope = this.resolveBoundSharedStateScope();
8939
8940
  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);
8940
8941
  }
8941
- syncSharedStateActiveRegistrations() {
8942
+ syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
8942
8943
  var _a, _b;
8943
- const nextScopes = (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && this.boundSharedStateScope ? new Set(collectSharedStateScopeChain(this.boundSharedStateScope)) : new Set();
8944
- (null !== (_b = this.registeredActiveScopes) && void 0 !== _b ? _b : new Set()).forEach(scope => {
8944
+ 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);
8945
+ }
8946
+ syncSharedStateActiveRegistrations() {
8947
+ var _a;
8948
+ const previousScopes = this.registeredActiveScopes;
8949
+ if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach(scope => {
8950
+ scope.subtreeActiveDescendants.delete(this);
8951
+ }), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
8952
+ const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
8953
+ null == previousScopes || previousScopes.forEach(scope => {
8945
8954
  nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
8946
8955
  }), nextScopes.forEach(scope => {
8947
8956
  scope.subtreeActiveDescendants.add(this);
@@ -8957,15 +8966,13 @@
8957
8966
  this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this), scheduleStageSharedStateRefresh(this.stage);
8958
8967
  }
8959
8968
  onParentSharedStateTreeChanged(stage, layer) {
8960
- this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingFromTree() : this.setStage(stage, layer);
8969
+ this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
8961
8970
  }
8962
8971
  refreshSharedStateBeforeRender() {
8963
8972
  var _a;
8964
8973
  (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({
8965
8974
  type: exports.AttributeUpdateType.STATE
8966
- }), this._emitCustomEvent("afterStateUpdate", {
8967
- type: exports.AttributeUpdateType.STATE
8968
- }), this.sharedStateDirty = !1) : this.sharedStateDirty = !1;
8975
+ }), this.emitStateUpdateEvent(), this.sharedStateDirty = !1) : this.sharedStateDirty = !1;
8969
8976
  }
8970
8977
  getLocalStatesVersion() {
8971
8978
  var _a, _b;
@@ -9015,15 +9022,13 @@
9015
9022
  };
9016
9023
  }
9017
9024
  recomputeCurrentStatePatch() {
9018
- var _a, _b, _c, _d;
9025
+ var _a, _b;
9019
9026
  if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length)) return this.effectiveStates = [], this.resolvedStatePatch = void 0, void this.syncSharedStateActiveRegistrations();
9020
- const stateResolveBaseAttrs = null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : this.attribute,
9021
- stateModel = this.createStateModel();
9022
- null === (_c = this.stateEngine) || void 0 === _c || _c.setResolveContext(this, stateResolveBaseAttrs);
9023
- const transition = stateModel.useStates(this.currentStates),
9024
- effectiveStates = null !== (_d = transition.effectiveStates) && void 0 !== _d ? _d : transition.states,
9027
+ const stateResolveBaseAttrs = this.getStateResolveBaseAttrs(),
9028
+ transition = this.createStateModel(stateResolveBaseAttrs).useStates(this.currentStates),
9029
+ effectiveStates = null !== (_b = transition.effectiveStates) && void 0 !== _b ? _b : transition.states,
9025
9030
  resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
9026
- this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs), this.syncSharedStateActiveRegistrations();
9031
+ this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.syncSharedStateActiveRegistrations();
9027
9032
  }
9028
9033
  buildStaticAttributeSnapshot() {
9029
9034
  var _a;
@@ -9035,6 +9040,23 @@
9035
9040
  "deep" === this.stateMergeMode && isPlainObjectValue(previousValue) && isPlainObjectValue(nextValue) ? snapshot[key] = deepMergeAttributeValue(previousValue, nextValue) : snapshot[key] = cloneAttributeValue(nextValue);
9036
9041
  }), snapshot) : snapshot;
9037
9042
  }
9043
+ buildRemovedStateAnimationAttrs(targetStateAttrs, previousResolvedStatePatch) {
9044
+ const extraAttrs = {};
9045
+ if (!previousResolvedStatePatch) return extraAttrs;
9046
+ const snapshot = this.buildStaticAttributeSnapshot(),
9047
+ staticTargetAttrs = snapshot;
9048
+ return Object.keys(previousResolvedStatePatch).forEach(key => {
9049
+ const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetStateAttrs, key);
9050
+ if (hasTargetAttr && void 0 !== targetStateAttrs[key]) return;
9051
+ const assignFallbackAttr = value => {
9052
+ void 0 === value && this.shouldSkipStateTransitionDefaultAttribute(key, staticTargetAttrs) || (extraAttrs[key] = void 0 === value ? value : cloneAttributeValue(value));
9053
+ };
9054
+ if (hasTargetAttr) assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));else if (Object.prototype.hasOwnProperty.call(snapshot, key)) {
9055
+ const snapshotValue = snapshot[key];
9056
+ assignFallbackAttr(void 0 === snapshotValue ? this.getStateTransitionDefaultAttribute(key, staticTargetAttrs) : snapshotValue);
9057
+ } else assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));
9058
+ }), extraAttrs;
9059
+ }
9038
9060
  syncObjectToSnapshot(target, snapshot) {
9039
9061
  const delta = new Map();
9040
9062
  return new Set([...Object.keys(target), ...Object.keys(snapshot)]).forEach(key => {
@@ -9045,16 +9067,17 @@
9045
9067
  next: void 0
9046
9068
  }), delete target[key]));
9047
9069
  const nextValue = snapshot[key];
9048
- isEqual(previousValue, nextValue) || (delta.set(key, {
9070
+ areAttributeValuesEqual(previousValue, nextValue) || (delta.set(key, {
9049
9071
  prev: previousValue,
9050
9072
  next: nextValue
9051
9073
  }), target[key] = cloneAttributeValue(nextValue));
9052
9074
  }), delta;
9053
9075
  }
9054
9076
  _syncAttribute() {
9077
+ this.attribute === this.baseAttributes && this.resolvedStatePatch && this.detachAttributeFromBaseAttributes();
9055
9078
  const snapshot = this.buildStaticAttributeSnapshot(),
9056
9079
  delta = this.syncObjectToSnapshot(this.attribute, snapshot);
9057
- return this.valid = this.isValid(), delta;
9080
+ return this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, delta;
9058
9081
  }
9059
9082
  _syncFinalAttributeFromStaticTruth() {
9060
9083
  const target = this.finalAttribute;
@@ -9062,47 +9085,146 @@
9062
9085
  const snapshot = this.buildStaticAttributeSnapshot();
9063
9086
  this.syncObjectToSnapshot(target, snapshot);
9064
9087
  }
9065
- submitUpdateByDelta(delta, forceUpdateTag = !1) {
9088
+ mergeAttributeDeltaCategory(category, key, prev, next) {
9089
+ var _a;
9090
+ let nextCategory = "stroke" === key || "shadowBlur" === key ? classifyAttributeDelta(key, prev, next) : null !== (_a = ATTRIBUTE_CATEGORY[key]) && void 0 !== _a ? _a : UpdateCategory.PAINT;
9091
+ return nextCategory & UpdateCategory.PICK && (nextCategory |= UpdateCategory.BOUNDS), nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key) && (nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS), category | nextCategory;
9092
+ }
9093
+ submitUpdateByCategory(category, forceUpdateTag = !1) {
9066
9094
  var _a;
9067
9095
  if (forceUpdateTag) return this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), void this.addUpdateLayoutTag();
9096
+ if (category !== UpdateCategory.NONE) {
9097
+ const stage = this.stage;
9098
+ stage && (null === (_a = getActiveStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordCategory(category));
9099
+ }
9100
+ (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();
9101
+ }
9102
+ submitUpdateByDelta(delta, forceUpdateTag = !1) {
9068
9103
  let category = UpdateCategory.NONE;
9069
9104
  delta.forEach((entry, key) => {
9070
- let nextCategory = classifyAttributeDelta(key, entry.prev, entry.next);
9071
- nextCategory & UpdateCategory.PICK && (nextCategory |= UpdateCategory.BOUNDS), nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key) && (nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS), category |= nextCategory;
9072
- }), 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();
9105
+ category = this.mergeAttributeDeltaCategory(category, key, entry.prev, entry.next);
9106
+ }), this.submitUpdateByCategory(category, forceUpdateTag);
9107
+ }
9108
+ submitTouchedKeyUpdate(keys, forceUpdateTag = !1) {
9109
+ this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTags(keys));
9110
+ }
9111
+ submitTouchedUpdate(needsShapeAndBounds) {
9112
+ !this.updateShapeAndBoundsTagSetted() && needsShapeAndBounds ? this.addUpdateShapeAndBoundsTag() : this.addUpdateBoundTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag();
9073
9113
  }
9074
9114
  commitBaseAttributeMutation(forceUpdateTag = !1, context) {
9075
- var _a, _b;
9076
- (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());
9115
+ var _a, _b, _c;
9116
+ (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());
9077
9117
  const delta = this._syncAttribute();
9078
9118
  this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
9079
9119
  }
9120
+ canCommitBaseAttributesByTouchedKeys() {
9121
+ var _a, _b;
9122
+ 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());
9123
+ }
9124
+ detachAttributeFromBaseAttributes() {
9125
+ this.attribute === this.baseAttributes && (this._baseAttributes = this.attribute, this.attribute = cloneAttributeSurface(this.attribute));
9126
+ }
9127
+ commitInternalBaseAttributes(params, context) {
9128
+ params && Object.keys(params).length && (this.canCommitBaseAttributesByTouchedKeys() ? this.commitBaseAttributesByTouchedKeys(params, !1, context) : (this.detachAttributeFromBaseAttributes(), this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context)));
9129
+ }
9130
+ commitBaseAttributesByTouchedKeys(params, forceUpdateTag = !1, context) {
9131
+ const source = params,
9132
+ baseAttributes = this.getBaseAttributesStorage();
9133
+ let hasKeys = !1,
9134
+ needsShapeAndBounds = forceUpdateTag;
9135
+ for (const key in source) Object.prototype.hasOwnProperty.call(source, key) && (hasKeys = !0, baseAttributes[key] = source[key], !needsShapeAndBounds && this.needUpdateTag(key) && (needsShapeAndBounds = !0));
9136
+ hasKeys && (this.attribute = baseAttributes, this._baseAttributes = void 0, this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, this.submitTouchedUpdate(needsShapeAndBounds), this.onAttributeUpdate(context));
9137
+ }
9138
+ commitBaseAttributeBySingleKey(key, value, forceUpdateTag = !1, context) {
9139
+ 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);
9140
+ }
9080
9141
  applyBaseAttributes(params) {
9081
9142
  const keys = Object.keys(params);
9082
9143
  for (let i = 0; i < keys.length; i++) {
9083
9144
  const key = keys[i];
9084
- this.baseAttributes[key] = cloneAttributeValue(params[key]);
9145
+ this.getBaseAttributesStorage()[key] = params[key];
9085
9146
  }
9086
9147
  }
9148
+ applyAnimationTransientAttributes(params, forceUpdateTag = !1, context) {
9149
+ const source = params;
9150
+ let target,
9151
+ needsShapeAndBounds = forceUpdateTag;
9152
+ 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));
9153
+ target && (this.attributeMayContainTransientAttrs = !0, this.valid = this.isValid(), this.submitTouchedUpdate(needsShapeAndBounds), this.onAttributeUpdate(context));
9154
+ }
9087
9155
  applyTransientAttributes(params, forceUpdateTag = !1, context) {
9156
+ this.detachAttributeFromBaseAttributes();
9088
9157
  const delta = new Map(),
9089
9158
  keys = Object.keys(params);
9090
9159
  for (let i = 0; i < keys.length; i++) {
9091
9160
  const key = keys[i],
9092
9161
  previousValue = this.attribute[key],
9093
9162
  nextValue = params[key];
9094
- isEqual(previousValue, nextValue) || (delta.set(key, {
9163
+ areAttributeValuesEqual(previousValue, nextValue) || (delta.set(key, {
9095
9164
  prev: previousValue,
9096
9165
  next: nextValue
9097
- }), this.attribute[key] = cloneAttributeValue(nextValue));
9166
+ }), this.attribute[key] = nextValue);
9098
9167
  }
9099
- this.valid = this.isValid(), this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
9168
+ delta.size && (this.attributeMayContainTransientAttrs = !0), this.valid = this.isValid(), this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
9100
9169
  }
9101
9170
  _restoreAttributeFromStaticTruth(context) {
9102
9171
  this._syncFinalAttributeFromStaticTruth();
9103
9172
  const delta = this._syncAttribute();
9104
9173
  this.submitUpdateByDelta(delta), this.onAttributeUpdate(context);
9105
9174
  }
9175
+ collectStatePatchDeltaKeys(previousPatch, nextPatch) {
9176
+ const keys = previousPatch ? Object.keys(previousPatch) : [];
9177
+ if (!nextPatch) return keys;
9178
+ for (const key in nextPatch) Object.prototype.hasOwnProperty.call(nextPatch, key) && !Object.prototype.hasOwnProperty.call(null != previousPatch ? previousPatch : {}, key) && keys.push(key);
9179
+ return keys;
9180
+ }
9181
+ getStaticTruthValueForStateKey(key, nextPatch) {
9182
+ var _a;
9183
+ const baseAttributes = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : {},
9184
+ patch = nextPatch;
9185
+ if (patch && Object.prototype.hasOwnProperty.call(patch, key)) {
9186
+ const patchValue = patch[key],
9187
+ baseValue = baseAttributes[key];
9188
+ return "deep" === this.stateMergeMode && isPlainObjectValue(baseValue) && isPlainObjectValue(patchValue) ? {
9189
+ hasValue: !0,
9190
+ value: deepMergeAttributeValue(baseValue, patchValue)
9191
+ } : {
9192
+ hasValue: !0,
9193
+ value: patchValue
9194
+ };
9195
+ }
9196
+ return Object.prototype.hasOwnProperty.call(baseAttributes, key) ? {
9197
+ hasValue: !0,
9198
+ value: baseAttributes[key]
9199
+ } : {
9200
+ hasValue: !1,
9201
+ value: void 0
9202
+ };
9203
+ }
9204
+ syncStatePatchDeltaToTarget(target, keys, nextPatch, collectCategory = !1) {
9205
+ let category = UpdateCategory.NONE;
9206
+ for (let i = 0; i < keys.length; i++) {
9207
+ const key = keys[i],
9208
+ previousValue = target[key],
9209
+ next = this.getStaticTruthValueForStateKey(key, nextPatch);
9210
+ if (!next.hasValue) {
9211
+ Object.prototype.hasOwnProperty.call(target, key) && (delete target[key], collectCategory && (category = this.mergeAttributeDeltaCategory(category, key, previousValue, void 0)));
9212
+ continue;
9213
+ }
9214
+ if (areAttributeValuesEqual(previousValue, next.value)) continue;
9215
+ const nextValue = cloneAttributeValue(next.value);
9216
+ target[key] = nextValue, collectCategory && (category = this.mergeAttributeDeltaCategory(category, key, previousValue, nextValue));
9217
+ }
9218
+ return category;
9219
+ }
9220
+ restoreAttributeFromStatePatchDelta(previousPatch, nextPatch, context) {
9221
+ this.detachAttributeFromBaseAttributes();
9222
+ const keys = this.collectStatePatchDeltaKeys(previousPatch, nextPatch),
9223
+ finalAttribute = this.finalAttribute;
9224
+ finalAttribute && this.syncStatePatchDeltaToTarget(finalAttribute, keys, nextPatch, !1);
9225
+ const category = this.syncStatePatchDeltaToTarget(this.attribute, keys, nextPatch, !0);
9226
+ this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, this.submitUpdateByCategory(category), this.onAttributeUpdate(context);
9227
+ }
9106
9228
  setMode(mode) {
9107
9229
  "3d" === mode ? this.set3dMode() : this.set2dMode();
9108
9230
  }
@@ -9125,7 +9247,7 @@
9125
9247
  return point;
9126
9248
  }
9127
9249
  onAnimateBind(animate) {
9128
- this._emitCustomEvent("animate-bind", animate);
9250
+ this.detachAttributeFromBaseAttributes(), this._emitCustomEvent("animate-bind", animate);
9129
9251
  }
9130
9252
  visitTrackedAnimates(cb) {
9131
9253
  const hook = this.forEachTrackedAnimate;
@@ -9138,8 +9260,22 @@
9138
9260
  const getTrackedAnimates = this.getTrackedAnimates;
9139
9261
  return "function" == typeof getTrackedAnimates ? getTrackedAnimates.call(this).size > 0 : !!(null === (_a = this.animates) || void 0 === _a ? void 0 : _a.size);
9140
9262
  }
9263
+ mayHaveTrackedAnimates() {
9264
+ var _a;
9265
+ return !!(null === (_a = this.animates) || void 0 === _a ? void 0 : _a.size) || !!this._animationStateManager;
9266
+ }
9141
9267
  tryUpdateAABBBounds() {
9268
+ if (!(this.shadowRoot || this._updateTag & exports.UpdateTag.UPDATE_BOUNDS)) return this._AABBBounds;
9142
9269
  const full = "imprecise" === this.attribute.boundsMode;
9270
+ if (!this.shadowRoot) {
9271
+ const graphicService = this.getGraphicService(),
9272
+ graphicTheme = this.getGraphicTheme();
9273
+ if (!graphicService.validCheck(this.attribute, graphicTheme, this._AABBBounds, this)) return this._AABBBounds;
9274
+ if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
9275
+ graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
9276
+ const bounds = this.doUpdateAABBBounds(full, graphicTheme);
9277
+ return graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
9278
+ }
9143
9279
  if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
9144
9280
  if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
9145
9281
  this.getGraphicService().beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
@@ -9212,14 +9348,14 @@
9212
9348
  const _parsedPath = new CustomSymbolClass(symbolType, cache);
9213
9349
  return Graphic.userSymbolMap[symbolType] = _parsedPath, _parsedPath;
9214
9350
  }
9215
- doUpdateAABBBounds(full) {
9351
+ doUpdateAABBBounds(full, graphicTheme) {
9216
9352
  this.updateAABBBoundsStamp++;
9217
- const graphicTheme = this.getGraphicTheme();
9353
+ const resolvedGraphicTheme = null != graphicTheme ? graphicTheme : this.getGraphicTheme();
9218
9354
  this._AABBBounds.clear();
9219
9355
  const attribute = this.attribute,
9220
- bounds = this.updateAABBBounds(attribute, graphicTheme, this._AABBBounds, full),
9356
+ bounds = this.updateAABBBounds(attribute, resolvedGraphicTheme, this._AABBBounds, full),
9221
9357
  {
9222
- boundsPadding = graphicTheme.boundsPadding
9358
+ boundsPadding = resolvedGraphicTheme.boundsPadding
9223
9359
  } = attribute,
9224
9360
  paddingArray = parsePadding(boundsPadding);
9225
9361
  return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(), bounds;
@@ -9287,25 +9423,63 @@
9287
9423
  this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
9288
9424
  }
9289
9425
  setAttributesAndPreventAnimate(params, forceUpdateTag = !1, context, ignorePriority) {
9290
- this.visitTrackedAnimates(animate => {
9291
- (animate.priority !== 1 / 0 || ignorePriority) && Object.keys(params).forEach(key => {
9292
- animate.preventAttr(key);
9293
- });
9426
+ if (!params) return;
9427
+ const keys = Object.keys(params);
9428
+ this.captureTransientFromAttrsBeforePreventAnimate(params, keys, context), this.visitTrackedAnimates(animate => {
9429
+ (animate.priority !== 1 / 0 || ignorePriority) && animate.preventAttrs(keys);
9294
9430
  }), this.applyTransientAttributes(params, forceUpdateTag, context);
9295
9431
  }
9432
+ captureTransientFromAttrsBeforePreventAnimate(params, keys, context) {
9433
+ var _a, _b;
9434
+ const graphicContext = this.context,
9435
+ diffAttrs = null !== (_a = null == graphicContext ? void 0 : graphicContext.diffAttrs) && void 0 !== _a ? _a : params,
9436
+ updateType = null == context ? void 0 : context.type;
9437
+ if (!keys.length || !diffAttrs || updateType === exports.AttributeUpdateType.STATE || null != updateType && updateType >= exports.AttributeUpdateType.ANIMATE_BIND && updateType <= exports.AttributeUpdateType.ANIMATE_END) return;
9438
+ const sameDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs === diffAttrs;
9439
+ let fromAttrs = sameDiffAttrs && null !== (_b = this.transientFromAttrsBeforePreventAnimate) && void 0 !== _b ? _b : null;
9440
+ sameDiffAttrs || (this.transientFromAttrsBeforePreventAnimate = null, this.transientFromAttrsBeforePreventAnimateDiffAttrs = null);
9441
+ let captured = !1;
9442
+ for (let i = 0; i < keys.length; i++) {
9443
+ const key = keys[i];
9444
+ if (!Object.prototype.hasOwnProperty.call(diffAttrs, key)) continue;
9445
+ const previousValue = this.attribute[key],
9446
+ nextValue = params[key];
9447
+ isEqual(previousValue, nextValue) || (null != fromAttrs || (fromAttrs = {}), fromAttrs[key] = cloneAttributeValue(previousValue), captured = !0);
9448
+ }
9449
+ captured && (this.transientFromAttrsBeforePreventAnimate = fromAttrs, this.transientFromAttrsBeforePreventAnimateDiffAttrs = diffAttrs);
9450
+ }
9451
+ consumeTransientFromAttrsBeforePreventAnimate(diffAttrs) {
9452
+ const transientFromAttrs = this.transientFromAttrsBeforePreventAnimate,
9453
+ sourceDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs;
9454
+ if (!transientFromAttrs || !sourceDiffAttrs) return null;
9455
+ 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;
9456
+ let fromAttrs = null,
9457
+ remaining = !1;
9458
+ 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);
9459
+ if (remaining) {
9460
+ const nextTransientFromAttrs = {};
9461
+ for (const key in transientFromAttrs) Object.prototype.hasOwnProperty.call(transientFromAttrs, key) && !Object.prototype.hasOwnProperty.call(diffAttrs, key) && (nextTransientFromAttrs[key] = transientFromAttrs[key]);
9462
+ this.transientFromAttrsBeforePreventAnimate = nextTransientFromAttrs;
9463
+ } else this.transientFromAttrsBeforePreventAnimate = null, this.transientFromAttrsBeforePreventAnimateDiffAttrs = null;
9464
+ return fromAttrs;
9465
+ }
9296
9466
  setAttributes(params, forceUpdateTag = !1, context) {
9297
- 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));
9467
+ 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));
9298
9468
  }
9299
9469
  _setAttributes(params, forceUpdateTag = !1, context) {
9300
- this.applyBaseAttributes(params), this.commitBaseAttributeMutation(forceUpdateTag, context);
9470
+ this.canCommitBaseAttributesByTouchedKeys() ? this.commitBaseAttributesByTouchedKeys(params, forceUpdateTag, context) : (this.detachAttributeFromBaseAttributes(), this.applyBaseAttributes(params), this.commitBaseAttributeMutation(forceUpdateTag, context));
9301
9471
  }
9302
9472
  setAttribute(key, value, forceUpdateTag, context) {
9303
9473
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
9304
9474
  [key]: value
9305
9475
  }, this.attribute, key, context);
9306
- params ? this._setAttributes(params, forceUpdateTag, context) : (this.applyBaseAttributes({
9307
- [key]: value
9308
- }), this.commitBaseAttributeMutation(!!forceUpdateTag, context)), "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
9476
+ if (params) this._setAttributes(params, forceUpdateTag, context);else if (this.canCommitBaseAttributesByTouchedKeys()) this.commitBaseAttributeBySingleKey(key, value, !!forceUpdateTag, context);else {
9477
+ const nextAttrs = {
9478
+ [key]: value
9479
+ };
9480
+ this.applyBaseAttributes(nextAttrs), this.commitBaseAttributeMutation(!!forceUpdateTag, context);
9481
+ }
9482
+ "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
9309
9483
  }
9310
9484
  needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
9311
9485
  for (let i = 0; i < k.length; i++) {
@@ -9324,7 +9498,7 @@
9324
9498
  const context = {
9325
9499
  type: exports.AttributeUpdateType.INIT
9326
9500
  };
9327
- 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 = exports.UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
9501
+ 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 = exports.UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
9328
9502
  }
9329
9503
  translate(x, y) {
9330
9504
  var _a, _b;
@@ -9336,10 +9510,15 @@
9336
9510
  x: x,
9337
9511
  y: y
9338
9512
  }, this.attribute, tempConstantXYKey, context);
9339
- params && (x = params.x, y = params.y, delete params.x, delete params.y, this.applyBaseAttributes(params));
9513
+ params && (x = params.x, y = params.y, delete params.x, delete params.y);
9340
9514
  const attribute = this.baseAttributes,
9341
- postMatrix = attribute.postMatrix;
9342
- 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;
9515
+ postMatrix = attribute.postMatrix,
9516
+ nextAttrs = params || {};
9517
+ if (postMatrix) {
9518
+ const nextPostMatrix = postMatrix.clone();
9519
+ application.transformUtil.fromMatrix(nextPostMatrix, nextPostMatrix).translate(x, y), nextAttrs.postMatrix = nextPostMatrix;
9520
+ } 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;
9521
+ return this.commitInternalBaseAttributes(nextAttrs, context), this;
9343
9522
  }
9344
9523
  translateTo(x, y) {
9345
9524
  const attribute = this.baseAttributes;
@@ -9351,7 +9530,10 @@
9351
9530
  x: x,
9352
9531
  y: y
9353
9532
  }, this.attribute, tempConstantXYKey, context);
9354
- return params ? (this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context), this) : (attribute.x = x, attribute.y = y, this.commitBaseAttributeMutation(!1, context), this);
9533
+ return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
9534
+ x: x,
9535
+ y: y
9536
+ }, context), this);
9355
9537
  }
9356
9538
  scale(scaleX, scaleY, scaleCenter) {
9357
9539
  var _a, _b;
@@ -9364,15 +9546,16 @@
9364
9546
  scaleY: scaleY,
9365
9547
  scaleCenter: scaleCenter
9366
9548
  }, this.attribute, tempConstantScaleXYKey, context);
9367
- params && (scaleX = params.scaleX, scaleY = params.scaleY, delete params.scaleX, delete params.scaleY, this.applyBaseAttributes(params));
9368
- const attribute = this.baseAttributes;
9549
+ params && (scaleX = params.scaleX, scaleY = params.scaleY, delete params.scaleX, delete params.scaleY);
9550
+ const attribute = this.baseAttributes,
9551
+ nextAttrs = params || {};
9369
9552
  if (scaleCenter) {
9370
9553
  let {
9371
9554
  postMatrix: postMatrix
9372
- } = this.attribute;
9373
- postMatrix || (postMatrix = new Matrix(), attribute.postMatrix = postMatrix), application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter);
9374
- } 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;
9375
- return this.commitBaseAttributeMutation(!1, context), this;
9555
+ } = this.baseAttributes;
9556
+ postMatrix = postMatrix ? postMatrix.clone() : new Matrix(), application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter), nextAttrs.postMatrix = postMatrix;
9557
+ } 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;
9558
+ return this.commitInternalBaseAttributes(nextAttrs, context), this;
9376
9559
  }
9377
9560
  scaleTo(scaleX, scaleY) {
9378
9561
  const attribute = this.baseAttributes;
@@ -9384,7 +9567,10 @@
9384
9567
  scaleX: scaleX,
9385
9568
  scaleY: scaleY
9386
9569
  }, this.attribute, tempConstantScaleXYKey, context);
9387
- return params ? (this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context), this) : (attribute.scaleX = scaleX, attribute.scaleY = scaleY, this.commitBaseAttributeMutation(!1, context), this);
9570
+ return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
9571
+ scaleX: scaleX,
9572
+ scaleY: scaleY
9573
+ }, context), this);
9388
9574
  }
9389
9575
  rotate(angle, rotateCenter) {
9390
9576
  var _a;
@@ -9396,24 +9582,26 @@
9396
9582
  angle: angle,
9397
9583
  rotateCenter: rotateCenter
9398
9584
  }, this.attribute, tempConstantAngleKey, context);
9399
- params && (delete params.angle, this.applyBaseAttributes(params));
9400
- const attribute = this.baseAttributes;
9585
+ params && delete params.angle;
9586
+ const attribute = this.baseAttributes,
9587
+ nextAttrs = params || {};
9401
9588
  if (rotateCenter) {
9402
9589
  let {
9403
9590
  postMatrix: postMatrix
9404
9591
  } = this.baseAttributes;
9405
- postMatrix || (postMatrix = new Matrix(), this.baseAttributes.postMatrix = postMatrix), application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter);
9406
- } else attribute.angle = (null !== (_a = attribute.angle) && void 0 !== _a ? _a : DefaultTransform.angle) + angle;
9407
- return this.commitBaseAttributeMutation(!1, context), this;
9592
+ postMatrix = postMatrix ? postMatrix.clone() : new Matrix(), application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter), nextAttrs.postMatrix = postMatrix;
9593
+ } else nextAttrs.angle = (null !== (_a = attribute.angle) && void 0 !== _a ? _a : DefaultTransform.angle) + angle;
9594
+ return this.commitInternalBaseAttributes(nextAttrs, context), this;
9408
9595
  }
9409
9596
  rotateTo(angle) {
9410
- const attribute = this.baseAttributes;
9411
- if (attribute.angle === angle) return this;
9597
+ if (this.baseAttributes.angle === angle) return this;
9412
9598
  const context = {
9413
9599
  type: exports.AttributeUpdateType.ROTATE_TO
9414
9600
  },
9415
9601
  params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(angle, this.attribute, tempConstantAngleKey, context);
9416
- return params ? (this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context), this) : (attribute.angle = angle, this.commitBaseAttributeMutation(!1, context), this);
9602
+ return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
9603
+ angle: angle
9604
+ }, context), this);
9417
9605
  }
9418
9606
  skewTo(b, c) {
9419
9607
  return this;
@@ -9431,7 +9619,15 @@
9431
9619
  var _a;
9432
9620
  return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
9433
9621
  }
9434
- createStateModel() {
9622
+ getStateResolveBaseAttrs() {
9623
+ var _a;
9624
+ return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
9625
+ }
9626
+ syncStateResolveContext(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
9627
+ var _a;
9628
+ return null === (_a = this.stateEngine) || void 0 === _a || _a.setResolveContext(this, stateResolveBaseAttrs), stateResolveBaseAttrs;
9629
+ }
9630
+ createStateModel(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
9435
9631
  const {
9436
9632
  compiledDefinitions: compiledDefinitions,
9437
9633
  stateProxyEligibility: stateProxyEligibility,
@@ -9444,7 +9640,7 @@
9444
9640
  stateProxyEligibility: stateProxyEligibility,
9445
9641
  states: this.states,
9446
9642
  mergeMode: this.stateMergeMode
9447
- }), 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({
9643
+ }), 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({
9448
9644
  states: this.states,
9449
9645
  currentStates: this.currentStates,
9450
9646
  stateSort: this.stateSort,
@@ -9452,28 +9648,162 @@
9452
9648
  stateEngine: this.stateEngine
9453
9649
  });
9454
9650
  }
9651
+ resolveSimpleLocalStateTransition(states, previousStates) {
9652
+ var _a;
9653
+ 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;
9654
+ if (1 === states.length) {
9655
+ const stateName = states[0],
9656
+ hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName),
9657
+ nextStates = [stateName],
9658
+ changed = !this.sameStateNames(previousStates, nextStates),
9659
+ resolvedStateAttrs = {};
9660
+ if (hasDefinition) {
9661
+ const attrs = this.states[stateName];
9662
+ if (null != attrs) {
9663
+ if (!isPlainObjectValue(attrs)) return null;
9664
+ const keys = Object.keys(attrs);
9665
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
9666
+ const key = keys[keyIndex];
9667
+ if (FULL_STATE_DEFINITION_KEYS.has(key)) return null;
9668
+ const attrValue = attrs[key];
9669
+ resolvedStateAttrs[key] = isPlainObjectValue(attrValue) ? cloneAttributeValue(attrValue) : attrValue;
9670
+ }
9671
+ }
9672
+ }
9673
+ return {
9674
+ changed: changed,
9675
+ states: nextStates,
9676
+ effectiveStates: nextStates,
9677
+ resolvedStateAttrs: resolvedStateAttrs
9678
+ };
9679
+ }
9680
+ const uniqueStates = Array.from(new Set(states)),
9681
+ withDefinition = [],
9682
+ withoutDefinition = [];
9683
+ for (let i = 0; i < uniqueStates.length; i++) {
9684
+ const stateName = uniqueStates[i];
9685
+ Object.prototype.hasOwnProperty.call(this.states, stateName) ? withDefinition.push(stateName) : withoutDefinition.push(stateName);
9686
+ }
9687
+ withDefinition.sort((left, right) => left.localeCompare(right));
9688
+ const nextStates = withDefinition.concat(withoutDefinition),
9689
+ changed = !this.sameStateNames(previousStates, nextStates),
9690
+ resolvedStateAttrs = {};
9691
+ for (let i = 0; i < nextStates.length; i++) {
9692
+ const stateName = nextStates[i];
9693
+ if (!Object.prototype.hasOwnProperty.call(this.states, stateName)) continue;
9694
+ const attrs = this.states[stateName];
9695
+ if (null == attrs) continue;
9696
+ if (!isPlainObjectValue(attrs)) return null;
9697
+ const keys = Object.keys(attrs);
9698
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
9699
+ const key = keys[keyIndex];
9700
+ if (FULL_STATE_DEFINITION_KEYS.has(key)) return null;
9701
+ const attrValue = attrs[key];
9702
+ resolvedStateAttrs[key] = isPlainObjectValue(attrValue) ? cloneAttributeValue(attrValue) : attrValue;
9703
+ }
9704
+ }
9705
+ return {
9706
+ changed: changed,
9707
+ states: nextStates,
9708
+ effectiveStates: nextStates,
9709
+ resolvedStateAttrs: resolvedStateAttrs
9710
+ };
9711
+ }
9712
+ resolveGraphicStateTransition(states, previousStates, forceResolverRefresh = !1) {
9713
+ var _a, _b;
9714
+ let transition = this.resolveSimpleLocalStateTransition(states, previousStates);
9715
+ const isSimpleLocalTransition = !!transition;
9716
+ let resolvedStateAttrs;
9717
+ if (transition) resolvedStateAttrs = transition.resolvedStateAttrs;else {
9718
+ const stateResolveBaseAttrs = this.getStateResolveBaseAttrs(),
9719
+ stateModel = this.createStateModel(stateResolveBaseAttrs);
9720
+ 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);
9721
+ }
9722
+ return {
9723
+ transition: transition,
9724
+ effectiveStates: null !== (_b = transition.effectiveStates) && void 0 !== _b ? _b : transition.states,
9725
+ resolvedStateAttrs: resolvedStateAttrs,
9726
+ isSimpleLocalTransition: isSimpleLocalTransition
9727
+ };
9728
+ }
9729
+ normalizeSetStatesOptions(options) {
9730
+ return options && "object" == typeof options ? {
9731
+ hasAnimation: options.animate,
9732
+ animateSameStatePatchChange: !0 === options.animateSameStatePatchChange,
9733
+ shouldRefreshSameStatePatch: !0
9734
+ } : {
9735
+ hasAnimation: "boolean" == typeof options ? options : void 0,
9736
+ animateSameStatePatchChange: !1,
9737
+ shouldRefreshSameStatePatch: !1
9738
+ };
9739
+ }
9740
+ sameStatePatches(left, right) {
9741
+ const leftRecord = null != left ? left : {},
9742
+ rightRecord = null != right ? right : {},
9743
+ keys = new Set([...Object.keys(leftRecord), ...Object.keys(rightRecord)]);
9744
+ for (const key of keys) {
9745
+ if (Object.prototype.hasOwnProperty.call(leftRecord, key) !== Object.prototype.hasOwnProperty.call(rightRecord, key)) return !1;
9746
+ if (!areAttributeValuesEqual(leftRecord[key], rightRecord[key])) return !1;
9747
+ }
9748
+ return !0;
9749
+ }
9750
+ commitSameStatePatchRefresh(states, hasAnimation, animateSameStatePatchChange = !1) {
9751
+ var _a;
9752
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
9753
+ previousResolvedStatePatch = this.resolvedStatePatch,
9754
+ {
9755
+ transition: transition,
9756
+ effectiveStates: effectiveStates,
9757
+ resolvedStateAttrs: resolvedStateAttrs,
9758
+ isSimpleLocalTransition: isSimpleLocalTransition
9759
+ } = this.resolveGraphicStateTransition(states, previousStates, !0),
9760
+ patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
9761
+ 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)) {
9762
+ if (this.stage) {
9763
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
9764
+ null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
9765
+ graphicId: this._uid,
9766
+ targetStates: [...transition.states]
9767
+ });
9768
+ }
9769
+ hasAnimation && animateSameStatePatchChange ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
9770
+ type: exports.AttributeUpdateType.STATE
9771
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
9772
+ type: exports.AttributeUpdateType.STATE
9773
+ }), this.emitStateUpdateEvent());
9774
+ }
9775
+ }
9455
9776
  resolveStateAnimateConfig(animateConfig) {
9456
9777
  var _a, _b, _c;
9457
9778
  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;
9458
9779
  }
9459
- applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig) {
9780
+ applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs) {
9460
9781
  const resolvedAnimateConfig = hasAnimation ? this.resolveStateAnimateConfig(animateConfig) : void 0,
9461
9782
  transitionOptions = resolvedAnimateConfig ? {
9462
- animateConfig: resolvedAnimateConfig
9783
+ animateConfig: resolvedAnimateConfig,
9784
+ extraAnimateAttrs: extraAnimateAttrs,
9785
+ shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
9463
9786
  } : void 0;
9464
9787
  if (isClear) return void this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, stateNames, transitionOptions);
9465
9788
  const plan = this.getStateTransitionOrchestrator().analyzeTransition({}, attrs, stateNames, hasAnimation, {
9466
9789
  noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
9467
- animateConfig: resolvedAnimateConfig
9790
+ animateConfig: resolvedAnimateConfig,
9791
+ extraAnimateAttrs: extraAnimateAttrs,
9792
+ shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
9468
9793
  });
9469
9794
  this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
9470
9795
  }
9471
- updateNormalAttrs(stateAttrs) {
9472
- this._deprecatedNormalAttrsView = cloneAttributeValue(this.baseAttributes);
9796
+ updateNormalAttrs(_stateAttrs) {}
9797
+ getStateTransitionDefaultAttribute(key, targetAttrs) {
9798
+ return this.getDefaultAttribute(key);
9799
+ }
9800
+ shouldSkipStateTransitionDefaultAttribute(_key, _targetAttrs) {
9801
+ return !1;
9473
9802
  }
9474
9803
  stopStateAnimates(type = "end") {
9475
9804
  const stopAnimationState = this.stopAnimationState;
9476
9805
  if ("function" == typeof stopAnimationState) return void stopAnimationState.call(this, "state", type);
9806
+ if (!this.mayHaveTrackedAnimates()) return;
9477
9807
  const stateAnimates = [];
9478
9808
  this.visitTrackedAnimates(animate => {
9479
9809
  animate.stateNames && stateAnimates.push(animate);
@@ -9486,18 +9816,25 @@
9486
9816
  }
9487
9817
  clearStates(hasAnimation) {
9488
9818
  var _a, _b, _c;
9489
- const previousStates = this.currentStates ? this.currentStates.slice() : [],
9819
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
9820
+ previousResolvedStatePatch = this.resolvedStatePatch,
9490
9821
  transition = this.createStateModel().clearStates();
9491
9822
  if (!transition.changed && 0 === previousStates.length) return this.currentStates = [], this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, void this.clearSharedStateActiveRegistrations();
9492
- const resolvedStateAttrs = cloneAttributeValue(null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : {});
9493
- 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", {
9494
- graphicId: this._uid,
9495
- targetStates: []
9496
- }), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0)) : (this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
9497
- type: exports.AttributeUpdateType.STATE
9498
- }), this._emitCustomEvent("afterStateUpdate", {
9499
- type: exports.AttributeUpdateType.STATE
9500
- })));
9823
+ const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
9824
+ if (!transition.changed || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0)) {
9825
+ if (this.currentStates = transition.states, this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, this.clearSharedStateActiveRegistrations(), this.stage) {
9826
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
9827
+ null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
9828
+ graphicId: this._uid,
9829
+ targetStates: []
9830
+ });
9831
+ }
9832
+ hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
9833
+ type: exports.AttributeUpdateType.STATE
9834
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
9835
+ type: exports.AttributeUpdateType.STATE
9836
+ }), this.emitStateUpdateEvent());
9837
+ }
9501
9838
  }
9502
9839
  removeState(stateName, hasAnimation) {
9503
9840
  const transition = this.createStateModel().removeState(stateName);
@@ -9511,38 +9848,59 @@
9511
9848
  const transition = this.createStateModel().addState(stateName, keepCurrentStates);
9512
9849
  transition.changed && this.useStates(transition.states, hasAnimation);
9513
9850
  }
9851
+ setStates(states, options) {
9852
+ var _a, _b, _c;
9853
+ const {
9854
+ hasAnimation: hasAnimation,
9855
+ animateSameStatePatchChange: animateSameStatePatchChange,
9856
+ shouldRefreshSameStatePatch: shouldRefreshSameStatePatch
9857
+ } = this.normalizeSetStatesOptions(options),
9858
+ nextStates = (null == states ? void 0 : states.length) ? states : EMPTY_STATE_NAMES,
9859
+ 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));
9860
+ if (nextStates.length) {
9861
+ if (this.sameStateNames(this.currentStates, nextStates)) return shouldRefreshSameStatePatch ? void this.commitSameStatePatchRefresh(nextStates, hasAnimation, animateSameStatePatchChange) : void (this.sharedStateDirty && this.refreshSharedStateBeforeRender());
9862
+ this.useStates(nextStates, hasAnimation);
9863
+ } else {
9864
+ if (!hasCurrentState && !this.sharedStateDirty) return;
9865
+ this.clearStates(hasAnimation);
9866
+ }
9867
+ }
9514
9868
  useStates(states, hasAnimation) {
9515
- var _a, _b, _c, _d, _e;
9869
+ var _a;
9516
9870
  if (!states.length) return void this.clearStates(hasAnimation);
9517
- const previousStates = this.currentStates ? this.currentStates.slice() : [],
9518
- stateResolveBaseAttrs = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute,
9519
- stateModel = this.createStateModel();
9520
- null === (_b = this.stateEngine) || void 0 === _b || _b.setResolveContext(this, stateResolveBaseAttrs);
9521
- const transition = stateModel.useStates(states);
9522
- if (!transition.changed && this.sameStateNames(previousStates, transition.states)) return;
9523
- const effectiveStates = null !== (_c = transition.effectiveStates) && void 0 !== _c ? _c : transition.states,
9524
- resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
9525
- 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", {
9526
- graphicId: this._uid,
9527
- targetStates: [...transition.states]
9528
- }), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation)) : (this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
9529
- type: exports.AttributeUpdateType.STATE
9530
- }), this._emitCustomEvent("afterStateUpdate", {
9531
- type: exports.AttributeUpdateType.STATE
9532
- })));
9871
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
9872
+ previousResolvedStatePatch = this.resolvedStatePatch,
9873
+ {
9874
+ transition: transition,
9875
+ effectiveStates: effectiveStates,
9876
+ resolvedStateAttrs: resolvedStateAttrs,
9877
+ isSimpleLocalTransition: isSimpleLocalTransition
9878
+ } = this.resolveGraphicStateTransition(states, previousStates);
9879
+ if ((transition.changed || !this.sameStateNames(previousStates, transition.states)) && this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) {
9880
+ if (this.currentStates = transition.states, this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stage) {
9881
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
9882
+ null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
9883
+ graphicId: this._uid,
9884
+ targetStates: [...transition.states]
9885
+ });
9886
+ }
9887
+ hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
9888
+ type: exports.AttributeUpdateType.STATE
9889
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
9890
+ type: exports.AttributeUpdateType.STATE
9891
+ }), this.emitStateUpdateEvent());
9892
+ }
9533
9893
  }
9534
9894
  invalidateResolver() {
9535
9895
  var _a, _b;
9536
9896
  if (!this.stateEngine || !(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.compiledStateDefinitions) return;
9537
- const stateResolveBaseAttrs = null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : this.attribute;
9538
- this.stateEngine.setResolveContext(this, stateResolveBaseAttrs), this.resolverEpoch += 1, this.stateEngine.invalidateResolverCache();
9897
+ this.syncStateResolveContext();
9898
+ this.resolverEpoch = (null !== (_b = this.resolverEpoch) && void 0 !== _b ? _b : 0) + 1, this.stateEngine.invalidateResolverCache();
9539
9899
  const transition = this.stateEngine.applyStates(this.currentStates),
9540
9900
  resolvedStateAttrs = Object.assign({}, this.stateEngine.resolvedPatch);
9541
- this.effectiveStates = [...transition.effectiveStates], this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs), this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
9901
+ this.effectiveStates = [...transition.effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
9542
9902
  type: exports.AttributeUpdateType.STATE
9543
- }), this._emitCustomEvent("afterStateUpdate", {
9544
- type: exports.AttributeUpdateType.STATE
9545
- });
9903
+ }), this.emitStateUpdateEvent();
9546
9904
  }
9547
9905
  sameStateNames(left, right) {
9548
9906
  const normalizedLeft = null != left ? left : [],
@@ -9563,6 +9921,9 @@
9563
9921
  addUpdateShapeAndBoundsTag() {
9564
9922
  this._updateTag |= exports.UpdateTag.UPDATE_SHAPE_AND_BOUNDS, this.parent && this.parent.addChildUpdateBoundTag(), this.glyphHost && this.glyphHost.addUpdateBoundTag();
9565
9923
  }
9924
+ addBroadUpdateTag() {
9925
+ this.shadowRoot && this.shadowRoot.addUpdateGlobalPositionTag(), this._updateTag |= exports.UpdateTag.UPDATE_SHAPE_AND_BOUNDS | exports.UpdateTag.UPDATE_PAINT | exports.UpdateTag.UPDATE_GLOBAL_LOCAL_MATRIX | exports.UpdateTag.UPDATE_LAYOUT, this.parent && this.parent.addChildUpdateBoundTag(), this.glyphHost && this.glyphHost.addUpdateBoundTag();
9926
+ }
9566
9927
  updateShapeAndBoundsTagSetted() {
9567
9928
  return (this._updateTag & exports.UpdateTag.UPDATE_SHAPE_AND_BOUNDS) === exports.UpdateTag.UPDATE_SHAPE_AND_BOUNDS;
9568
9929
  }
@@ -9650,13 +10011,13 @@
9650
10011
  }
9651
10012
  }
9652
10013
  setStage(stage, layer) {
9653
- var _a, _b, _c, _d, _e, _f, _g, _h;
10014
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
9654
10015
  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,
9655
10016
  previousStage = this.stage;
9656
10017
  if (this.stage !== stage || this.layer !== layer) {
9657
- 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()) {
9658
- const previousTimeline = null === (_e = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _e ? void 0 : _e.call(previousStage),
9659
- nextTimeline = null === (_f = null == stage ? void 0 : stage.getTimeline) || void 0 === _f ? void 0 : _f.call(stage),
10018
+ 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()) {
10019
+ const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
10020
+ nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
9660
10021
  detachedStageAnimates = [];
9661
10022
  this.visitTrackedAnimates(a => {
9662
10023
  (!!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)));
@@ -9669,9 +10030,13 @@
9669
10030
  type: exports.AttributeUpdateType.ANIMATE_END
9670
10031
  }));
9671
10032
  }
9672
- 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));
10033
+ 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));
9673
10034
  }
9674
- this.syncSharedStateScopeBindingFromTree(!!(null === (_h = this.currentStates) || void 0 === _h ? void 0 : _h.length));
10035
+ ((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);
10036
+ }
10037
+ detachStageForRelease() {
10038
+ var _a, _b, _c;
10039
+ (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));
9675
10040
  }
9676
10041
  setStageToShadowRoot(stage, layer) {
9677
10042
  this.shadowRoot && this.shadowRoot.setStage(stage, layer);
@@ -9738,6 +10103,7 @@
9738
10103
  res && (res.state = "fail", cb && cb());
9739
10104
  }
9740
10105
  _stopAnimates() {
10106
+ if (!this.mayHaveTrackedAnimates()) return;
9741
10107
  const animates = [];
9742
10108
  this.visitTrackedAnimates(animate => {
9743
10109
  animates.push(animate);
@@ -9751,14 +10117,17 @@
9751
10117
  });
9752
10118
  }
9753
10119
  release() {
9754
- var _a, _b, _c;
9755
- this.releaseStatus = "released", this.clearSharedStateActiveRegistrations(), this.stopAnimates();
9756
- const graphicService = null !== (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.graphicService) && void 0 !== _b ? _b : application.graphicService;
9757
- null === (_c = null == graphicService ? void 0 : graphicService.onRelease) || void 0 === _c || _c.call(graphicService, this), super.release();
10120
+ var _a, _b, _c, _d;
10121
+ this.releaseStatus = "released", (null === (_a = this.registeredActiveScopes) || void 0 === _a ? void 0 : _a.size) && this.clearSharedStateActiveRegistrations(), (this.mayHaveTrackedAnimates() || this.shadowRoot) && this.stopAnimates();
10122
+ const graphicService = null !== (_c = null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService;
10123
+ null === (_d = null == graphicService ? void 0 : graphicService.onRelease) || void 0 === _d || _d.call(graphicService, this), super.release();
10124
+ }
10125
+ hasCustomEvent(type) {
10126
+ return !!this._events && type in this._events;
9758
10127
  }
9759
10128
  _dispatchCustomEvent(type, context) {
9760
10129
  var _a, _b;
9761
- if (this._events && type in this._events) {
10130
+ if (this.hasCustomEvent(type)) {
9762
10131
  const changeEvent = new CustomEvent(type, context);
9763
10132
  changeEvent.bubbles = !1;
9764
10133
  const manager = null === (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventSystem) || void 0 === _b ? void 0 : _b.manager;
@@ -9767,7 +10136,7 @@
9767
10136
  return !0;
9768
10137
  }
9769
10138
  beforeStateUpdate(attrs, prevStates, nextStates, hasAnimation, isClear) {
9770
- return this._dispatchCustomEvent("beforeStateUpdate", {
10139
+ return !this.hasCustomEvent("beforeStateUpdate") || this._dispatchCustomEvent("beforeStateUpdate", {
9771
10140
  type: exports.AttributeUpdateType.STATE,
9772
10141
  attrs: Object.assign({}, attrs),
9773
10142
  prevStates: prevStates.slice(),
@@ -9776,6 +10145,11 @@
9776
10145
  isClear: !!isClear
9777
10146
  });
9778
10147
  }
10148
+ emitStateUpdateEvent() {
10149
+ this.hasCustomEvent("afterStateUpdate") && this._emitCustomEvent("afterStateUpdate", {
10150
+ type: exports.AttributeUpdateType.STATE
10151
+ });
10152
+ }
9779
10153
  _emitCustomEvent(type, context) {
9780
10154
  this._dispatchCustomEvent(type, context);
9781
10155
  }
@@ -10957,6 +11331,52 @@
10957
11331
  needUpdateTag(key) {
10958
11332
  return super.needUpdateTag(key, RECT_UPDATE_TAG_KEY);
10959
11333
  }
11334
+ shouldSkipStateTransitionDefaultAttribute(key, targetAttrs) {
11335
+ var _a;
11336
+ const attrs = null !== (_a = null != targetAttrs ? targetAttrs : this.baseAttributes) && void 0 !== _a ? _a : this.attribute,
11337
+ hasValue = attrKey => null != attrs[attrKey],
11338
+ isNilValue = attrKey => null == attrs[attrKey];
11339
+ switch (key) {
11340
+ case "width":
11341
+ return isNilValue("width") && hasValue("x") && hasValue("x1");
11342
+ case "height":
11343
+ return isNilValue("height") && hasValue("y") && hasValue("y1");
11344
+ case "x1":
11345
+ return isNilValue("x1") && hasValue("x") && hasValue("width");
11346
+ case "y1":
11347
+ return isNilValue("y1") && hasValue("y") && hasValue("height");
11348
+ default:
11349
+ return !1;
11350
+ }
11351
+ }
11352
+ getStateTransitionDefaultAttribute(key, targetAttrs) {
11353
+ var _a;
11354
+ const attrs = null !== (_a = null != targetAttrs ? targetAttrs : this.baseAttributes) && void 0 !== _a ? _a : this.attribute,
11355
+ getNumber = attrKey => {
11356
+ const value = attrs[attrKey];
11357
+ return "number" == typeof value && Number.isFinite(value) ? value : void 0;
11358
+ },
11359
+ x = getNumber("x"),
11360
+ y = getNumber("y"),
11361
+ x1 = getNumber("x1"),
11362
+ y1 = getNumber("y1"),
11363
+ width = getNumber("width"),
11364
+ height = getNumber("height");
11365
+ switch (key) {
11366
+ case "width":
11367
+ if (null == width && null != x && null != x1) return x1 - x;
11368
+ break;
11369
+ case "height":
11370
+ if (null == height && null != y && null != y1) return y1 - y;
11371
+ break;
11372
+ case "x1":
11373
+ if (null == x1 && null != x && null != width) return x + width;
11374
+ break;
11375
+ case "y1":
11376
+ if (null == y1 && null != y && null != height) return y + height;
11377
+ }
11378
+ return super.getStateTransitionDefaultAttribute(key, targetAttrs);
11379
+ }
10960
11380
  toCustomPath() {
10961
11381
  let path = super.toCustomPath();
10962
11382
  if (path) return path;
@@ -12736,13 +13156,15 @@
12736
13156
  }(exports.GroupUpdateAABBBoundsMode || (exports.GroupUpdateAABBBoundsMode = {}));
12737
13157
  class Group extends Graphic {
12738
13158
  constructor(params) {
12739
- super(params), this.type = "group", this.parent = null, this.isContainer = !0, this.numberType = GROUP_NUMBER_TYPE, this._childUpdateTag = exports.UpdateTag.UPDATE_BOUNDS;
13159
+ super(params), this.type = "group", this.parent = null, this.isContainer = !0, this._hasSharedStateDefinitions = !1, this.numberType = GROUP_NUMBER_TYPE, this._childUpdateTag = exports.UpdateTag.UPDATE_BOUNDS;
12740
13160
  }
12741
13161
  get sharedStateDefinitions() {
12742
13162
  return this._sharedStateDefinitions;
12743
13163
  }
12744
13164
  set sharedStateDefinitions(value) {
12745
- this._sharedStateDefinitions !== value && (this._sharedStateDefinitions = value, this.ensureSharedStateScopeBound(), this.sharedStateScope && (setSharedStateScopeLocalDefinitions(this.sharedStateScope, value), markScopeActiveDescendantsDirty(this.sharedStateScope, this.stage)));
13165
+ if (this._sharedStateDefinitions === value) return;
13166
+ const previousScope = this.sharedStateScope;
13167
+ 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();
12746
13168
  }
12747
13169
  setMode(mode) {
12748
13170
  "3d" === mode ? this.set3dMode() : this.set2dMode();
@@ -12867,9 +13289,10 @@
12867
13289
  insertInto(newNode, idx) {
12868
13290
  return this._updateChildToStage(super.insertInto(newNode, idx));
12869
13291
  }
12870
- removeChild(child) {
13292
+ removeChild(child, highPerformance = !1) {
13293
+ var _a;
12871
13294
  const data = super.removeChild(child);
12872
- return this.getGraphicService().onRemove(child), child.setStage(null, null), this.addUpdateBoundTag(), data;
13295
+ 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;
12873
13296
  }
12874
13297
  removeAllChild(deep = !1) {
12875
13298
  const children = this.children.slice();
@@ -12881,11 +13304,13 @@
12881
13304
  }
12882
13305
  setStage(stage, layer) {
12883
13306
  var _a, _b, _c, _d, _e, _f;
12884
- 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;
12885
- 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 => {
13307
+ 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,
13308
+ 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;
13309
+ 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 => {
12886
13310
  item.setStage(stage, this.layer);
12887
13311
  });
12888
- this.layer !== layer && (this.layer = layer), this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingFromTree(!!(null === (_f = this.currentStates) || void 0 === _f ? void 0 : _f.length)), this.forEachChildren(item => {
13312
+ const layerChanged = this.layer !== layer;
13313
+ layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.forEachChildren(item => {
12889
13314
  item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(stage, this.layer);
12890
13315
  });
12891
13316
  }
@@ -12932,15 +13357,29 @@
12932
13357
  g.release(all);
12933
13358
  }), super.release();
12934
13359
  }
13360
+ detachStageForRelease() {
13361
+ super.detachStageForRelease(), this.sharedStateScope = void 0, this.forEachChildren(item => {
13362
+ var _a;
13363
+ null === (_a = item.detachStageForRelease) || void 0 === _a || _a.call(item);
13364
+ });
13365
+ }
12935
13366
  ensureSharedStateScopeBound() {
12936
13367
  var _a, _b, _c;
13368
+ if (!this.hasSharedStateDefinitions()) return void (this.sharedStateScope = void 0);
12937
13369
  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;
12938
13370
  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);
12939
13371
  }
13372
+ hasSharedStateDefinitions() {
13373
+ return this._hasSharedStateDefinitions;
13374
+ }
13375
+ notifyChildrenSharedStateTreeChanged() {
13376
+ this.forEachChildren(item => {
13377
+ item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(this.stage, this.layer);
13378
+ });
13379
+ }
12940
13380
  onParentSharedStateTreeChanged(stage, layer) {
12941
- this.stage === stage && this.layer === layer ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingFromTree(), this.forEachChildren(item => {
12942
- item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(stage, this.layer);
12943
- })) : this.setStage(stage, layer);
13381
+ var _a;
13382
+ 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);
12944
13383
  }
12945
13384
  }
12946
13385
  Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
@@ -13288,7 +13727,10 @@
13288
13727
  beforeUpdateAABBBounds: new SyncHook(["graphic", "stage", "willUpdate", "aabbBounds"]),
13289
13728
  afterUpdateAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds", "globalAABBBounds", "selfChange"]),
13290
13729
  clearAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds"])
13291
- }, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds();
13730
+ }, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds(), this.tempAABBBoundsResult = {
13731
+ tb1: this.tempAABBBounds1,
13732
+ tb2: this.tempAABBBounds2
13733
+ };
13292
13734
  }
13293
13735
  onAttributeUpdate(graphic) {
13294
13736
  this.hooks.onAttributeUpdate.taps.length && this.hooks.onAttributeUpdate.call(graphic);
@@ -13388,10 +13830,7 @@
13388
13830
  updateTempAABBBounds(aabbBounds) {
13389
13831
  const tb1 = this.tempAABBBounds1,
13390
13832
  tb2 = this.tempAABBBounds2;
13391
- return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), {
13392
- tb1: tb1,
13393
- tb2: tb2
13394
- };
13833
+ return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), this.tempAABBBoundsResult;
13395
13834
  }
13396
13835
  }
13397
13836
 
@@ -14733,7 +15172,7 @@
14733
15172
  const globalBounds = new AABBBounds();
14734
15173
  class DirtyBoundsPlugin {
14735
15174
  constructor() {
14736
- this.name = "DirtyBoundsPlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.handlePaintOnlyUpdate = graphic => {
15175
+ this.name = "DirtyBoundsPlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.dirtyBoundsHooksRegistered = !1, this.handlePaintOnlyUpdate = graphic => {
14737
15176
  var _a, _b, _c, _d;
14738
15177
  const stage = this.pluginService.stage;
14739
15178
  if (!stage || stage !== graphic.stage || !stage.renderCount) return;
@@ -14753,12 +15192,13 @@
14753
15192
  owner._AABBBounds && "function" == typeof owner._AABBBounds.empty && !owner._AABBBounds.empty() || "function" != typeof owner.doUpdateAABBBounds || owner.doUpdateAABBBounds("imprecise" === (null === (_a = owner.attribute) || void 0 === _a ? void 0 : _a.boundsMode));
14754
15193
  return owner._globalAABBBounds && "function" == typeof owner._globalAABBBounds.empty && !owner._globalAABBBounds.empty() || "function" != typeof owner.tryUpdateGlobalAABBBounds || owner.tryUpdateGlobalAABBBounds(), null !== (_b = owner._globalAABBBounds) && void 0 !== _b ? _b : owner.globalAABBBounds;
14755
15194
  }
14756
- activate(context) {
14757
- this.pluginService = context, context.stage.hooks.afterRender.tap(this.key, stage => {
14758
- stage && stage === this.pluginService.stage && stage.dirtyBounds.clear();
14759
- });
14760
- const stage = this.pluginService.stage;
14761
- stage && (stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handlePaintOnlyUpdate), stage.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, (graphic, stage, willUpdate, bounds) => {
15195
+ getRemoveDirtyBounds(graphic) {
15196
+ var _a;
15197
+ const cachedBounds = (null !== (_a = graphic.glyphHost) && void 0 !== _a ? _a : graphic)._globalAABBBounds;
15198
+ if (cachedBounds && "function" == typeof cachedBounds.empty && !cachedBounds.empty()) return cachedBounds;
15199
+ }
15200
+ registerDirtyBoundsHooks(stage) {
15201
+ this.dirtyBoundsHooksRegistered || (stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handlePaintOnlyUpdate), stage.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, (graphic, stage, willUpdate, bounds) => {
14762
15202
  graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === this.pluginService.stage && stage.renderCount && (graphic.isContainer && !graphic.shouldSelfChangeUpdateAABBBounds() || willUpdate && (globalBounds.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2), stage.dirty(globalBounds, graphic.parent && graphic.parent.globalTransMatrix)));
14763
15203
  }), stage.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, (graphic, stage, bounds, params, selfChange) => {
14764
15204
  stage && stage === this.pluginService.stage && stage.renderCount && (graphic.isContainer && !selfChange || stage.dirty(params.globalAABBBounds));
@@ -14766,12 +15206,21 @@
14766
15206
  stage && stage === this.pluginService.stage && stage.renderCount && stage && stage.dirty(bounds);
14767
15207
  }), stage.graphicService.hooks.onRemove.tap(this.key, graphic => {
14768
15208
  const stage = graphic.stage;
14769
- stage && stage === this.pluginService.stage && stage.renderCount && stage && stage.dirty(graphic.globalAABBBounds);
14770
- }));
15209
+ if (!stage || stage !== this.pluginService.stage || !stage.renderCount) return;
15210
+ const bounds = this.getRemoveDirtyBounds(graphic);
15211
+ bounds && !bounds.empty() && stage.dirty(bounds);
15212
+ }), this.dirtyBoundsHooksRegistered = !0);
15213
+ }
15214
+ activate(context) {
15215
+ this.pluginService = context, context.stage.hooks.afterRender.tap(this.key, stage => {
15216
+ stage && stage === this.pluginService.stage && (stage.dirtyBounds.clear(), this.registerDirtyBoundsHooks(stage));
15217
+ });
15218
+ const stage = this.pluginService.stage;
15219
+ stage && stage.renderCount && this.registerDirtyBoundsHooks(stage);
14771
15220
  }
14772
15221
  deactivate(context) {
14773
15222
  const stage = this.pluginService.stage;
14774
- stage && (stage.graphicService.hooks.onAttributeUpdate.taps = stage.graphicService.hooks.onAttributeUpdate.taps.filter(item => item.name !== this.key), stage.graphicService.hooks.beforeUpdateAABBBounds.taps = stage.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => item.name !== this.key), stage.graphicService.hooks.afterUpdateAABBBounds.taps = stage.graphicService.hooks.afterUpdateAABBBounds.taps.filter(item => item.name !== this.key), stage.graphicService.hooks.clearAABBBounds.taps = stage.graphicService.hooks.clearAABBBounds.taps.filter(item => item.name !== this.key), stage.hooks.afterRender.taps = stage.hooks.afterRender.taps.filter(item => item.name !== this.key), stage.graphicService.hooks.onRemove.taps = stage.graphicService.hooks.onRemove.taps.filter(item => item.name !== this.key));
15223
+ stage && (stage.graphicService.hooks.onAttributeUpdate.taps = stage.graphicService.hooks.onAttributeUpdate.taps.filter(item => item.name !== this.key), this.dirtyBoundsHooksRegistered = !1, stage.graphicService.hooks.beforeUpdateAABBBounds.taps = stage.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => item.name !== this.key), stage.graphicService.hooks.afterUpdateAABBBounds.taps = stage.graphicService.hooks.afterUpdateAABBBounds.taps.filter(item => item.name !== this.key), stage.graphicService.hooks.clearAABBBounds.taps = stage.graphicService.hooks.clearAABBBounds.taps.filter(item => item.name !== this.key), stage.hooks.afterRender.taps = stage.hooks.afterRender.taps.filter(item => item.name !== this.key), stage.graphicService.hooks.onRemove.taps = stage.graphicService.hooks.onRemove.taps.filter(item => item.name !== this.key));
14775
15224
  }
14776
15225
  }
14777
15226
 
@@ -15127,7 +15576,7 @@
15127
15576
  ticker.bindStage(this), this._ticker && this._ticker.removeListener("tick", this.afterTickCb), ticker.addTimeline(this.timeline), this._ticker = ticker, this._ticker.on("tick", this.afterTickCb);
15128
15577
  }
15129
15578
  constructor(params = {}, deps = {}) {
15130
- var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
15579
+ var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
15131
15580
  super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
15132
15581
  if (!(this._skipRender < 0)) if (visible) {
15133
15582
  if (this.dirtyBounds) {
@@ -15137,7 +15586,8 @@
15137
15586
  this._skipRender > 1 && this.renderNextFrame(), this._skipRender = 0;
15138
15587
  } else this._skipRender = 1;
15139
15588
  }, this.beforeRender = stage => {
15140
- flushStageSharedStateRefresh(this), this._beforeRenderList.forEach(cb => cb(stage));
15589
+ const pendingSharedRefresh = this._pendingSharedStateRefreshGraphics;
15590
+ (null == pendingSharedRefresh ? void 0 : pendingSharedRefresh.size) && flushStageSharedStateRefresh(this), this._beforeRenderList.forEach(cb => cb(stage));
15141
15591
  }, this.afterClearScreen = drawParams => {
15142
15592
  this._afterClearScreen && this._afterClearScreen(drawParams);
15143
15593
  }, this.afterClearRect = drawParams => {
@@ -15162,14 +15612,17 @@
15162
15612
  canvas: params.canvas
15163
15613
  }), this.state = "normal", this.renderCount = 0, this.tryInitEventSystem(), this._background = null !== (_w = params.background) && void 0 !== _w ? _w : DefaultConfig.BACKGROUND, this.stage = this, this.appendChild(this.layerService.createLayer(this, {
15164
15614
  main: !0
15165
- })), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, ensureStageStatePerfMonitor(this), this._stateBatchScheduler = new StateBatchScheduler(this, ensureStageStatePerfMonitor(this)), this.rootSharedStateScope = createRootSharedStateScope(this, null === (_x = this.theme) || void 0 === _x ? void 0 : _x.stateDefinitions), this.theme.onStateDefinitionsChange = () => {
15615
+ })), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.theme.onStateDefinitionsChange = () => {
15166
15616
  var _a;
15167
- this.rootSharedStateScope && (setRootSharedStateScopeThemeDefinitions(this.rootSharedStateScope, null === (_a = this.theme) || void 0 === _a ? void 0 : _a.stateDefinitions), markScopeActiveDescendantsDirty(this.rootSharedStateScope, this));
15617
+ const definitions = null === (_a = this.theme) || void 0 === _a ? void 0 : _a.stateDefinitions;
15618
+ if (!definitions || !Object.keys(definitions).length) return void (this.rootSharedStateScope && (setRootSharedStateScopeThemeDefinitions(this.rootSharedStateScope, definitions), markScopeActiveDescendantsDirty(this.rootSharedStateScope, this)));
15619
+ const rootScope = this.ensureRootSharedStateScope(definitions);
15620
+ setRootSharedStateScopeThemeDefinitions(rootScope, definitions), markScopeActiveDescendantsDirty(rootScope, this);
15168
15621
  }, this.renderStyle = params.renderStyle, params.autoRender && this.enableAutoRender(), params.autoRefresh && this.enableAutoRefresh(), !1 === params.disableDirtyBounds && this.enableDirtyBounds(), params.enableHtmlAttribute && this.enableHtmlAttribute(params.enableHtmlAttribute), params.ReactDOM && this.enableReactAttribute(params.ReactDOM), params.enableLayout && this.enableLayout(), this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender), params.beforeRender && this._beforeRenderList.push(params.beforeRender), params.afterRender && this._afterRenderList.push(params.afterRender), this.hooks.afterClearScreen.tap("constructor", this.afterClearScreen), this.hooks.afterClearRect.tap("constructor", this.afterClearRect), this._afterClearScreen = params.afterClearScreen, this._afterClearRect = params.afterClearRect, this.supportInteractiveLayer = !1 !== params.interactiveLayer, params.optimize || (params.optimize = {
15169
15622
  tickRenderMode: "effect"
15170
15623
  }), this.optmize(params.optimize), params.background && isString$1(this._background) && this._background.includes("/") && this.setAttributes({
15171
15624
  background: this._background
15172
- }), this.initAnimate(params), this.rafId = null !== (_y = params.rafId) && void 0 !== _y ? _y : Math.floor(6 * Math.random());
15625
+ }), this.initAnimate(params), this.rafId = null !== (_x = params.rafId) && void 0 !== _x ? _x : Math.floor(6 * Math.random());
15173
15626
  }
15174
15627
  initAnimate(params) {
15175
15628
  var _a;
@@ -15429,8 +15882,14 @@
15429
15882
  this._doRenderInThisFrame(), this.willNextFrameRender = !1;
15430
15883
  }));
15431
15884
  }
15885
+ ensureRootSharedStateScope(themeStateDefinitions) {
15886
+ return this.rootSharedStateScope ? (this.rootSharedStateScope.ownerStage = this, this.rootSharedStateScope) : (this.rootSharedStateScope = createRootSharedStateScope(this, themeStateDefinitions), this.rootSharedStateScope);
15887
+ }
15888
+ getStateBatchScheduler() {
15889
+ return this._stateBatchScheduler || (this._stateBatchScheduler = new StateBatchScheduler(this, ensureStageStatePerfMonitor(this))), this._stateBatchScheduler;
15890
+ }
15432
15891
  scheduleStateBatch(graphics, targetStates) {
15433
- this._stateBatchScheduler.schedule(graphics, targetStates);
15892
+ this.getStateBatchScheduler().schedule(graphics, targetStates);
15434
15893
  }
15435
15894
  getStatePerfSnapshot() {
15436
15895
  return ensureStageStatePerfMonitor(this).getSnapshot();
@@ -17931,7 +18390,11 @@
17931
18390
  };
17932
18391
  class BaseRender {
17933
18392
  init(contributions) {
17934
- 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 === exports.BaseRenderContributionTime.beforeFillStroke), this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === exports.BaseRenderContributionTime.afterFillStroke));
18393
+ this.builtinContributions || (this.builtinContributions = []), this._renderContribitions = contributions ? contributions.getContributions().slice() : [];
18394
+ const addContribution = item => {
18395
+ this._renderContribitions.includes(item) || this._renderContribitions.push(item);
18396
+ };
18397
+ 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 === exports.BaseRenderContributionTime.beforeFillStroke), this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === exports.BaseRenderContributionTime.afterFillStroke)) : (this._beforeRenderContribitions = [], this._afterRenderContribitions = []);
17935
18398
  }
17936
18399
  reInit() {
17937
18400
  this.init(this.graphicRenderContributions);
@@ -22980,8 +23443,8 @@
22980
23443
  graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === this.pluginService.stage && graphic.isContainer && !this.skipBoundsTrigger && _tempBounds.copy(bounds);
22981
23444
  }), stage.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, (graphic, stage, bounds, params, selfChange) => {
22982
23445
  stage && stage === this.pluginService.stage && graphic.isContainer && !this.skipBoundsTrigger && (_tempBounds.equals(bounds) || this.tryLayout(graphic, !1));
22983
- }), stage.graphicService.hooks.onSetStage.tap(this.key, graphic => {
22984
- graphic.glyphHost && (graphic = graphic.glyphHost), this.tryLayout(graphic, !1);
23446
+ }), stage.graphicService.hooks.onSetStage.tap(this.key, (graphic, nextStage) => {
23447
+ nextStage && nextStage === this.pluginService.stage && (graphic.glyphHost && (graphic = graphic.glyphHost), this.tryLayout(graphic, !1));
22985
23448
  }));
22986
23449
  }
22987
23450
  deactivate(context) {
@@ -23544,7 +24007,6 @@
23544
24007
  segments: segments,
23545
24008
  shouldClipImageByLayout: shouldClipImageByLayout,
23546
24009
  shouldUseMat4: shouldUseMat4,
23547
- shouldUseSimpleAttributeFastPath: shouldUseSimpleAttributeFastPath,
23548
24010
  snapLength: snapLength,
23549
24011
  splitArc: splitArc,
23550
24012
  splitArea: splitArea,
@@ -32343,7 +32805,67 @@
32343
32805
  return !1;
32344
32806
  }
32345
32807
 
32808
+ const animateUpdateContext = {
32809
+ type: exports.AttributeUpdateType.ANIMATE_UPDATE
32810
+ },
32811
+ animateBindContext = {
32812
+ type: exports.AttributeUpdateType.ANIMATE_BIND
32813
+ },
32814
+ animateStartContext = {
32815
+ type: exports.AttributeUpdateType.ANIMATE_START
32816
+ };
32817
+ function getAnimationContext(type) {
32818
+ switch (type) {
32819
+ case exports.AttributeUpdateType.ANIMATE_UPDATE:
32820
+ return animateUpdateContext;
32821
+ case exports.AttributeUpdateType.ANIMATE_BIND:
32822
+ return animateBindContext;
32823
+ case exports.AttributeUpdateType.ANIMATE_START:
32824
+ return animateStartContext;
32825
+ default:
32826
+ return {
32827
+ type: type
32828
+ };
32829
+ }
32830
+ }
32831
+ function prepareAnimationFrameAttribute(target) {
32832
+ const transientTarget = target;
32833
+ return transientTarget.attribute || (transientTarget.attribute = {}), transientTarget.attribute === transientTarget.baseAttributes && "function" == typeof transientTarget.detachAttributeFromBaseAttributes && transientTarget.detachAttributeFromBaseAttributes(), transientTarget.attributeMayContainTransientAttrs = !0, transientTarget.attribute;
32834
+ }
32835
+ function commitAnimationFrameAttribute(target) {
32836
+ var _a, _b;
32837
+ null === (_b = (_a = target).onAttributeUpdate) || void 0 === _b || _b.call(_a, animateUpdateContext);
32838
+ }
32839
+ function applyAnimationFrameAttributes(target, attributes) {
32840
+ if (!attributes) return;
32841
+ const targetAttribute = prepareAnimationFrameAttribute(target);
32842
+ for (const key in attributes) Object.prototype.hasOwnProperty.call(attributes, key) && (targetAttribute[key] = attributes[key]);
32843
+ commitAnimationFrameAttribute(target);
32844
+ }
32845
+ function applyAnimationFrameNumberAttributes(target, keys, from, to, ratio) {
32846
+ const targetAttribute = prepareAnimationFrameAttribute(target);
32847
+ for (let i = 0; i < keys.length; i++) {
32848
+ const key = keys[i];
32849
+ targetAttribute[key] = from[key] + (to[key] - from[key]) * ratio;
32850
+ }
32851
+ commitAnimationFrameAttribute(target);
32852
+ }
32853
+ function applyAnimationTransientAttributes(target, attributes, type = exports.AttributeUpdateType.ANIMATE_UPDATE) {
32854
+ var _a;
32855
+ if (!attributes) return;
32856
+ const context = getAnimationContext(type),
32857
+ transientTarget = target;
32858
+ "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);
32859
+ }
32860
+ function applyAppearStartAttributes(target, attributes) {
32861
+ applyAnimationTransientAttributes(target, attributes, exports.AttributeUpdateType.ANIMATE_BIND);
32862
+ }
32863
+
32346
32864
  function noop() {}
32865
+ function includesKey$1(keys, key) {
32866
+ for (let i = 0; i < keys.length; i++) if (keys[i] === key) return !0;
32867
+ return !1;
32868
+ }
32347
32869
  class Step {
32348
32870
  constructor(type, props, duration, easing) {
32349
32871
  var _a;
@@ -32399,6 +32921,17 @@
32399
32921
  onBind() {
32400
32922
  "glyph" === this.target.type && (this.syncAttributeUpdate = this._syncAttributeUpdate);
32401
32923
  }
32924
+ runInterpolateUpdate(fromProps, toProps, ratio) {
32925
+ if (this.animate.interpolateUpdateFunction) return void this.animate.interpolateUpdateFunction(fromProps, toProps, ratio, this, this.target);
32926
+ const funcs = this.interpolateUpdateFunctions,
32927
+ propKeys = this.propKeys;
32928
+ if (funcs && propKeys) for (let index = 0; index < funcs.length; index++) {
32929
+ const key = propKeys[index],
32930
+ fromValue = fromProps[key],
32931
+ toValue = toProps[key];
32932
+ funcs[index](key, fromValue, toValue, ratio, this, this.target);
32933
+ }
32934
+ }
32402
32935
  onFirstRun() {}
32403
32936
  onStart() {
32404
32937
  if (!this._hasFirstRun) {
@@ -32413,23 +32946,49 @@
32413
32946
  tryPreventConflict() {
32414
32947
  var _a, _b;
32415
32948
  const animate = this.animate,
32416
- target = this.target;
32417
- (null !== (_b = null === (_a = target.forEachTrackedAnimate) || void 0 === _a ? void 0 : _a.bind(target)) && void 0 !== _b ? _b : cb => {
32418
- var _a;
32419
- null === (_a = target.animates) || void 0 === _a || _a.forEach(cb);
32420
- })(a => {
32949
+ target = this.target,
32950
+ forEachTrackedAnimate = null !== (_b = null === (_a = target.forEachTrackedAnimate) || void 0 === _a ? void 0 : _a.bind(target)) && void 0 !== _b ? _b : cb => {
32951
+ var _a;
32952
+ null === (_a = target.animates) || void 0 === _a || _a.forEach(cb);
32953
+ },
32954
+ propKeys = this.propKeys;
32955
+ forEachTrackedAnimate(a => {
32421
32956
  if (a === animate || a.priority > animate.priority || a.priority === 1 / 0) return;
32422
32957
  const fromProps = a.getStartProps();
32423
- this.propKeys.forEach(key => {
32424
- null != fromProps[key] && a.preventAttr(key);
32425
- });
32958
+ let conflictKeys = null;
32959
+ for (let i = 0; i < propKeys.length; i++) {
32960
+ const key = propKeys[i];
32961
+ null != fromProps[key] && (null != conflictKeys ? conflictKeys : conflictKeys = []).push(key);
32962
+ }
32963
+ conflictKeys && a.preventAttrs(conflictKeys);
32426
32964
  });
32427
32965
  }
32966
+ removeKeysFromRecord(record, keys) {
32967
+ if (!record) return record;
32968
+ let hasBlockedKey = !1;
32969
+ for (const key in record) if (Object.prototype.hasOwnProperty.call(record, key) && includesKey$1(keys, key)) {
32970
+ hasBlockedKey = !0;
32971
+ break;
32972
+ }
32973
+ if (!hasBlockedKey) return record;
32974
+ const nextRecord = {};
32975
+ for (const key in record) Object.prototype.hasOwnProperty.call(record, key) && !includesKey$1(keys, key) && (nextRecord[key] = record[key]);
32976
+ return nextRecord;
32977
+ }
32428
32978
  deleteSelfAttr(key) {
32979
+ this.deleteSelfAttrs([key]);
32980
+ }
32981
+ deleteSelfAttrs(keys) {
32429
32982
  var _a;
32430
- delete this.props[key], this.fromProps && delete this.fromProps[key];
32431
- const index = this.propKeys.indexOf(key);
32432
- -1 !== index && (this.propKeys.splice(index, 1), null === (_a = this.interpolateUpdateFunctions) || void 0 === _a || _a.splice(index, 1));
32983
+ 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)) {
32984
+ const funcs = this.interpolateUpdateFunctions;
32985
+ let writeIndex = 0;
32986
+ for (let readIndex = 0; readIndex < this.propKeys.length; readIndex++) {
32987
+ const propKey = this.propKeys[readIndex];
32988
+ includesKey$1(keys, propKey) || (writeIndex !== readIndex && (this.propKeys[writeIndex] = propKey, funcs && (funcs[writeIndex] = funcs[readIndex])), writeIndex++);
32989
+ }
32990
+ this.propKeys.length = writeIndex, funcs && (funcs.length = writeIndex);
32991
+ }
32433
32992
  }
32434
32993
  trySyncStartProps() {
32435
32994
  this.propKeys.forEach(key => {
@@ -32439,11 +32998,7 @@
32439
32998
  update(end, ratio, out) {
32440
32999
  if (this.onStart(), !this.props || !this.propKeys) return;
32441
33000
  const easedRatio = this.easing(ratio);
32442
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
32443
- if (!this.animate.validAttr(this.propKeys[index])) return;
32444
- const key = this.propKeys[index];
32445
- func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
32446
- }), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
33001
+ this.runInterpolateUpdate(this.fromProps, this.props, easedRatio), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
32447
33002
  }
32448
33003
  onUpdate(end, ratio, out) {}
32449
33004
  onEnd(cb) {
@@ -32468,7 +33023,7 @@
32468
33023
  onStart() {
32469
33024
  super.onStart();
32470
33025
  const fromProps = this.getFromProps();
32471
- this.target.setAttributes(fromProps);
33026
+ applyAnimationTransientAttributes(this.target, fromProps, exports.AttributeUpdateType.ANIMATE_START);
32472
33027
  }
32473
33028
  update(end, ratio, out) {
32474
33029
  this.onStart();
@@ -32647,19 +33202,34 @@
32647
33202
  }), this.applyTransientFromAttributes();
32648
33203
  }
32649
33204
  deleteSelfAttr(key) {
32650
- super.deleteSelfAttr(key), delete this.from[key];
33205
+ this.deleteSelfAttrs([key]);
33206
+ }
33207
+ deleteSelfAttrs(keys) {
33208
+ super.deleteSelfAttrs(keys), this.from = this.removeKeysFromRecord(this.from, keys);
32651
33209
  }
32652
33210
  update(end, ratio, out) {
32653
33211
  if (this.onStart(), !this.props || !this.propKeys) return;
32654
33212
  const easedRatio = this.easing(ratio);
32655
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.from, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
32656
- if (!this.animate.validAttr(this.propKeys[index])) return;
32657
- const key = this.propKeys[index];
32658
- func(key, this.from[key], this.props[key], easedRatio, this, this.target);
32659
- }), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
33213
+ this.runInterpolateUpdate(this.from, this.props, easedRatio), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
32660
33214
  }
32661
33215
  }
32662
33216
 
33217
+ function includesKey(keys, key) {
33218
+ for (let i = 0; i < keys.length; i++) if (keys[i] === key) return !0;
33219
+ return !1;
33220
+ }
33221
+ function removeKeysFromRecord(record, keys) {
33222
+ if (!record) return record;
33223
+ let hasBlockedKey = !1;
33224
+ for (const key in record) if (Object.prototype.hasOwnProperty.call(record, key) && includesKey(keys, key)) {
33225
+ hasBlockedKey = !0;
33226
+ break;
33227
+ }
33228
+ if (!hasBlockedKey) return record;
33229
+ const nextRecord = {};
33230
+ for (const key in record) Object.prototype.hasOwnProperty.call(record, key) && !includesKey(keys, key) && (nextRecord[key] = record[key]);
33231
+ return nextRecord;
33232
+ }
32663
33233
  class Animate {
32664
33234
  constructor(id = Generator.GenAutoIncrementId(), timeline = defaultTimeline, slience) {
32665
33235
  this.id = id, this.status = exports.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;
@@ -32682,8 +33252,8 @@
32682
33252
  bind(target) {
32683
33253
  this.target = target;
32684
33254
  const trackerTarget = this.target;
32685
- 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(() => {
32686
- this.stop(), "function" == typeof trackerTarget.restoreStaticAttribute && trackerTarget.restoreStaticAttribute(), "function" == typeof trackerTarget.untrackAnimate ? trackerTarget.untrackAnimate(this.id) : this.target.animates.delete(this.id);
33255
+ 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(() => {
33256
+ this.stop(), this.__skipRestoreStaticAttributeOnRemove || "function" != typeof trackerTarget.restoreStaticAttribute || trackerTarget.restoreStaticAttribute(), "function" == typeof trackerTarget.untrackAnimate ? trackerTarget.untrackAnimate(this.id) : this.target.animates.delete(this.id);
32687
33257
  }), this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.target.animationAttribute || (this.target.animationAttribute = {}), this;
32688
33258
  }
32689
33259
  to(props, duration = 300, easing = "linear") {
@@ -32747,12 +33317,14 @@
32747
33317
  cb ? (this._onRemove || (this._onRemove = []), this._onRemove.push(cb)) : null === (_a = this._onRemove) || void 0 === _a || _a.forEach(cb => cb());
32748
33318
  }
32749
33319
  preventAttr(key) {
32750
- this._preventAttrs.add(key), delete this._startProps[key], delete this._endProps[key];
32751
- let step = this._firstStep;
32752
- for (; step;) step.deleteSelfAttr(key), step = step.next;
33320
+ this.preventAttrs([key]);
32753
33321
  }
32754
33322
  preventAttrs(keys) {
32755
- keys.forEach(key => this._preventAttrs.add(key));
33323
+ if (!(null == keys ? void 0 : keys.length)) return;
33324
+ for (let i = 0; i < keys.length; i++) this._preventAttrs.add(keys[i]);
33325
+ this._startProps = removeKeysFromRecord(this._startProps, keys), this._endProps = removeKeysFromRecord(this._endProps, keys);
33326
+ let step = this._firstStep;
33327
+ for (; step;) step.deleteSelfAttrs(keys), step = step.next;
32756
33328
  }
32757
33329
  validAttr(key) {
32758
33330
  return !this._preventAttrs.has(key);
@@ -32819,7 +33391,7 @@
32819
33391
  if (nextTime >= this._startTime + this._totalDuration) {
32820
33392
  null === (_a = this._lastStep) || void 0 === _a || _a.onUpdate(!0, 1, {}), null === (_b = this._lastStep) || void 0 === _b || _b.onEnd(), this.onEnd(), this.status = exports.AnimateStatus.END;
32821
33393
  const trackerTarget = this.target;
32822
- return void ("function" == typeof (null == trackerTarget ? void 0 : trackerTarget.restoreStaticAttribute) && trackerTarget.restoreStaticAttribute());
33394
+ return "function" == typeof (null == trackerTarget ? void 0 : trackerTarget.restoreStaticAttribute) && trackerTarget.restoreStaticAttribute(), void (this.__skipRestoreStaticAttributeOnRemove = !0);
32823
33395
  }
32824
33396
  this.status = exports.AnimateStatus.RUNNING, this.currentTime <= this._startTime && this.onStart(), this.currentTime = nextTime;
32825
33397
  let cycleTime = nextTime - this._startTime,
@@ -32830,7 +33402,7 @@
32830
33402
  const currentLoop = Math.floor((nextTime - this._startTime) / this._duration);
32831
33403
  newLoop = currentLoop > this._currentLoop, this._currentLoop = currentLoop, bounceTime = this._bounce && currentLoop % 2 == 1, bounceTime && (cycleTime = this._duration - cycleTime);
32832
33404
  }
32833
- newLoop && !bounceTime && this.target.setAttributes(this._startProps);
33405
+ newLoop && !bounceTime && applyAnimationTransientAttributes(this.target, this._startProps, exports.AttributeUpdateType.ANIMATE_START);
32834
33406
  let targetStep = null;
32835
33407
  if (this._lastStep === this._firstStep) targetStep = this._firstStep;else {
32836
33408
  let currentStep = this._firstStep;
@@ -33117,6 +33689,9 @@
33117
33689
  })), this.registerTransition("state", "*", () => ({
33118
33690
  allowTransition: !0,
33119
33691
  stopOriginalTransition: !1
33692
+ })), this.registerTransition("state", "state", () => ({
33693
+ allowTransition: !0,
33694
+ stopOriginalTransition: !0
33120
33695
  })), this.registerTransition("state", "disappear", () => ({
33121
33696
  allowTransition: !0,
33122
33697
  stopOriginalTransition: !0
@@ -33173,6 +33748,33 @@
33173
33748
  cb();
33174
33749
  });
33175
33750
  }
33751
+ getActiveAttrKeys() {
33752
+ const keys = [];
33753
+ for (let i = 0; i < this._animates.length; i++) {
33754
+ const animate = this._animates[i];
33755
+ if (animate.status === exports.AnimateStatus.END) continue;
33756
+ const endProps = animate.getEndProps();
33757
+ if (endProps) for (const key in endProps) Object.prototype.hasOwnProperty.call(endProps, key) && keys.indexOf(key) < 0 && keys.push(key);
33758
+ }
33759
+ return keys;
33760
+ }
33761
+ hasActiveAttrs() {
33762
+ for (let i = 0; i < this._animates.length; i++) {
33763
+ const animate = this._animates[i];
33764
+ if (animate.status === exports.AnimateStatus.END) continue;
33765
+ const endProps = animate.getEndProps();
33766
+ if (endProps) for (const key in endProps) if (Object.prototype.hasOwnProperty.call(endProps, key)) return !0;
33767
+ }
33768
+ return !1;
33769
+ }
33770
+ preventAttrs(keys) {
33771
+ if (!(null == keys ? void 0 : keys.length)) return this.hasActiveAttrs();
33772
+ for (let i = 0; i < this._animates.length; i++) {
33773
+ const animate = this._animates[i];
33774
+ animate.status !== exports.AnimateStatus.END && animate.preventAttrs(keys);
33775
+ }
33776
+ return this.hasActiveAttrs();
33777
+ }
33176
33778
  _trackAnimation(animate) {
33177
33779
  this._animates.push(animate), this._activeCount++, 1 !== this._activeCount || this._started || (this._started = !0, this.onStart()), animate.onEnd(() => {
33178
33780
  this._activeCount--;
@@ -33295,7 +33897,8 @@
33295
33897
  let parsedFromProps = null,
33296
33898
  props = params.to,
33297
33899
  from = params.from;
33298
- 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);
33900
+ const commitAttrOutChannel = this.shouldCommitAttrOutChannel(type);
33901
+ 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);
33299
33902
  let totalDelay = 0;
33300
33903
  oneByOneDelay && (totalDelay = oneByOneDelay * (count - index - 1));
33301
33904
  const delayAfterValue = isFunction$1(delayAfter) ? delayAfter(null === (_h = null === (_g = graphic.context) || void 0 === _g ? void 0 : _g.data) || void 0 === _h ? void 0 : _h[0], graphic, {}) : delayAfter;
@@ -33358,7 +33961,8 @@
33358
33961
  let parsedFromProps = null,
33359
33962
  props = effect.to,
33360
33963
  from = effect.from;
33361
- 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);
33964
+ const commitAttrOutChannel = this.shouldCommitAttrOutChannel(type);
33965
+ 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);
33362
33966
  const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
33363
33967
  customType = effect.custom ? effect.customType : getCustomType(custom);
33364
33968
  this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
@@ -33372,11 +33976,14 @@
33372
33976
  interpolator(ratio, from, to, step, target, animate.target, customParams);
33373
33977
  }, animate.to(props, duration, easing);
33374
33978
  }
33979
+ shouldCommitAttrOutChannel(type) {
33980
+ return "update" !== type;
33981
+ }
33375
33982
  createCustomAnimation(animate, CustomAnimateConstructor, from, props, duration, easing, customParams) {
33376
33983
  const customAnimate = new CustomAnimateConstructor(from, props, duration, easing, customParams);
33377
33984
  animate.play(customAnimate);
33378
33985
  }
33379
- createPropsFromChannel(channel, graphic) {
33986
+ createPropsFromChannel(channel, graphic, includeAttrOutChannel = !0) {
33380
33987
  var _a;
33381
33988
  const props = {};
33382
33989
  let from = null;
@@ -33385,7 +33992,7 @@
33385
33992
  props: props,
33386
33993
  attrOutChannel: null
33387
33994
  };
33388
- const attrOutChannel = {};
33995
+ const attrOutChannel = includeAttrOutChannel ? {} : null;
33389
33996
  let hasAttrs = !1;
33390
33997
  const diffAttrs = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs;
33391
33998
  if (Array.isArray(channel) && (channel = channel.reduce((res, key) => (void 0 === diffAttrs[key] || (res[key] = {
@@ -33394,9 +34001,10 @@
33394
34001
  var _a, _b, _c, _d;
33395
34002
  const config = channel[key];
33396
34003
  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);
33397
- }), diffAttrs) for (const key in diffAttrs) {
34004
+ }), diffAttrs && attrOutChannel) for (const key in diffAttrs) {
33398
34005
  const value = diffAttrs[key];
33399
- void 0 !== value && (props.hasOwnProperty(key) || (attrOutChannel[key] = value, hasAttrs = !0));
34006
+ if (void 0 === value) continue;
34007
+ props.hasOwnProperty(key) || !!(null == from ? void 0 : from.hasOwnProperty(key)) || (attrOutChannel[key] = value, hasAttrs = !0);
33400
34008
  }
33401
34009
  return {
33402
34010
  from: from,
@@ -33421,7 +34029,7 @@
33421
34029
  stop(type, callEnd = !0) {
33422
34030
  for (; this._animates.length > 0;) {
33423
34031
  const animate = this._animates.pop();
33424
- !1 === callEnd && (animate.status = exports.AnimateStatus.END), null == animate || animate.stop(type);
34032
+ !1 === callEnd && (animate.status = exports.AnimateStatus.END, animate.__skipRestoreStaticAttributeOnRemove = !0), null == animate || animate.stop(type);
33425
34033
  }
33426
34034
  this._animates = [], this._activeCount = 0, this._started && (this._started = !1, callEnd && this.onEnd());
33427
34035
  }
@@ -33472,8 +34080,22 @@
33472
34080
  hasTrackedAnimate() {
33473
34081
  return this.trackedAnimates.size > 0;
33474
34082
  }
34083
+ hasStateInfo(list, target) {
34084
+ for (let i = 0; i < list.length; i++) if (list[i] === target) return !0;
34085
+ return !1;
34086
+ }
34087
+ takeOverUpdateAttrs(nextState, currentStates, shouldStopState) {
34088
+ if (nextState.state !== AnimationStates.UPDATE || !currentStates.length) return;
34089
+ const nextKeys = nextState.executor.getActiveAttrKeys();
34090
+ if (nextKeys.length) for (let i = 0; i < currentStates.length; i++) {
34091
+ const currentState = currentStates[i];
34092
+ currentState.state !== AnimationStates.UPDATE || currentState === nextState || this.hasStateInfo(shouldStopState, currentState) || currentState.executor.preventAttrs(nextKeys) || (currentState.executor.stop(null, !1), shouldStopState.push(currentState));
34093
+ }
34094
+ }
33475
34095
  applyState(nextState, animationConfig, callback) {
34096
+ var _a;
33476
34097
  const registry = AnimationTransitionRegistry.getInstance(),
34098
+ currentStateList = null !== (_a = this.stateList) && void 0 !== _a ? _a : [],
33477
34099
  shouldStopState = [],
33478
34100
  shouldApplyState = [];
33479
34101
  if (this.stateList && this.stateList.length ? nextState.forEach((state, index) => {
@@ -33481,14 +34103,14 @@
33481
34103
  allowTransition: !0,
33482
34104
  stopOriginalTransition: !0
33483
34105
  };
33484
- this.stateList.forEach(currState => {
34106
+ currentStateList.forEach(currState => {
33485
34107
  const _result = registry.isTransitionAllowed(currState.state, state, this.graphic);
33486
34108
  result.allowTransition = result.allowTransition && _result.allowTransition;
33487
34109
  }), result.allowTransition && (shouldApplyState.push({
33488
34110
  state: state,
33489
34111
  animationConfig: isArray$1(animationConfig[index]) ? animationConfig[index].map(item => item.animation) : animationConfig[index].animation,
33490
34112
  executor: new AnimateExecutor(this.graphic)
33491
- }), this.stateList.forEach(currState => {
34113
+ }), currentStateList.forEach(currState => {
33492
34114
  registry.isTransitionAllowed(currState.state, state, this.graphic).stopOriginalTransition && shouldStopState.push(currState);
33493
34115
  }));
33494
34116
  }) : nextState.forEach((state, index) => {
@@ -33500,12 +34122,18 @@
33500
34122
  }), shouldStopState.forEach(state => {
33501
34123
  state.executor.stop(null, !1);
33502
34124
  }), shouldApplyState.length) {
33503
- shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig);
34125
+ shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig), this.takeOverUpdateAttrs(shouldApplyState[0], currentStateList, shouldStopState);
33504
34126
  for (let i = 0; i < shouldApplyState.length; i++) {
33505
34127
  const nextState = shouldApplyState[i + 1],
33506
34128
  currentState = shouldApplyState[i];
33507
34129
  currentState.executor.onEnd(() => {
33508
- nextState && nextState.executor.execute(nextState.animationConfig), this.stateList = this.stateList.filter(state => state !== currentState), i === shouldApplyState.length - 1 && callback && callback(!1);
34130
+ var _a;
34131
+ if (nextState) {
34132
+ nextState.executor.execute(nextState.animationConfig);
34133
+ const stoppedStates = [];
34134
+ 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)));
34135
+ }
34136
+ this.stateList = this.stateList.filter(state => state !== currentState), i === shouldApplyState.length - 1 && callback && callback(!1);
33509
34137
  });
33510
34138
  }
33511
34139
  } else callback && callback(!0);
@@ -33748,8 +34376,11 @@
33748
34376
  }), this));
33749
34377
  }
33750
34378
  deleteSelfAttr(key) {
34379
+ this.deleteSelfAttrs([key]);
34380
+ }
34381
+ deleteSelfAttrs(keys) {
33751
34382
  this.tasks.forEach(task => {
33752
- task.animate && task.animate.forEach(animate => animate.preventAttr(key));
34383
+ task.animate && task.animate.forEach(animate => animate.preventAttrs(keys));
33753
34384
  });
33754
34385
  }
33755
34386
  stop(type) {
@@ -33854,7 +34485,9 @@
33854
34485
  const parts = formattedNumber.toString().split(".");
33855
34486
  parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","), formattedWithBasicFormat = parts.join(".");
33856
34487
  } else formattedWithBasicFormat = formattedNumber;
33857
- formattedText = this.formatTemplate ? this.formatTemplate.replace("{{var}}", formattedWithBasicFormat.toString()) : formattedWithBasicFormat, this.target.setAttribute("text", formattedText);
34488
+ formattedText = this.formatTemplate ? this.formatTemplate.replace("{{var}}", formattedWithBasicFormat.toString()) : formattedWithBasicFormat, applyAnimationTransientAttributes(this.target, {
34489
+ text: formattedText
34490
+ });
33858
34491
  }
33859
34492
  }
33860
34493
 
@@ -33961,7 +34594,7 @@
33961
34594
  onUpdate(end, ratio, out) {
33962
34595
  const target = this.target,
33963
34596
  pathProxy = "function" == typeof target.pathProxy ? target.pathProxy(target.attribute) : target.pathProxy;
33964
- interpolateMorphingData(this.morphingData, pathProxy, ratio), this.otherAttrs && this.otherAttrs.length && interpolateOtherAttrs(this.otherAttrs, out, ratio), this.target.setAttributes(out), end && !this.saveOnEnd && (this.target.pathProxy = null);
34597
+ interpolateMorphingData(this.morphingData, pathProxy, ratio), this.otherAttrs && this.otherAttrs.length && interpolateOtherAttrs(this.otherAttrs, out, ratio), end && this.saveOnEnd ? this.target.setAttributes(out) : applyAnimationTransientAttributes(this.target, out), end && !this.saveOnEnd && (this.target.pathProxy = null);
33965
34598
  }
33966
34599
  }
33967
34600
  const morphPath = (fromGraphic, toGraphic, animationConfig, fromGraphicTransform) => {
@@ -34192,7 +34825,9 @@
34192
34825
  const blinkRate = .1;
34193
34826
  Math.floor(ratio / blinkRate) % 2 == 0 && (displayText = this.beforeText + currentText + this.cursorChar + this.afterText);
34194
34827
  } else displayText = this.beforeText + currentText + this.cursorChar + this.afterText;
34195
- this.target.setAttribute("text", displayText);
34828
+ applyAnimationTransientAttributes(this.target, {
34829
+ text: displayText
34830
+ });
34196
34831
  }
34197
34832
  }
34198
34833
 
@@ -34201,11 +34836,9 @@
34201
34836
  super(null, {}, duration, easing, params), this.clipFromAttribute = from, this.clipToAttribute = to, this._group = null == params ? void 0 : params.group, this._clipGraphic = null == params ? void 0 : params.clipGraphic;
34202
34837
  }
34203
34838
  onBind() {
34204
- super.onBind(), this._group && this._clipGraphic && (this._lastClip = this._group.attribute.clip, this._lastPath = this._group.attribute.path, this._group.setAttributes({
34839
+ super.onBind(), this._group && this._clipGraphic && (this._lastClip = this._group.attribute.clip, this._lastPath = this._group.attribute.path, applyAppearStartAttributes(this._group, {
34205
34840
  clip: !0,
34206
34841
  path: [this._clipGraphic]
34207
- }, !1, {
34208
- type: exports.AttributeUpdateType.ANIMATE_BIND
34209
34842
  }));
34210
34843
  }
34211
34844
  onEnd() {
@@ -34341,6 +34974,25 @@
34341
34974
  }
34342
34975
  }
34343
34976
 
34977
+ function buildAnimationStaticCommitAttrs(target, keys, animate, fallbackAttrs) {
34978
+ var _a;
34979
+ const commitTarget = target,
34980
+ contextFinalAttrs = null === (_a = commitTarget.context) || void 0 === _a ? void 0 : _a.finalAttrs,
34981
+ finalAttribute = "function" == typeof commitTarget.getFinalAttribute ? commitTarget.getFinalAttribute() : commitTarget.finalAttribute;
34982
+ let commitAttrs = null;
34983
+ for (let i = 0; i < keys.length; i++) {
34984
+ const key = keys[i];
34985
+ animate && !animate.validAttr(key) || (contextFinalAttrs && Object.prototype.hasOwnProperty.call(contextFinalAttrs, key) ? (null != commitAttrs || (commitAttrs = {}), commitAttrs[key] = contextFinalAttrs[key]) : finalAttribute && Object.prototype.hasOwnProperty.call(finalAttribute, key) ? (null != commitAttrs || (commitAttrs = {}), commitAttrs[key] = finalAttribute[key]) : fallbackAttrs && Object.prototype.hasOwnProperty.call(fallbackAttrs, key) && (null != commitAttrs || (commitAttrs = {}), commitAttrs[key] = fallbackAttrs[key]));
34986
+ }
34987
+ return commitAttrs;
34988
+ }
34989
+ function commitAnimationStaticAttrs(target, keys, animate, fallbackAttrs) {
34990
+ const commitAttrs = buildAnimationStaticCommitAttrs(target, keys, animate, fallbackAttrs);
34991
+ return !!commitAttrs && (target.setAttributes(commitAttrs, !1, {
34992
+ type: exports.AttributeUpdateType.ANIMATE_END
34993
+ }), !0);
34994
+ }
34995
+
34344
34996
  class TagPointsUpdate extends ACustomAnimate {
34345
34997
  constructor(from, to, duration, easing, params) {
34346
34998
  var _a, _b;
@@ -34359,21 +35011,9 @@
34359
35011
  }
34360
35012
  onBind() {
34361
35013
  super.onBind();
34362
- const {
34363
- points: points,
34364
- segments: segments
34365
- } = this.target.attribute,
34366
- {
34367
- points: pointsTo,
34368
- segments: segmentsTo
34369
- } = this.target.getFinalAttribute();
34370
- this.from = {
34371
- points: points,
34372
- segments: segments
34373
- }, this.to = {
34374
- points: pointsTo,
34375
- segments: segmentsTo
34376
- }, this.props = this.to;
35014
+ const currentAttribute = this.target.attribute,
35015
+ finalAttribute = this.target.getFinalAttribute();
35016
+ this.from = {}, this.to = {}, Object.prototype.hasOwnProperty.call(currentAttribute, "points") && (this.from.points = currentAttribute.points), Object.prototype.hasOwnProperty.call(currentAttribute, "segments") && (this.from.segments = currentAttribute.segments), finalAttribute && Object.prototype.hasOwnProperty.call(finalAttribute, "points") && (this.to.points = finalAttribute.points), finalAttribute && Object.prototype.hasOwnProperty.call(finalAttribute, "segments") && (this.to.segments = finalAttribute.segments), this.props = this.to;
34377
35017
  const originFromPoints = this.getPoints(this.from),
34378
35018
  originToPoints = this.getPoints(this.to, !0);
34379
35019
  this.fromPoints = originFromPoints ? Array.isArray(originFromPoints) ? originFromPoints : [originFromPoints] : [], this.toPoints = originToPoints ? Array.isArray(originToPoints) ? originToPoints : [originToPoints] : [];
@@ -34409,31 +35049,42 @@
34409
35049
  const lastClipRange = this.target.attribute.clipRange;
34410
35050
  isValidNumber$1(lastClipRange * this.clipRange) && (this.clipRange *= lastClipRange);
34411
35051
  }
35052
+ onEnd(cb) {
35053
+ cb ? super.onEnd(cb) : (this.to && commitAnimationStaticAttrs(this.target, Object.keys(this.to), this.animate, this.to), super.onEnd());
35054
+ }
35055
+ applyPointTransientAttributes(attributes) {
35056
+ const validAttrs = {};
35057
+ Object.keys(attributes).forEach(key => {
35058
+ this.animate.validAttr(key) && (validAttrs[key] = attributes[key]);
35059
+ }), Object.keys(validAttrs).length && (applyAnimationFrameAttributes(this.target, validAttrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag());
35060
+ }
34412
35061
  onUpdate(end, ratio, out) {
34413
- if (end) return Object.keys(this.to).forEach(k => {
34414
- this.target.attribute[k] = this.to[k];
34415
- }), this.target.addUpdatePositionTag(), void this.target.addUpdateShapeAndBoundsTag();
34416
- if (this.points = this.points.map((point, index) => {
34417
- const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
34418
- return newPoint.context = point.context, newPoint;
34419
- }), this.clipRange) {
34420
- if (this.shrinkClipRange) return void (end ? (out.points = this.toPoints, out.clipRange = 1) : (out.points = this.fromPoints, out.clipRange = this.clipRange - (this.clipRange - this.shrinkClipRange) * ratio));
34421
- this.target.setAttributes({
34422
- clipRange: this.clipRange + (1 - this.clipRange) * ratio
34423
- });
34424
- }
34425
- if (this.segmentsCache && this.to.segments) {
34426
- let start = 0;
34427
- const segments = this.to.segments.map((segment, index) => {
34428
- const end = start + this.segmentsCache[index],
34429
- points = this.points.slice(start, end);
34430
- return start = end, Object.assign(Object.assign({}, segment), {
34431
- points: points
35062
+ if (end) this.applyPointTransientAttributes(this.to);else {
35063
+ if (this.points = this.points.map((point, index) => {
35064
+ const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
35065
+ return newPoint.context = point.context, newPoint;
35066
+ }), this.clipRange) {
35067
+ if (this.shrinkClipRange) return void (end ? (out.points = this.toPoints, out.clipRange = 1) : (out.points = this.fromPoints, out.clipRange = this.clipRange - (this.clipRange - this.shrinkClipRange) * ratio));
35068
+ applyAnimationTransientAttributes(this.target, {
35069
+ clipRange: this.clipRange + (1 - this.clipRange) * ratio
34432
35070
  });
35071
+ }
35072
+ if (this.segmentsCache && this.to.segments) {
35073
+ let start = 0;
35074
+ const segments = this.to.segments.map((segment, index) => {
35075
+ const end = start + this.segmentsCache[index],
35076
+ points = this.points.slice(start, end);
35077
+ return start = end, Object.assign(Object.assign({}, segment), {
35078
+ points: points
35079
+ });
35080
+ });
35081
+ this.applyPointTransientAttributes({
35082
+ segments: segments
35083
+ });
35084
+ } else this.applyPointTransientAttributes({
35085
+ points: this.points
34433
35086
  });
34434
- this.target.attribute.segments = segments;
34435
- } else this.target.attribute.points = this.points;
34436
- this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35087
+ }
34437
35088
  }
34438
35089
  }
34439
35090
 
@@ -34451,13 +35102,13 @@
34451
35102
  this.keys.forEach(key => {
34452
35103
  var _a, _b, _c;
34453
35104
  to[key] = null !== (_a = null == attrs ? void 0 : attrs[key]) && void 0 !== _a ? _a : 1, from[key] = null !== (_c = null !== (_b = from[key]) && void 0 !== _b ? _b : fromAttrs[key]) && void 0 !== _c ? _c : 0;
34454
- }), null === (_d = (_c = this.target).applyFinalAttributeToAttribute) || void 0 === _d || _d.call(_c), this.props = to, this.propKeys = this.keys, this.from = from, this.to = to, !1 !== (null === (_e = this.params.controlOptions) || void 0 === _e ? void 0 : _e.immediatelyApply) && this.target.setAttributes(from);
35105
+ }), null === (_d = (_c = this.target).applyFinalAttributeToAttribute) || void 0 === _d || _d.call(_c), this.props = to, this.propKeys = this.keys, this.from = from, this.to = to, !1 !== (null === (_e = this.params.controlOptions) || void 0 === _e ? void 0 : _e.immediatelyApply) && applyAppearStartAttributes(this.target, from);
34455
35106
  }
34456
35107
  onUpdate(end, ratio, out) {
34457
- const attribute = this.target.attribute;
35108
+ const attrs = {};
34458
35109
  this.propKeys.forEach(key => {
34459
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
34460
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35110
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35111
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
34461
35112
  }
34462
35113
  }
34463
35114
  class CommonOut extends ACustomAnimate {
@@ -34472,16 +35123,16 @@
34472
35123
  this.keys.forEach(key => {
34473
35124
  var _a;
34474
35125
  to[key] = 0, from[key] = null !== (_a = attrs[key]) && void 0 !== _a ? _a : 1;
34475
- }), this.props = to, this.propKeys = this.keys, this.from = from, this.to = to, Object.assign(this.target.attribute, from), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
35126
+ }), this.props = to, this.propKeys = this.keys, this.from = from, this.to = to, applyAnimationTransientAttributes(this.target, from, exports.AttributeUpdateType.ANIMATE_BIND), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
34476
35127
  }
34477
35128
  onEnd(cb) {
34478
35129
  super.onEnd(cb);
34479
35130
  }
34480
35131
  onUpdate(end, ratio, out) {
34481
- const attribute = this.target.attribute;
35132
+ const attrs = {};
34482
35133
  this.propKeys.forEach(key => {
34483
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
34484
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35134
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35135
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
34485
35136
  }
34486
35137
  }
34487
35138
 
@@ -34524,8 +35175,7 @@
34524
35175
  onEnd() {}
34525
35176
  onUpdate(end, ratio, out) {
34526
35177
  if (null == this.phi || null == this.theta) return;
34527
- const target = this.target,
34528
- {
35178
+ const {
34529
35179
  center: center,
34530
35180
  r: r,
34531
35181
  cb: cb
@@ -34536,8 +35186,15 @@
34536
35186
  x = r * Math.sin(phi) * Math.cos(theta) + center.x,
34537
35187
  y = r * Math.cos(phi) + center.y,
34538
35188
  z = r * Math.sin(phi) * Math.sin(theta) + center.z;
34539
- for (target.attribute.x = x, target.attribute.y = y, target.attribute.z = z, target.attribute.alpha = theta + pi / 2; target.attribute.alpha > pi2;) target.attribute.alpha -= pi2;
34540
- target.attribute.alpha = pi2 - target.attribute.alpha, target.attribute.zIndex = -1e4 * target.attribute.z, cb && cb(out);
35189
+ let alpha = theta + pi / 2;
35190
+ for (; alpha > pi2;) alpha -= pi2;
35191
+ alpha = pi2 - alpha, applyAnimationFrameAttributes(this.target, {
35192
+ x: x,
35193
+ y: y,
35194
+ z: z,
35195
+ alpha: alpha,
35196
+ zIndex: -1e4 * z
35197
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag(), cb && cb(out);
34541
35198
  }
34542
35199
  }
34543
35200
 
@@ -34679,15 +35336,23 @@
34679
35336
  this.propKeys ? this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateAngle : "startAngle" === this.propKeys[0] ? this._updateFunction = this.updateStartAngle : "endAngle" === this.propKeys[0] ? this._updateFunction = this.updateEndAngle : this.valid = !1 : this.valid = !1;
34680
35337
  }
34681
35338
  deleteSelfAttr(key) {
34682
- delete this.props[key], this.fromProps && delete this.fromProps[key];
34683
- const index = this.propKeys.indexOf(key);
34684
- -1 !== index && this.propKeys.splice(index, 1), this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateAngle : "startAngle" === this.propKeys[0] ? this._updateFunction = this.updateStartAngle : "endAngle" === this.propKeys[0] ? this._updateFunction = this.updateEndAngle : this._updateFunction = null;
35339
+ this.deleteSelfAttrs([key]);
35340
+ }
35341
+ deleteSelfAttrs(keys) {
35342
+ var _a;
35343
+ super.deleteSelfAttrs(keys);
35344
+ const firstKey = null === (_a = this.propKeys) || void 0 === _a ? void 0 : _a[0];
35345
+ this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateAngle : this._updateFunction = "startAngle" === firstKey ? this.updateStartAngle : "endAngle" === firstKey ? this.updateEndAngle : null;
34685
35346
  }
34686
35347
  updateStartAngle(ratio) {
34687
- this.target.attribute.startAngle = this.from.startAngle + (this.to.startAngle - this.from.startAngle) * ratio;
35348
+ applyAnimationFrameAttributes(this.target, {
35349
+ startAngle: this.from.startAngle + (this.to.startAngle - this.from.startAngle) * ratio
35350
+ });
34688
35351
  }
34689
35352
  updateEndAngle(ratio) {
34690
- this.target.attribute.endAngle = this.from.endAngle + (this.to.endAngle - this.from.endAngle) * ratio;
35353
+ applyAnimationFrameAttributes(this.target, {
35354
+ endAngle: this.from.endAngle + (this.to.endAngle - this.from.endAngle) * ratio
35355
+ });
34691
35356
  }
34692
35357
  updateAngle(ratio) {
34693
35358
  this.updateStartAngle(ratio), this.updateEndAngle(ratio);
@@ -34705,7 +35370,7 @@
34705
35370
  to: to
34706
35371
  } = growAngleIn(this.target, this.params.options, this.params),
34707
35372
  fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
34708
- this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to, null === (_d = (_c = this.target).applyFinalAttributeToAttribute) || void 0 === _d || _d.call(_c), !1 !== (null === (_e = this.params.controlOptions) || void 0 === _e ? void 0 : _e.immediatelyApply) && this.target.setAttributes(fromAttrs), this.determineUpdateFunction();
35373
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to, null === (_d = (_c = this.target).applyFinalAttributeToAttribute) || void 0 === _d || _d.call(_c), !1 !== (null === (_e = this.params.controlOptions) || void 0 === _e ? void 0 : _e.immediatelyApply) && applyAppearStartAttributes(this.target, fromAttrs), this.determineUpdateFunction();
34709
35374
  }
34710
35375
  }
34711
35376
  class GrowAngleOut extends GrowAngleBase {
@@ -34855,16 +35520,16 @@
34855
35520
  to: to
34856
35521
  } = growCenterIn(this.target, this.params.options, this.params),
34857
35522
  fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
34858
- this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to, null === (_d = (_c = this.target).applyFinalAttributeToAttribute) || void 0 === _d || _d.call(_c), !1 !== (null === (_e = this.params.controlOptions) || void 0 === _e ? void 0 : _e.immediatelyApply) && this.target.setAttributes(fromAttrs);
35523
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to, null === (_d = (_c = this.target).applyFinalAttributeToAttribute) || void 0 === _d || _d.call(_c), !1 !== (null === (_e = this.params.controlOptions) || void 0 === _e ? void 0 : _e.immediatelyApply) && applyAppearStartAttributes(this.target, fromAttrs);
34859
35524
  }
34860
35525
  onEnd(cb) {
34861
35526
  super.onEnd(cb);
34862
35527
  }
34863
35528
  onUpdate(end, ratio, out) {
34864
- const attribute = this.target.attribute;
35529
+ const attrs = {};
34865
35530
  this.propKeys.forEach(key => {
34866
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
34867
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35531
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35532
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
34868
35533
  }
34869
35534
  }
34870
35535
  class GrowCenterOut extends ACustomAnimate {
@@ -34883,10 +35548,10 @@
34883
35548
  super.onEnd(cb);
34884
35549
  }
34885
35550
  onUpdate(end, ratio, out) {
34886
- const attribute = this.target.attribute;
35551
+ const attrs = {};
34887
35552
  this.propKeys.forEach(key => {
34888
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
34889
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35553
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35554
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
34890
35555
  }
34891
35556
  }
34892
35557
 
@@ -34960,16 +35625,13 @@
34960
35625
  to: to
34961
35626
  } = growHeightIn(this.target, this.params.options, this.params),
34962
35627
  fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
34963
- this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to, null === (_d = (_c = this.target).applyFinalAttributeToAttribute) || void 0 === _d || _d.call(_c), !1 !== (null === (_e = this.params.controlOptions) || void 0 === _e ? void 0 : _e.immediatelyApply) && this.target.setAttributes(fromAttrs);
35628
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to, null === (_d = (_c = this.target).applyFinalAttributeToAttribute) || void 0 === _d || _d.call(_c), !1 !== (null === (_e = this.params.controlOptions) || void 0 === _e ? void 0 : _e.immediatelyApply) && applyAppearStartAttributes(this.target, fromAttrs);
34964
35629
  }
34965
35630
  onEnd(cb) {
34966
35631
  super.onEnd(cb);
34967
35632
  }
34968
35633
  onUpdate(end, ratio, out) {
34969
- const attribute = this.target.attribute;
34970
- this.propKeys.forEach(key => {
34971
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
34972
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35634
+ applyAnimationFrameNumberAttributes(this.target, this.propKeys, this.from, this.to, ratio), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
34973
35635
  }
34974
35636
  }
34975
35637
  function growHeightOutIndividual(graphic, options, animationParameters) {
@@ -35027,10 +35689,7 @@
35027
35689
  super.onEnd(cb);
35028
35690
  }
35029
35691
  onUpdate(end, ratio, out) {
35030
- const attribute = this.target.attribute;
35031
- this.propKeys.forEach(key => {
35032
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35033
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35692
+ applyAnimationFrameNumberAttributes(this.target, this.propKeys, this.from, this.to, ratio), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35034
35693
  }
35035
35694
  }
35036
35695
 
@@ -35063,7 +35722,9 @@
35063
35722
  var _a, _b;
35064
35723
  const fromPoints = null === (_a = this.from) || void 0 === _a ? void 0 : _a.points,
35065
35724
  toPoints = null === (_b = this.to) || void 0 === _b ? void 0 : _b.points;
35066
- fromPoints && toPoints && (this.target.attribute.points = fromPoints.map((point, index) => pointInterpolation(fromPoints[index], toPoints[index], ratio)), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag());
35725
+ fromPoints && toPoints && (applyAnimationFrameAttributes(this.target, {
35726
+ points: fromPoints.map((point, index) => pointInterpolation(fromPoints[index], toPoints[index], ratio))
35727
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag());
35067
35728
  }
35068
35729
  }
35069
35730
  class GrowPointsIn extends GworPointsBase {
@@ -35074,7 +35735,7 @@
35074
35735
  from: from,
35075
35736
  to: to
35076
35737
  } = growPointsIn(this.target, this.params.options, this.params);
35077
- this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from, this.to = to, null === (_b = (_a = this.target).applyFinalAttributeToAttribute) || void 0 === _b || _b.call(_a), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && this.target.setAttributes(from);
35738
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from, this.to = to, null === (_b = (_a = this.target).applyFinalAttributeToAttribute) || void 0 === _b || _b.call(_a), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && applyAppearStartAttributes(this.target, from);
35078
35739
  } else this.valid = !1;
35079
35740
  }
35080
35741
  }
@@ -35136,7 +35797,7 @@
35136
35797
  from: from,
35137
35798
  to: to
35138
35799
  } = growPointsXIn(this.target, this.params.options, this.params);
35139
- this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from, this.to = to, null === (_b = (_a = this.target).applyFinalAttributeToAttribute) || void 0 === _b || _b.call(_a), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && this.target.setAttributes(from);
35800
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from, this.to = to, null === (_b = (_a = this.target).applyFinalAttributeToAttribute) || void 0 === _b || _b.call(_a), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && applyAppearStartAttributes(this.target, from);
35140
35801
  } else this.valid = !1;
35141
35802
  }
35142
35803
  }
@@ -35198,7 +35859,7 @@
35198
35859
  from: from,
35199
35860
  to: to
35200
35861
  } = growPointsYIn(this.target, this.params.options, this.params);
35201
- this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from, this.to = to, null === (_b = (_a = this.target).applyFinalAttributeToAttribute) || void 0 === _b || _b.call(_a), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && this.target.setAttributes(from);
35862
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from, this.to = to, null === (_b = (_a = this.target).applyFinalAttributeToAttribute) || void 0 === _b || _b.call(_a), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && applyAppearStartAttributes(this.target, from);
35202
35863
  } else this.valid = !1;
35203
35864
  }
35204
35865
  }
@@ -35295,10 +35956,10 @@
35295
35956
  super(from, to, duration, easing, params);
35296
35957
  }
35297
35958
  onUpdate(end, ratio, out) {
35298
- const attribute = this.target.attribute;
35959
+ const attrs = {};
35299
35960
  this.propKeys.forEach(key => {
35300
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35301
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35961
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35962
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35302
35963
  }
35303
35964
  }
35304
35965
  class GrowRadiusIn extends GrowPointsBase {
@@ -35310,7 +35971,7 @@
35310
35971
  to: to
35311
35972
  } = growRadiusIn(this.target, this.params.options, this.params),
35312
35973
  fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
35313
- this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to, null === (_d = (_c = this.target).applyFinalAttributeToAttribute) || void 0 === _d || _d.call(_c), !1 !== (null === (_e = this.params.controlOptions) || void 0 === _e ? void 0 : _e.immediatelyApply) && this.target.setAttributes(fromAttrs);
35974
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to, null === (_d = (_c = this.target).applyFinalAttributeToAttribute) || void 0 === _d || _d.call(_c), !1 !== (null === (_e = this.params.controlOptions) || void 0 === _e ? void 0 : _e.immediatelyApply) && applyAppearStartAttributes(this.target, fromAttrs);
35314
35975
  }
35315
35976
  }
35316
35977
  class GrowRadiusOut extends GrowPointsBase {
@@ -35432,16 +36093,13 @@
35432
36093
  to: to
35433
36094
  } = growWidthIn(this.target, this.params.options, this.params),
35434
36095
  fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
35435
- this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to, null === (_d = (_c = this.target).applyFinalAttributeToAttribute) || void 0 === _d || _d.call(_c), !1 !== (null === (_e = this.params.controlOptions) || void 0 === _e ? void 0 : _e.immediatelyApply) && this.target.setAttributes(fromAttrs);
36096
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to, null === (_d = (_c = this.target).applyFinalAttributeToAttribute) || void 0 === _d || _d.call(_c), !1 !== (null === (_e = this.params.controlOptions) || void 0 === _e ? void 0 : _e.immediatelyApply) && applyAppearStartAttributes(this.target, fromAttrs);
35436
36097
  }
35437
36098
  onEnd(cb) {
35438
36099
  super.onEnd(cb);
35439
36100
  }
35440
36101
  onUpdate(end, ratio, out) {
35441
- const attribute = this.target.attribute;
35442
- this.propKeys.forEach(key => {
35443
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35444
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
36102
+ applyAnimationFrameNumberAttributes(this.target, this.propKeys, this.from, this.to, ratio), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35445
36103
  }
35446
36104
  }
35447
36105
  class GrowWidthOut extends ACustomAnimate {
@@ -35461,10 +36119,7 @@
35461
36119
  super.onEnd(cb);
35462
36120
  }
35463
36121
  onUpdate(end, ratio, out) {
35464
- const attribute = this.target.attribute;
35465
- this.propKeys.forEach(key => {
35466
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
35467
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
36122
+ applyAnimationFrameNumberAttributes(this.target, this.propKeys, this.from, this.to, ratio), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
35468
36123
  }
35469
36124
  }
35470
36125
 
@@ -35483,7 +36138,7 @@
35483
36138
  } = this.params,
35484
36139
  symbolTime = duration / 10;
35485
36140
  let symbolStartOuterFrom, symbolStartOuterTo;
35486
- if (target._symbolStart.setAttributes({
36141
+ if (applyAppearStartAttributes(target._symbolStart, {
35487
36142
  scaleX: 0,
35488
36143
  scaleY: 0
35489
36144
  }), animator.animate(target._symbolStart, {
@@ -35504,12 +36159,12 @@
35504
36159
  clipRange: 0
35505
36160
  }, symbolStartOuterTo = {
35506
36161
  clipRange: 1
35507
- }), target._symbolStartOuter.setAttributes(symbolStartOuterFrom), animator.animate(target._symbolStartOuter, {
36162
+ }), applyAppearStartAttributes(target._symbolStartOuter, symbolStartOuterFrom), animator.animate(target._symbolStartOuter, {
35508
36163
  type: "to",
35509
36164
  to: symbolStartOuterTo,
35510
36165
  duration: 5 * symbolTime,
35511
36166
  easing: easing
35512
- }), target._symbolEnd.setAttributes({
36167
+ }), applyAppearStartAttributes(target._symbolEnd, {
35513
36168
  scaleX: 0,
35514
36169
  scaleY: 0
35515
36170
  }), animator.animate(target._symbolEnd, {
@@ -35521,7 +36176,7 @@
35521
36176
  duration: 2 * symbolTime,
35522
36177
  delay: 8 * symbolTime,
35523
36178
  easing: easing
35524
- }), target._line.setAttributes({
36179
+ }), applyAppearStartAttributes(target._line, {
35525
36180
  clipRange: 0
35526
36181
  }), animator.animate(target._line, {
35527
36182
  type: "to",
@@ -35532,7 +36187,7 @@
35532
36187
  easing: easing
35533
36188
  }), "typewriter" === titleType) {
35534
36189
  const titleTopText = target._titleTop.attribute.text;
35535
- target._titleTop.setAttributes({
36190
+ applyAppearStartAttributes(target._titleTop, {
35536
36191
  text: ""
35537
36192
  }), animator.animate(target._titleTop, {
35538
36193
  type: "custom",
@@ -35545,7 +36200,7 @@
35545
36200
  custom: InputText
35546
36201
  });
35547
36202
  const titleBottomText = target._titleBottom.attribute.text;
35548
- target._titleBottom.setAttributes({
36203
+ applyAppearStartAttributes(target._titleBottom, {
35549
36204
  text: ""
35550
36205
  }), animator.animate(target._titleBottom, {
35551
36206
  type: "custom",
@@ -35557,7 +36212,7 @@
35557
36212
  },
35558
36213
  custom: InputText
35559
36214
  });
35560
- } else target._titleTop.setAttributes({
36215
+ } else applyAppearStartAttributes(target._titleTop, {
35561
36216
  dy: target._titleTop.AABBBounds.height() + 10
35562
36217
  }), animator.animate(target._titleTop, {
35563
36218
  type: "to",
@@ -35567,7 +36222,7 @@
35567
36222
  delay: 5 * symbolTime,
35568
36223
  duration: 4 * symbolTime,
35569
36224
  easing: "linear"
35570
- }), target._titleBottom.setAttributes({
36225
+ }), applyAppearStartAttributes(target._titleBottom, {
35571
36226
  dy: -(10 + target._titleBottom.AABBBounds.height())
35572
36227
  }), animator.animate(target._titleBottom, {
35573
36228
  type: "to",
@@ -35581,7 +36236,7 @@
35581
36236
  "scale" === titlePanelType ? [target._titleTopPanel, target._titleBottomPanel].forEach(panel => {
35582
36237
  var _a;
35583
36238
  const scaleX = null !== (_a = panel.attribute.scaleX) && void 0 !== _a ? _a : 1;
35584
- panel.setAttributes({
36239
+ applyAppearStartAttributes(panel, {
35585
36240
  scaleX: 0
35586
36241
  }), animator.animate(panel, {
35587
36242
  type: "to",
@@ -35594,7 +36249,7 @@
35594
36249
  }) : "stroke" === titlePanelType && [target._titleTopPanel, target._titleBottomPanel].forEach(panel => {
35595
36250
  const b = panel.AABBBounds,
35596
36251
  totalLen = 2 * (b.width() + b.height());
35597
- panel.setAttributes({
36252
+ applyAppearStartAttributes(panel, {
35598
36253
  lineDash: [0, 10 * totalLen]
35599
36254
  }), animator.animate(panel, {
35600
36255
  type: "to",
@@ -35701,7 +36356,7 @@
35701
36356
  {
35702
36357
  wave: wave
35703
36358
  } = this.params;
35704
- if (target.setAttributes({
36359
+ if (applyAppearStartAttributes(target, {
35705
36360
  scaleX: 0,
35706
36361
  scaleY: 0
35707
36362
  }), animator.animate(target, {
@@ -35854,7 +36509,9 @@
35854
36509
  }
35855
36510
  }
35856
36511
  }
35857
- this.target.setAttribute("textConfig", currentTextConfig);
36512
+ applyAnimationTransientAttributes(this.target, {
36513
+ textConfig: currentTextConfig
36514
+ });
35858
36515
  }
35859
36516
  }
35860
36517
 
@@ -35881,18 +36538,21 @@
35881
36538
  displayedLength = Math.round(fromItems * (1 - adjustedRatio));
35882
36539
  } else displayedLength = Math.round(fromItems * (1 - ratio));
35883
36540
  let currentTextConfig = "forward" === this.direction ? this.fromTextConfig.slice(fromItems - displayedLength) : this.fromTextConfig.slice(0, displayedLength);
35884
- this.fadeOutChars && (currentTextConfig = this.applyFadeEffect(currentTextConfig, ratio, fromItems, displayedLength)), this.showCursor && displayedLength > 0 && (currentTextConfig = this.addCursor(currentTextConfig, ratio)), this.target.setAttribute("textConfig", currentTextConfig);
36541
+ this.fadeOutChars && (currentTextConfig = this.applyFadeEffect(currentTextConfig, ratio, fromItems, displayedLength)), this.showCursor && displayedLength > 0 && (currentTextConfig = this.addCursor(currentTextConfig, ratio)), applyAnimationTransientAttributes(this.target, {
36542
+ textConfig: currentTextConfig
36543
+ });
35885
36544
  } else {
35886
36545
  if (this.fadeOutChars) {
35887
36546
  const adjustedRatio = Math.min(1, ratio / maxTextHideRatio);
35888
36547
  displayedLength = Math.round(fromItems * (1 - adjustedRatio));
35889
36548
  } else displayedLength = Math.round(fromItems * (1 - ratio));
35890
36549
  let currentTextConfig = this.fromTextConfig.slice(0, displayedLength);
35891
- this.fadeOutChars && (currentTextConfig = this.applyFadeEffect(currentTextConfig, ratio, fromItems, displayedLength)), this.showCursor && displayedLength > 0 && (currentTextConfig = this.addCursor(currentTextConfig, ratio)), this.target.setAttribute("textConfig", currentTextConfig);
36550
+ this.fadeOutChars && (currentTextConfig = this.applyFadeEffect(currentTextConfig, ratio, fromItems, displayedLength)), this.showCursor && displayedLength > 0 && (currentTextConfig = this.addCursor(currentTextConfig, ratio)), applyAnimationTransientAttributes(this.target, {
36551
+ textConfig: currentTextConfig
36552
+ });
35892
36553
  }
35893
36554
  }
35894
36555
  applyFadeEffect(textConfig, ratio, totalItems, displayedLength) {
35895
- "forward" === this.direction ? totalItems - displayedLength : displayedLength;
35896
36556
  const fadeProgress = (ratio - (1 - this.fadeOutDuration)) / this.fadeOutDuration,
35897
36557
  fadeOpacity = Math.max(0, 1 - Math.min(1, fadeProgress));
35898
36558
  return textConfig.map((item, index) => {
@@ -35994,7 +36654,9 @@
35994
36654
  if (!this.valid) return;
35995
36655
  const maxTextShowRatio = 1 - this.fadeInDuration;
35996
36656
  let updatedTextConfig;
35997
- updatedTextConfig = this.wordByWord && this.wordGroups.length > 0 ? this.updateByWord(ratio, maxTextShowRatio) : this.updateByCharacter(ratio, maxTextShowRatio), this.target.setAttribute("textConfig", updatedTextConfig);
36657
+ updatedTextConfig = this.wordByWord && this.wordGroups.length > 0 ? this.updateByWord(ratio, maxTextShowRatio) : this.updateByCharacter(ratio, maxTextShowRatio), applyAnimationTransientAttributes(this.target, {
36658
+ textConfig: updatedTextConfig
36659
+ });
35998
36660
  }
35999
36661
  updateByWord(ratio, maxTextShowRatio) {
36000
36662
  const totalGroups = this.wordGroups.length,
@@ -36123,7 +36785,9 @@
36123
36785
  if (!this.valid) return;
36124
36786
  const maxTextShowRatio = 1 - this.fadeOutDuration;
36125
36787
  let updatedTextConfig;
36126
- updatedTextConfig = this.wordByWord && this.wordGroups.length > 0 ? this.updateByWord(ratio, maxTextShowRatio) : this.updateByCharacter(ratio, maxTextShowRatio), this.target.setAttribute("textConfig", updatedTextConfig);
36788
+ updatedTextConfig = this.wordByWord && this.wordGroups.length > 0 ? this.updateByWord(ratio, maxTextShowRatio) : this.updateByCharacter(ratio, maxTextShowRatio), applyAnimationTransientAttributes(this.target, {
36789
+ textConfig: updatedTextConfig
36790
+ });
36127
36791
  }
36128
36792
  updateByWord(ratio, maxTextShowRatio) {
36129
36793
  const totalGroups = this.wordGroups.length,
@@ -36222,24 +36886,32 @@
36222
36886
  scaleY: null !== (_k = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _k ? _k : 1
36223
36887
  }, this._updateFunction = this.updateXY;
36224
36888
  }
36225
- null === (_m = (_l = this.target).applyFinalAttributeToAttribute) || void 0 === _m || _m.call(_l), this.props = to, this.from = from, this.to = to, !1 !== (null === (_o = this.params.controlOptions) || void 0 === _o ? void 0 : _o.immediatelyApply) && this.target.setAttributes(from);
36889
+ null === (_m = (_l = this.target).applyFinalAttributeToAttribute) || void 0 === _m || _m.call(_l), this.props = to, this.from = from, this.to = to, !1 !== (null === (_o = this.params.controlOptions) || void 0 === _o ? void 0 : _o.immediatelyApply) && applyAppearStartAttributes(this.target, from);
36226
36890
  }
36227
36891
  onEnd(cb) {
36228
36892
  super.onEnd(cb);
36229
36893
  }
36230
36894
  updateX(ratio) {
36231
- this.target.attribute.scaleX = this.from.scaleX + (this.to.scaleX - this.from.scaleX) * ratio;
36895
+ this.applyScaleTransientAttrs(ratio, !0, !1);
36232
36896
  }
36233
36897
  updateY(ratio) {
36234
- this.target.attribute.scaleY = this.from.scaleY + (this.to.scaleY - this.from.scaleY) * ratio;
36898
+ this.applyScaleTransientAttrs(ratio, !1, !0);
36235
36899
  }
36236
36900
  updateXY(ratio) {
36237
- this.updateX(ratio), this.updateY(ratio);
36901
+ this.applyScaleTransientAttrs(ratio, !0, !0);
36902
+ }
36903
+ applyScaleTransientAttrs(ratio, scaleX, scaleY) {
36904
+ const attrs = {};
36905
+ scaleX && (attrs.scaleX = this.from.scaleX + (this.to.scaleX - this.from.scaleX) * ratio), scaleY && (attrs.scaleY = this.from.scaleY + (this.to.scaleY - this.from.scaleY) * ratio), applyAnimationFrameAttributes(this.target, attrs);
36238
36906
  }
36239
36907
  deleteSelfAttr(key) {
36240
- delete this.props[key], this.fromProps && delete this.fromProps[key];
36241
- const index = this.propKeys.indexOf(key);
36242
- -1 !== index && this.propKeys.splice(index, 1), this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateXY : "scaleX" === this.propKeys[0] ? this._updateFunction = this.updateX : "scaleY" === this.propKeys[0] ? this._updateFunction = this.updateY : this._updateFunction = null;
36908
+ this.deleteSelfAttrs([key]);
36909
+ }
36910
+ deleteSelfAttrs(keys) {
36911
+ var _a;
36912
+ super.deleteSelfAttrs(keys);
36913
+ const firstKey = null === (_a = this.propKeys) || void 0 === _a ? void 0 : _a[0];
36914
+ this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateXY : this._updateFunction = "scaleX" === firstKey ? this.updateX : "scaleY" === firstKey ? this.updateY : null;
36243
36915
  }
36244
36916
  onUpdate(end, ratio, out) {
36245
36917
  this._updateFunction && (this._updateFunction(ratio), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag());
@@ -36284,10 +36956,10 @@
36284
36956
  super.onEnd(cb);
36285
36957
  }
36286
36958
  onUpdate(end, ratio, out) {
36287
- const attribute = this.target.attribute;
36959
+ const attrs = {};
36288
36960
  this.propKeys.forEach(key => {
36289
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
36290
- }), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
36961
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
36962
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
36291
36963
  }
36292
36964
  }
36293
36965
 
@@ -36298,14 +36970,19 @@
36298
36970
  update(end, ratio, out) {
36299
36971
  if (this.onStart(), !this.props || !this.propKeys) return;
36300
36972
  const easedRatio = this.easing(ratio);
36301
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
36302
- if (!this.animate.validAttr(this.propKeys[index])) return;
36303
- const key = this.propKeys[index];
36304
- func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
36305
- }), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
36973
+ this.runInterpolateUpdate(this.fromProps, this.props, easedRatio), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
36306
36974
  }
36307
36975
  }
36308
36976
 
36977
+ function buildInterpolatedAttrs(keys, from, to, ratio) {
36978
+ const attrs = {};
36979
+ return keys.forEach(key => {
36980
+ attrs[key] = from[key] + (to[key] - from[key]) * ratio;
36981
+ }), attrs;
36982
+ }
36983
+ function applyStoryFrame(target, attrs) {
36984
+ applyAnimationFrameAttributes(target, attrs), target.addUpdatePositionTag(), target.addUpdateShapeAndBoundsTag();
36985
+ }
36309
36986
  class SlideIn extends ACustomAnimate {
36310
36987
  constructor(from, to, duration, easing, params) {
36311
36988
  super(from, to, duration, easing, params);
@@ -36325,13 +37002,10 @@
36325
37002
  opacity: 1,
36326
37003
  baseOpacity: 1
36327
37004
  };
36328
- "top" === direction ? (from.y = (null !== (_e = attrs.y) && void 0 !== _e ? _e : 0) - distance, to.y = null !== (_f = attrs.y) && void 0 !== _f ? _f : 0, this.propKeys = ["opacity", "baseOpacity", "y"]) : "bottom" === direction ? (from.y = (null !== (_g = attrs.y) && void 0 !== _g ? _g : 0) + distance, to.y = null !== (_h = attrs.y) && void 0 !== _h ? _h : 0, this.propKeys = ["opacity", "baseOpacity", "y"]) : "left" === direction ? (from.x = (null !== (_j = attrs.x) && void 0 !== _j ? _j : 0) - distance, to.x = null !== (_k = attrs.x) && void 0 !== _k ? _k : 0, this.propKeys = ["opacity", "baseOpacity", "x"]) : (from.x = (null !== (_l = attrs.x) && void 0 !== _l ? _l : 0) + distance, to.x = null !== (_m = attrs.x) && void 0 !== _m ? _m : 0, this.propKeys = ["opacity", "baseOpacity", "x"]), this.from = from, this.to = to, this.props = to, this.target.setAttributes(from);
37005
+ "top" === direction ? (from.y = (null !== (_e = attrs.y) && void 0 !== _e ? _e : 0) - distance, to.y = null !== (_f = attrs.y) && void 0 !== _f ? _f : 0, this.propKeys = ["opacity", "baseOpacity", "y"]) : "bottom" === direction ? (from.y = (null !== (_g = attrs.y) && void 0 !== _g ? _g : 0) + distance, to.y = null !== (_h = attrs.y) && void 0 !== _h ? _h : 0, this.propKeys = ["opacity", "baseOpacity", "y"]) : "left" === direction ? (from.x = (null !== (_j = attrs.x) && void 0 !== _j ? _j : 0) - distance, to.x = null !== (_k = attrs.x) && void 0 !== _k ? _k : 0, this.propKeys = ["opacity", "baseOpacity", "x"]) : (from.x = (null !== (_l = attrs.x) && void 0 !== _l ? _l : 0) + distance, to.x = null !== (_m = attrs.x) && void 0 !== _m ? _m : 0, this.propKeys = ["opacity", "baseOpacity", "x"]), this.from = from, this.to = to, this.props = to, applyAppearStartAttributes(this.target, from);
36329
37006
  }
36330
37007
  onUpdate(end, ratio, out) {
36331
- const attribute = this.target.attribute;
36332
- this.propKeys.forEach(key => {
36333
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
36334
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37008
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
36335
37009
  }
36336
37010
  }
36337
37011
  class GrowIn extends ACustomAnimate {
@@ -36353,13 +37027,10 @@
36353
37027
  opacity: 1,
36354
37028
  baseOpacity: 1
36355
37029
  };
36356
- this.propKeys = ["opacity", "baseOpacity"], "x" !== direction && "xy" !== direction || (from.scaleX = fromScale, to.scaleX = null !== (_f = attrs.scaleX) && void 0 !== _f ? _f : 1, this.propKeys.push("scaleX")), "y" !== direction && "xy" !== direction || (from.scaleY = fromScale, to.scaleY = null !== (_g = attrs.scaleY) && void 0 !== _g ? _g : 1, this.propKeys.push("scaleY")), this.from = from, this.to = to, this.props = to, this.target.setAttributes(from);
37030
+ this.propKeys = ["opacity", "baseOpacity"], "x" !== direction && "xy" !== direction || (from.scaleX = fromScale, to.scaleX = null !== (_f = attrs.scaleX) && void 0 !== _f ? _f : 1, this.propKeys.push("scaleX")), "y" !== direction && "xy" !== direction || (from.scaleY = fromScale, to.scaleY = null !== (_g = attrs.scaleY) && void 0 !== _g ? _g : 1, this.propKeys.push("scaleY")), this.from = from, this.to = to, this.props = to, applyAppearStartAttributes(this.target, from);
36357
37031
  }
36358
37032
  onUpdate(end, ratio, out) {
36359
- const attribute = this.target.attribute;
36360
- this.propKeys.forEach(key => {
36361
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
36362
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37033
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
36363
37034
  }
36364
37035
  }
36365
37036
  class SpinIn extends ACustomAnimate {
@@ -36387,13 +37058,10 @@
36387
37058
  scaleX: null !== (_h = attrs.scaleX) && void 0 !== _h ? _h : 1,
36388
37059
  scaleY: null !== (_j = attrs.scaleY) && void 0 !== _j ? _j : 1
36389
37060
  };
36390
- this.propKeys = ["opacity", "baseOpacity", "angle", "scaleX", "scaleY"], this.from = from, this.to = to, this.props = to, this.target.setAttributes(from);
37061
+ this.propKeys = ["opacity", "baseOpacity", "angle", "scaleX", "scaleY"], this.from = from, this.to = to, this.props = to, applyAppearStartAttributes(this.target, from);
36391
37062
  }
36392
37063
  onUpdate(end, ratio, out) {
36393
- const attribute = this.target.attribute;
36394
- this.propKeys.forEach(key => {
36395
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
36396
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37064
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
36397
37065
  }
36398
37066
  }
36399
37067
  class StrokeIn extends ACustomAnimate {
@@ -36434,12 +37102,14 @@
36434
37102
  lineWidth: lineWidth,
36435
37103
  stroke: strokeColor,
36436
37104
  strokeOpacity: fromOpacity
36437
- }, showFill ? (this.from.fillOpacity = fillOpacity, this.to.fillOpacity = null !== (_t = this.originalAttributes.fillOpacity) && void 0 !== _t ? _t : 1) : (this.from.fillOpacity = 0, this.to.fillOpacity = 0), this.propKeys = ["lineDash", "lineDashOffset", "lineWidth", "stroke", "strokeOpacity", "fillOpacity"], this.props = this.to, this.target.setAttributes(this.from);
37105
+ }, showFill ? (this.from.fillOpacity = fillOpacity, this.to.fillOpacity = null !== (_t = this.originalAttributes.fillOpacity) && void 0 !== _t ? _t : 1) : (this.from.fillOpacity = 0, this.to.fillOpacity = 0), this.propKeys = ["lineDash", "lineDashOffset", "lineWidth", "stroke", "strokeOpacity", "fillOpacity"], this.props = this.to, applyAppearStartAttributes(this.target, this.from);
36438
37106
  }
36439
37107
  onUpdate(end, ratio, out) {
36440
37108
  var _a;
36441
- const attribute = this.target.attribute;
36442
- attribute.lineDashOffset = this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio, (null === (_a = this.params) || void 0 === _a ? void 0 : _a.showFill) && (attribute.fillOpacity = this.from.fillOpacity + (this.to.fillOpacity - this.from.fillOpacity) * ratio);
37109
+ const attrs = {
37110
+ lineDashOffset: this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio
37111
+ };
37112
+ (null === (_a = this.params) || void 0 === _a ? void 0 : _a.showFill) && (attrs.fillOpacity = this.from.fillOpacity + (this.to.fillOpacity - this.from.fillOpacity) * ratio), applyAnimationTransientAttributes(this.target, attrs);
36443
37113
  }
36444
37114
  onEnd() {
36445
37115
  var _a;
@@ -36486,12 +37156,14 @@
36486
37156
  lineWidth: lineWidth,
36487
37157
  stroke: strokeColor,
36488
37158
  strokeOpacity: fromOpacity
36489
- }, showFill ? (this.from.fillOpacity = null !== (_r = this.originalAttributes.fillOpacity) && void 0 !== _r ? _r : 1, this.to.fillOpacity = 0) : (this.from.fillOpacity = 0, this.to.fillOpacity = 0), this.propKeys = ["lineDash", "lineDashOffset", "lineWidth", "stroke", "strokeOpacity", "fillOpacity"], this.props = this.to, this.target.setAttributes(this.from);
37159
+ }, showFill ? (this.from.fillOpacity = null !== (_r = this.originalAttributes.fillOpacity) && void 0 !== _r ? _r : 1, this.to.fillOpacity = 0) : (this.from.fillOpacity = 0, this.to.fillOpacity = 0), this.propKeys = ["lineDash", "lineDashOffset", "lineWidth", "stroke", "strokeOpacity", "fillOpacity"], this.props = this.to, applyAppearStartAttributes(this.target, this.from);
36490
37160
  }
36491
37161
  onUpdate(end, ratio, out) {
36492
37162
  var _a;
36493
- const attribute = this.target.attribute;
36494
- attribute.lineDashOffset = this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio, (null === (_a = this.params) || void 0 === _a ? void 0 : _a.showFill) && (attribute.fillOpacity = this.from.fillOpacity + (this.to.fillOpacity - this.from.fillOpacity) * ratio);
37163
+ const attrs = {
37164
+ lineDashOffset: this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio
37165
+ };
37166
+ (null === (_a = this.params) || void 0 === _a ? void 0 : _a.showFill) && (attrs.fillOpacity = this.from.fillOpacity + (this.to.fillOpacity - this.from.fillOpacity) * ratio), applyAnimationTransientAttributes(this.target, attrs);
36495
37167
  }
36496
37168
  }
36497
37169
  class MoveScaleIn extends ACustomAnimate {
@@ -36588,10 +37260,7 @@
36588
37260
  "top" === direction ? (from.y = null !== (_g = attrs.y) && void 0 !== _g ? _g : 0, to.y = (null !== (_h = attrs.y) && void 0 !== _h ? _h : 0) - distance, this.propKeys = ["opacity", "baseOpacity", "y"]) : "bottom" === direction ? (from.y = null !== (_j = attrs.y) && void 0 !== _j ? _j : 0, to.y = (null !== (_k = attrs.y) && void 0 !== _k ? _k : 0) + distance, this.propKeys = ["opacity", "baseOpacity", "y"]) : "left" === direction ? (from.x = null !== (_l = attrs.x) && void 0 !== _l ? _l : 0, to.x = (null !== (_m = attrs.x) && void 0 !== _m ? _m : 0) - distance, this.propKeys = ["opacity", "baseOpacity", "x"]) : (from.x = null !== (_o = attrs.x) && void 0 !== _o ? _o : 0, to.x = (null !== (_p = attrs.x) && void 0 !== _p ? _p : 0) + distance, this.propKeys = ["opacity", "baseOpacity", "x"]), this.from = from, this.to = to, this.props = to;
36589
37261
  }
36590
37262
  onUpdate(end, ratio, out) {
36591
- const attribute = this.target.attribute;
36592
- this.propKeys.forEach(key => {
36593
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
36594
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37263
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
36595
37264
  }
36596
37265
  }
36597
37266
  class GrowOut extends ACustomAnimate {
@@ -36616,10 +37285,7 @@
36616
37285
  this.propKeys = ["opacity", "baseOpacity"], "x" !== direction && "xy" !== direction || (from.scaleX = null !== (_h = attrs.scaleX) && void 0 !== _h ? _h : 1, to.scaleX = toScale, this.propKeys.push("scaleX")), "y" !== direction && "xy" !== direction || (from.scaleY = null !== (_j = attrs.scaleY) && void 0 !== _j ? _j : 1, to.scaleY = toScale, this.propKeys.push("scaleY")), this.from = from, this.to = to, this.props = to;
36617
37286
  }
36618
37287
  onUpdate(end, ratio, out) {
36619
- const attribute = this.target.attribute;
36620
- this.propKeys.forEach(key => {
36621
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
36622
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37288
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
36623
37289
  }
36624
37290
  }
36625
37291
  class SpinOut extends ACustomAnimate {
@@ -36650,10 +37316,7 @@
36650
37316
  this.propKeys = ["opacity", "baseOpacity", "angle", "scaleX", "scaleY"], this.from = from, this.to = to, this.props = to;
36651
37317
  }
36652
37318
  onUpdate(end, ratio, out) {
36653
- const attribute = this.target.attribute;
36654
- this.propKeys.forEach(key => {
36655
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
36656
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37319
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
36657
37320
  }
36658
37321
  }
36659
37322
  class MoveScaleOut extends ACustomAnimate {
@@ -36738,51 +37401,127 @@
36738
37401
  onUpdate(end, ratio, out) {
36739
37402
  const angle = ratio * Math.PI * this.pulseCount,
36740
37403
  pulseValue = Math.abs(Math.sin(angle)),
36741
- attribute = this.target.attribute;
37404
+ attrs = {};
36742
37405
  if (this.useOpacity) {
36743
37406
  const opacity = 1 + (this.pulseOpacity - 1) * pulseValue;
36744
- this.useStroke && (attribute.strokeOpacity = (this.originalAttributes.strokeOpacity || 1) * opacity), this.useFill && (attribute.fillOpacity = (this.originalAttributes.fillOpacity || 1) * opacity);
37407
+ this.useStroke && (attrs.strokeOpacity = (this.originalAttributes.strokeOpacity || 1) * opacity), this.useFill && (attrs.fillOpacity = (this.originalAttributes.fillOpacity || 1) * opacity);
36745
37408
  }
36746
37409
  if (this.useScale) {
36747
37410
  const scale = 1 + (this.pulseScale - 1) * pulseValue;
36748
- attribute.scaleX = (this.originalAttributes.scaleX || 1) * scale, attribute.scaleY = (this.originalAttributes.scaleY || 1) * scale;
37411
+ attrs.scaleX = (this.originalAttributes.scaleX || 1) * scale, attrs.scaleY = (this.originalAttributes.scaleY || 1) * scale;
36749
37412
  }
36750
- this.useColor && this.pulseColor && this.applyColorPulse(attribute, pulseValue), this.target.addUpdateShapeAndBoundsTag(), this.target.addUpdatePositionTag();
37413
+ this.useColor && this.pulseColor && this.applyColorPulse(attrs, pulseValue), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdateShapeAndBoundsTag(), this.target.addUpdatePositionTag();
36751
37414
  }
36752
- applyColorPulse(attribute, pulseValue) {
37415
+ applyColorPulse(attrs, pulseValue) {
36753
37416
  const colorRatio = this.pulseColorIntensity * pulseValue;
36754
- this.useFill && this.originalFill && this.pulseColor && (attribute.fill = interpolateColor(this.originalFill, this.pulseColor, colorRatio, !0)), this.useStroke && this.originalStroke && this.pulseColor && (attribute.stroke = interpolateColor(this.originalStroke, this.pulseColor, colorRatio, !0));
37417
+ this.useFill && this.originalFill && this.pulseColor && (attrs.fill = interpolateColor(this.originalFill, this.pulseColor, colorRatio, !0)), this.useStroke && this.originalStroke && this.pulseColor && (attrs.stroke = interpolateColor(this.originalStroke, this.pulseColor, colorRatio, !0));
36755
37418
  }
36756
37419
  onEnd() {
36757
37420
  super.onEnd(), this.target.setAttributes(this.originalAttributes);
36758
37421
  }
36759
37422
  }
36760
37423
 
37424
+ const clipPathGeometryAttrs = {
37425
+ x: !0,
37426
+ y: !0,
37427
+ x1: !0,
37428
+ y1: !0,
37429
+ width: !0,
37430
+ height: !0
37431
+ };
37432
+ function includesChannel(channels, key) {
37433
+ for (let i = 0; i < channels.length; i++) if (channels[i] === key) return !0;
37434
+ return !1;
37435
+ }
37436
+ function filterExcludedChannels(diffAttrs, excludeChannels) {
37437
+ if (!(null == excludeChannels ? void 0 : excludeChannels.length)) return diffAttrs;
37438
+ const nextAttrs = {};
37439
+ for (const key in diffAttrs) Object.prototype.hasOwnProperty.call(diffAttrs, key) && !includesChannel(excludeChannels, key) && (nextAttrs[key] = diffAttrs[key]);
37440
+ return nextAttrs;
37441
+ }
36761
37442
  class Update extends ACustomAnimate {
36762
37443
  constructor(from, to, duration, easing, params) {
36763
- super(from, to, duration, easing, params);
37444
+ super(from, to, duration, easing, params), this.updateFromAttrs = null, this.clipPathSyncKeys = null, this.clipPathSyncParent = null, this.clipPathSyncChildIndex = -1, this.clipPathSyncDisabled = !1;
36764
37445
  }
36765
37446
  onBind() {
36766
- var _a, _b;
37447
+ var _a;
36767
37448
  super.onBind();
37449
+ const targetContext = null !== (_a = this.target.context) && void 0 !== _a ? _a : {};
36768
37450
  let {
36769
37451
  diffAttrs = {}
36770
- } = null !== (_a = this.target.context) && void 0 !== _a ? _a : {};
37452
+ } = targetContext;
36771
37453
  const {
36772
37454
  options: options
36773
37455
  } = this.params;
36774
- diffAttrs = Object.assign({}, diffAttrs), (null === (_b = null == options ? void 0 : options.excludeChannels) || void 0 === _b ? void 0 : _b.length) && options.excludeChannels.forEach(channel => {
36775
- delete diffAttrs[channel];
36776
- }), this.props = diffAttrs;
37456
+ diffAttrs = filterExcludedChannels(diffAttrs, null == options ? void 0 : options.excludeChannels), this.props = diffAttrs;
37457
+ const consumeTransientFromAttrs = this.target.consumeTransientFromAttrsBeforePreventAnimate;
37458
+ this.updateFromAttrs = "function" == typeof consumeTransientFromAttrs ? consumeTransientFromAttrs.call(this.target, diffAttrs) : null, this.clipPathSyncKeys = Object.keys(diffAttrs).filter(key => clipPathGeometryAttrs[key]), this.clipPathSyncDisabled = !this.clipPathSyncKeys.length, this.syncParentClipPathToTarget();
37459
+ }
37460
+ trySyncStartProps() {
37461
+ const updateFromAttrs = this.updateFromAttrs;
37462
+ this.propKeys.forEach(key => {
37463
+ this.fromProps[key] = updateFromAttrs && Object.prototype.hasOwnProperty.call(updateFromAttrs, key) ? updateFromAttrs[key] : this.animate.target.getComputedAttribute(key);
37464
+ });
37465
+ }
37466
+ onEnd(cb) {
37467
+ var _a;
37468
+ cb ? super.onEnd(cb) : (this.props && commitAnimationStaticAttrs(this.target, null !== (_a = this.propKeys) && void 0 !== _a ? _a : Object.keys(this.props), this.animate, this.props), this.syncParentClipPathToTarget(), super.onEnd());
36777
37469
  }
36778
37470
  update(end, ratio, out) {
36779
37471
  if (this.onStart(), !this.props || !this.propKeys) return;
36780
37472
  const easedRatio = this.easing(ratio);
36781
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
36782
- if (!this.animate.validAttr(this.propKeys[index])) return;
36783
- const key = this.propKeys[index];
36784
- func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
36785
- }), this.onUpdate(end, easedRatio, out);
37473
+ this.runInterpolateUpdate(this.fromProps, this.props, easedRatio), this.syncParentClipPathToTarget(), this.onUpdate(end, easedRatio, out);
37474
+ }
37475
+ syncParentClipPathToTarget() {
37476
+ var _a, _b, _c, _d;
37477
+ if (this.clipPathSyncDisabled) return;
37478
+ const target = this.target,
37479
+ parent = target.parent,
37480
+ path = null === (_a = null == parent ? void 0 : parent.attribute) || void 0 === _a ? void 0 : _a.path;
37481
+ if (!(null === (_b = null == parent ? void 0 : parent.attribute) || void 0 === _b ? void 0 : _b.clip) || !Array.isArray(path) || !path.length) return;
37482
+ const childIndex = this.getClipPathSyncChildIndex(parent);
37483
+ if (childIndex < 0 || childIndex >= path.length) return;
37484
+ const clipGraphic = path[childIndex];
37485
+ if (!(null == clipGraphic ? void 0 : clipGraphic.attribute) || clipGraphic.type !== target.type || !this.isClipPathStaticTarget(clipGraphic)) return;
37486
+ const syncAttrs = this.buildClipPathTransientAttrs(clipGraphic);
37487
+ syncAttrs && (applyAnimationFrameAttributes(clipGraphic, syncAttrs), null === (_c = clipGraphic.addUpdatePositionTag) || void 0 === _c || _c.call(clipGraphic), null === (_d = clipGraphic.addUpdateShapeAndBoundsTag) || void 0 === _d || _d.call(clipGraphic));
37488
+ }
37489
+ getClipPathSyncChildIndex(parent) {
37490
+ var _a;
37491
+ if (this.clipPathSyncParent === parent && this.clipPathSyncChildIndex >= 0) return this.clipPathSyncChildIndex;
37492
+ const target = this.target;
37493
+ let childIndex = -1;
37494
+ return null === (_a = parent.forEachChildren) || void 0 === _a || _a.call(parent, (child, index) => child === target && (childIndex = index, !0)), this.clipPathSyncParent = parent, this.clipPathSyncChildIndex = childIndex, childIndex;
37495
+ }
37496
+ isClipPathStaticTarget(clipGraphic) {
37497
+ var _a, _b;
37498
+ const target = this.target,
37499
+ targetFinalAttrs = this.getTargetFinalAttrs(),
37500
+ clipGraphicFinalAttrs = "function" == typeof clipGraphic.getFinalAttribute ? clipGraphic.getFinalAttribute() : clipGraphic.finalAttribute,
37501
+ clipFinalAttrs = null !== (_a = null != clipGraphicFinalAttrs ? clipGraphicFinalAttrs : clipGraphic.baseAttributes) && void 0 !== _a ? _a : clipGraphic.attribute,
37502
+ keys = null !== (_b = this.clipPathSyncKeys) && void 0 !== _b ? _b : [];
37503
+ return !!(keys.length && targetFinalAttrs && clipFinalAttrs) && keys.every(key => {
37504
+ var _a, _b;
37505
+ return this.isSameClipPathValue(clipFinalAttrs[key], null !== (_a = targetFinalAttrs[key]) && void 0 !== _a ? _a : null === (_b = target.attribute) || void 0 === _b ? void 0 : _b[key]);
37506
+ });
37507
+ }
37508
+ getTargetFinalAttrs() {
37509
+ var _a, _b, _c;
37510
+ const target = this.target;
37511
+ return null !== (_c = null !== (_b = null === (_a = target.context) || void 0 === _a ? void 0 : _a.finalAttrs) && void 0 !== _b ? _b : "function" == typeof target.getFinalAttribute ? target.getFinalAttribute() : target.finalAttribute) && void 0 !== _c ? _c : null;
37512
+ }
37513
+ isSameClipPathValue(a, b) {
37514
+ return "number" == typeof a && "number" == typeof b ? Math.abs(a - b) < 1e-8 : a === b;
37515
+ }
37516
+ buildClipPathTransientAttrs(clipGraphic) {
37517
+ var _a;
37518
+ const target = this.target,
37519
+ attrs = {};
37520
+ return (null !== (_a = this.clipPathSyncKeys) && void 0 !== _a ? _a : []).forEach(key => {
37521
+ var _a;
37522
+ const nextValue = null === (_a = target.attribute) || void 0 === _a ? void 0 : _a[key];
37523
+ Object.prototype.hasOwnProperty.call(clipGraphic.attribute, key) && void 0 !== nextValue && !this.isSameClipPathValue(clipGraphic.attribute[key], nextValue) && (attrs[key] = nextValue);
37524
+ }), Object.keys(attrs).length ? attrs : null;
36786
37525
  }
36787
37526
  }
36788
37527
 
@@ -36889,10 +37628,10 @@
36889
37628
  super(from, to, duration, easing, params);
36890
37629
  }
36891
37630
  onUpdate(end, ratio, out) {
36892
- const attribute = this.target.attribute;
37631
+ const attrs = {};
36893
37632
  this.propKeys.forEach(key => {
36894
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
36895
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37633
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
37634
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
36896
37635
  }
36897
37636
  }
36898
37637
  class MoveIn extends MoveBase {
@@ -36903,7 +37642,7 @@
36903
37642
  from: from,
36904
37643
  to: to
36905
37644
  } = moveIn(this.target, this.params.options, this.params);
36906
- this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from, this.to = to, null === (_b = (_a = this.target).applyFinalAttributeToAttribute) || void 0 === _b || _b.call(_a), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && this.target.setAttributes(from);
37645
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from, this.to = to, null === (_b = (_a = this.target).applyFinalAttributeToAttribute) || void 0 === _b || _b.call(_a), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && applyAppearStartAttributes(this.target, from);
36907
37646
  }
36908
37647
  }
36909
37648
  class MoveOut extends MoveBase {
@@ -36948,10 +37687,10 @@
36948
37687
  super(from, to, duration, easing, params);
36949
37688
  }
36950
37689
  onUpdate(end, ratio, out) {
36951
- const attribute = this.target.attribute;
37690
+ const attrs = {};
36952
37691
  this.propKeys.forEach(key => {
36953
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
36954
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37692
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
37693
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
36955
37694
  }
36956
37695
  }
36957
37696
  class RotateIn extends RotateBase {
@@ -36962,7 +37701,7 @@
36962
37701
  from: from,
36963
37702
  to: to
36964
37703
  } = rotateIn(this.target, this.params.options);
36965
- this.props = to, this.propKeys = ["angle"], this.from = from, this.to = to, null === (_b = (_a = this.target).applyFinalAttributeToAttribute) || void 0 === _b || _b.call(_a), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && this.target.setAttributes(from);
37704
+ this.props = to, this.propKeys = ["angle"], this.from = from, this.to = to, null === (_b = (_a = this.target).applyFinalAttributeToAttribute) || void 0 === _b || _b.call(_a), !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && applyAppearStartAttributes(this.target, from);
36966
37705
  }
36967
37706
  }
36968
37707
  class RotateOut extends RotateBase {
@@ -36978,8 +37717,8 @@
36978
37717
 
36979
37718
  class MotionPath extends ACustomAnimate {
36980
37719
  constructor(from, to, duration, easing, params) {
36981
- var _a;
36982
- super(from, to, duration, easing, params), params && (this.pathLength = params.path.getLength(), this.path = params.path, this.distance = params.distance, this.totalLength = this.distance * this.pathLength, this.initAngle = null !== (_a = params.initAngle) && void 0 !== _a ? _a : 0, this.changeAngle = !!params.changeAngle, this.cb = params.cb);
37720
+ var _a, _b, _c;
37721
+ super(from, to, duration, easing, params), params && (this.pathLength = params.path.getLength(), this.path = params.path, this.distance = params.distance, this.totalLength = this.distance * this.pathLength, this.initAngle = null !== (_a = params.initAngle) && void 0 !== _a ? _a : 0, this.changeAngle = !!params.changeAngle, this.commitOnEnd = null === (_c = null !== (_b = params.commitOnEnd) && void 0 !== _b ? _b : params.saveOnEnd) || void 0 === _c || _c, this.cb = params.cb);
36983
37722
  }
36984
37723
  onBind() {
36985
37724
  this.from = {
@@ -36994,7 +37733,7 @@
36994
37733
  pos: pos,
36995
37734
  angle: angle
36996
37735
  } = this.path.getAttrAt(at);
36997
- attrs.x = pos.x, attrs.y = pos.y, this.changeAngle && (attrs.angle = angle + this.initAngle), this.cb && this.cb(this.from, this.to, ratio, this.target), this.target.setAttributes(attrs);
37736
+ attrs.x = pos.x, attrs.y = pos.y, this.changeAngle && (attrs.angle = angle + this.initAngle), this.cb && this.cb(this.from, this.to, ratio, this.target), end && this.commitOnEnd ? this.target.setAttributes(attrs) : (applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag());
36998
37737
  }
36999
37738
  }
37000
37739
 
@@ -40742,6 +41481,43 @@
40742
41481
  }
40743
41482
  }
40744
41483
 
41484
+ function commitUpdateAnimationTarget(graphic, targetAttrs, startAttrs) {
41485
+ var _a, _b, _c, _d;
41486
+ if (!graphic || !targetAttrs) return;
41487
+ const committedTargetAttrs = cloneDeep(targetAttrs),
41488
+ transientStartAttrs = cloneDeep(null != startAttrs ? startAttrs : graphic.attribute);
41489
+ graphic.setAttributes(committedTargetAttrs), null === (_b = (_a = graphic).setFinalAttributes) || void 0 === _b || _b.call(_a, committedTargetAttrs), null === (_d = (_c = graphic).setAttributesAndPreventAnimate) || void 0 === _d || _d.call(_c, transientStartAttrs, !1, {
41490
+ type: exports.AttributeUpdateType.ANIMATE_BIND
41491
+ });
41492
+ }
41493
+
41494
+ function collectTrackedAnimates(graphic, animates = [], visited = new Set()) {
41495
+ var _a, _b, _c, _d, _e;
41496
+ const trackedAnimates = null !== (_c = null === (_b = (_a = graphic).getTrackedAnimates) || void 0 === _b ? void 0 : _b.call(_a)) && void 0 !== _c ? _c : graphic.animates;
41497
+ return null == trackedAnimates || trackedAnimates.forEach(animate => {
41498
+ animate && !visited.has(animate) && (visited.add(animate), animates.push(animate));
41499
+ }), null === (_e = (_d = graphic).forEachChildren) || void 0 === _e || _e.call(_d, child => {
41500
+ collectTrackedAnimates(child, animates, visited);
41501
+ }), animates;
41502
+ }
41503
+ function appendExitReleaseCallback(state, callback) {
41504
+ callback && (null == state || state.onComplete.push(callback));
41505
+ }
41506
+ function runExitReleaseCallbacks(callbacks) {
41507
+ callbacks.forEach(callback => {
41508
+ callback();
41509
+ });
41510
+ }
41511
+ function bindExitReleaseAnimates(exitAnimates, getState, finalize) {
41512
+ const finish = animate => {
41513
+ const state = getState();
41514
+ state && !state.finalized && state.pendingAnimates.has(animate) && (state.pendingAnimates.delete(animate), state.pendingAnimates.size || finalize());
41515
+ };
41516
+ exitAnimates.forEach(animate => {
41517
+ animate.onEnd(() => finish(animate)), animate.onRemove(() => finish(animate));
41518
+ });
41519
+ }
41520
+
40745
41521
  const DefaultAxisAnimation = {
40746
41522
  type: "default",
40747
41523
  duration: 300,
@@ -40773,12 +41549,65 @@
40773
41549
  });
40774
41550
  return this.add(offscreenGroup), this._renderInner(offscreenGroup), this.removeChild(offscreenGroup), this.attribute = currentAttribute, offscreenGroup.AABBBounds;
40775
41551
  }
41552
+ _finalizeExitRelease() {
41553
+ var _a, _b;
41554
+ const state = this._exitReleaseState;
41555
+ if (null == state ? void 0 : state.finalized) return;
41556
+ state && (state.finalized = !0);
41557
+ const parent = this.parent,
41558
+ removeFromParent = !!(null == state ? void 0 : state.removeFromParent),
41559
+ callbacks = null !== (_a = null == state ? void 0 : state.onComplete) && void 0 !== _a ? _a : [];
41560
+ this._exitReleaseState = void 0, this._prevInnerView = null, this._innerView = null, this.axisLabelsContainer = null, this.axisContainer = null, this.removeAllChild(!0), super.release(!0), removeFromParent && (null === (_b = null != parent ? parent : this.parent) || void 0 === _b || _b.removeChild(this)), runExitReleaseCallbacks(callbacks);
41561
+ }
41562
+ _runExitAnimationBeforeRelease(options = {}) {
41563
+ var _a, _b, _c;
41564
+ if (this._exitReleaseState && !this._exitReleaseState.finalized) return this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent, appendExitReleaseCallback(this._exitReleaseState, options.onComplete), !0;
41565
+ if (!this.stage || !1 === this.attribute.animation || !1 === this.attribute.animationExit || !this._innerView) return !1;
41566
+ if (this._prepare(), !(null === (_a = this._animationConfig) || void 0 === _a ? void 0 : _a.exit)) return !1;
41567
+ const exitTargets = new Set();
41568
+ if (traverseGroup(this._innerView, el => {
41569
+ "group" !== el.type && exitTargets.add(el);
41570
+ }), !exitTargets.size) return !1;
41571
+ const existingAnimates = collectTrackedAnimates(this),
41572
+ {
41573
+ delay = 0,
41574
+ duration = DefaultAxisAnimation.duration,
41575
+ easing = DefaultAxisAnimation.easing
41576
+ } = this._animationConfig.exit;
41577
+ exitTargets.forEach(target => {
41578
+ var _a, _b, _c;
41579
+ const startAttrs = {
41580
+ opacity: null !== (_a = target.attribute.opacity) && void 0 !== _a ? _a : 1,
41581
+ fillOpacity: null !== (_b = target.attribute.fillOpacity) && void 0 !== _b ? _b : 1,
41582
+ strokeOpacity: null !== (_c = target.attribute.strokeOpacity) && void 0 !== _c ? _c : 1
41583
+ },
41584
+ endAttrs = {
41585
+ opacity: 0,
41586
+ fillOpacity: 0,
41587
+ strokeOpacity: 0
41588
+ };
41589
+ commitUpdateAnimationTarget(target, endAttrs, startAttrs), target.animate().wait(delay).to(endAttrs, duration, easing);
41590
+ });
41591
+ const exitAnimates = collectTrackedAnimates(this).filter(animate => !existingAnimates.includes(animate));
41592
+ if (!exitAnimates.length) return !1;
41593
+ this.setAttribute("childrenPickable", !1), null === (_c = (_b = this._innerView).removeAllEventListeners) || void 0 === _c || _c.call(_b), this.releaseStatus = "willRelease";
41594
+ const pendingAnimates = new Set(exitAnimates);
41595
+ return this._exitReleaseState = {
41596
+ pendingAnimates: pendingAnimates,
41597
+ finalized: !1,
41598
+ removeFromParent: !!options.removeFromParent,
41599
+ onComplete: options.onComplete ? [options.onComplete] : []
41600
+ }, bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease()), !0;
41601
+ }
41602
+ releaseWithExitAnimation(options = {}) {
41603
+ return "released" !== this.releaseStatus && this._runExitAnimationBeforeRelease(options);
41604
+ }
40776
41605
  render() {
40777
- this._prepare(), this._prevInnerView = this._innerView && getElMap(this._innerView), this.removeAllChild(!0), this._innerView = graphicCreator.group({
41606
+ this._exitReleaseState || (this._prepare(), this._prevInnerView = this._innerView && getElMap(this._innerView), this.removeAllChild(!0), this._innerView = graphicCreator.group({
40778
41607
  x: 0,
40779
41608
  y: 0,
40780
41609
  pickable: !1
40781
- }), this.add(this._innerView), this._renderInner(this._innerView), this._bindEvent(), this.runAnimation();
41610
+ }), this.add(this._innerView), this._renderInner(this._innerView), this._bindEvent(), this.runAnimation());
40782
41611
  }
40783
41612
  _prepare() {
40784
41613
  this._prepareAnimate(DefaultAxisAnimation);
@@ -41067,33 +41896,29 @@
41067
41896
  var _a;
41068
41897
  if ("group" !== el.type && el.id) {
41069
41898
  const oldEl = prevInnerView[el.id];
41070
- if (el.setFinalAttributes(el.attribute), oldEl) {
41899
+ if (oldEl) {
41071
41900
  oldEl.release();
41072
- const oldAttrs = oldEl.attribute,
41073
- finalAttrs = el.getFinalAttribute(),
41901
+ const oldAttrs = cloneDeep(oldEl.attribute),
41902
+ finalAttrs = cloneDeep(el.attribute),
41074
41903
  diffAttrs = diff(oldAttrs, finalAttrs);
41075
41904
  let hasDiff = Object.keys(diffAttrs).length > 0;
41076
- if ("opacity" in oldAttrs && finalAttrs.opacity !== oldAttrs.opacity && (diffAttrs.opacity = null !== (_a = finalAttrs.opacity) && void 0 !== _a ? _a : 1, hasDiff = !0), animationConfig.update && hasDiff) {
41077
- this._newElementAttrMap[el.id] = {
41078
- state: "update",
41079
- node: el,
41080
- attrs: el.attribute
41081
- };
41082
- const oldAttrs = oldEl.attribute;
41083
- el.setAttributes(oldAttrs), el.applyAnimationState(["update"], [{
41084
- name: "update",
41085
- animation: Object.assign(Object.assign({
41086
- selfOnly: !0
41087
- }, animationConfig.update), {
41088
- type: "axisUpdate",
41089
- customParameters: {
41090
- config: animationConfig.update,
41091
- diffAttrs: diffAttrs,
41092
- lastScale: lastScale
41093
- }
41094
- })
41095
- }]);
41096
- }
41905
+ "opacity" in oldAttrs && finalAttrs.opacity !== oldAttrs.opacity && (diffAttrs.opacity = null !== (_a = finalAttrs.opacity) && void 0 !== _a ? _a : 1, hasDiff = !0), animationConfig.update && hasDiff && (this._newElementAttrMap[el.id] = {
41906
+ state: "update",
41907
+ node: el,
41908
+ attrs: finalAttrs
41909
+ }, commitUpdateAnimationTarget(el, finalAttrs, oldAttrs), el.applyAnimationState(["update"], [{
41910
+ name: "update",
41911
+ animation: Object.assign(Object.assign({
41912
+ selfOnly: !0
41913
+ }, animationConfig.update), {
41914
+ type: "axisUpdate",
41915
+ customParameters: {
41916
+ config: animationConfig.update,
41917
+ diffAttrs: diffAttrs,
41918
+ lastScale: lastScale
41919
+ }
41920
+ })
41921
+ }]));
41097
41922
  } else animationConfig.enter && (this._newElementAttrMap[el.id] = {
41098
41923
  state: "enter",
41099
41924
  node: el,
@@ -41114,8 +41939,8 @@
41114
41939
  });
41115
41940
  }
41116
41941
  }
41117
- release() {
41118
- super.release(), this._prevInnerView = null, this._innerView = null;
41942
+ release(all) {
41943
+ this._exitReleaseState ? this._finalizeExitRelease() : (all && this.removeAllChild(!0), super.release(all), all && this.removeAllChild(!0), this._prevInnerView = null, this._innerView = null);
41119
41944
  }
41120
41945
  }
41121
41946
 
@@ -41437,7 +42262,10 @@
41437
42262
  const point = getTickCoord(lastScale.scale(currData.rawValue)),
41438
42263
  newX = this.target.attribute.x,
41439
42264
  newY = this.target.attribute.y;
41440
- this.target.setAttributes({
42265
+ commitUpdateAnimationTarget(this.target, {
42266
+ x: newX,
42267
+ y: newY
42268
+ }, {
41441
42269
  x: point.x,
41442
42270
  y: point.y
41443
42271
  }), animator.animate(this.target, {
@@ -41465,10 +42293,9 @@
41465
42293
  const duration = this.duration,
41466
42294
  easing = this.easing,
41467
42295
  {
41468
- config: config,
41469
42296
  diffAttrs: diffAttrs
41470
42297
  } = this.params;
41471
- animator.animate(this.target, {
42298
+ commitUpdateAnimationTarget(this.target, Object.assign({}, diffAttrs)), animator.animate(this.target, {
41472
42299
  type: "to",
41473
42300
  to: Object.assign({}, diffAttrs),
41474
42301
  duration: duration,
@@ -41479,7 +42306,10 @@
41479
42306
  }), this.completeBind(animator);
41480
42307
  }
41481
42308
  deleteSelfAttr(key) {
41482
- super.deleteSelfAttr(key), this._animator.deleteSelfAttr(key);
42309
+ this.deleteSelfAttrs([key]);
42310
+ }
42311
+ deleteSelfAttrs(keys) {
42312
+ super.deleteSelfAttrs(keys), this._animator.deleteSelfAttrs(keys);
41483
42313
  }
41484
42314
  tryPreventConflict() {}
41485
42315
  }
@@ -42025,8 +42855,8 @@
42025
42855
  const orient = this.attribute.orient;
42026
42856
  return "left" === orient || "right" === orient ? this.attribute.width ? this.attribute.width : (this.attribute.maxWidth && (offset = Math.min(offset, this.attribute.maxWidth)), this.attribute.minWidth && (offset = Math.max(offset, this.attribute.minWidth)), offset) : offset;
42027
42857
  }
42028
- release() {
42029
- super.release(), this._breaks = null;
42858
+ release(all) {
42859
+ super.release(all), this._breaks = null;
42030
42860
  }
42031
42861
  }
42032
42862
  LineAxis.defaultAttributes = DEFAULT_AXIS_THEME, mixin(LineAxis, LineAxisMixin);
@@ -42353,6 +43183,7 @@
42353
43183
  super(...arguments), this.mode = exports.AnimateMode.NORMAL;
42354
43184
  }
42355
43185
  onBind() {
43186
+ this._started = !1;
42356
43187
  const currentInnerView = this.target.getInnerView(),
42357
43188
  prevInnerView = this.target.getPrevInnerView();
42358
43189
  prevInnerView && (this._newElementAttrMap = {}, traverseGroup(currentInnerView, el => {
@@ -42370,7 +43201,7 @@
42370
43201
  fillOpacity: null !== (_b = newProps.fillOpacity) && void 0 !== _b ? _b : 1,
42371
43202
  strokeOpacity: null !== (_c = newProps.strokeOpacity) && void 0 !== _c ? _c : 1
42372
43203
  })
42373
- }, el.setAttributes(oldEl.attribute);
43204
+ }, commitUpdateAnimationTarget(el, this._newElementAttrMap[el.id].attrs, cloneDeep(oldEl.attribute));
42374
43205
  }
42375
43206
  } else {
42376
43207
  const finalOpacityAttrs = {
@@ -42382,7 +43213,7 @@
42382
43213
  state: "enter",
42383
43214
  node: el,
42384
43215
  attrs: finalOpacityAttrs
42385
- }, el.setAttributes({
43216
+ }, commitUpdateAnimationTarget(el, finalOpacityAttrs, {
42386
43217
  opacity: 0,
42387
43218
  fillOpacity: 0,
42388
43219
  strokeOpacity: 0
@@ -42392,6 +43223,8 @@
42392
43223
  }));
42393
43224
  }
42394
43225
  onStart() {
43226
+ if (this._started) return;
43227
+ this._started = !0;
42395
43228
  let duration = this.duration,
42396
43229
  easing = this.easing;
42397
43230
  this._newElementAttrMap && Object.keys(this._newElementAttrMap).forEach(id => {
@@ -43995,6 +44828,14 @@
43995
44828
  }
43996
44829
  return t;
43997
44830
  };
44831
+ function cloneAttributeSnapshot(value) {
44832
+ if (!isObject$1(value) || isArray$1(value)) return value;
44833
+ const snapshot = {};
44834
+ return Object.keys(value).forEach(key => {
44835
+ const nextValue = value[key];
44836
+ snapshot[key] = isObject$1(nextValue) && !isArray$1(nextValue) ? cloneAttributeSnapshot(nextValue) : nextValue;
44837
+ }), snapshot;
44838
+ }
43998
44839
  loadLabelComponent();
43999
44840
  class LabelBase extends AnimateComponent {
44000
44841
  setBitmap(bitmap) {
@@ -44059,11 +44900,56 @@
44059
44900
  return baseMark && baseMark.getAttributes(!0).fill && lineGraphic.setAttribute("stroke", baseMark.getAttributes(!0).fill), this.attribute.line && !isEmpty(this.attribute.line.style) && lineGraphic.setAttributes(this.attribute.line.style), this._setStatesOfLabelLine(lineGraphic), lineGraphic;
44060
44901
  }
44061
44902
  }
44903
+ _finalizeExitRelease() {
44904
+ var _a, _b, _c, _d;
44905
+ const state = this._exitReleaseState;
44906
+ if (null == state ? void 0 : state.finalized) return;
44907
+ state && (state.finalized = !0);
44908
+ const parent = this.parent,
44909
+ removeFromParent = !!(null == state ? void 0 : state.removeFromParent),
44910
+ callbacks = null !== (_a = null == state ? void 0 : state.onComplete) && void 0 !== _a ? _a : [];
44911
+ this._exitReleaseState = void 0, this._graphicToText = new Map(), null === (_b = this._idToGraphic) || void 0 === _b || _b.clear(), null === (_c = this._idToPoint) || void 0 === _c || _c.clear(), this._baseMarks = void 0, this.removeAllChild(!0), super.release(!0), removeFromParent && (null === (_d = null != parent ? parent : this.parent) || void 0 === _d || _d.removeChild(this)), runExitReleaseCallbacks(callbacks);
44912
+ }
44913
+ _runExitAnimationBeforeRelease(options = {}) {
44914
+ var _a, _b;
44915
+ if (this._exitReleaseState && !this._exitReleaseState.finalized) return this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent, appendExitReleaseCallback(this._exitReleaseState, options.onComplete), !0;
44916
+ if (!this.stage || !1 === this.attribute.animation || !1 === this.attribute.animationExit || !(null === (_a = this._graphicToText) || void 0 === _a ? void 0 : _a.size)) return !1;
44917
+ if (this._prepareAnimate(DefaultLabelAnimation), !(null === (_b = this._animationConfig) || void 0 === _b ? void 0 : _b.exit)) return !1;
44918
+ const exitTargets = new Set();
44919
+ if (this._graphicToText.forEach(label => {
44920
+ (null == label ? void 0 : label.text) && exitTargets.add(label.text), (null == label ? void 0 : label.labelLine) && exitTargets.add(label.labelLine);
44921
+ }), !exitTargets.size) return !1;
44922
+ const existingAnimates = collectTrackedAnimates(this);
44923
+ exitTargets.forEach(target => {
44924
+ var _a;
44925
+ target.applyAnimationState(["exit"], [{
44926
+ name: "exit",
44927
+ animation: Object.assign(Object.assign({}, this._animationConfig.exit), {
44928
+ type: null !== (_a = this._animationConfig.exit.type) && void 0 !== _a ? _a : "fadeOut",
44929
+ selfOnly: !0
44930
+ })
44931
+ }]);
44932
+ });
44933
+ const exitAnimates = collectTrackedAnimates(this).filter(animate => !existingAnimates.includes(animate));
44934
+ if (!exitAnimates.length) return !1;
44935
+ this.setAttribute("childrenPickable", !1), this.releaseStatus = "willRelease";
44936
+ const pendingAnimates = new Set(exitAnimates);
44937
+ return this._exitReleaseState = {
44938
+ pendingAnimates: pendingAnimates,
44939
+ finalized: !1,
44940
+ removeFromParent: !!options.removeFromParent,
44941
+ onComplete: options.onComplete ? [options.onComplete] : []
44942
+ }, bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease()), !0;
44943
+ }
44944
+ releaseWithExitAnimation(options = {}) {
44945
+ return "released" !== this.releaseStatus && this._runExitAnimationBeforeRelease(options);
44946
+ }
44062
44947
  render() {
44948
+ if (this._exitReleaseState) return;
44063
44949
  if (this._prepare(), isNil$1(this._idToGraphic) || this._isCollectionBase && isNil$1(this._idToPoint)) return;
44064
44950
  const markAttributeList = [];
44065
44951
  !1 !== this._enableAnimation && this._baseMarks.forEach(mark => {
44066
- markAttributeList.push(mark.attribute), mark.initAttributes(mark.getAttributes(!0));
44952
+ markAttributeList.push(cloneAttributeSnapshot(mark.attribute)), mark.initAttributes(mark.getAttributes(!0));
44067
44953
  });
44068
44954
  const {
44069
44955
  overlap: overlap,
@@ -44488,7 +45374,7 @@
44488
45374
  text: curText,
44489
45375
  labelLine: curLabelLine
44490
45376
  } = currentLabel;
44491
- prevText.applyAnimationState(["update"], [{
45377
+ commitUpdateAnimationTarget(prevText, null == curText ? void 0 : curText.attribute), commitUpdateAnimationTarget(prevLabelLine, null == curLabelLine ? void 0 : curLabelLine.attribute), prevText.applyAnimationState(["update"], [{
44492
45378
  name: "update",
44493
45379
  animation: {
44494
45380
  type: "labelUpdate",
@@ -44514,7 +45400,6 @@
44514
45400
  }
44515
45401
  _updateLabel(prevLabel, currentLabel) {
44516
45402
  const {
44517
- text: prevText,
44518
45403
  labelLine: prevLabelLine
44519
45404
  } = prevLabel,
44520
45405
  {
@@ -44630,6 +45515,10 @@
44630
45515
  _canPlaceInside(textBound, shapeBound) {
44631
45516
  return !(!textBound || !shapeBound) && shapeBound.encloses(textBound);
44632
45517
  }
45518
+ release(all) {
45519
+ var _a, _b;
45520
+ this._exitReleaseState ? this._finalizeExitRelease() : (all && this.removeAllChild(!0), super.release(all), this._graphicToText = new Map(), null === (_a = this._idToGraphic) || void 0 === _a || _a.clear(), null === (_b = this._idToPoint) || void 0 === _b || _b.clear(), this._baseMarks = void 0);
45521
+ }
44633
45522
  setLocation(point) {
44634
45523
  this.translateTo(point.x, point.y);
44635
45524
  }
@@ -45399,6 +46288,7 @@
45399
46288
  }
45400
46289
  render() {
45401
46290
  var _a;
46291
+ if (this._exitReleaseState) return;
45402
46292
  const {
45403
46293
  dataLabels: dataLabels,
45404
46294
  size: size
@@ -45433,6 +46323,47 @@
45433
46323
  currentComponentMap.get(key) || this.removeChild(cp);
45434
46324
  }), this._componentMap = currentComponentMap;
45435
46325
  }
46326
+ _finalizeExitRelease() {
46327
+ var _a, _b, _c;
46328
+ const state = this._exitReleaseState;
46329
+ if (null == state ? void 0 : state.finalized) return;
46330
+ state && (state.finalized = !0);
46331
+ const parent = this.parent,
46332
+ removeFromParent = !!(null == state ? void 0 : state.removeFromParent),
46333
+ callbacks = null !== (_a = null == state ? void 0 : state.onComplete) && void 0 !== _a ? _a : [];
46334
+ this._exitReleaseState = void 0, null === (_b = this._componentMap) || void 0 === _b || _b.clear(), this.removeAllChild(!0), super.release(!0), removeFromParent && (null === (_c = null != parent ? parent : this.parent) || void 0 === _c || _c.removeChild(this)), runExitReleaseCallbacks(callbacks);
46335
+ }
46336
+ releaseWithExitAnimation(options = {}) {
46337
+ var _a;
46338
+ if ("released" === this.releaseStatus) return !1;
46339
+ if (this._exitReleaseState && !this._exitReleaseState.finalized) return this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent, appendExitReleaseCallback(this._exitReleaseState, options.onComplete), !0;
46340
+ if (!this.stage || !(null === (_a = this._componentMap) || void 0 === _a ? void 0 : _a.size)) return !1;
46341
+ const state = {
46342
+ pendingCount: 0,
46343
+ finalized: !1,
46344
+ removeFromParent: !!options.removeFromParent,
46345
+ onComplete: options.onComplete ? [options.onComplete] : []
46346
+ },
46347
+ exitingComponents = [],
46348
+ fallbackComponents = [];
46349
+ let initializing = !0;
46350
+ const finish = () => {
46351
+ state.finalized || (state.pendingCount -= 1, state.pendingCount <= 0 && !initializing && this._finalizeExitRelease());
46352
+ };
46353
+ return this._exitReleaseState = state, this._componentMap.forEach(component => {
46354
+ state.pendingCount += 1;
46355
+ component.releaseWithExitAnimation({
46356
+ removeFromParent: !1,
46357
+ onComplete: finish
46358
+ }) ? exitingComponents.push(component) : (state.pendingCount -= 1, fallbackComponents.push(component));
46359
+ }), exitingComponents.length ? (fallbackComponents.forEach(component => {
46360
+ component.release(!0), this.removeChild(component);
46361
+ }), this.setAttribute("childrenPickable", !1), this.releaseStatus = "willRelease", initializing = !1, state.pendingCount <= 0 && this._finalizeExitRelease(), !0) : (this._exitReleaseState = void 0, !1);
46362
+ }
46363
+ release(all) {
46364
+ var _a;
46365
+ this._exitReleaseState ? this._finalizeExitRelease() : (all && this.removeAllChild(!0), super.release(all), null === (_a = this._componentMap) || void 0 === _a || _a.clear());
46366
+ }
45436
46367
  setLocation(point) {
45437
46368
  this.translateTo(point.x, point.y);
45438
46369
  }
@@ -47066,14 +47997,51 @@
47066
47997
  y: clipInRange ? -(null !== (_b = limitRect.y) && void 0 !== _b ? _b : 0) : 0
47067
47998
  });
47068
47999
  }
47069
- render() {
48000
+ _finalizeExitRelease() {
48001
+ var _a, _b;
48002
+ const state = this._exitReleaseState;
48003
+ if (null == state ? void 0 : state.finalized) return;
48004
+ state && (state.finalized = !0);
48005
+ const parent = this.parent,
48006
+ removeFromParent = !!(null == state ? void 0 : state.removeFromParent),
48007
+ releaseSelf = !!(null == state ? void 0 : state.releaseSelf),
48008
+ callbacks = null !== (_a = null == state ? void 0 : state.onComplete) && void 0 !== _a ? _a : [];
48009
+ this._exitReleaseState = void 0, this._releaseEvent(), this._container = null, this._containerClip = null, this.removeAllChild(!0), releaseSelf && (super.release(!0), removeFromParent && (null === (_b = null != parent ? parent : this.parent) || void 0 === _b || _b.removeChild(this))), runExitReleaseCallbacks(callbacks);
48010
+ }
48011
+ _runExitAnimationBeforeCleanup(options = {}) {
47070
48012
  var _a;
48013
+ const releaseSelf = !!options.releaseSelf;
48014
+ if (this._exitReleaseState && !this._exitReleaseState.finalized) return this._exitReleaseState.releaseSelf = this._exitReleaseState.releaseSelf || releaseSelf, this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent, appendExitReleaseCallback(this._exitReleaseState, options.onComplete), !0;
48015
+ if (!this.stage || !1 === this.attribute.animation || !1 === this.attribute.animationExit || !this._container) return !1;
48016
+ if (this.transAnimationConfig(), !(null === (_a = this._animationConfig) || void 0 === _a ? void 0 : _a.exit)) return !1;
48017
+ const existingAnimates = collectTrackedAnimates(this);
48018
+ this.markerAnimate("exit");
48019
+ const exitAnimates = collectTrackedAnimates(this).filter(animate => !existingAnimates.includes(animate));
48020
+ if (!exitAnimates.length) return !1;
48021
+ this._releaseEvent(), this.setAttribute("childrenPickable", !1), releaseSelf && (this.releaseStatus = "willRelease");
48022
+ const pendingAnimates = new Set(exitAnimates);
48023
+ return this._exitReleaseState = {
48024
+ pendingAnimates: pendingAnimates,
48025
+ finalized: !1,
48026
+ releaseSelf: releaseSelf,
48027
+ removeFromParent: !!options.removeFromParent,
48028
+ onComplete: options.onComplete ? [options.onComplete] : []
48029
+ }, bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease()), !0;
48030
+ }
48031
+ releaseWithExitAnimation(options = {}) {
48032
+ return "released" !== this.releaseStatus && this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({}, options), {
48033
+ releaseSelf: !0
48034
+ }));
48035
+ }
48036
+ render() {
48037
+ var _a, _b;
48038
+ if (null === (_a = this._exitReleaseState) || void 0 === _a ? void 0 : _a.releaseSelf) return;
47071
48039
  this.transAnimationConfig(), this.setAttribute("pickable", !1);
47072
- const markerVisible = null === (_a = this.attribute.visible) || void 0 === _a || _a;
47073
- !1 === this.attribute.interactive && this.setAttribute("childrenPickable", !1), markerVisible && this.isValidPoints() ? this._container ? (this._updateContainer(), this.updateMarker(), this.markerAnimate("update")) : (this._initContainer(), this.initMarker(this._container), this.markerAnimate("enter")) : (this.markerAnimate("exit"), this._container = null, this.removeAllChild(!0)), this._releaseEvent(), this._bindEvent();
48040
+ const markerVisible = null === (_b = this.attribute.visible) || void 0 === _b || _b;
48041
+ !1 === this.attribute.interactive && this.setAttribute("childrenPickable", !1), markerVisible && this.isValidPoints() ? (this._exitReleaseState && this._finalizeExitRelease(), this._container ? (this._updateContainer(), this.updateMarker(), this.markerAnimate("update")) : (this._initContainer(), this.initMarker(this._container), this.markerAnimate("enter"))) : this._runExitAnimationBeforeCleanup() || (this._container = null, this._containerClip = null, this.removeAllChild(!0)), this._releaseEvent(), this._bindEvent();
47074
48042
  }
47075
- release() {
47076
- this.markerAnimate("exit"), super.release(), this._releaseEvent(), this._container = null;
48043
+ release(all) {
48044
+ this._exitReleaseState ? this._finalizeExitRelease() : (!1 !== this.attribute.animation && !1 !== this.attribute.animationExit && this.markerAnimate("exit"), all && this.removeAllChild(!0), super.release(all), this._releaseEvent(), this._container = null, this._containerClip = null);
47077
48045
  }
47078
48046
  }
47079
48047
 
@@ -47083,7 +48051,10 @@
47083
48051
  null === (_a = null == graphic ? void 0 : graphic.animates) || void 0 === _a || _a.forEach(a => a.stop("end"));
47084
48052
  const fillOpacityConfig = null !== (_c = null === (_b = graphic.attribute) || void 0 === _b ? void 0 : _b.fillOpacity) && void 0 !== _c ? _c : 1,
47085
48053
  strokeOpacityConfig = null !== (_e = null === (_d = graphic.attribute) || void 0 === _d ? void 0 : _d.strokeOpacity) && void 0 !== _e ? _e : 1;
47086
- graphic.setAttributes({
48054
+ commitUpdateAnimationTarget(graphic, {
48055
+ fillOpacity: fillOpacityConfig,
48056
+ strokeOpacity: strokeOpacityConfig
48057
+ }, {
47087
48058
  fillOpacity: 0,
47088
48059
  strokeOpacity: 0
47089
48060
  }), graphic.animate().wait(delay).to({
@@ -47099,7 +48070,10 @@
47099
48070
  }
47100
48071
  function graphicFadeOut(graphic, delay, duration, easing) {
47101
48072
  var _a, _b, _c, _d;
47102
- graphic && (graphic.setAttributes({
48073
+ graphic && (commitUpdateAnimationTarget(graphic, {
48074
+ fillOpacity: 0,
48075
+ strokeOpacity: 0
48076
+ }, {
47103
48077
  fillOpacity: null !== (_b = null === (_a = graphic.attribute) || void 0 === _a ? void 0 : _a.fillOpacity) && void 0 !== _b ? _b : 1,
47104
48078
  strokeOpacity: null !== (_d = null === (_c = graphic.attribute) || void 0 === _c ? void 0 : _c.strokeOpacity) && void 0 !== _d ? _d : 1
47105
48079
  }), graphic.animate().wait(delay).to({
@@ -47119,7 +48093,11 @@
47119
48093
  lineDuration = .7 * duration,
47120
48094
  endSymbolDuration = .1 * duration,
47121
48095
  labelDuration = .1 * duration;
47122
- graphicFadeIn(line.startSymbol, delay, startSymbolDuration, easing), line.lines.forEach(line => line.setAttribute("clipRange", 0)), line.lines.forEach((l, index) => {
48096
+ graphicFadeIn(line.startSymbol, delay, startSymbolDuration, easing), line.lines.forEach(line => commitUpdateAnimationTarget(line, {
48097
+ clipRange: 1
48098
+ }, {
48099
+ clipRange: 0
48100
+ })), line.lines.forEach((l, index) => {
47123
48101
  const stepDuration = lineDuration / line.lines.length;
47124
48102
  l.animate().wait(delay + startSymbolDuration + index * stepDuration).to({
47125
48103
  clipRange: 1
@@ -47177,7 +48155,11 @@
47177
48155
  decorativeDuration = .05 * duration,
47178
48156
  endSymbolDuration = .1 * duration,
47179
48157
  labelDuration = .1 * duration;
47180
- graphicFadeIn(itemLine.startSymbol, delay, startSymbolDuration, easing), itemLine.lines.forEach(line => line.setAttribute("clipRange", 0)), itemLine.lines.forEach((l, index) => {
48158
+ graphicFadeIn(itemLine.startSymbol, delay, startSymbolDuration, easing), itemLine.lines.forEach(line => commitUpdateAnimationTarget(line, {
48159
+ clipRange: 1
48160
+ }, {
48161
+ clipRange: 0
48162
+ })), itemLine.lines.forEach((l, index) => {
47181
48163
  const stepDuration = lineDuration / itemLine.lines.length;
47182
48164
  l.animate().wait(delay + startSymbolDuration + index * stepDuration).to({
47183
48165
  clipRange: 1
@@ -49322,7 +50304,10 @@
49322
50304
  const innerGroupHeight = innerGroupBounds.height(),
49323
50305
  itemGroupWidth = isValid$1(this.attribute.item.width) ? this.attribute.item.width : innerGroupWidth + parsedPadding[1] + parsedPadding[3],
49324
50306
  itemGroupHeight = this._itemHeightByUser || innerGroupHeight + parsedPadding[0] + parsedPadding[2];
49325
- return itemGroup.attribute.width = itemGroupWidth, itemGroup.attribute.height = itemGroupHeight, focusShape && focusShape.setAttribute("visible", !1), innerGroup.translateTo(-innerGroupBounds.x1 + parsedPadding[3], -innerGroupBounds.y1 + parsedPadding[0]), itemGroup;
50307
+ return itemGroup.setAttributes({
50308
+ width: itemGroupWidth,
50309
+ height: itemGroupHeight
50310
+ }), focusShape && focusShape.setAttribute("visible", !1), innerGroup.translateTo(-innerGroupBounds.x1 + parsedPadding[3], -innerGroupBounds.y1 + parsedPadding[0]), itemGroup;
49326
50311
  }
49327
50312
  _createPager(compStyle) {
49328
50313
  var _a, _b;
@@ -49461,12 +50446,18 @@
49461
50446
  let containerSize;
49462
50447
  containerSize = this._itemContext.isHorizontal ? this._itemsContainer.AABBBounds.width() : this._itemsContainer.AABBBounds.height();
49463
50448
  const startOffset = containerSize * start;
49464
- this.updateScrollMask(), animation ? this._itemsContainer.animate().to({
49465
- [channel]: -startOffset
49466
- }, animationDuration, animationEasing) : this._itemsContainer.setAttribute(channel, -startOffset);
49467
- } else animation ? this._itemsContainer.animate().to({
49468
- [channel]: -(newPage - 1) * pageSize
49469
- }, animationDuration, animationEasing) : this._itemsContainer.setAttribute(channel, -(newPage - 1) * pageSize);
50449
+ if (this.updateScrollMask(), animation) {
50450
+ const attrs = {
50451
+ [channel]: -startOffset
50452
+ };
50453
+ commitUpdateAnimationTarget(this._itemsContainer, attrs), this._itemsContainer.animate().to(attrs, animationDuration, animationEasing);
50454
+ } else this._itemsContainer.setAttribute(channel, -startOffset);
50455
+ } else if (animation) {
50456
+ const attrs = {
50457
+ [channel]: -(newPage - 1) * pageSize
50458
+ };
50459
+ commitUpdateAnimationTarget(this._itemsContainer, attrs), this._itemsContainer.animate().to(attrs, animationDuration, animationEasing);
50460
+ } else this._itemsContainer.setAttribute(channel, -(newPage - 1) * pageSize);
49470
50461
  }
49471
50462
  };
49472
50463
  if (this._itemContext.isScrollbar) {
@@ -50953,7 +51944,11 @@
50953
51944
  subTextBoundsWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;
50954
51945
  let totalWidth = Math.max(mainTextBoundsWidth, subTextBoundsWidth),
50955
51946
  totalHeight = mainTextBoundsHeight + (null !== (_q = subtextStyle.height) && void 0 !== _q ? _q : subTextBoundsHeight);
50956
- if (isValid$1(width) && (totalWidth = width), isValid$1(height) && (totalHeight = height), isValid$1(minWidth) && totalWidth < minWidth && (totalWidth = minWidth), isValid$1(maxWidth) && totalWidth > maxWidth && (totalWidth = maxWidth), isValid$1(minHeight) && totalHeight < minHeight && (totalHeight = minHeight), isValid$1(maxHeight) && totalHeight > maxHeight && (totalHeight = maxHeight), group.attribute.width = totalWidth, group.attribute.height = totalHeight, group.attribute.boundsPadding = parsedPadding, this._mainTitle) {
51947
+ if (isValid$1(width) && (totalWidth = width), isValid$1(height) && (totalHeight = height), isValid$1(minWidth) && totalWidth < minWidth && (totalWidth = minWidth), isValid$1(maxWidth) && totalWidth > maxWidth && (totalWidth = maxWidth), isValid$1(minHeight) && totalHeight < minHeight && (totalHeight = minHeight), isValid$1(maxHeight) && totalHeight > maxHeight && (totalHeight = maxHeight), group.setAttributes({
51948
+ width: totalWidth,
51949
+ height: totalHeight,
51950
+ boundsPadding: parsedPadding
51951
+ }), this._mainTitle) {
50957
51952
  if (isValid$1(align) || isValid$1(textStyle.align)) {
50958
51953
  const mainTitleAlign = textStyle.align ? textStyle.align : align,
50959
51954
  mainTitleWidth = null !== (_r = textStyle.width) && void 0 !== _r ? _r : totalWidth;
@@ -52490,6 +53485,7 @@
52490
53485
  setActive(labelGroup, activeLabelStyle), setActive(symbolGroup, activeSymbolStyle);
52491
53486
  }
52492
53487
  appearAnimate(animateConfig) {
53488
+ var _a;
52493
53489
  const {
52494
53490
  duration = 1e3,
52495
53491
  easing = "quadOut"
@@ -52505,26 +53501,39 @@
52505
53501
  perSymbolNormalDuration = 90 * percent,
52506
53502
  symbolDelay = 100 * percent,
52507
53503
  symbolNormalDelay = 600 * percent;
52508
- if (this._line && (this._line.setAttributes({
53504
+ if (this._line && (commitUpdateAnimationTarget(this._line, {
53505
+ clipRange: 1
53506
+ }, {
52509
53507
  clipRange: 0
52510
53508
  }), this._line.animate().to({
52511
53509
  clipRange: 1
52512
- }, lineDuration, easing)), this._activeLine && (this._activeLine.setAttributes({
52513
- opacity: 0
52514
- }), this._activeLine.animate().wait(500).to({
52515
- opacity: 1
52516
- }, activeLineDuration, easing)), this._symbolGroup) {
53510
+ }, lineDuration, easing)), this._activeLine) {
53511
+ const opacity = null !== (_a = this._activeLine.attribute.opacity) && void 0 !== _a ? _a : 1;
53512
+ commitUpdateAnimationTarget(this._activeLine, {
53513
+ opacity: opacity
53514
+ }, {
53515
+ opacity: 0
53516
+ }), this._activeLine.animate().wait(500).to({
53517
+ opacity: opacity
53518
+ }, activeLineDuration, easing);
53519
+ }
53520
+ if (this._symbolGroup) {
52517
53521
  const size = this._symbolGroup.count - 1,
52518
53522
  delay = percent * (1 === size ? 0 : 400 / (size - 1)),
52519
53523
  delayNormal = percent * (1 === size ? 0 : 240 / (size - 1));
52520
53524
  this._symbolGroup.forEachChildren((symbol, i) => {
53525
+ var _a;
52521
53526
  const originAttrs = {};
52522
53527
  Object.keys(activeSymbolStyle).forEach(k => {
52523
53528
  originAttrs[k] = symbol.attribute[k];
52524
- }), symbol.setAttributes({
53529
+ });
53530
+ const opacity = null !== (_a = symbol.attribute.opacity) && void 0 !== _a ? _a : 1;
53531
+ commitUpdateAnimationTarget(symbol, {
53532
+ opacity: opacity
53533
+ }, {
52525
53534
  opacity: 0
52526
53535
  }), symbol.animate().wait(symbolDelay + delay * i).to({
52527
- opacity: 1
53536
+ opacity: opacity
52528
53537
  }, perSymbolDuration, easing), symbol.animate().wait(symbolNormalDelay + delayNormal * i).to(Object.assign({}, activeSymbolStyle), perSymbolNormalDuration, easing).to(Object.assign({}, originAttrs), perSymbolNormalDuration, easing);
52529
53538
  });
52530
53539
  }
@@ -52533,13 +53542,18 @@
52533
53542
  delay = percent * (1 === size ? 0 : 400 / (size - 1)),
52534
53543
  delayNormal = percent * (1 === size ? 0 : 240 / (size - 1));
52535
53544
  this._labelGroup.forEachChildren((label, i) => {
53545
+ var _a;
52536
53546
  const originAttrs = {};
52537
53547
  Object.keys(activeLabelStyle).forEach(k => {
52538
53548
  originAttrs[k] = label.attribute[k];
52539
- }), label.setAttributes({
53549
+ });
53550
+ const opacity = null !== (_a = label.attribute.opacity) && void 0 !== _a ? _a : 1;
53551
+ commitUpdateAnimationTarget(label, {
53552
+ opacity: opacity
53553
+ }, {
52540
53554
  opacity: 0
52541
53555
  }), label.animate().wait(symbolDelay + delay * i).to({
52542
- opacity: 1
53556
+ opacity: opacity
52543
53557
  }, perSymbolDuration, easing), label.animate().wait(symbolNormalDelay + delayNormal * i).to(Object.assign({
52544
53558
  dy: 10
52545
53559
  }, activeLabelStyle), perSymbolNormalDuration, easing).to(Object.assign({
@@ -52573,7 +53587,11 @@
52573
53587
  duration = 1e3,
52574
53588
  easing = "quadOut"
52575
53589
  } = animateConfig;
52576
- this.animate().to({
53590
+ commitUpdateAnimationTarget(this, {
53591
+ clipRange: nextClipRange
53592
+ }, {
53593
+ clipRange: clipRange
53594
+ }), this.animate().to({
52577
53595
  clipRange: nextClipRange
52578
53596
  }, duration, easing);
52579
53597
  } else this.setAttributes({
@@ -54292,7 +55310,7 @@
54292
55310
  return resolveLegacyApp().createStage(params);
54293
55311
  }
54294
55312
 
54295
- const version = "1.1.0-alpha.2";
55313
+ const version = "1.1.0-alpha.20";
54296
55314
 
54297
55315
  exports.AComponentAnimate = AComponentAnimate;
54298
55316
  exports.ACustomAnimate = ACustomAnimate;
@@ -55217,7 +56235,6 @@
55217
56235
  exports.setPoptipTheme = setPoptipTheme;
55218
56236
  exports.shouldClipImageByLayout = shouldClipImageByLayout;
55219
56237
  exports.shouldUseMat4 = shouldUseMat4;
55220
- exports.shouldUseSimpleAttributeFastPath = shouldUseSimpleAttributeFastPath;
55221
56238
  exports.smartInvertStrategy = smartInvertStrategy;
55222
56239
  exports.snakeWave = snakeWave;
55223
56240
  exports.snapLength = snapLength;