@visactor/react-vchart 2.1.0-alpha.0 → 2.1.0-alpha.2

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/build/index.js CHANGED
@@ -13467,6 +13467,12 @@
13467
13467
  function getStageStatePerfMonitor(stage) {
13468
13468
  if (stage) return stage[STAGE_PERF_MONITOR];
13469
13469
  }
13470
+ function getActiveStageStatePerfMonitor(stage) {
13471
+ var _a;
13472
+ if (!stage) return;
13473
+ const current = getStageStatePerfMonitor(stage);
13474
+ return current || (!0 === (null === (_a = stage.statePerfConfig) || void 0 === _a ? void 0 : _a.enabled) ? ensureStageStatePerfMonitor(stage) : void 0);
13475
+ }
13470
13476
 
13471
13477
  function isPlainObject$1(value) {
13472
13478
  return null != value && "object" == typeof value && !Array.isArray(value);
@@ -13562,7 +13568,7 @@
13562
13568
  }
13563
13569
  invalidateResolverCache() {
13564
13570
  var _a, _b;
13565
- 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");
13571
+ 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");
13566
13572
  }
13567
13573
  hasState(stateName) {
13568
13574
  return !!this._activeStates.length && (null == stateName || this._activeStates.includes(stateName));
@@ -13609,7 +13615,7 @@
13609
13615
  }
13610
13616
  recomputePatch(effectiveStates) {
13611
13617
  var _a;
13612
- const perfMonitor = getStageStatePerfMonitor(null === (_a = this.graphic) || void 0 === _a ? void 0 : _a.stage),
13618
+ const perfMonitor = getActiveStageStatePerfMonitor(null === (_a = this.graphic) || void 0 === _a ? void 0 : _a.stage),
13613
13619
  patchStart = perfMonitor ? performance.now() : 0;
13614
13620
  let resolverCost = 0;
13615
13621
  const cacheKey = effectiveStates.join(","),
@@ -13857,32 +13863,6 @@
13857
13863
  }
13858
13864
  }), resolvedAttrs;
13859
13865
  }
13860
- resolveWithCompiled(normalAttrs, compiledDefinitions, stateProxy, effectiveStates, resolvedPatch) {
13861
- var _a, _b;
13862
- const mergeMode = null !== (_a = this.options.mergeMode) && void 0 !== _a ? _a : "shallow",
13863
- resolvedAttrs = null !== (_b = cloneValue(resolvedPatch)) && void 0 !== _b ? _b : {};
13864
- return effectiveStates.forEach(stateName => {
13865
- const proxyPatch = null == stateProxy ? void 0 : stateProxy(stateName, effectiveStates);
13866
- null != proxyPatch && Object.keys(proxyPatch).forEach(key => {
13867
- const nextValue = proxyPatch[key],
13868
- hasCompiledDefinition = compiledDefinitions.has(stateName);
13869
- if ("deep" === mergeMode && isPlainObject(nextValue) && (isPlainObject(resolvedAttrs[key]) || !hasCompiledDefinition && isPlainObject(normalAttrs[key]))) {
13870
- const baseValue = isPlainObject(resolvedAttrs[key]) ? resolvedAttrs[key] : isPlainObject(normalAttrs[key]) ? normalAttrs[key] : {};
13871
- resolvedAttrs[key] = deepMerge(baseValue, nextValue);
13872
- } else resolvedAttrs[key] = cloneValue(nextValue);
13873
- });
13874
- }), resolvedAttrs;
13875
- }
13876
- computeNormalAttrsBackup(normalAttrs, targetAttrs, finalAttribute) {
13877
- const nextNormalAttrs = {},
13878
- nextTargetAttrs = Object.assign({}, targetAttrs);
13879
- for (const key in targetAttrs) Object.prototype.hasOwnProperty.call(targetAttrs, key) && (nextNormalAttrs[key] = cloneValue(normalAttrs && key in normalAttrs ? normalAttrs[key] : finalAttribute[key]));
13880
- if (normalAttrs) for (const key in normalAttrs) Object.prototype.hasOwnProperty.call(normalAttrs, key) && !(key in targetAttrs) && (nextTargetAttrs[key] = cloneValue(normalAttrs[key]));
13881
- return {
13882
- attrs: nextTargetAttrs,
13883
- normalAttrs: nextNormalAttrs
13884
- };
13885
- }
13886
13866
  }
13887
13867
 
13888
13868
  function hasOwnKeys(value) {
@@ -14017,7 +13997,7 @@
14017
13997
  }
14018
13998
  function ensureSharedStateScopeFresh(scope) {
14019
13999
  var _a;
14020
- 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;
14000
+ 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;
14021
14001
  }
14022
14002
  function collectSharedStateScopeChain(scope) {
14023
14003
  const chain = [];
@@ -14028,7 +14008,7 @@
14028
14008
 
14029
14009
  function scheduleStageSharedStateRefresh(stage) {
14030
14010
  var _a;
14031
- stage && "released" !== stage.releaseStatus && (null === (_a = getStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordRefresh("renderScheduled"), stage.renderNextFrame());
14011
+ stage && "released" !== stage.releaseStatus && (null === (_a = getActiveStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordRefresh("renderScheduled"), stage.renderNextFrame());
14032
14012
  }
14033
14013
  function enqueueGraphicSharedStateRefresh(stage, graphic) {
14034
14014
  var _a;
@@ -14036,7 +14016,7 @@
14036
14016
  const pending = null !== (_a = stage._pendingSharedStateRefreshGraphics) && void 0 !== _a ? _a : stage._pendingSharedStateRefreshGraphics = new Set();
14037
14017
  if (!pending.has(graphic)) {
14038
14018
  pending.add(graphic);
14039
- const perfMonitor = getStageStatePerfMonitor(stage);
14019
+ const perfMonitor = getActiveStageStatePerfMonitor(stage);
14040
14020
  null == perfMonitor || perfMonitor.recordRefresh("queuedGraphics"), null == perfMonitor || perfMonitor.recordAllocation("refreshQueuePushes");
14041
14021
  }
14042
14022
  }
@@ -14051,12 +14031,13 @@
14051
14031
  function flushStageSharedStateRefresh(stage) {
14052
14032
  const pending = stage._pendingSharedStateRefreshGraphics;
14053
14033
  if (!pending || !pending.size) return;
14054
- const perfMonitor = getStageStatePerfMonitor(stage),
14034
+ const perfMonitor = getActiveStageStatePerfMonitor(stage),
14055
14035
  start = perfMonitor ? performance.now() : 0,
14056
14036
  graphics = Array.from(pending.values());
14057
14037
  pending.clear(), null == perfMonitor || perfMonitor.recordRefresh("flushedGraphics", graphics.length), graphics.forEach(graphic => {
14058
14038
  if ("released" === graphic.releaseStatus) return;
14059
14039
  if (graphic.stage !== stage) return;
14040
+ if (!graphic.sharedStateDirty) return;
14060
14041
  const refresh = graphic.refreshSharedStateBeforeRender;
14061
14042
  "function" == typeof refresh && (refresh.call(graphic), null == perfMonitor || perfMonitor.incrementCounter("sharedRefreshCommits"));
14062
14043
  }), perfMonitor && (perfMonitor.recordCost("sharedRefresh", performance.now() - start), perfMonitor.recordEvent("shared-refresh-flush", {
@@ -14073,9 +14054,12 @@
14073
14054
  tempConstantScaleXYKey = ["scaleX", "scaleY"],
14074
14055
  tempConstantAngleKey = ["angle"],
14075
14056
  builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
14076
- point = new Point();
14057
+ FULL_STATE_DEFINITION_KEYS = new Set(["name", "patch", "priority", "exclude", "suppress", "resolver", "declaredAffectedKeys"]),
14058
+ point = new Point(),
14059
+ EMPTY_STATE_NAMES = [],
14060
+ BROAD_UPDATE_CATEGORY = UpdateCategory.PAINT | UpdateCategory.SHAPE | UpdateCategory.BOUNDS | UpdateCategory.TRANSFORM | UpdateCategory.LAYOUT;
14077
14061
  function isPlainObjectValue(value) {
14078
- return "object" == typeof value && null != value && !isArray$1(value);
14062
+ return "object" == typeof value && null != value && !Array.isArray(value);
14079
14063
  }
14080
14064
  function cloneAttributeValue(value) {
14081
14065
  if (!isPlainObjectValue(value)) return value;
@@ -14086,12 +14070,6 @@
14086
14070
  clone[key] = isPlainObjectValue(nextValue) ? cloneAttributeValue(nextValue) : nextValue;
14087
14071
  }), clone;
14088
14072
  }
14089
- function cloneSimpleAttributeRecord(value) {
14090
- return isPlainObjectValue(value) ? Object.assign({}, value) : value;
14091
- }
14092
- function shouldUseSimpleAttributeFastPath(value) {
14093
- return !!isPlainObjectValue(value) && !Object.keys(value).some(key => isPlainObjectValue(value[key]));
14094
- }
14095
14073
  function cloneAttributeSurface(value) {
14096
14074
  if (!isPlainObjectValue(value)) return value;
14097
14075
  const source = value,
@@ -14101,6 +14079,9 @@
14101
14079
  clone[key] = isPlainObjectValue(nextValue) ? Object.assign({}, nextValue) : nextValue;
14102
14080
  }), clone;
14103
14081
  }
14082
+ function areAttributeValuesEqual(left, right) {
14083
+ return left === right || !!(isPlainObjectValue(left) || isPlainObjectValue(right) || Array.isArray(left) || Array.isArray(right)) && isEqual(left, right);
14084
+ }
14104
14085
  function deepMergeAttributeValue(base, value) {
14105
14086
  var _a;
14106
14087
  const result = null !== (_a = cloneAttributeValue(base)) && void 0 !== _a ? _a : {};
@@ -14163,18 +14144,24 @@
14163
14144
  get globalTransMatrix() {
14164
14145
  return this.tryUpdateGlobalTransMatrix(!0);
14165
14146
  }
14147
+ get baseAttributes() {
14148
+ var _a;
14149
+ return null !== (_a = this._baseAttributes) && void 0 !== _a ? _a : this.attribute;
14150
+ }
14151
+ set baseAttributes(value) {
14152
+ value !== this.attribute ? this._baseAttributes = value : this._baseAttributes = void 0;
14153
+ }
14166
14154
  constructor(params = {}) {
14167
14155
  var _a;
14168
- super(), this.resolverEpoch = 0, this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT;
14169
- const useSimpleAttributeFastPath = shouldUseSimpleAttributeFastPath(params),
14170
- initialBaseAttributes = useSimpleAttributeFastPath ? cloneSimpleAttributeRecord(params) : cloneAttributeValue(params);
14171
- 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);
14156
+ super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background && this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0), params.texture && isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
14172
14157
  }
14173
14158
  get normalAttrs() {
14174
14159
  return this.baseAttributes;
14175
14160
  }
14176
- set normalAttrs(value) {
14177
- this._deprecatedNormalAttrsView = null != value ? value : void 0;
14161
+ set normalAttrs(_value) {}
14162
+ getBaseAttributesStorage() {
14163
+ var _a;
14164
+ return null !== (_a = this._baseAttributes) && void 0 !== _a ? _a : this.attribute;
14178
14165
  }
14179
14166
  getGraphicService() {
14180
14167
  var _a, _b;
@@ -14205,10 +14192,18 @@
14205
14192
  const nextScope = this.resolveBoundSharedStateScope();
14206
14193
  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);
14207
14194
  }
14208
- syncSharedStateActiveRegistrations() {
14195
+ syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
14209
14196
  var _a, _b;
14210
- const nextScopes = (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && this.boundSharedStateScope ? new Set(collectSharedStateScopeChain(this.boundSharedStateScope)) : new Set();
14211
- (null !== (_b = this.registeredActiveScopes) && void 0 !== _b ? _b : new Set()).forEach(scope => {
14197
+ 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);
14198
+ }
14199
+ syncSharedStateActiveRegistrations() {
14200
+ var _a;
14201
+ const previousScopes = this.registeredActiveScopes;
14202
+ if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach(scope => {
14203
+ scope.subtreeActiveDescendants.delete(this);
14204
+ }), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
14205
+ const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
14206
+ null == previousScopes || previousScopes.forEach(scope => {
14212
14207
  nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
14213
14208
  }), nextScopes.forEach(scope => {
14214
14209
  scope.subtreeActiveDescendants.add(this);
@@ -14224,15 +14219,13 @@
14224
14219
  this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this), scheduleStageSharedStateRefresh(this.stage);
14225
14220
  }
14226
14221
  onParentSharedStateTreeChanged(stage, layer) {
14227
- this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingFromTree() : this.setStage(stage, layer);
14222
+ this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
14228
14223
  }
14229
14224
  refreshSharedStateBeforeRender() {
14230
14225
  var _a;
14231
14226
  (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({
14232
14227
  type: AttributeUpdateType.STATE
14233
- }), this._emitCustomEvent("afterStateUpdate", {
14234
- type: AttributeUpdateType.STATE
14235
- }), this.sharedStateDirty = !1) : this.sharedStateDirty = !1;
14228
+ }), this.emitStateUpdateEvent(), this.sharedStateDirty = !1) : this.sharedStateDirty = !1;
14236
14229
  }
14237
14230
  getLocalStatesVersion() {
14238
14231
  var _a, _b;
@@ -14290,7 +14283,7 @@
14290
14283
  const transition = stateModel.useStates(this.currentStates),
14291
14284
  effectiveStates = null !== (_d = transition.effectiveStates) && void 0 !== _d ? _d : transition.states,
14292
14285
  resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
14293
- this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs), this.syncSharedStateActiveRegistrations();
14286
+ this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.syncSharedStateActiveRegistrations();
14294
14287
  }
14295
14288
  buildStaticAttributeSnapshot() {
14296
14289
  var _a;
@@ -14329,16 +14322,17 @@
14329
14322
  next: void 0
14330
14323
  }), delete target[key]));
14331
14324
  const nextValue = snapshot[key];
14332
- isEqual(previousValue, nextValue) || (delta.set(key, {
14325
+ areAttributeValuesEqual(previousValue, nextValue) || (delta.set(key, {
14333
14326
  prev: previousValue,
14334
14327
  next: nextValue
14335
14328
  }), target[key] = cloneAttributeValue(nextValue));
14336
14329
  }), delta;
14337
14330
  }
14338
14331
  _syncAttribute() {
14332
+ this.attribute === this.baseAttributes && this.resolvedStatePatch && this.detachAttributeFromBaseAttributes();
14339
14333
  const snapshot = this.buildStaticAttributeSnapshot(),
14340
14334
  delta = this.syncObjectToSnapshot(this.attribute, snapshot);
14341
- return this.valid = this.isValid(), delta;
14335
+ return this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, delta;
14342
14336
  }
14343
14337
  _syncFinalAttributeFromStaticTruth() {
14344
14338
  const target = this.finalAttribute;
@@ -14346,47 +14340,146 @@
14346
14340
  const snapshot = this.buildStaticAttributeSnapshot();
14347
14341
  this.syncObjectToSnapshot(target, snapshot);
14348
14342
  }
14349
- submitUpdateByDelta(delta, forceUpdateTag = !1) {
14343
+ mergeAttributeDeltaCategory(category, key, prev, next) {
14344
+ var _a;
14345
+ let nextCategory = "stroke" === key || "shadowBlur" === key ? classifyAttributeDelta(key, prev, next) : null !== (_a = ATTRIBUTE_CATEGORY[key]) && void 0 !== _a ? _a : UpdateCategory.PAINT;
14346
+ return nextCategory & UpdateCategory.PICK && (nextCategory |= UpdateCategory.BOUNDS), nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key) && (nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS), category | nextCategory;
14347
+ }
14348
+ submitUpdateByCategory(category, forceUpdateTag = !1) {
14350
14349
  var _a;
14351
14350
  if (forceUpdateTag) return this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), void this.addUpdateLayoutTag();
14351
+ if (category !== UpdateCategory.NONE) {
14352
+ const stage = this.stage;
14353
+ stage && (null === (_a = getActiveStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordCategory(category));
14354
+ }
14355
+ (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();
14356
+ }
14357
+ submitUpdateByDelta(delta, forceUpdateTag = !1) {
14352
14358
  let category = UpdateCategory.NONE;
14353
14359
  delta.forEach((entry, key) => {
14354
- let nextCategory = classifyAttributeDelta(key, entry.prev, entry.next);
14355
- nextCategory & UpdateCategory.PICK && (nextCategory |= UpdateCategory.BOUNDS), nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key) && (nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS), category |= nextCategory;
14356
- }), 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();
14360
+ category = this.mergeAttributeDeltaCategory(category, key, entry.prev, entry.next);
14361
+ }), this.submitUpdateByCategory(category, forceUpdateTag);
14362
+ }
14363
+ submitTouchedKeyUpdate(keys, forceUpdateTag = !1) {
14364
+ this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTags(keys));
14365
+ }
14366
+ submitTouchedUpdate(needsShapeAndBounds) {
14367
+ !this.updateShapeAndBoundsTagSetted() && needsShapeAndBounds ? this.addUpdateShapeAndBoundsTag() : this.addUpdateBoundTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag();
14357
14368
  }
14358
14369
  commitBaseAttributeMutation(forceUpdateTag = !1, context) {
14359
- var _a, _b;
14360
- (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());
14370
+ var _a, _b, _c;
14371
+ (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());
14361
14372
  const delta = this._syncAttribute();
14362
14373
  this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
14363
14374
  }
14375
+ canCommitBaseAttributesByTouchedKeys() {
14376
+ var _a, _b;
14377
+ 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());
14378
+ }
14379
+ detachAttributeFromBaseAttributes() {
14380
+ this.attribute === this.baseAttributes && (this._baseAttributes = this.attribute, this.attribute = cloneAttributeSurface(this.attribute));
14381
+ }
14382
+ commitInternalBaseAttributes(params, context) {
14383
+ params && Object.keys(params).length && (this.canCommitBaseAttributesByTouchedKeys() ? this.commitBaseAttributesByTouchedKeys(params, !1, context) : (this.detachAttributeFromBaseAttributes(), this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context)));
14384
+ }
14385
+ commitBaseAttributesByTouchedKeys(params, forceUpdateTag = !1, context) {
14386
+ const source = params,
14387
+ baseAttributes = this.getBaseAttributesStorage();
14388
+ let hasKeys = !1,
14389
+ needsShapeAndBounds = forceUpdateTag;
14390
+ for (const key in source) Object.prototype.hasOwnProperty.call(source, key) && (hasKeys = !0, baseAttributes[key] = source[key], !needsShapeAndBounds && this.needUpdateTag(key) && (needsShapeAndBounds = !0));
14391
+ hasKeys && (this.attribute = baseAttributes, this._baseAttributes = void 0, this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, this.submitTouchedUpdate(needsShapeAndBounds), this.onAttributeUpdate(context));
14392
+ }
14393
+ commitBaseAttributeBySingleKey(key, value, forceUpdateTag = !1, context) {
14394
+ 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);
14395
+ }
14364
14396
  applyBaseAttributes(params) {
14365
14397
  const keys = Object.keys(params);
14366
14398
  for (let i = 0; i < keys.length; i++) {
14367
14399
  const key = keys[i];
14368
- this.baseAttributes[key] = cloneAttributeValue(params[key]);
14400
+ this.getBaseAttributesStorage()[key] = params[key];
14369
14401
  }
14370
14402
  }
14403
+ applyAnimationTransientAttributes(params, forceUpdateTag = !1, context) {
14404
+ const source = params;
14405
+ let target,
14406
+ needsShapeAndBounds = forceUpdateTag;
14407
+ 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));
14408
+ target && (this.attributeMayContainTransientAttrs = !0, this.valid = this.isValid(), this.submitTouchedUpdate(needsShapeAndBounds), this.onAttributeUpdate(context));
14409
+ }
14371
14410
  applyTransientAttributes(params, forceUpdateTag = !1, context) {
14411
+ this.detachAttributeFromBaseAttributes();
14372
14412
  const delta = new Map(),
14373
14413
  keys = Object.keys(params);
14374
14414
  for (let i = 0; i < keys.length; i++) {
14375
14415
  const key = keys[i],
14376
14416
  previousValue = this.attribute[key],
14377
14417
  nextValue = params[key];
14378
- isEqual(previousValue, nextValue) || (delta.set(key, {
14418
+ areAttributeValuesEqual(previousValue, nextValue) || (delta.set(key, {
14379
14419
  prev: previousValue,
14380
14420
  next: nextValue
14381
- }), this.attribute[key] = cloneAttributeValue(nextValue));
14421
+ }), this.attribute[key] = nextValue);
14382
14422
  }
14383
- this.valid = this.isValid(), this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
14423
+ delta.size && (this.attributeMayContainTransientAttrs = !0), this.valid = this.isValid(), this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
14384
14424
  }
14385
14425
  _restoreAttributeFromStaticTruth(context) {
14386
14426
  this._syncFinalAttributeFromStaticTruth();
14387
14427
  const delta = this._syncAttribute();
14388
14428
  this.submitUpdateByDelta(delta), this.onAttributeUpdate(context);
14389
14429
  }
14430
+ collectStatePatchDeltaKeys(previousPatch, nextPatch) {
14431
+ const keys = previousPatch ? Object.keys(previousPatch) : [];
14432
+ if (!nextPatch) return keys;
14433
+ for (const key in nextPatch) Object.prototype.hasOwnProperty.call(nextPatch, key) && !Object.prototype.hasOwnProperty.call(null != previousPatch ? previousPatch : {}, key) && keys.push(key);
14434
+ return keys;
14435
+ }
14436
+ getStaticTruthValueForStateKey(key, nextPatch) {
14437
+ var _a;
14438
+ const baseAttributes = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : {},
14439
+ patch = nextPatch;
14440
+ if (patch && Object.prototype.hasOwnProperty.call(patch, key)) {
14441
+ const patchValue = patch[key],
14442
+ baseValue = baseAttributes[key];
14443
+ return "deep" === this.stateMergeMode && isPlainObjectValue(baseValue) && isPlainObjectValue(patchValue) ? {
14444
+ hasValue: !0,
14445
+ value: deepMergeAttributeValue(baseValue, patchValue)
14446
+ } : {
14447
+ hasValue: !0,
14448
+ value: patchValue
14449
+ };
14450
+ }
14451
+ return Object.prototype.hasOwnProperty.call(baseAttributes, key) ? {
14452
+ hasValue: !0,
14453
+ value: baseAttributes[key]
14454
+ } : {
14455
+ hasValue: !1,
14456
+ value: void 0
14457
+ };
14458
+ }
14459
+ syncStatePatchDeltaToTarget(target, keys, nextPatch, collectCategory = !1) {
14460
+ let category = UpdateCategory.NONE;
14461
+ for (let i = 0; i < keys.length; i++) {
14462
+ const key = keys[i],
14463
+ previousValue = target[key],
14464
+ next = this.getStaticTruthValueForStateKey(key, nextPatch);
14465
+ if (!next.hasValue) {
14466
+ Object.prototype.hasOwnProperty.call(target, key) && (delete target[key], collectCategory && (category = this.mergeAttributeDeltaCategory(category, key, previousValue, void 0)));
14467
+ continue;
14468
+ }
14469
+ if (areAttributeValuesEqual(previousValue, next.value)) continue;
14470
+ const nextValue = cloneAttributeValue(next.value);
14471
+ target[key] = nextValue, collectCategory && (category = this.mergeAttributeDeltaCategory(category, key, previousValue, nextValue));
14472
+ }
14473
+ return category;
14474
+ }
14475
+ restoreAttributeFromStatePatchDelta(previousPatch, nextPatch, context) {
14476
+ this.detachAttributeFromBaseAttributes();
14477
+ const keys = this.collectStatePatchDeltaKeys(previousPatch, nextPatch),
14478
+ finalAttribute = this.finalAttribute;
14479
+ finalAttribute && this.syncStatePatchDeltaToTarget(finalAttribute, keys, nextPatch, !1);
14480
+ const category = this.syncStatePatchDeltaToTarget(this.attribute, keys, nextPatch, !0);
14481
+ this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, this.submitUpdateByCategory(category), this.onAttributeUpdate(context);
14482
+ }
14390
14483
  setMode(mode) {
14391
14484
  "3d" === mode ? this.set3dMode() : this.set2dMode();
14392
14485
  }
@@ -14409,7 +14502,7 @@
14409
14502
  return point;
14410
14503
  }
14411
14504
  onAnimateBind(animate) {
14412
- this._emitCustomEvent("animate-bind", animate);
14505
+ this.detachAttributeFromBaseAttributes(), this._emitCustomEvent("animate-bind", animate);
14413
14506
  }
14414
14507
  visitTrackedAnimates(cb) {
14415
14508
  const hook = this.forEachTrackedAnimate;
@@ -14422,8 +14515,22 @@
14422
14515
  const getTrackedAnimates = this.getTrackedAnimates;
14423
14516
  return "function" == typeof getTrackedAnimates ? getTrackedAnimates.call(this).size > 0 : !!(null === (_a = this.animates) || void 0 === _a ? void 0 : _a.size);
14424
14517
  }
14518
+ mayHaveTrackedAnimates() {
14519
+ var _a;
14520
+ return !!(null === (_a = this.animates) || void 0 === _a ? void 0 : _a.size) || !!this._animationStateManager;
14521
+ }
14425
14522
  tryUpdateAABBBounds() {
14523
+ if (!(this.shadowRoot || this._updateTag & UpdateTag.UPDATE_BOUNDS)) return this._AABBBounds;
14426
14524
  const full = "imprecise" === this.attribute.boundsMode;
14525
+ if (!this.shadowRoot) {
14526
+ const graphicService = this.getGraphicService(),
14527
+ graphicTheme = this.getGraphicTheme();
14528
+ if (!graphicService.validCheck(this.attribute, graphicTheme, this._AABBBounds, this)) return this._AABBBounds;
14529
+ if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
14530
+ graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
14531
+ const bounds = this.doUpdateAABBBounds(full, graphicTheme);
14532
+ return graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
14533
+ }
14427
14534
  if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
14428
14535
  if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
14429
14536
  this.getGraphicService().beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
@@ -14496,14 +14603,14 @@
14496
14603
  const _parsedPath = new CustomSymbolClass(symbolType, cache);
14497
14604
  return Graphic.userSymbolMap[symbolType] = _parsedPath, _parsedPath;
14498
14605
  }
14499
- doUpdateAABBBounds(full) {
14606
+ doUpdateAABBBounds(full, graphicTheme) {
14500
14607
  this.updateAABBBoundsStamp++;
14501
- const graphicTheme = this.getGraphicTheme();
14608
+ const resolvedGraphicTheme = null != graphicTheme ? graphicTheme : this.getGraphicTheme();
14502
14609
  this._AABBBounds.clear();
14503
14610
  const attribute = this.attribute,
14504
- bounds = this.updateAABBBounds(attribute, graphicTheme, this._AABBBounds, full),
14611
+ bounds = this.updateAABBBounds(attribute, resolvedGraphicTheme, this._AABBBounds, full),
14505
14612
  {
14506
- boundsPadding = graphicTheme.boundsPadding
14613
+ boundsPadding = resolvedGraphicTheme.boundsPadding
14507
14614
  } = attribute,
14508
14615
  paddingArray = parsePadding(boundsPadding);
14509
14616
  return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(), bounds;
@@ -14571,25 +14678,63 @@
14571
14678
  this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
14572
14679
  }
14573
14680
  setAttributesAndPreventAnimate(params, forceUpdateTag = !1, context, ignorePriority) {
14574
- this.visitTrackedAnimates(animate => {
14575
- (animate.priority !== 1 / 0 || ignorePriority) && Object.keys(params).forEach(key => {
14576
- animate.preventAttr(key);
14577
- });
14681
+ if (!params) return;
14682
+ const keys = Object.keys(params);
14683
+ this.captureTransientFromAttrsBeforePreventAnimate(params, keys, context), this.visitTrackedAnimates(animate => {
14684
+ (animate.priority !== 1 / 0 || ignorePriority) && animate.preventAttrs(keys);
14578
14685
  }), this.applyTransientAttributes(params, forceUpdateTag, context);
14579
14686
  }
14687
+ captureTransientFromAttrsBeforePreventAnimate(params, keys, context) {
14688
+ var _a, _b;
14689
+ const graphicContext = this.context,
14690
+ diffAttrs = null !== (_a = null == graphicContext ? void 0 : graphicContext.diffAttrs) && void 0 !== _a ? _a : params,
14691
+ updateType = null == context ? void 0 : context.type;
14692
+ if (!keys.length || !diffAttrs || updateType === AttributeUpdateType.STATE || null != updateType && updateType >= AttributeUpdateType.ANIMATE_BIND && updateType <= AttributeUpdateType.ANIMATE_END) return;
14693
+ const sameDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs === diffAttrs;
14694
+ let fromAttrs = sameDiffAttrs && null !== (_b = this.transientFromAttrsBeforePreventAnimate) && void 0 !== _b ? _b : null;
14695
+ sameDiffAttrs || (this.transientFromAttrsBeforePreventAnimate = null, this.transientFromAttrsBeforePreventAnimateDiffAttrs = null);
14696
+ let captured = !1;
14697
+ for (let i = 0; i < keys.length; i++) {
14698
+ const key = keys[i];
14699
+ if (!Object.prototype.hasOwnProperty.call(diffAttrs, key)) continue;
14700
+ const previousValue = this.attribute[key],
14701
+ nextValue = params[key];
14702
+ isEqual(previousValue, nextValue) || (null != fromAttrs || (fromAttrs = {}), fromAttrs[key] = cloneAttributeValue(previousValue), captured = !0);
14703
+ }
14704
+ captured && (this.transientFromAttrsBeforePreventAnimate = fromAttrs, this.transientFromAttrsBeforePreventAnimateDiffAttrs = diffAttrs);
14705
+ }
14706
+ consumeTransientFromAttrsBeforePreventAnimate(diffAttrs) {
14707
+ const transientFromAttrs = this.transientFromAttrsBeforePreventAnimate,
14708
+ sourceDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs;
14709
+ if (!transientFromAttrs || !sourceDiffAttrs) return null;
14710
+ 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;
14711
+ let fromAttrs = null,
14712
+ remaining = !1;
14713
+ 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);
14714
+ if (remaining) {
14715
+ const nextTransientFromAttrs = {};
14716
+ for (const key in transientFromAttrs) Object.prototype.hasOwnProperty.call(transientFromAttrs, key) && !Object.prototype.hasOwnProperty.call(diffAttrs, key) && (nextTransientFromAttrs[key] = transientFromAttrs[key]);
14717
+ this.transientFromAttrsBeforePreventAnimate = nextTransientFromAttrs;
14718
+ } else this.transientFromAttrsBeforePreventAnimate = null, this.transientFromAttrsBeforePreventAnimateDiffAttrs = null;
14719
+ return fromAttrs;
14720
+ }
14580
14721
  setAttributes(params, forceUpdateTag = !1, context) {
14581
- 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));
14722
+ 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));
14582
14723
  }
14583
14724
  _setAttributes(params, forceUpdateTag = !1, context) {
14584
- this.applyBaseAttributes(params), this.commitBaseAttributeMutation(forceUpdateTag, context);
14725
+ this.canCommitBaseAttributesByTouchedKeys() ? this.commitBaseAttributesByTouchedKeys(params, forceUpdateTag, context) : (this.detachAttributeFromBaseAttributes(), this.applyBaseAttributes(params), this.commitBaseAttributeMutation(forceUpdateTag, context));
14585
14726
  }
14586
14727
  setAttribute(key, value, forceUpdateTag, context) {
14587
14728
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
14588
14729
  [key]: value
14589
14730
  }, this.attribute, key, context);
14590
- params ? this._setAttributes(params, forceUpdateTag, context) : (this.applyBaseAttributes({
14591
- [key]: value
14592
- }), this.commitBaseAttributeMutation(!!forceUpdateTag, context)), "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
14731
+ if (params) this._setAttributes(params, forceUpdateTag, context);else if (this.canCommitBaseAttributesByTouchedKeys()) this.commitBaseAttributeBySingleKey(key, value, !!forceUpdateTag, context);else {
14732
+ const nextAttrs = {
14733
+ [key]: value
14734
+ };
14735
+ this.applyBaseAttributes(nextAttrs), this.commitBaseAttributeMutation(!!forceUpdateTag, context);
14736
+ }
14737
+ "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
14593
14738
  }
14594
14739
  needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
14595
14740
  for (let i = 0; i < k.length; i++) {
@@ -14608,7 +14753,7 @@
14608
14753
  const context = {
14609
14754
  type: AttributeUpdateType.INIT
14610
14755
  };
14611
- params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.baseAttributes = cloneAttributeValue(params), this.attribute || (this.attribute = {}), this.resolvedStatePatch = void 0, this._syncAttribute(), params.background && this.loadImage(params.background, !0), isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
14756
+ params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params, this.attribute = params, this._baseAttributes = void 0, this.resolvedStatePatch = void 0, this.attributeMayContainTransientAttrs = !1, this.valid = this.isValid(), params.background && this.loadImage(params.background, !0), params.texture && isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
14612
14757
  }
14613
14758
  translate(x, y) {
14614
14759
  var _a, _b;
@@ -14620,10 +14765,15 @@
14620
14765
  x: x,
14621
14766
  y: y
14622
14767
  }, this.attribute, tempConstantXYKey, context);
14623
- params && (x = params.x, y = params.y, delete params.x, delete params.y, this.applyBaseAttributes(params));
14768
+ params && (x = params.x, y = params.y, delete params.x, delete params.y);
14624
14769
  const attribute = this.baseAttributes,
14625
- postMatrix = attribute.postMatrix;
14626
- 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;
14770
+ postMatrix = attribute.postMatrix,
14771
+ nextAttrs = params || {};
14772
+ if (postMatrix) {
14773
+ const nextPostMatrix = postMatrix.clone();
14774
+ application.transformUtil.fromMatrix(nextPostMatrix, nextPostMatrix).translate(x, y), nextAttrs.postMatrix = nextPostMatrix;
14775
+ } 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;
14776
+ return this.commitInternalBaseAttributes(nextAttrs, context), this;
14627
14777
  }
14628
14778
  translateTo(x, y) {
14629
14779
  const attribute = this.baseAttributes;
@@ -14635,7 +14785,10 @@
14635
14785
  x: x,
14636
14786
  y: y
14637
14787
  }, this.attribute, tempConstantXYKey, context);
14638
- return params ? (this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context), this) : (attribute.x = x, attribute.y = y, this.commitBaseAttributeMutation(!1, context), this);
14788
+ return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
14789
+ x: x,
14790
+ y: y
14791
+ }, context), this);
14639
14792
  }
14640
14793
  scale(scaleX, scaleY, scaleCenter) {
14641
14794
  var _a, _b;
@@ -14648,15 +14801,16 @@
14648
14801
  scaleY: scaleY,
14649
14802
  scaleCenter: scaleCenter
14650
14803
  }, this.attribute, tempConstantScaleXYKey, context);
14651
- params && (scaleX = params.scaleX, scaleY = params.scaleY, delete params.scaleX, delete params.scaleY, this.applyBaseAttributes(params));
14652
- const attribute = this.baseAttributes;
14804
+ params && (scaleX = params.scaleX, scaleY = params.scaleY, delete params.scaleX, delete params.scaleY);
14805
+ const attribute = this.baseAttributes,
14806
+ nextAttrs = params || {};
14653
14807
  if (scaleCenter) {
14654
14808
  let {
14655
14809
  postMatrix: postMatrix
14656
- } = this.attribute;
14657
- postMatrix || (postMatrix = new Matrix(), attribute.postMatrix = postMatrix), application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter);
14658
- } 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;
14659
- return this.commitBaseAttributeMutation(!1, context), this;
14810
+ } = this.baseAttributes;
14811
+ postMatrix = postMatrix ? postMatrix.clone() : new Matrix(), application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter), nextAttrs.postMatrix = postMatrix;
14812
+ } 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;
14813
+ return this.commitInternalBaseAttributes(nextAttrs, context), this;
14660
14814
  }
14661
14815
  scaleTo(scaleX, scaleY) {
14662
14816
  const attribute = this.baseAttributes;
@@ -14668,7 +14822,10 @@
14668
14822
  scaleX: scaleX,
14669
14823
  scaleY: scaleY
14670
14824
  }, this.attribute, tempConstantScaleXYKey, context);
14671
- return params ? (this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context), this) : (attribute.scaleX = scaleX, attribute.scaleY = scaleY, this.commitBaseAttributeMutation(!1, context), this);
14825
+ return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
14826
+ scaleX: scaleX,
14827
+ scaleY: scaleY
14828
+ }, context), this);
14672
14829
  }
14673
14830
  rotate(angle, rotateCenter) {
14674
14831
  var _a;
@@ -14680,24 +14837,26 @@
14680
14837
  angle: angle,
14681
14838
  rotateCenter: rotateCenter
14682
14839
  }, this.attribute, tempConstantAngleKey, context);
14683
- params && (delete params.angle, this.applyBaseAttributes(params));
14684
- const attribute = this.baseAttributes;
14840
+ params && delete params.angle;
14841
+ const attribute = this.baseAttributes,
14842
+ nextAttrs = params || {};
14685
14843
  if (rotateCenter) {
14686
14844
  let {
14687
14845
  postMatrix: postMatrix
14688
14846
  } = this.baseAttributes;
14689
- postMatrix || (postMatrix = new Matrix(), this.baseAttributes.postMatrix = postMatrix), application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter);
14690
- } else attribute.angle = (null !== (_a = attribute.angle) && void 0 !== _a ? _a : DefaultTransform.angle) + angle;
14691
- return this.commitBaseAttributeMutation(!1, context), this;
14847
+ postMatrix = postMatrix ? postMatrix.clone() : new Matrix(), application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter), nextAttrs.postMatrix = postMatrix;
14848
+ } else nextAttrs.angle = (null !== (_a = attribute.angle) && void 0 !== _a ? _a : DefaultTransform.angle) + angle;
14849
+ return this.commitInternalBaseAttributes(nextAttrs, context), this;
14692
14850
  }
14693
14851
  rotateTo(angle) {
14694
- const attribute = this.baseAttributes;
14695
- if (attribute.angle === angle) return this;
14852
+ if (this.baseAttributes.angle === angle) return this;
14696
14853
  const context = {
14697
14854
  type: AttributeUpdateType.ROTATE_TO
14698
14855
  },
14699
14856
  params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(angle, this.attribute, tempConstantAngleKey, context);
14700
- return params ? (this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context), this) : (attribute.angle = angle, this.commitBaseAttributeMutation(!1, context), this);
14857
+ return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
14858
+ angle: angle
14859
+ }, context), this);
14701
14860
  }
14702
14861
  skewTo(b, c) {
14703
14862
  return this;
@@ -14736,6 +14895,131 @@
14736
14895
  stateEngine: this.stateEngine
14737
14896
  });
14738
14897
  }
14898
+ resolveSimpleLocalStateTransition(states, previousStates) {
14899
+ var _a;
14900
+ 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;
14901
+ if (1 === states.length) {
14902
+ const stateName = states[0],
14903
+ hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName),
14904
+ nextStates = [stateName],
14905
+ changed = !this.sameStateNames(previousStates, nextStates),
14906
+ resolvedStateAttrs = {};
14907
+ if (hasDefinition) {
14908
+ const attrs = this.states[stateName];
14909
+ if (null != attrs) {
14910
+ if (!isPlainObjectValue(attrs)) return null;
14911
+ const keys = Object.keys(attrs);
14912
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
14913
+ const key = keys[keyIndex];
14914
+ if (FULL_STATE_DEFINITION_KEYS.has(key)) return null;
14915
+ const attrValue = attrs[key];
14916
+ resolvedStateAttrs[key] = isPlainObjectValue(attrValue) ? cloneAttributeValue(attrValue) : attrValue;
14917
+ }
14918
+ }
14919
+ }
14920
+ return {
14921
+ changed: changed,
14922
+ states: nextStates,
14923
+ effectiveStates: nextStates,
14924
+ resolvedStateAttrs: resolvedStateAttrs
14925
+ };
14926
+ }
14927
+ const uniqueStates = Array.from(new Set(states)),
14928
+ withDefinition = [],
14929
+ withoutDefinition = [];
14930
+ for (let i = 0; i < uniqueStates.length; i++) {
14931
+ const stateName = uniqueStates[i];
14932
+ Object.prototype.hasOwnProperty.call(this.states, stateName) ? withDefinition.push(stateName) : withoutDefinition.push(stateName);
14933
+ }
14934
+ withDefinition.sort((left, right) => left.localeCompare(right));
14935
+ const nextStates = withDefinition.concat(withoutDefinition),
14936
+ changed = !this.sameStateNames(previousStates, nextStates),
14937
+ resolvedStateAttrs = {};
14938
+ for (let i = 0; i < nextStates.length; i++) {
14939
+ const stateName = nextStates[i];
14940
+ if (!Object.prototype.hasOwnProperty.call(this.states, stateName)) continue;
14941
+ const attrs = this.states[stateName];
14942
+ if (null == attrs) continue;
14943
+ if (!isPlainObjectValue(attrs)) return null;
14944
+ const keys = Object.keys(attrs);
14945
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
14946
+ const key = keys[keyIndex];
14947
+ if (FULL_STATE_DEFINITION_KEYS.has(key)) return null;
14948
+ const attrValue = attrs[key];
14949
+ resolvedStateAttrs[key] = isPlainObjectValue(attrValue) ? cloneAttributeValue(attrValue) : attrValue;
14950
+ }
14951
+ }
14952
+ return {
14953
+ changed: changed,
14954
+ states: nextStates,
14955
+ effectiveStates: nextStates,
14956
+ resolvedStateAttrs: resolvedStateAttrs
14957
+ };
14958
+ }
14959
+ resolveGraphicStateTransition(states, previousStates, forceResolverRefresh = !1) {
14960
+ var _a, _b, _c, _d;
14961
+ let transition = this.resolveSimpleLocalStateTransition(states, previousStates);
14962
+ const isSimpleLocalTransition = !!transition;
14963
+ let resolvedStateAttrs;
14964
+ if (transition) resolvedStateAttrs = transition.resolvedStateAttrs;else {
14965
+ const stateResolveBaseAttrs = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute,
14966
+ stateModel = this.createStateModel();
14967
+ null === (_b = this.stateEngine) || void 0 === _b || _b.setResolveContext(this, stateResolveBaseAttrs), forceResolverRefresh && (null === (_c = this.stateEngine) || void 0 === _c || _c.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);
14968
+ }
14969
+ return {
14970
+ transition: transition,
14971
+ effectiveStates: null !== (_d = transition.effectiveStates) && void 0 !== _d ? _d : transition.states,
14972
+ resolvedStateAttrs: resolvedStateAttrs,
14973
+ isSimpleLocalTransition: isSimpleLocalTransition
14974
+ };
14975
+ }
14976
+ normalizeSetStatesOptions(options) {
14977
+ return options && "object" == typeof options ? {
14978
+ hasAnimation: options.animate,
14979
+ animateSameStatePatchChange: !0 === options.animateSameStatePatchChange,
14980
+ shouldRefreshSameStatePatch: !0
14981
+ } : {
14982
+ hasAnimation: "boolean" == typeof options ? options : void 0,
14983
+ animateSameStatePatchChange: !1,
14984
+ shouldRefreshSameStatePatch: !1
14985
+ };
14986
+ }
14987
+ sameStatePatches(left, right) {
14988
+ const leftRecord = null != left ? left : {},
14989
+ rightRecord = null != right ? right : {},
14990
+ keys = new Set([...Object.keys(leftRecord), ...Object.keys(rightRecord)]);
14991
+ for (const key of keys) {
14992
+ if (Object.prototype.hasOwnProperty.call(leftRecord, key) !== Object.prototype.hasOwnProperty.call(rightRecord, key)) return !1;
14993
+ if (!areAttributeValuesEqual(leftRecord[key], rightRecord[key])) return !1;
14994
+ }
14995
+ return !0;
14996
+ }
14997
+ commitSameStatePatchRefresh(states, hasAnimation, animateSameStatePatchChange = !1) {
14998
+ var _a;
14999
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
15000
+ previousResolvedStatePatch = this.resolvedStatePatch,
15001
+ {
15002
+ transition: transition,
15003
+ effectiveStates: effectiveStates,
15004
+ resolvedStateAttrs: resolvedStateAttrs,
15005
+ isSimpleLocalTransition: isSimpleLocalTransition
15006
+ } = this.resolveGraphicStateTransition(states, previousStates, !0),
15007
+ patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
15008
+ 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)) {
15009
+ if (this.stage) {
15010
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
15011
+ null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
15012
+ graphicId: this._uid,
15013
+ targetStates: [...transition.states]
15014
+ });
15015
+ }
15016
+ hasAnimation && animateSameStatePatchChange ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
15017
+ type: AttributeUpdateType.STATE
15018
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
15019
+ type: AttributeUpdateType.STATE
15020
+ }), this.emitStateUpdateEvent());
15021
+ }
15022
+ }
14739
15023
  resolveStateAnimateConfig(animateConfig) {
14740
15024
  var _a, _b, _c;
14741
15025
  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;
@@ -14756,9 +15040,7 @@
14756
15040
  });
14757
15041
  this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
14758
15042
  }
14759
- updateNormalAttrs(stateAttrs) {
14760
- this._deprecatedNormalAttrsView = cloneAttributeValue(this.baseAttributes);
14761
- }
15043
+ updateNormalAttrs(_stateAttrs) {}
14762
15044
  getStateTransitionDefaultAttribute(key, targetAttrs) {
14763
15045
  return this.getDefaultAttribute(key);
14764
15046
  }
@@ -14768,6 +15050,7 @@
14768
15050
  stopStateAnimates(type = "end") {
14769
15051
  const stopAnimationState = this.stopAnimationState;
14770
15052
  if ("function" == typeof stopAnimationState) return void stopAnimationState.call(this, "state", type);
15053
+ if (!this.mayHaveTrackedAnimates()) return;
14771
15054
  const stateAnimates = [];
14772
15055
  this.visitTrackedAnimates(animate => {
14773
15056
  animate.stateNames && stateAnimates.push(animate);
@@ -14780,19 +15063,25 @@
14780
15063
  }
14781
15064
  clearStates(hasAnimation) {
14782
15065
  var _a, _b, _c;
14783
- const previousStates = this.currentStates ? this.currentStates.slice() : [],
14784
- previousResolvedStatePatch = this.resolvedStatePatch ? cloneAttributeValue(this.resolvedStatePatch) : void 0,
15066
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
15067
+ previousResolvedStatePatch = this.resolvedStatePatch,
14785
15068
  transition = this.createStateModel().clearStates();
14786
15069
  if (!transition.changed && 0 === previousStates.length) return this.currentStates = [], this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, void this.clearSharedStateActiveRegistrations();
14787
- const resolvedStateAttrs = cloneAttributeValue(null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : {});
14788
- 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", {
14789
- graphicId: this._uid,
14790
- targetStates: []
14791
- }), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
14792
- type: AttributeUpdateType.STATE
14793
- }), this._emitCustomEvent("afterStateUpdate", {
14794
- type: AttributeUpdateType.STATE
14795
- })));
15070
+ const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
15071
+ if (!transition.changed || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0)) {
15072
+ if (this.currentStates = transition.states, this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, this.clearSharedStateActiveRegistrations(), this.stage) {
15073
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
15074
+ null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
15075
+ graphicId: this._uid,
15076
+ targetStates: []
15077
+ });
15078
+ }
15079
+ hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
15080
+ type: AttributeUpdateType.STATE
15081
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
15082
+ type: AttributeUpdateType.STATE
15083
+ }), this.emitStateUpdateEvent());
15084
+ }
14796
15085
  }
14797
15086
  removeState(stateName, hasAnimation) {
14798
15087
  const transition = this.createStateModel().removeState(stateName);
@@ -14806,39 +15095,59 @@
14806
15095
  const transition = this.createStateModel().addState(stateName, keepCurrentStates);
14807
15096
  transition.changed && this.useStates(transition.states, hasAnimation);
14808
15097
  }
15098
+ setStates(states, options) {
15099
+ var _a, _b, _c;
15100
+ const {
15101
+ hasAnimation: hasAnimation,
15102
+ animateSameStatePatchChange: animateSameStatePatchChange,
15103
+ shouldRefreshSameStatePatch: shouldRefreshSameStatePatch
15104
+ } = this.normalizeSetStatesOptions(options),
15105
+ nextStates = (null == states ? void 0 : states.length) ? states : EMPTY_STATE_NAMES,
15106
+ 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));
15107
+ if (nextStates.length) {
15108
+ if (this.sameStateNames(this.currentStates, nextStates)) return shouldRefreshSameStatePatch ? void this.commitSameStatePatchRefresh(nextStates, hasAnimation, animateSameStatePatchChange) : void (this.sharedStateDirty && this.refreshSharedStateBeforeRender());
15109
+ this.useStates(nextStates, hasAnimation);
15110
+ } else {
15111
+ if (!hasCurrentState && !this.sharedStateDirty) return;
15112
+ this.clearStates(hasAnimation);
15113
+ }
15114
+ }
14809
15115
  useStates(states, hasAnimation) {
14810
- var _a, _b, _c, _d, _e;
15116
+ var _a;
14811
15117
  if (!states.length) return void this.clearStates(hasAnimation);
14812
- const previousStates = this.currentStates ? this.currentStates.slice() : [],
14813
- previousResolvedStatePatch = this.resolvedStatePatch ? cloneAttributeValue(this.resolvedStatePatch) : void 0,
14814
- stateResolveBaseAttrs = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute,
14815
- stateModel = this.createStateModel();
14816
- null === (_b = this.stateEngine) || void 0 === _b || _b.setResolveContext(this, stateResolveBaseAttrs);
14817
- const transition = stateModel.useStates(states);
14818
- if (!transition.changed && this.sameStateNames(previousStates, transition.states)) return;
14819
- const effectiveStates = null !== (_c = transition.effectiveStates) && void 0 !== _c ? _c : transition.states,
14820
- resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
14821
- 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", {
14822
- graphicId: this._uid,
14823
- targetStates: [...transition.states]
14824
- }), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
14825
- type: AttributeUpdateType.STATE
14826
- }), this._emitCustomEvent("afterStateUpdate", {
14827
- type: AttributeUpdateType.STATE
14828
- })));
15118
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
15119
+ previousResolvedStatePatch = this.resolvedStatePatch,
15120
+ {
15121
+ transition: transition,
15122
+ effectiveStates: effectiveStates,
15123
+ resolvedStateAttrs: resolvedStateAttrs,
15124
+ isSimpleLocalTransition: isSimpleLocalTransition
15125
+ } = this.resolveGraphicStateTransition(states, previousStates);
15126
+ if ((transition.changed || !this.sameStateNames(previousStates, transition.states)) && this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) {
15127
+ if (this.currentStates = transition.states, this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stage) {
15128
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
15129
+ null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
15130
+ graphicId: this._uid,
15131
+ targetStates: [...transition.states]
15132
+ });
15133
+ }
15134
+ hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
15135
+ type: AttributeUpdateType.STATE
15136
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
15137
+ type: AttributeUpdateType.STATE
15138
+ }), this.emitStateUpdateEvent());
15139
+ }
14829
15140
  }
14830
15141
  invalidateResolver() {
14831
- var _a, _b;
15142
+ var _a, _b, _c;
14832
15143
  if (!this.stateEngine || !(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.compiledStateDefinitions) return;
14833
15144
  const stateResolveBaseAttrs = null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : this.attribute;
14834
- this.stateEngine.setResolveContext(this, stateResolveBaseAttrs), this.resolverEpoch += 1, this.stateEngine.invalidateResolverCache();
15145
+ this.stateEngine.setResolveContext(this, stateResolveBaseAttrs), this.resolverEpoch = (null !== (_c = this.resolverEpoch) && void 0 !== _c ? _c : 0) + 1, this.stateEngine.invalidateResolverCache();
14835
15146
  const transition = this.stateEngine.applyStates(this.currentStates),
14836
15147
  resolvedStateAttrs = Object.assign({}, this.stateEngine.resolvedPatch);
14837
- this.effectiveStates = [...transition.effectiveStates], this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs), this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
15148
+ this.effectiveStates = [...transition.effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
14838
15149
  type: AttributeUpdateType.STATE
14839
- }), this._emitCustomEvent("afterStateUpdate", {
14840
- type: AttributeUpdateType.STATE
14841
- });
15150
+ }), this.emitStateUpdateEvent();
14842
15151
  }
14843
15152
  sameStateNames(left, right) {
14844
15153
  const normalizedLeft = null != left ? left : [],
@@ -14859,6 +15168,9 @@
14859
15168
  addUpdateShapeAndBoundsTag() {
14860
15169
  this._updateTag |= UpdateTag.UPDATE_SHAPE_AND_BOUNDS, this.parent && this.parent.addChildUpdateBoundTag(), this.glyphHost && this.glyphHost.addUpdateBoundTag();
14861
15170
  }
15171
+ addBroadUpdateTag() {
15172
+ this.shadowRoot && this.shadowRoot.addUpdateGlobalPositionTag(), this._updateTag |= UpdateTag.UPDATE_SHAPE_AND_BOUNDS | UpdateTag.UPDATE_PAINT | UpdateTag.UPDATE_GLOBAL_LOCAL_MATRIX | UpdateTag.UPDATE_LAYOUT, this.parent && this.parent.addChildUpdateBoundTag(), this.glyphHost && this.glyphHost.addUpdateBoundTag();
15173
+ }
14862
15174
  updateShapeAndBoundsTagSetted() {
14863
15175
  return (this._updateTag & UpdateTag.UPDATE_SHAPE_AND_BOUNDS) === UpdateTag.UPDATE_SHAPE_AND_BOUNDS;
14864
15176
  }
@@ -14946,13 +15258,13 @@
14946
15258
  }
14947
15259
  }
14948
15260
  setStage(stage, layer) {
14949
- var _a, _b, _c, _d, _e, _f, _g, _h;
15261
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
14950
15262
  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,
14951
15263
  previousStage = this.stage;
14952
15264
  if (this.stage !== stage || this.layer !== layer) {
14953
- 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()) {
14954
- const previousTimeline = null === (_e = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _e ? void 0 : _e.call(previousStage),
14955
- nextTimeline = null === (_f = null == stage ? void 0 : stage.getTimeline) || void 0 === _f ? void 0 : _f.call(stage),
15265
+ 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()) {
15266
+ const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
15267
+ nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
14956
15268
  detachedStageAnimates = [];
14957
15269
  this.visitTrackedAnimates(a => {
14958
15270
  (!!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)));
@@ -14965,9 +15277,13 @@
14965
15277
  type: AttributeUpdateType.ANIMATE_END
14966
15278
  }));
14967
15279
  }
14968
- 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));
15280
+ 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));
14969
15281
  }
14970
- this.syncSharedStateScopeBindingFromTree(!!(null === (_h = this.currentStates) || void 0 === _h ? void 0 : _h.length));
15282
+ ((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);
15283
+ }
15284
+ detachStageForRelease() {
15285
+ var _a, _b, _c;
15286
+ (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));
14971
15287
  }
14972
15288
  setStageToShadowRoot(stage, layer) {
14973
15289
  this.shadowRoot && this.shadowRoot.setStage(stage, layer);
@@ -15034,6 +15350,7 @@
15034
15350
  res && (res.state = "fail", cb && cb());
15035
15351
  }
15036
15352
  _stopAnimates() {
15353
+ if (!this.mayHaveTrackedAnimates()) return;
15037
15354
  const animates = [];
15038
15355
  this.visitTrackedAnimates(animate => {
15039
15356
  animates.push(animate);
@@ -15047,14 +15364,17 @@
15047
15364
  });
15048
15365
  }
15049
15366
  release() {
15050
- var _a, _b, _c;
15051
- this.releaseStatus = "released", this.clearSharedStateActiveRegistrations(), this.stopAnimates();
15052
- const graphicService = null !== (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.graphicService) && void 0 !== _b ? _b : application.graphicService;
15053
- null === (_c = null == graphicService ? void 0 : graphicService.onRelease) || void 0 === _c || _c.call(graphicService, this), super.release();
15367
+ var _a, _b, _c, _d;
15368
+ this.releaseStatus = "released", (null === (_a = this.registeredActiveScopes) || void 0 === _a ? void 0 : _a.size) && this.clearSharedStateActiveRegistrations(), (this.mayHaveTrackedAnimates() || this.shadowRoot) && this.stopAnimates();
15369
+ const graphicService = null !== (_c = null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService;
15370
+ null === (_d = null == graphicService ? void 0 : graphicService.onRelease) || void 0 === _d || _d.call(graphicService, this), super.release();
15371
+ }
15372
+ hasCustomEvent(type) {
15373
+ return !!this._events && type in this._events;
15054
15374
  }
15055
15375
  _dispatchCustomEvent(type, context) {
15056
15376
  var _a, _b;
15057
- if (this._events && type in this._events) {
15377
+ if (this.hasCustomEvent(type)) {
15058
15378
  const changeEvent = new CustomEvent(type, context);
15059
15379
  changeEvent.bubbles = !1;
15060
15380
  const manager = null === (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventSystem) || void 0 === _b ? void 0 : _b.manager;
@@ -15063,7 +15383,7 @@
15063
15383
  return !0;
15064
15384
  }
15065
15385
  beforeStateUpdate(attrs, prevStates, nextStates, hasAnimation, isClear) {
15066
- return this._dispatchCustomEvent("beforeStateUpdate", {
15386
+ return !this.hasCustomEvent("beforeStateUpdate") || this._dispatchCustomEvent("beforeStateUpdate", {
15067
15387
  type: AttributeUpdateType.STATE,
15068
15388
  attrs: Object.assign({}, attrs),
15069
15389
  prevStates: prevStates.slice(),
@@ -15072,6 +15392,11 @@
15072
15392
  isClear: !!isClear
15073
15393
  });
15074
15394
  }
15395
+ emitStateUpdateEvent() {
15396
+ this.hasCustomEvent("afterStateUpdate") && this._emitCustomEvent("afterStateUpdate", {
15397
+ type: AttributeUpdateType.STATE
15398
+ });
15399
+ }
15075
15400
  _emitCustomEvent(type, context) {
15076
15401
  this._dispatchCustomEvent(type, context);
15077
15402
  }
@@ -18078,13 +18403,15 @@
18078
18403
  }(GroupUpdateAABBBoundsMode || (GroupUpdateAABBBoundsMode = {}));
18079
18404
  let Group$1 = class Group extends Graphic {
18080
18405
  constructor(params) {
18081
- super(params), this.type = "group", this.parent = null, this.isContainer = !0, this.numberType = GROUP_NUMBER_TYPE, this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
18406
+ super(params), this.type = "group", this.parent = null, this.isContainer = !0, this._hasSharedStateDefinitions = !1, this.numberType = GROUP_NUMBER_TYPE, this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
18082
18407
  }
18083
18408
  get sharedStateDefinitions() {
18084
18409
  return this._sharedStateDefinitions;
18085
18410
  }
18086
18411
  set sharedStateDefinitions(value) {
18087
- this._sharedStateDefinitions !== value && (this._sharedStateDefinitions = value, this.ensureSharedStateScopeBound(), this.sharedStateScope && (setSharedStateScopeLocalDefinitions(this.sharedStateScope, value), markScopeActiveDescendantsDirty(this.sharedStateScope, this.stage)));
18412
+ if (this._sharedStateDefinitions === value) return;
18413
+ const previousScope = this.sharedStateScope;
18414
+ 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();
18088
18415
  }
18089
18416
  setMode(mode) {
18090
18417
  "3d" === mode ? this.set3dMode() : this.set2dMode();
@@ -18209,9 +18536,10 @@
18209
18536
  insertInto(newNode, idx) {
18210
18537
  return this._updateChildToStage(super.insertInto(newNode, idx));
18211
18538
  }
18212
- removeChild(child) {
18539
+ removeChild(child, highPerformance = !1) {
18540
+ var _a;
18213
18541
  const data = super.removeChild(child);
18214
- return this.getGraphicService().onRemove(child), child.setStage(null, null), this.addUpdateBoundTag(), data;
18542
+ 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;
18215
18543
  }
18216
18544
  removeAllChild(deep = !1) {
18217
18545
  const children = this.children.slice();
@@ -18223,11 +18551,13 @@
18223
18551
  }
18224
18552
  setStage(stage, layer) {
18225
18553
  var _a, _b, _c, _d, _e, _f;
18226
- 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;
18227
- 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 => {
18554
+ 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,
18555
+ 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;
18556
+ 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 => {
18228
18557
  item.setStage(stage, this.layer);
18229
18558
  });
18230
- this.layer !== layer && (this.layer = layer), this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingFromTree(!!(null === (_f = this.currentStates) || void 0 === _f ? void 0 : _f.length)), this.forEachChildren(item => {
18559
+ const layerChanged = this.layer !== layer;
18560
+ layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.forEachChildren(item => {
18231
18561
  item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(stage, this.layer);
18232
18562
  });
18233
18563
  }
@@ -18274,15 +18604,29 @@
18274
18604
  g.release(all);
18275
18605
  }), super.release();
18276
18606
  }
18607
+ detachStageForRelease() {
18608
+ super.detachStageForRelease(), this.sharedStateScope = void 0, this.forEachChildren(item => {
18609
+ var _a;
18610
+ null === (_a = item.detachStageForRelease) || void 0 === _a || _a.call(item);
18611
+ });
18612
+ }
18277
18613
  ensureSharedStateScopeBound() {
18278
18614
  var _a, _b, _c;
18615
+ if (!this.hasSharedStateDefinitions()) return void (this.sharedStateScope = void 0);
18279
18616
  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;
18280
18617
  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);
18281
18618
  }
18619
+ hasSharedStateDefinitions() {
18620
+ return this._hasSharedStateDefinitions;
18621
+ }
18622
+ notifyChildrenSharedStateTreeChanged() {
18623
+ this.forEachChildren(item => {
18624
+ item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(this.stage, this.layer);
18625
+ });
18626
+ }
18282
18627
  onParentSharedStateTreeChanged(stage, layer) {
18283
- this.stage === stage && this.layer === layer ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingFromTree(), this.forEachChildren(item => {
18284
- item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(stage, this.layer);
18285
- })) : this.setStage(stage, layer);
18628
+ var _a;
18629
+ 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);
18286
18630
  }
18287
18631
  };
18288
18632
  Group$1.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
@@ -18630,7 +18974,10 @@
18630
18974
  beforeUpdateAABBBounds: new SyncHook(["graphic", "stage", "willUpdate", "aabbBounds"]),
18631
18975
  afterUpdateAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds", "globalAABBBounds", "selfChange"]),
18632
18976
  clearAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds"])
18633
- }, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds();
18977
+ }, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds(), this.tempAABBBoundsResult = {
18978
+ tb1: this.tempAABBBounds1,
18979
+ tb2: this.tempAABBBounds2
18980
+ };
18634
18981
  }
18635
18982
  onAttributeUpdate(graphic) {
18636
18983
  this.hooks.onAttributeUpdate.taps.length && this.hooks.onAttributeUpdate.call(graphic);
@@ -18730,10 +19077,7 @@
18730
19077
  updateTempAABBBounds(aabbBounds) {
18731
19078
  const tb1 = this.tempAABBBounds1,
18732
19079
  tb2 = this.tempAABBBounds2;
18733
- return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), {
18734
- tb1: tb1,
18735
- tb2: tb2
18736
- };
19080
+ return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), this.tempAABBBoundsResult;
18737
19081
  }
18738
19082
  }
18739
19083
 
@@ -20075,7 +20419,7 @@
20075
20419
  const globalBounds = new AABBBounds();
20076
20420
  class DirtyBoundsPlugin {
20077
20421
  constructor() {
20078
- this.name = "DirtyBoundsPlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.handlePaintOnlyUpdate = graphic => {
20422
+ this.name = "DirtyBoundsPlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.dirtyBoundsHooksRegistered = !1, this.handlePaintOnlyUpdate = graphic => {
20079
20423
  var _a, _b, _c, _d;
20080
20424
  const stage = this.pluginService.stage;
20081
20425
  if (!stage || stage !== graphic.stage || !stage.renderCount) return;
@@ -20095,12 +20439,13 @@
20095
20439
  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));
20096
20440
  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;
20097
20441
  }
20098
- activate(context) {
20099
- this.pluginService = context, context.stage.hooks.afterRender.tap(this.key, stage => {
20100
- stage && stage === this.pluginService.stage && stage.dirtyBounds.clear();
20101
- });
20102
- const stage = this.pluginService.stage;
20103
- stage && (stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handlePaintOnlyUpdate), stage.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, (graphic, stage, willUpdate, bounds) => {
20442
+ getRemoveDirtyBounds(graphic) {
20443
+ var _a;
20444
+ const cachedBounds = (null !== (_a = graphic.glyphHost) && void 0 !== _a ? _a : graphic)._globalAABBBounds;
20445
+ if (cachedBounds && "function" == typeof cachedBounds.empty && !cachedBounds.empty()) return cachedBounds;
20446
+ }
20447
+ registerDirtyBoundsHooks(stage) {
20448
+ this.dirtyBoundsHooksRegistered || (stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handlePaintOnlyUpdate), stage.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, (graphic, stage, willUpdate, bounds) => {
20104
20449
  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)));
20105
20450
  }), stage.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, (graphic, stage, bounds, params, selfChange) => {
20106
20451
  stage && stage === this.pluginService.stage && stage.renderCount && (graphic.isContainer && !selfChange || stage.dirty(params.globalAABBBounds));
@@ -20108,12 +20453,21 @@
20108
20453
  stage && stage === this.pluginService.stage && stage.renderCount && stage && stage.dirty(bounds);
20109
20454
  }), stage.graphicService.hooks.onRemove.tap(this.key, graphic => {
20110
20455
  const stage = graphic.stage;
20111
- stage && stage === this.pluginService.stage && stage.renderCount && stage && stage.dirty(graphic.globalAABBBounds);
20112
- }));
20456
+ if (!stage || stage !== this.pluginService.stage || !stage.renderCount) return;
20457
+ const bounds = this.getRemoveDirtyBounds(graphic);
20458
+ bounds && !bounds.empty() && stage.dirty(bounds);
20459
+ }), this.dirtyBoundsHooksRegistered = !0);
20460
+ }
20461
+ activate(context) {
20462
+ this.pluginService = context, context.stage.hooks.afterRender.tap(this.key, stage => {
20463
+ stage && stage === this.pluginService.stage && (stage.dirtyBounds.clear(), this.registerDirtyBoundsHooks(stage));
20464
+ });
20465
+ const stage = this.pluginService.stage;
20466
+ stage && stage.renderCount && this.registerDirtyBoundsHooks(stage);
20113
20467
  }
20114
20468
  deactivate(context) {
20115
20469
  const stage = this.pluginService.stage;
20116
- 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));
20470
+ 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));
20117
20471
  }
20118
20472
  }
20119
20473
 
@@ -20469,7 +20823,7 @@
20469
20823
  ticker.bindStage(this), this._ticker && this._ticker.removeListener("tick", this.afterTickCb), ticker.addTimeline(this.timeline), this._ticker = ticker, this._ticker.on("tick", this.afterTickCb);
20470
20824
  }
20471
20825
  constructor(params = {}, deps = {}) {
20472
- var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
20826
+ var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
20473
20827
  super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
20474
20828
  if (!(this._skipRender < 0)) if (visible) {
20475
20829
  if (this.dirtyBounds) {
@@ -20479,7 +20833,8 @@
20479
20833
  this._skipRender > 1 && this.renderNextFrame(), this._skipRender = 0;
20480
20834
  } else this._skipRender = 1;
20481
20835
  }, this.beforeRender = stage => {
20482
- flushStageSharedStateRefresh(this), this._beforeRenderList.forEach(cb => cb(stage));
20836
+ const pendingSharedRefresh = this._pendingSharedStateRefreshGraphics;
20837
+ (null == pendingSharedRefresh ? void 0 : pendingSharedRefresh.size) && flushStageSharedStateRefresh(this), this._beforeRenderList.forEach(cb => cb(stage));
20483
20838
  }, this.afterClearScreen = drawParams => {
20484
20839
  this._afterClearScreen && this._afterClearScreen(drawParams);
20485
20840
  }, this.afterClearRect = drawParams => {
@@ -20504,14 +20859,17 @@
20504
20859
  canvas: params.canvas
20505
20860
  }), 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, {
20506
20861
  main: !0
20507
- })), 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 = () => {
20862
+ })), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.theme.onStateDefinitionsChange = () => {
20508
20863
  var _a;
20509
- this.rootSharedStateScope && (setRootSharedStateScopeThemeDefinitions(this.rootSharedStateScope, null === (_a = this.theme) || void 0 === _a ? void 0 : _a.stateDefinitions), markScopeActiveDescendantsDirty(this.rootSharedStateScope, this));
20864
+ const definitions = null === (_a = this.theme) || void 0 === _a ? void 0 : _a.stateDefinitions;
20865
+ if (!definitions || !Object.keys(definitions).length) return void (this.rootSharedStateScope && (setRootSharedStateScopeThemeDefinitions(this.rootSharedStateScope, definitions), markScopeActiveDescendantsDirty(this.rootSharedStateScope, this)));
20866
+ const rootScope = this.ensureRootSharedStateScope(definitions);
20867
+ setRootSharedStateScopeThemeDefinitions(rootScope, definitions), markScopeActiveDescendantsDirty(rootScope, this);
20510
20868
  }, 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 = {
20511
20869
  tickRenderMode: "effect"
20512
20870
  }), this.optmize(params.optimize), params.background && isString$1(this._background) && this._background.includes("/") && this.setAttributes({
20513
20871
  background: this._background
20514
- }), this.initAnimate(params), this.rafId = null !== (_y = params.rafId) && void 0 !== _y ? _y : Math.floor(6 * Math.random());
20872
+ }), this.initAnimate(params), this.rafId = null !== (_x = params.rafId) && void 0 !== _x ? _x : Math.floor(6 * Math.random());
20515
20873
  }
20516
20874
  initAnimate(params) {
20517
20875
  var _a;
@@ -20771,8 +21129,14 @@
20771
21129
  this._doRenderInThisFrame(), this.willNextFrameRender = !1;
20772
21130
  }));
20773
21131
  }
21132
+ ensureRootSharedStateScope(themeStateDefinitions) {
21133
+ return this.rootSharedStateScope ? (this.rootSharedStateScope.ownerStage = this, this.rootSharedStateScope) : (this.rootSharedStateScope = createRootSharedStateScope(this, themeStateDefinitions), this.rootSharedStateScope);
21134
+ }
21135
+ getStateBatchScheduler() {
21136
+ return this._stateBatchScheduler || (this._stateBatchScheduler = new StateBatchScheduler(this, ensureStageStatePerfMonitor(this))), this._stateBatchScheduler;
21137
+ }
20774
21138
  scheduleStateBatch(graphics, targetStates) {
20775
- this._stateBatchScheduler.schedule(graphics, targetStates);
21139
+ this.getStateBatchScheduler().schedule(graphics, targetStates);
20776
21140
  }
20777
21141
  getStatePerfSnapshot() {
20778
21142
  return ensureStageStatePerfMonitor(this).getSnapshot();
@@ -23273,7 +23637,11 @@
23273
23637
  };
23274
23638
  class BaseRender {
23275
23639
  init(contributions) {
23276
- contributions && (this._renderContribitions = contributions.getContributions()), this._renderContribitions || (this._renderContribitions = []), this.builtinContributions || (this.builtinContributions = []), this.builtinContributions.push(defaultBaseClipRenderBeforeContribution), this.builtinContributions.push(defaultBaseClipRenderAfterContribution), this.builtinContributions.forEach(item => this._renderContribitions.push(item)), this._renderContribitions.length && (this._renderContribitions.sort((a, b) => b.order - a.order), this._beforeRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.beforeFillStroke), this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.afterFillStroke));
23640
+ this.builtinContributions || (this.builtinContributions = []), this._renderContribitions = contributions ? contributions.getContributions().slice() : [];
23641
+ const addContribution = item => {
23642
+ this._renderContribitions.includes(item) || this._renderContribitions.push(item);
23643
+ };
23644
+ this.builtinContributions.forEach(addContribution), addContribution(defaultBaseClipRenderBeforeContribution), addContribution(defaultBaseClipRenderAfterContribution), this._renderContribitions.length ? (this._renderContribitions.sort((a, b) => b.order - a.order), this._beforeRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.beforeFillStroke), this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.afterFillStroke)) : (this._beforeRenderContribitions = [], this._afterRenderContribitions = []);
23277
23645
  }
23278
23646
  reInit() {
23279
23647
  this.init(this.graphicRenderContributions);
@@ -28322,8 +28690,8 @@
28322
28690
  graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === this.pluginService.stage && graphic.isContainer && !this.skipBoundsTrigger && _tempBounds.copy(bounds);
28323
28691
  }), stage.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, (graphic, stage, bounds, params, selfChange) => {
28324
28692
  stage && stage === this.pluginService.stage && graphic.isContainer && !this.skipBoundsTrigger && (_tempBounds.equals(bounds) || this.tryLayout(graphic, !1));
28325
- }), stage.graphicService.hooks.onSetStage.tap(this.key, graphic => {
28326
- graphic.glyphHost && (graphic = graphic.glyphHost), this.tryLayout(graphic, !1);
28693
+ }), stage.graphicService.hooks.onSetStage.tap(this.key, (graphic, nextStage) => {
28694
+ nextStage && nextStage === this.pluginService.stage && (graphic.glyphHost && (graphic = graphic.glyphHost), this.tryLayout(graphic, !1));
28327
28695
  }));
28328
28696
  }
28329
28697
  deactivate(context) {
@@ -28886,7 +29254,6 @@
28886
29254
  segments: segments,
28887
29255
  shouldClipImageByLayout: shouldClipImageByLayout,
28888
29256
  shouldUseMat4: shouldUseMat4,
28889
- shouldUseSimpleAttributeFastPath: shouldUseSimpleAttributeFastPath,
28890
29257
  snapLength: snapLength,
28891
29258
  splitArc: splitArc,
28892
29259
  splitArea: splitArea,
@@ -34439,15 +34806,38 @@
34439
34806
  if (!graphic || !targetAttrs) return;
34440
34807
  const committedTargetAttrs = cloneDeep(targetAttrs),
34441
34808
  transientStartAttrs = cloneDeep(null != startAttrs ? startAttrs : graphic.attribute);
34442
- graphic.setAttributes(committedTargetAttrs);
34443
- const baseAttributes = graphic.baseAttributes;
34444
- baseAttributes && "object" == typeof baseAttributes && Object.keys(committedTargetAttrs).forEach(key => {
34445
- baseAttributes[key] = cloneDeep(committedTargetAttrs[key]);
34446
- }), 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, {
34809
+ 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, {
34447
34810
  type: AttributeUpdateType.ANIMATE_BIND
34448
34811
  });
34449
34812
  }
34450
34813
 
34814
+ function collectTrackedAnimates(graphic, animates = [], visited = new Set()) {
34815
+ var _a, _b, _c, _d, _e;
34816
+ const trackedAnimates = null !== (_c = null === (_b = (_a = graphic).getTrackedAnimates) || void 0 === _b ? void 0 : _b.call(_a)) && void 0 !== _c ? _c : graphic.animates;
34817
+ return null == trackedAnimates || trackedAnimates.forEach(animate => {
34818
+ animate && !visited.has(animate) && (visited.add(animate), animates.push(animate));
34819
+ }), null === (_e = (_d = graphic).forEachChildren) || void 0 === _e || _e.call(_d, child => {
34820
+ collectTrackedAnimates(child, animates, visited);
34821
+ }), animates;
34822
+ }
34823
+ function appendExitReleaseCallback(state, callback) {
34824
+ callback && (null == state || state.onComplete.push(callback));
34825
+ }
34826
+ function runExitReleaseCallbacks(callbacks) {
34827
+ callbacks.forEach(callback => {
34828
+ callback();
34829
+ });
34830
+ }
34831
+ function bindExitReleaseAnimates(exitAnimates, getState, finalize) {
34832
+ const finish = animate => {
34833
+ const state = getState();
34834
+ state && !state.finalized && state.pendingAnimates.has(animate) && (state.pendingAnimates.delete(animate), state.pendingAnimates.size || finalize());
34835
+ };
34836
+ exitAnimates.forEach(animate => {
34837
+ animate.onEnd(() => finish(animate)), animate.onRemove(() => finish(animate));
34838
+ });
34839
+ }
34840
+
34451
34841
  const DefaultAxisAnimation = {
34452
34842
  type: "default",
34453
34843
  duration: 300,
@@ -34479,12 +34869,65 @@
34479
34869
  });
34480
34870
  return this.add(offscreenGroup), this._renderInner(offscreenGroup), this.removeChild(offscreenGroup), this.attribute = currentAttribute, offscreenGroup.AABBBounds;
34481
34871
  }
34872
+ _finalizeExitRelease() {
34873
+ var _a, _b;
34874
+ const state = this._exitReleaseState;
34875
+ if (null == state ? void 0 : state.finalized) return;
34876
+ state && (state.finalized = !0);
34877
+ const parent = this.parent,
34878
+ removeFromParent = !!(null == state ? void 0 : state.removeFromParent),
34879
+ callbacks = null !== (_a = null == state ? void 0 : state.onComplete) && void 0 !== _a ? _a : [];
34880
+ 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);
34881
+ }
34882
+ _runExitAnimationBeforeRelease(options = {}) {
34883
+ var _a, _b, _c;
34884
+ if (this._exitReleaseState && !this._exitReleaseState.finalized) return this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent, appendExitReleaseCallback(this._exitReleaseState, options.onComplete), !0;
34885
+ if (!this.stage || !1 === this.attribute.animation || !1 === this.attribute.animationExit || !this._innerView) return !1;
34886
+ if (this._prepare(), !(null === (_a = this._animationConfig) || void 0 === _a ? void 0 : _a.exit)) return !1;
34887
+ const exitTargets = new Set();
34888
+ if (traverseGroup(this._innerView, el => {
34889
+ "group" !== el.type && exitTargets.add(el);
34890
+ }), !exitTargets.size) return !1;
34891
+ const existingAnimates = collectTrackedAnimates(this),
34892
+ {
34893
+ delay = 0,
34894
+ duration = DefaultAxisAnimation.duration,
34895
+ easing = DefaultAxisAnimation.easing
34896
+ } = this._animationConfig.exit;
34897
+ exitTargets.forEach(target => {
34898
+ var _a, _b, _c;
34899
+ const startAttrs = {
34900
+ opacity: null !== (_a = target.attribute.opacity) && void 0 !== _a ? _a : 1,
34901
+ fillOpacity: null !== (_b = target.attribute.fillOpacity) && void 0 !== _b ? _b : 1,
34902
+ strokeOpacity: null !== (_c = target.attribute.strokeOpacity) && void 0 !== _c ? _c : 1
34903
+ },
34904
+ endAttrs = {
34905
+ opacity: 0,
34906
+ fillOpacity: 0,
34907
+ strokeOpacity: 0
34908
+ };
34909
+ commitUpdateAnimationTarget(target, endAttrs, startAttrs), target.animate().wait(delay).to(endAttrs, duration, easing);
34910
+ });
34911
+ const exitAnimates = collectTrackedAnimates(this).filter(animate => !existingAnimates.includes(animate));
34912
+ if (!exitAnimates.length) return !1;
34913
+ this.setAttribute("childrenPickable", !1), null === (_c = (_b = this._innerView).removeAllEventListeners) || void 0 === _c || _c.call(_b), this.releaseStatus = "willRelease";
34914
+ const pendingAnimates = new Set(exitAnimates);
34915
+ return this._exitReleaseState = {
34916
+ pendingAnimates: pendingAnimates,
34917
+ finalized: !1,
34918
+ removeFromParent: !!options.removeFromParent,
34919
+ onComplete: options.onComplete ? [options.onComplete] : []
34920
+ }, bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease()), !0;
34921
+ }
34922
+ releaseWithExitAnimation(options = {}) {
34923
+ return "released" !== this.releaseStatus && this._runExitAnimationBeforeRelease(options);
34924
+ }
34482
34925
  render() {
34483
- this._prepare(), this._prevInnerView = this._innerView && getElMap(this._innerView), this.removeAllChild(!0), this._innerView = graphicCreator.group({
34926
+ this._exitReleaseState || (this._prepare(), this._prevInnerView = this._innerView && getElMap(this._innerView), this.removeAllChild(!0), this._innerView = graphicCreator.group({
34484
34927
  x: 0,
34485
34928
  y: 0,
34486
34929
  pickable: !1
34487
- }), this.add(this._innerView), this._renderInner(this._innerView), this._bindEvent(), this.runAnimation();
34930
+ }), this.add(this._innerView), this._renderInner(this._innerView), this._bindEvent(), this.runAnimation());
34488
34931
  }
34489
34932
  _prepare() {
34490
34933
  this._prepareAnimate(DefaultAxisAnimation);
@@ -34816,8 +35259,8 @@
34816
35259
  });
34817
35260
  }
34818
35261
  }
34819
- release() {
34820
- super.release(), this._prevInnerView = null, this._innerView = null;
35262
+ release(all) {
35263
+ this._exitReleaseState ? this._finalizeExitRelease() : (all && this.removeAllChild(!0), super.release(all), all && this.removeAllChild(!0), this._prevInnerView = null, this._innerView = null);
34821
35264
  }
34822
35265
  }
34823
35266
 
@@ -35329,20 +35772,67 @@
35329
35772
  return !1;
35330
35773
  }
35331
35774
 
35775
+ const animateUpdateContext = {
35776
+ type: AttributeUpdateType.ANIMATE_UPDATE
35777
+ },
35778
+ animateBindContext = {
35779
+ type: AttributeUpdateType.ANIMATE_BIND
35780
+ },
35781
+ animateStartContext = {
35782
+ type: AttributeUpdateType.ANIMATE_START
35783
+ };
35784
+ function getAnimationContext(type) {
35785
+ switch (type) {
35786
+ case AttributeUpdateType.ANIMATE_UPDATE:
35787
+ return animateUpdateContext;
35788
+ case AttributeUpdateType.ANIMATE_BIND:
35789
+ return animateBindContext;
35790
+ case AttributeUpdateType.ANIMATE_START:
35791
+ return animateStartContext;
35792
+ default:
35793
+ return {
35794
+ type: type
35795
+ };
35796
+ }
35797
+ }
35798
+ function prepareAnimationFrameAttribute(target) {
35799
+ const transientTarget = target;
35800
+ return transientTarget.attribute || (transientTarget.attribute = {}), transientTarget.attribute === transientTarget.baseAttributes && "function" == typeof transientTarget.detachAttributeFromBaseAttributes && transientTarget.detachAttributeFromBaseAttributes(), transientTarget.attributeMayContainTransientAttrs = !0, transientTarget.attribute;
35801
+ }
35802
+ function commitAnimationFrameAttribute(target) {
35803
+ var _a, _b;
35804
+ null === (_b = (_a = target).onAttributeUpdate) || void 0 === _b || _b.call(_a, animateUpdateContext);
35805
+ }
35806
+ function applyAnimationFrameAttributes(target, attributes) {
35807
+ if (!attributes) return;
35808
+ const targetAttribute = prepareAnimationFrameAttribute(target);
35809
+ for (const key in attributes) Object.prototype.hasOwnProperty.call(attributes, key) && (targetAttribute[key] = attributes[key]);
35810
+ commitAnimationFrameAttribute(target);
35811
+ }
35812
+ function applyAnimationFrameNumberAttributes(target, keys, from, to, ratio) {
35813
+ const targetAttribute = prepareAnimationFrameAttribute(target);
35814
+ for (let i = 0; i < keys.length; i++) {
35815
+ const key = keys[i];
35816
+ targetAttribute[key] = from[key] + (to[key] - from[key]) * ratio;
35817
+ }
35818
+ commitAnimationFrameAttribute(target);
35819
+ }
35332
35820
  function applyAnimationTransientAttributes(target, attributes, type = AttributeUpdateType.ANIMATE_UPDATE) {
35333
35821
  var _a;
35334
35822
  if (!attributes) return;
35335
- const context = {
35336
- type: type
35337
- },
35823
+ const context = getAnimationContext(type),
35338
35824
  transientTarget = target;
35339
- "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);
35825
+ "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);
35340
35826
  }
35341
35827
  function applyAppearStartAttributes(target, attributes) {
35342
35828
  applyAnimationTransientAttributes(target, attributes, AttributeUpdateType.ANIMATE_BIND);
35343
35829
  }
35344
35830
 
35345
35831
  function noop() {}
35832
+ function includesKey$1(keys, key) {
35833
+ for (let i = 0; i < keys.length; i++) if (keys[i] === key) return !0;
35834
+ return !1;
35835
+ }
35346
35836
  class Step {
35347
35837
  constructor(type, props, duration, easing) {
35348
35838
  var _a;
@@ -35398,6 +35888,17 @@
35398
35888
  onBind() {
35399
35889
  "glyph" === this.target.type && (this.syncAttributeUpdate = this._syncAttributeUpdate);
35400
35890
  }
35891
+ runInterpolateUpdate(fromProps, toProps, ratio) {
35892
+ if (this.animate.interpolateUpdateFunction) return void this.animate.interpolateUpdateFunction(fromProps, toProps, ratio, this, this.target);
35893
+ const funcs = this.interpolateUpdateFunctions,
35894
+ propKeys = this.propKeys;
35895
+ if (funcs && propKeys) for (let index = 0; index < funcs.length; index++) {
35896
+ const key = propKeys[index],
35897
+ fromValue = fromProps[key],
35898
+ toValue = toProps[key];
35899
+ funcs[index](key, fromValue, toValue, ratio, this, this.target);
35900
+ }
35901
+ }
35401
35902
  onFirstRun() {}
35402
35903
  onStart() {
35403
35904
  if (!this._hasFirstRun) {
@@ -35412,23 +35913,49 @@
35412
35913
  tryPreventConflict() {
35413
35914
  var _a, _b;
35414
35915
  const animate = this.animate,
35415
- target = this.target;
35416
- (null !== (_b = null === (_a = target.forEachTrackedAnimate) || void 0 === _a ? void 0 : _a.bind(target)) && void 0 !== _b ? _b : cb => {
35417
- var _a;
35418
- null === (_a = target.animates) || void 0 === _a || _a.forEach(cb);
35419
- })(a => {
35916
+ target = this.target,
35917
+ forEachTrackedAnimate = null !== (_b = null === (_a = target.forEachTrackedAnimate) || void 0 === _a ? void 0 : _a.bind(target)) && void 0 !== _b ? _b : cb => {
35918
+ var _a;
35919
+ null === (_a = target.animates) || void 0 === _a || _a.forEach(cb);
35920
+ },
35921
+ propKeys = this.propKeys;
35922
+ forEachTrackedAnimate(a => {
35420
35923
  if (a === animate || a.priority > animate.priority || a.priority === 1 / 0) return;
35421
35924
  const fromProps = a.getStartProps();
35422
- this.propKeys.forEach(key => {
35423
- null != fromProps[key] && a.preventAttr(key);
35424
- });
35925
+ let conflictKeys = null;
35926
+ for (let i = 0; i < propKeys.length; i++) {
35927
+ const key = propKeys[i];
35928
+ null != fromProps[key] && (null != conflictKeys ? conflictKeys : conflictKeys = []).push(key);
35929
+ }
35930
+ conflictKeys && a.preventAttrs(conflictKeys);
35425
35931
  });
35426
35932
  }
35933
+ removeKeysFromRecord(record, keys) {
35934
+ if (!record) return record;
35935
+ let hasBlockedKey = !1;
35936
+ for (const key in record) if (Object.prototype.hasOwnProperty.call(record, key) && includesKey$1(keys, key)) {
35937
+ hasBlockedKey = !0;
35938
+ break;
35939
+ }
35940
+ if (!hasBlockedKey) return record;
35941
+ const nextRecord = {};
35942
+ for (const key in record) Object.prototype.hasOwnProperty.call(record, key) && !includesKey$1(keys, key) && (nextRecord[key] = record[key]);
35943
+ return nextRecord;
35944
+ }
35427
35945
  deleteSelfAttr(key) {
35946
+ this.deleteSelfAttrs([key]);
35947
+ }
35948
+ deleteSelfAttrs(keys) {
35428
35949
  var _a;
35429
- delete this.props[key], this.fromProps && delete this.fromProps[key];
35430
- const index = this.propKeys.indexOf(key);
35431
- -1 !== index && (this.propKeys.splice(index, 1), null === (_a = this.interpolateUpdateFunctions) || void 0 === _a || _a.splice(index, 1));
35950
+ 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)) {
35951
+ const funcs = this.interpolateUpdateFunctions;
35952
+ let writeIndex = 0;
35953
+ for (let readIndex = 0; readIndex < this.propKeys.length; readIndex++) {
35954
+ const propKey = this.propKeys[readIndex];
35955
+ includesKey$1(keys, propKey) || (writeIndex !== readIndex && (this.propKeys[writeIndex] = propKey, funcs && (funcs[writeIndex] = funcs[readIndex])), writeIndex++);
35956
+ }
35957
+ this.propKeys.length = writeIndex, funcs && (funcs.length = writeIndex);
35958
+ }
35432
35959
  }
35433
35960
  trySyncStartProps() {
35434
35961
  this.propKeys.forEach(key => {
@@ -35438,11 +35965,7 @@
35438
35965
  update(end, ratio, out) {
35439
35966
  if (this.onStart(), !this.props || !this.propKeys) return;
35440
35967
  const easedRatio = this.easing(ratio);
35441
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
35442
- if (!this.animate.validAttr(this.propKeys[index])) return;
35443
- const key = this.propKeys[index];
35444
- func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
35445
- }), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
35968
+ this.runInterpolateUpdate(this.fromProps, this.props, easedRatio), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
35446
35969
  }
35447
35970
  onUpdate(end, ratio, out) {}
35448
35971
  onEnd(cb) {
@@ -35646,19 +36169,34 @@
35646
36169
  }), this.applyTransientFromAttributes();
35647
36170
  }
35648
36171
  deleteSelfAttr(key) {
35649
- super.deleteSelfAttr(key), delete this.from[key];
36172
+ this.deleteSelfAttrs([key]);
36173
+ }
36174
+ deleteSelfAttrs(keys) {
36175
+ super.deleteSelfAttrs(keys), this.from = this.removeKeysFromRecord(this.from, keys);
35650
36176
  }
35651
36177
  update(end, ratio, out) {
35652
36178
  if (this.onStart(), !this.props || !this.propKeys) return;
35653
36179
  const easedRatio = this.easing(ratio);
35654
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.from, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
35655
- if (!this.animate.validAttr(this.propKeys[index])) return;
35656
- const key = this.propKeys[index];
35657
- func(key, this.from[key], this.props[key], easedRatio, this, this.target);
35658
- }), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
36180
+ this.runInterpolateUpdate(this.from, this.props, easedRatio), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
35659
36181
  }
35660
36182
  }
35661
36183
 
36184
+ function includesKey(keys, key) {
36185
+ for (let i = 0; i < keys.length; i++) if (keys[i] === key) return !0;
36186
+ return !1;
36187
+ }
36188
+ function removeKeysFromRecord(record, keys) {
36189
+ if (!record) return record;
36190
+ let hasBlockedKey = !1;
36191
+ for (const key in record) if (Object.prototype.hasOwnProperty.call(record, key) && includesKey(keys, key)) {
36192
+ hasBlockedKey = !0;
36193
+ break;
36194
+ }
36195
+ if (!hasBlockedKey) return record;
36196
+ const nextRecord = {};
36197
+ for (const key in record) Object.prototype.hasOwnProperty.call(record, key) && !includesKey(keys, key) && (nextRecord[key] = record[key]);
36198
+ return nextRecord;
36199
+ }
35662
36200
  class Animate {
35663
36201
  constructor(id = Generator.GenAutoIncrementId(), timeline = defaultTimeline, slience) {
35664
36202
  this.id = id, this.status = AnimateStatus.INITIAL, this._timeline = timeline, timeline.addAnimate(this), this.slience = slience, this._startTime = 0, this._duration = 0, this._totalDuration = 0, this._loopCount = 0, this._currentLoop = 0, this._bounce = !1, this._firstStep = null, this._lastStep = null, this._startProps = {}, this._endProps = {}, this._preventAttrs = new Set(), this.currentTime = 0, this.interpolateUpdateFunction = null, this.priority = 0;
@@ -35681,7 +36219,7 @@
35681
36219
  bind(target) {
35682
36220
  this.target = target;
35683
36221
  const trackerTarget = this.target;
35684
- 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(() => {
36222
+ 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(() => {
35685
36223
  this.stop(), this.__skipRestoreStaticAttributeOnRemove || "function" != typeof trackerTarget.restoreStaticAttribute || trackerTarget.restoreStaticAttribute(), "function" == typeof trackerTarget.untrackAnimate ? trackerTarget.untrackAnimate(this.id) : this.target.animates.delete(this.id);
35686
36224
  }), this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.target.animationAttribute || (this.target.animationAttribute = {}), this;
35687
36225
  }
@@ -35746,12 +36284,14 @@
35746
36284
  cb ? (this._onRemove || (this._onRemove = []), this._onRemove.push(cb)) : null === (_a = this._onRemove) || void 0 === _a || _a.forEach(cb => cb());
35747
36285
  }
35748
36286
  preventAttr(key) {
35749
- this._preventAttrs.add(key), delete this._startProps[key], delete this._endProps[key];
35750
- let step = this._firstStep;
35751
- for (; step;) step.deleteSelfAttr(key), step = step.next;
36287
+ this.preventAttrs([key]);
35752
36288
  }
35753
36289
  preventAttrs(keys) {
35754
- keys.forEach(key => this._preventAttrs.add(key));
36290
+ if (!(null == keys ? void 0 : keys.length)) return;
36291
+ for (let i = 0; i < keys.length; i++) this._preventAttrs.add(keys[i]);
36292
+ this._startProps = removeKeysFromRecord(this._startProps, keys), this._endProps = removeKeysFromRecord(this._endProps, keys);
36293
+ let step = this._firstStep;
36294
+ for (; step;) step.deleteSelfAttrs(keys), step = step.next;
35755
36295
  }
35756
36296
  validAttr(key) {
35757
36297
  return !this._preventAttrs.has(key);
@@ -36123,6 +36663,33 @@
36123
36663
  cb();
36124
36664
  });
36125
36665
  }
36666
+ getActiveAttrKeys() {
36667
+ const keys = [];
36668
+ for (let i = 0; i < this._animates.length; i++) {
36669
+ const animate = this._animates[i];
36670
+ if (animate.status === AnimateStatus.END) continue;
36671
+ const endProps = animate.getEndProps();
36672
+ if (endProps) for (const key in endProps) Object.prototype.hasOwnProperty.call(endProps, key) && keys.indexOf(key) < 0 && keys.push(key);
36673
+ }
36674
+ return keys;
36675
+ }
36676
+ hasActiveAttrs() {
36677
+ for (let i = 0; i < this._animates.length; i++) {
36678
+ const animate = this._animates[i];
36679
+ if (animate.status === AnimateStatus.END) continue;
36680
+ const endProps = animate.getEndProps();
36681
+ if (endProps) for (const key in endProps) if (Object.prototype.hasOwnProperty.call(endProps, key)) return !0;
36682
+ }
36683
+ return !1;
36684
+ }
36685
+ preventAttrs(keys) {
36686
+ if (!(null == keys ? void 0 : keys.length)) return this.hasActiveAttrs();
36687
+ for (let i = 0; i < this._animates.length; i++) {
36688
+ const animate = this._animates[i];
36689
+ animate.status !== AnimateStatus.END && animate.preventAttrs(keys);
36690
+ }
36691
+ return this.hasActiveAttrs();
36692
+ }
36126
36693
  _trackAnimation(animate) {
36127
36694
  this._animates.push(animate), this._activeCount++, 1 !== this._activeCount || this._started || (this._started = !0, this.onStart()), animate.onEnd(() => {
36128
36695
  this._activeCount--;
@@ -36245,7 +36812,8 @@
36245
36812
  let parsedFromProps = null,
36246
36813
  props = params.to,
36247
36814
  from = params.from;
36248
- 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);
36815
+ const commitAttrOutChannel = this.shouldCommitAttrOutChannel(type);
36816
+ 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);
36249
36817
  let totalDelay = 0;
36250
36818
  oneByOneDelay && (totalDelay = oneByOneDelay * (count - index - 1));
36251
36819
  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;
@@ -36308,7 +36876,8 @@
36308
36876
  let parsedFromProps = null,
36309
36877
  props = effect.to,
36310
36878
  from = effect.from;
36311
- 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);
36879
+ const commitAttrOutChannel = this.shouldCommitAttrOutChannel(type);
36880
+ 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);
36312
36881
  const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
36313
36882
  customType = effect.custom ? effect.customType : getCustomType(custom);
36314
36883
  this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
@@ -36322,11 +36891,14 @@
36322
36891
  interpolator(ratio, from, to, step, target, animate.target, customParams);
36323
36892
  }, animate.to(props, duration, easing);
36324
36893
  }
36894
+ shouldCommitAttrOutChannel(type) {
36895
+ return "update" !== type;
36896
+ }
36325
36897
  createCustomAnimation(animate, CustomAnimateConstructor, from, props, duration, easing, customParams) {
36326
36898
  const customAnimate = new CustomAnimateConstructor(from, props, duration, easing, customParams);
36327
36899
  animate.play(customAnimate);
36328
36900
  }
36329
- createPropsFromChannel(channel, graphic) {
36901
+ createPropsFromChannel(channel, graphic, includeAttrOutChannel = !0) {
36330
36902
  var _a;
36331
36903
  const props = {};
36332
36904
  let from = null;
@@ -36335,7 +36907,7 @@
36335
36907
  props: props,
36336
36908
  attrOutChannel: null
36337
36909
  };
36338
- const attrOutChannel = {};
36910
+ const attrOutChannel = includeAttrOutChannel ? {} : null;
36339
36911
  let hasAttrs = !1;
36340
36912
  const diffAttrs = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs;
36341
36913
  if (Array.isArray(channel) && (channel = channel.reduce((res, key) => (void 0 === diffAttrs[key] || (res[key] = {
@@ -36344,7 +36916,7 @@
36344
36916
  var _a, _b, _c, _d;
36345
36917
  const config = channel[key];
36346
36918
  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);
36347
- }), diffAttrs) for (const key in diffAttrs) {
36919
+ }), diffAttrs && attrOutChannel) for (const key in diffAttrs) {
36348
36920
  const value = diffAttrs[key];
36349
36921
  if (void 0 === value) continue;
36350
36922
  props.hasOwnProperty(key) || !!(null == from ? void 0 : from.hasOwnProperty(key)) || (attrOutChannel[key] = value, hasAttrs = !0);
@@ -36423,8 +36995,22 @@
36423
36995
  hasTrackedAnimate() {
36424
36996
  return this.trackedAnimates.size > 0;
36425
36997
  }
36998
+ hasStateInfo(list, target) {
36999
+ for (let i = 0; i < list.length; i++) if (list[i] === target) return !0;
37000
+ return !1;
37001
+ }
37002
+ takeOverUpdateAttrs(nextState, currentStates, shouldStopState) {
37003
+ if (nextState.state !== AnimationStates$1.UPDATE || !currentStates.length) return;
37004
+ const nextKeys = nextState.executor.getActiveAttrKeys();
37005
+ if (nextKeys.length) for (let i = 0; i < currentStates.length; i++) {
37006
+ const currentState = currentStates[i];
37007
+ currentState.state !== AnimationStates$1.UPDATE || currentState === nextState || this.hasStateInfo(shouldStopState, currentState) || currentState.executor.preventAttrs(nextKeys) || (currentState.executor.stop(null, !1), shouldStopState.push(currentState));
37008
+ }
37009
+ }
36426
37010
  applyState(nextState, animationConfig, callback) {
37011
+ var _a;
36427
37012
  const registry = AnimationTransitionRegistry.getInstance(),
37013
+ currentStateList = null !== (_a = this.stateList) && void 0 !== _a ? _a : [],
36428
37014
  shouldStopState = [],
36429
37015
  shouldApplyState = [];
36430
37016
  if (this.stateList && this.stateList.length ? nextState.forEach((state, index) => {
@@ -36432,14 +37018,14 @@
36432
37018
  allowTransition: !0,
36433
37019
  stopOriginalTransition: !0
36434
37020
  };
36435
- this.stateList.forEach(currState => {
37021
+ currentStateList.forEach(currState => {
36436
37022
  const _result = registry.isTransitionAllowed(currState.state, state, this.graphic);
36437
37023
  result.allowTransition = result.allowTransition && _result.allowTransition;
36438
37024
  }), result.allowTransition && (shouldApplyState.push({
36439
37025
  state: state,
36440
37026
  animationConfig: isArray$1(animationConfig[index]) ? animationConfig[index].map(item => item.animation) : animationConfig[index].animation,
36441
37027
  executor: new AnimateExecutor(this.graphic)
36442
- }), this.stateList.forEach(currState => {
37028
+ }), currentStateList.forEach(currState => {
36443
37029
  registry.isTransitionAllowed(currState.state, state, this.graphic).stopOriginalTransition && shouldStopState.push(currState);
36444
37030
  }));
36445
37031
  }) : nextState.forEach((state, index) => {
@@ -36451,12 +37037,18 @@
36451
37037
  }), shouldStopState.forEach(state => {
36452
37038
  state.executor.stop(null, !1);
36453
37039
  }), shouldApplyState.length) {
36454
- shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig);
37040
+ shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig), this.takeOverUpdateAttrs(shouldApplyState[0], currentStateList, shouldStopState);
36455
37041
  for (let i = 0; i < shouldApplyState.length; i++) {
36456
37042
  const nextState = shouldApplyState[i + 1],
36457
37043
  currentState = shouldApplyState[i];
36458
37044
  currentState.executor.onEnd(() => {
36459
- nextState && nextState.executor.execute(nextState.animationConfig), this.stateList = this.stateList.filter(state => state !== currentState), i === shouldApplyState.length - 1 && callback && callback(!1);
37045
+ var _a;
37046
+ if (nextState) {
37047
+ nextState.executor.execute(nextState.animationConfig);
37048
+ const stoppedStates = [];
37049
+ 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)));
37050
+ }
37051
+ this.stateList = this.stateList.filter(state => state !== currentState), i === shouldApplyState.length - 1 && callback && callback(!1);
36460
37052
  });
36461
37053
  }
36462
37054
  } else callback && callback(!0);
@@ -36699,8 +37291,11 @@
36699
37291
  }), this));
36700
37292
  }
36701
37293
  deleteSelfAttr(key) {
37294
+ this.deleteSelfAttrs([key]);
37295
+ }
37296
+ deleteSelfAttrs(keys) {
36702
37297
  this.tasks.forEach(task => {
36703
- task.animate && task.animate.forEach(animate => animate.preventAttr(key));
37298
+ task.animate && task.animate.forEach(animate => animate.preventAttrs(keys));
36704
37299
  });
36705
37300
  }
36706
37301
  stop(type) {
@@ -37264,6 +37859,25 @@
37264
37859
  }
37265
37860
  }
37266
37861
 
37862
+ function buildAnimationStaticCommitAttrs(target, keys, animate, fallbackAttrs) {
37863
+ var _a;
37864
+ const commitTarget = target,
37865
+ contextFinalAttrs = null === (_a = commitTarget.context) || void 0 === _a ? void 0 : _a.finalAttrs,
37866
+ finalAttribute = "function" == typeof commitTarget.getFinalAttribute ? commitTarget.getFinalAttribute() : commitTarget.finalAttribute;
37867
+ let commitAttrs = null;
37868
+ for (let i = 0; i < keys.length; i++) {
37869
+ const key = keys[i];
37870
+ 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]));
37871
+ }
37872
+ return commitAttrs;
37873
+ }
37874
+ function commitAnimationStaticAttrs(target, keys, animate, fallbackAttrs) {
37875
+ const commitAttrs = buildAnimationStaticCommitAttrs(target, keys, animate, fallbackAttrs);
37876
+ return !!commitAttrs && (target.setAttributes(commitAttrs, !1, {
37877
+ type: AttributeUpdateType.ANIMATE_END
37878
+ }), !0);
37879
+ }
37880
+
37267
37881
  class TagPointsUpdate extends ACustomAnimate {
37268
37882
  constructor(from, to, duration, easing, params) {
37269
37883
  var _a, _b;
@@ -37282,21 +37896,9 @@
37282
37896
  }
37283
37897
  onBind() {
37284
37898
  super.onBind();
37285
- const {
37286
- points: points,
37287
- segments: segments
37288
- } = this.target.attribute,
37289
- {
37290
- points: pointsTo,
37291
- segments: segmentsTo
37292
- } = this.target.getFinalAttribute();
37293
- this.from = {
37294
- points: points,
37295
- segments: segments
37296
- }, this.to = {
37297
- points: pointsTo,
37298
- segments: segmentsTo
37299
- }, this.props = this.to;
37899
+ const currentAttribute = this.target.attribute,
37900
+ finalAttribute = this.target.getFinalAttribute();
37901
+ 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;
37300
37902
  const originFromPoints = this.getPoints(this.from),
37301
37903
  originToPoints = this.getPoints(this.to, !0);
37302
37904
  this.fromPoints = originFromPoints ? Array.isArray(originFromPoints) ? originFromPoints : [originFromPoints] : [], this.toPoints = originToPoints ? Array.isArray(originToPoints) ? originToPoints : [originToPoints] : [];
@@ -37332,31 +37934,42 @@
37332
37934
  const lastClipRange = this.target.attribute.clipRange;
37333
37935
  isValidNumber$1(lastClipRange * this.clipRange) && (this.clipRange *= lastClipRange);
37334
37936
  }
37937
+ onEnd(cb) {
37938
+ cb ? super.onEnd(cb) : (this.to && commitAnimationStaticAttrs(this.target, Object.keys(this.to), this.animate, this.to), super.onEnd());
37939
+ }
37940
+ applyPointTransientAttributes(attributes) {
37941
+ const validAttrs = {};
37942
+ Object.keys(attributes).forEach(key => {
37943
+ this.animate.validAttr(key) && (validAttrs[key] = attributes[key]);
37944
+ }), Object.keys(validAttrs).length && (applyAnimationFrameAttributes(this.target, validAttrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag());
37945
+ }
37335
37946
  onUpdate(end, ratio, out) {
37336
- if (end) return Object.keys(this.to).forEach(k => {
37337
- this.target.attribute[k] = this.to[k];
37338
- }), this.target.addUpdatePositionTag(), void this.target.addUpdateShapeAndBoundsTag();
37339
- if (this.points = this.points.map((point, index) => {
37340
- const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
37341
- return newPoint.context = point.context, newPoint;
37342
- }), this.clipRange) {
37343
- 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));
37344
- applyAnimationTransientAttributes(this.target, {
37345
- clipRange: this.clipRange + (1 - this.clipRange) * ratio
37346
- });
37347
- }
37348
- if (this.segmentsCache && this.to.segments) {
37349
- let start = 0;
37350
- const segments = this.to.segments.map((segment, index) => {
37351
- const end = start + this.segmentsCache[index],
37352
- points = this.points.slice(start, end);
37353
- return start = end, Object.assign(Object.assign({}, segment), {
37354
- points: points
37947
+ if (end) this.applyPointTransientAttributes(this.to);else {
37948
+ if (this.points = this.points.map((point, index) => {
37949
+ const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
37950
+ return newPoint.context = point.context, newPoint;
37951
+ }), this.clipRange) {
37952
+ 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));
37953
+ applyAnimationTransientAttributes(this.target, {
37954
+ clipRange: this.clipRange + (1 - this.clipRange) * ratio
37955
+ });
37956
+ }
37957
+ if (this.segmentsCache && this.to.segments) {
37958
+ let start = 0;
37959
+ const segments = this.to.segments.map((segment, index) => {
37960
+ const end = start + this.segmentsCache[index],
37961
+ points = this.points.slice(start, end);
37962
+ return start = end, Object.assign(Object.assign({}, segment), {
37963
+ points: points
37964
+ });
37355
37965
  });
37966
+ this.applyPointTransientAttributes({
37967
+ segments: segments
37968
+ });
37969
+ } else this.applyPointTransientAttributes({
37970
+ points: this.points
37356
37971
  });
37357
- this.target.attribute.segments = segments;
37358
- } else this.target.attribute.points = this.points;
37359
- this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37972
+ }
37360
37973
  }
37361
37974
  }
37362
37975
 
@@ -37377,10 +37990,10 @@
37377
37990
  }), 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);
37378
37991
  }
37379
37992
  onUpdate(end, ratio, out) {
37380
- const attribute = this.target.attribute;
37993
+ const attrs = {};
37381
37994
  this.propKeys.forEach(key => {
37382
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
37383
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37995
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
37996
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37384
37997
  }
37385
37998
  }
37386
37999
  class CommonOut extends ACustomAnimate {
@@ -37395,16 +38008,16 @@
37395
38008
  this.keys.forEach(key => {
37396
38009
  var _a;
37397
38010
  to[key] = 0, from[key] = null !== (_a = attrs[key]) && void 0 !== _a ? _a : 1;
37398
- }), 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();
38011
+ }), this.props = to, this.propKeys = this.keys, this.from = from, this.to = to, applyAnimationTransientAttributes(this.target, from, AttributeUpdateType.ANIMATE_BIND), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
37399
38012
  }
37400
38013
  onEnd(cb) {
37401
38014
  super.onEnd(cb);
37402
38015
  }
37403
38016
  onUpdate(end, ratio, out) {
37404
- const attribute = this.target.attribute;
38017
+ const attrs = {};
37405
38018
  this.propKeys.forEach(key => {
37406
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
37407
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
38019
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
38020
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37408
38021
  }
37409
38022
  }
37410
38023
 
@@ -37434,8 +38047,7 @@
37434
38047
  onEnd() {}
37435
38048
  onUpdate(end, ratio, out) {
37436
38049
  if (null == this.phi || null == this.theta) return;
37437
- const target = this.target,
37438
- {
38050
+ const {
37439
38051
  center: center,
37440
38052
  r: r,
37441
38053
  cb: cb
@@ -37446,8 +38058,15 @@
37446
38058
  x = r * Math.sin(phi) * Math.cos(theta) + center.x,
37447
38059
  y = r * Math.cos(phi) + center.y,
37448
38060
  z = r * Math.sin(phi) * Math.sin(theta) + center.z;
37449
- for (target.attribute.x = x, target.attribute.y = y, target.attribute.z = z, target.attribute.alpha = theta + pi$1 / 2; target.attribute.alpha > pi2;) target.attribute.alpha -= pi2;
37450
- target.attribute.alpha = pi2 - target.attribute.alpha, target.attribute.zIndex = -1e4 * target.attribute.z, cb && cb(out);
38061
+ let alpha = theta + pi$1 / 2;
38062
+ for (; alpha > pi2;) alpha -= pi2;
38063
+ alpha = pi2 - alpha, applyAnimationFrameAttributes(this.target, {
38064
+ x: x,
38065
+ y: y,
38066
+ z: z,
38067
+ alpha: alpha,
38068
+ zIndex: -1e4 * z
38069
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag(), cb && cb(out);
37451
38070
  }
37452
38071
  }
37453
38072
 
@@ -37589,15 +38208,23 @@
37589
38208
  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;
37590
38209
  }
37591
38210
  deleteSelfAttr(key) {
37592
- delete this.props[key], this.fromProps && delete this.fromProps[key];
37593
- const index = this.propKeys.indexOf(key);
37594
- -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;
38211
+ this.deleteSelfAttrs([key]);
38212
+ }
38213
+ deleteSelfAttrs(keys) {
38214
+ var _a;
38215
+ super.deleteSelfAttrs(keys);
38216
+ const firstKey = null === (_a = this.propKeys) || void 0 === _a ? void 0 : _a[0];
38217
+ this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateAngle : this._updateFunction = "startAngle" === firstKey ? this.updateStartAngle : "endAngle" === firstKey ? this.updateEndAngle : null;
37595
38218
  }
37596
38219
  updateStartAngle(ratio) {
37597
- this.target.attribute.startAngle = this.from.startAngle + (this.to.startAngle - this.from.startAngle) * ratio;
38220
+ applyAnimationFrameAttributes(this.target, {
38221
+ startAngle: this.from.startAngle + (this.to.startAngle - this.from.startAngle) * ratio
38222
+ });
37598
38223
  }
37599
38224
  updateEndAngle(ratio) {
37600
- this.target.attribute.endAngle = this.from.endAngle + (this.to.endAngle - this.from.endAngle) * ratio;
38225
+ applyAnimationFrameAttributes(this.target, {
38226
+ endAngle: this.from.endAngle + (this.to.endAngle - this.from.endAngle) * ratio
38227
+ });
37601
38228
  }
37602
38229
  updateAngle(ratio) {
37603
38230
  this.updateStartAngle(ratio), this.updateEndAngle(ratio);
@@ -37771,10 +38398,10 @@
37771
38398
  super.onEnd(cb);
37772
38399
  }
37773
38400
  onUpdate(end, ratio, out) {
37774
- const attribute = this.target.attribute;
38401
+ const attrs = {};
37775
38402
  this.propKeys.forEach(key => {
37776
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
37777
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
38403
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
38404
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37778
38405
  }
37779
38406
  }
37780
38407
  class GrowCenterOut extends ACustomAnimate {
@@ -37793,10 +38420,10 @@
37793
38420
  super.onEnd(cb);
37794
38421
  }
37795
38422
  onUpdate(end, ratio, out) {
37796
- const attribute = this.target.attribute;
38423
+ const attrs = {};
37797
38424
  this.propKeys.forEach(key => {
37798
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
37799
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
38425
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
38426
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37800
38427
  }
37801
38428
  }
37802
38429
 
@@ -37876,10 +38503,7 @@
37876
38503
  super.onEnd(cb);
37877
38504
  }
37878
38505
  onUpdate(end, ratio, out) {
37879
- const attribute = this.target.attribute;
37880
- this.propKeys.forEach(key => {
37881
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
37882
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
38506
+ applyAnimationFrameNumberAttributes(this.target, this.propKeys, this.from, this.to, ratio), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37883
38507
  }
37884
38508
  }
37885
38509
  function growHeightOutIndividual(graphic, options, animationParameters) {
@@ -37937,10 +38561,7 @@
37937
38561
  super.onEnd(cb);
37938
38562
  }
37939
38563
  onUpdate(end, ratio, out) {
37940
- const attribute = this.target.attribute;
37941
- this.propKeys.forEach(key => {
37942
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
37943
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
38564
+ applyAnimationFrameNumberAttributes(this.target, this.propKeys, this.from, this.to, ratio), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
37944
38565
  }
37945
38566
  }
37946
38567
 
@@ -37973,7 +38594,9 @@
37973
38594
  var _a, _b;
37974
38595
  const fromPoints = null === (_a = this.from) || void 0 === _a ? void 0 : _a.points,
37975
38596
  toPoints = null === (_b = this.to) || void 0 === _b ? void 0 : _b.points;
37976
- fromPoints && toPoints && (this.target.attribute.points = fromPoints.map((point, index) => pointInterpolation(fromPoints[index], toPoints[index], ratio)), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag());
38597
+ fromPoints && toPoints && (applyAnimationFrameAttributes(this.target, {
38598
+ points: fromPoints.map((point, index) => pointInterpolation(fromPoints[index], toPoints[index], ratio))
38599
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag());
37977
38600
  }
37978
38601
  }
37979
38602
  class GrowPointsIn extends GworPointsBase {
@@ -38205,10 +38828,10 @@
38205
38828
  super(from, to, duration, easing, params);
38206
38829
  }
38207
38830
  onUpdate(end, ratio, out) {
38208
- const attribute = this.target.attribute;
38831
+ const attrs = {};
38209
38832
  this.propKeys.forEach(key => {
38210
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
38211
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
38833
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
38834
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
38212
38835
  }
38213
38836
  }
38214
38837
  class GrowRadiusIn extends GrowPointsBase {
@@ -38348,10 +38971,7 @@
38348
38971
  super.onEnd(cb);
38349
38972
  }
38350
38973
  onUpdate(end, ratio, out) {
38351
- const attribute = this.target.attribute;
38352
- this.propKeys.forEach(key => {
38353
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
38354
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
38974
+ applyAnimationFrameNumberAttributes(this.target, this.propKeys, this.from, this.to, ratio), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
38355
38975
  }
38356
38976
  }
38357
38977
  class GrowWidthOut extends ACustomAnimate {
@@ -38371,10 +38991,7 @@
38371
38991
  super.onEnd(cb);
38372
38992
  }
38373
38993
  onUpdate(end, ratio, out) {
38374
- const attribute = this.target.attribute;
38375
- this.propKeys.forEach(key => {
38376
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
38377
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
38994
+ applyAnimationFrameNumberAttributes(this.target, this.propKeys, this.from, this.to, ratio), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
38378
38995
  }
38379
38996
  }
38380
38997
 
@@ -39147,18 +39764,26 @@
39147
39764
  super.onEnd(cb);
39148
39765
  }
39149
39766
  updateX(ratio) {
39150
- this.target.attribute.scaleX = this.from.scaleX + (this.to.scaleX - this.from.scaleX) * ratio;
39767
+ this.applyScaleTransientAttrs(ratio, !0, !1);
39151
39768
  }
39152
39769
  updateY(ratio) {
39153
- this.target.attribute.scaleY = this.from.scaleY + (this.to.scaleY - this.from.scaleY) * ratio;
39770
+ this.applyScaleTransientAttrs(ratio, !1, !0);
39154
39771
  }
39155
39772
  updateXY(ratio) {
39156
- this.updateX(ratio), this.updateY(ratio);
39773
+ this.applyScaleTransientAttrs(ratio, !0, !0);
39774
+ }
39775
+ applyScaleTransientAttrs(ratio, scaleX, scaleY) {
39776
+ const attrs = {};
39777
+ 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);
39157
39778
  }
39158
39779
  deleteSelfAttr(key) {
39159
- delete this.props[key], this.fromProps && delete this.fromProps[key];
39160
- const index = this.propKeys.indexOf(key);
39161
- -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;
39780
+ this.deleteSelfAttrs([key]);
39781
+ }
39782
+ deleteSelfAttrs(keys) {
39783
+ var _a;
39784
+ super.deleteSelfAttrs(keys);
39785
+ const firstKey = null === (_a = this.propKeys) || void 0 === _a ? void 0 : _a[0];
39786
+ this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateXY : this._updateFunction = "scaleX" === firstKey ? this.updateX : "scaleY" === firstKey ? this.updateY : null;
39162
39787
  }
39163
39788
  onUpdate(end, ratio, out) {
39164
39789
  this._updateFunction && (this._updateFunction(ratio), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag());
@@ -39203,10 +39828,10 @@
39203
39828
  super.onEnd(cb);
39204
39829
  }
39205
39830
  onUpdate(end, ratio, out) {
39206
- const attribute = this.target.attribute;
39831
+ const attrs = {};
39207
39832
  this.propKeys.forEach(key => {
39208
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
39209
- }), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
39833
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
39834
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
39210
39835
  }
39211
39836
  }
39212
39837
 
@@ -39217,14 +39842,19 @@
39217
39842
  update(end, ratio, out) {
39218
39843
  if (this.onStart(), !this.props || !this.propKeys) return;
39219
39844
  const easedRatio = this.easing(ratio);
39220
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
39221
- if (!this.animate.validAttr(this.propKeys[index])) return;
39222
- const key = this.propKeys[index];
39223
- func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
39224
- }), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
39845
+ this.runInterpolateUpdate(this.fromProps, this.props, easedRatio), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
39225
39846
  }
39226
39847
  }
39227
39848
 
39849
+ function buildInterpolatedAttrs(keys, from, to, ratio) {
39850
+ const attrs = {};
39851
+ return keys.forEach(key => {
39852
+ attrs[key] = from[key] + (to[key] - from[key]) * ratio;
39853
+ }), attrs;
39854
+ }
39855
+ function applyStoryFrame(target, attrs) {
39856
+ applyAnimationFrameAttributes(target, attrs), target.addUpdatePositionTag(), target.addUpdateShapeAndBoundsTag();
39857
+ }
39228
39858
  class SlideIn extends ACustomAnimate {
39229
39859
  constructor(from, to, duration, easing, params) {
39230
39860
  super(from, to, duration, easing, params);
@@ -39247,10 +39877,7 @@
39247
39877
  "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);
39248
39878
  }
39249
39879
  onUpdate(end, ratio, out) {
39250
- const attribute = this.target.attribute;
39251
- this.propKeys.forEach(key => {
39252
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
39253
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
39880
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
39254
39881
  }
39255
39882
  }
39256
39883
  class GrowIn extends ACustomAnimate {
@@ -39275,10 +39902,7 @@
39275
39902
  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);
39276
39903
  }
39277
39904
  onUpdate(end, ratio, out) {
39278
- const attribute = this.target.attribute;
39279
- this.propKeys.forEach(key => {
39280
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
39281
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
39905
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
39282
39906
  }
39283
39907
  }
39284
39908
  class SpinIn extends ACustomAnimate {
@@ -39309,10 +39933,7 @@
39309
39933
  this.propKeys = ["opacity", "baseOpacity", "angle", "scaleX", "scaleY"], this.from = from, this.to = to, this.props = to, applyAppearStartAttributes(this.target, from);
39310
39934
  }
39311
39935
  onUpdate(end, ratio, out) {
39312
- const attribute = this.target.attribute;
39313
- this.propKeys.forEach(key => {
39314
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
39315
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
39936
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
39316
39937
  }
39317
39938
  }
39318
39939
  class StrokeIn extends ACustomAnimate {
@@ -39357,8 +39978,10 @@
39357
39978
  }
39358
39979
  onUpdate(end, ratio, out) {
39359
39980
  var _a;
39360
- const attribute = this.target.attribute;
39361
- 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);
39981
+ const attrs = {
39982
+ lineDashOffset: this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio
39983
+ };
39984
+ (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);
39362
39985
  }
39363
39986
  onEnd() {
39364
39987
  var _a;
@@ -39409,8 +40032,10 @@
39409
40032
  }
39410
40033
  onUpdate(end, ratio, out) {
39411
40034
  var _a;
39412
- const attribute = this.target.attribute;
39413
- 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);
40035
+ const attrs = {
40036
+ lineDashOffset: this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio
40037
+ };
40038
+ (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);
39414
40039
  }
39415
40040
  }
39416
40041
  class MoveScaleIn extends ACustomAnimate {
@@ -39507,10 +40132,7 @@
39507
40132
  "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;
39508
40133
  }
39509
40134
  onUpdate(end, ratio, out) {
39510
- const attribute = this.target.attribute;
39511
- this.propKeys.forEach(key => {
39512
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
39513
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
40135
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
39514
40136
  }
39515
40137
  }
39516
40138
  class GrowOut extends ACustomAnimate {
@@ -39535,10 +40157,7 @@
39535
40157
  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;
39536
40158
  }
39537
40159
  onUpdate(end, ratio, out) {
39538
- const attribute = this.target.attribute;
39539
- this.propKeys.forEach(key => {
39540
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
39541
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
40160
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
39542
40161
  }
39543
40162
  }
39544
40163
  class SpinOut extends ACustomAnimate {
@@ -39569,10 +40188,7 @@
39569
40188
  this.propKeys = ["opacity", "baseOpacity", "angle", "scaleX", "scaleY"], this.from = from, this.to = to, this.props = to;
39570
40189
  }
39571
40190
  onUpdate(end, ratio, out) {
39572
- const attribute = this.target.attribute;
39573
- this.propKeys.forEach(key => {
39574
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
39575
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
40191
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
39576
40192
  }
39577
40193
  }
39578
40194
  class MoveScaleOut extends ACustomAnimate {
@@ -39657,56 +40273,127 @@
39657
40273
  onUpdate(end, ratio, out) {
39658
40274
  const angle = ratio * Math.PI * this.pulseCount,
39659
40275
  pulseValue = Math.abs(Math.sin(angle)),
39660
- attribute = this.target.attribute;
40276
+ attrs = {};
39661
40277
  if (this.useOpacity) {
39662
40278
  const opacity = 1 + (this.pulseOpacity - 1) * pulseValue;
39663
- this.useStroke && (attribute.strokeOpacity = (this.originalAttributes.strokeOpacity || 1) * opacity), this.useFill && (attribute.fillOpacity = (this.originalAttributes.fillOpacity || 1) * opacity);
40279
+ this.useStroke && (attrs.strokeOpacity = (this.originalAttributes.strokeOpacity || 1) * opacity), this.useFill && (attrs.fillOpacity = (this.originalAttributes.fillOpacity || 1) * opacity);
39664
40280
  }
39665
40281
  if (this.useScale) {
39666
40282
  const scale = 1 + (this.pulseScale - 1) * pulseValue;
39667
- attribute.scaleX = (this.originalAttributes.scaleX || 1) * scale, attribute.scaleY = (this.originalAttributes.scaleY || 1) * scale;
40283
+ attrs.scaleX = (this.originalAttributes.scaleX || 1) * scale, attrs.scaleY = (this.originalAttributes.scaleY || 1) * scale;
39668
40284
  }
39669
- this.useColor && this.pulseColor && this.applyColorPulse(attribute, pulseValue), this.target.addUpdateShapeAndBoundsTag(), this.target.addUpdatePositionTag();
40285
+ this.useColor && this.pulseColor && this.applyColorPulse(attrs, pulseValue), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdateShapeAndBoundsTag(), this.target.addUpdatePositionTag();
39670
40286
  }
39671
- applyColorPulse(attribute, pulseValue) {
40287
+ applyColorPulse(attrs, pulseValue) {
39672
40288
  const colorRatio = this.pulseColorIntensity * pulseValue;
39673
- 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));
40289
+ 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));
39674
40290
  }
39675
40291
  onEnd() {
39676
40292
  super.onEnd(), this.target.setAttributes(this.originalAttributes);
39677
40293
  }
39678
40294
  }
39679
40295
 
40296
+ const clipPathGeometryAttrs = {
40297
+ x: !0,
40298
+ y: !0,
40299
+ x1: !0,
40300
+ y1: !0,
40301
+ width: !0,
40302
+ height: !0
40303
+ };
40304
+ function includesChannel(channels, key) {
40305
+ for (let i = 0; i < channels.length; i++) if (channels[i] === key) return !0;
40306
+ return !1;
40307
+ }
40308
+ function filterExcludedChannels(diffAttrs, excludeChannels) {
40309
+ if (!(null == excludeChannels ? void 0 : excludeChannels.length)) return diffAttrs;
40310
+ const nextAttrs = {};
40311
+ for (const key in diffAttrs) Object.prototype.hasOwnProperty.call(diffAttrs, key) && !includesChannel(excludeChannels, key) && (nextAttrs[key] = diffAttrs[key]);
40312
+ return nextAttrs;
40313
+ }
39680
40314
  class Update extends ACustomAnimate {
39681
40315
  constructor(from, to, duration, easing, params) {
39682
- super(from, to, duration, easing, params);
40316
+ super(from, to, duration, easing, params), this.updateFromAttrs = null, this.clipPathSyncKeys = null, this.clipPathSyncParent = null, this.clipPathSyncChildIndex = -1, this.clipPathSyncDisabled = !1;
39683
40317
  }
39684
40318
  onBind() {
39685
- var _a, _b;
40319
+ var _a;
39686
40320
  super.onBind();
40321
+ const targetContext = null !== (_a = this.target.context) && void 0 !== _a ? _a : {};
39687
40322
  let {
39688
40323
  diffAttrs = {}
39689
- } = null !== (_a = this.target.context) && void 0 !== _a ? _a : {};
40324
+ } = targetContext;
39690
40325
  const {
39691
40326
  options: options
39692
40327
  } = this.params;
39693
- diffAttrs = Object.assign({}, diffAttrs), (null === (_b = null == options ? void 0 : options.excludeChannels) || void 0 === _b ? void 0 : _b.length) && options.excludeChannels.forEach(channel => {
39694
- delete diffAttrs[channel];
39695
- }), this.props = diffAttrs;
40328
+ diffAttrs = filterExcludedChannels(diffAttrs, null == options ? void 0 : options.excludeChannels), this.props = diffAttrs;
40329
+ const consumeTransientFromAttrs = this.target.consumeTransientFromAttrsBeforePreventAnimate;
40330
+ 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();
40331
+ }
40332
+ trySyncStartProps() {
40333
+ const updateFromAttrs = this.updateFromAttrs;
40334
+ this.propKeys.forEach(key => {
40335
+ this.fromProps[key] = updateFromAttrs && Object.prototype.hasOwnProperty.call(updateFromAttrs, key) ? updateFromAttrs[key] : this.animate.target.getComputedAttribute(key);
40336
+ });
39696
40337
  }
39697
40338
  onEnd(cb) {
39698
- cb ? super.onEnd(cb) : (this.props && Object.keys(this.props).length && this.target.setAttributes(this.props, !1, {
39699
- type: AttributeUpdateType.ANIMATE_END
39700
- }), super.onEnd());
40339
+ var _a;
40340
+ 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());
39701
40341
  }
39702
40342
  update(end, ratio, out) {
39703
40343
  if (this.onStart(), !this.props || !this.propKeys) return;
39704
40344
  const easedRatio = this.easing(ratio);
39705
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
39706
- if (!this.animate.validAttr(this.propKeys[index])) return;
39707
- const key = this.propKeys[index];
39708
- func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
39709
- }), this.onUpdate(end, easedRatio, out);
40345
+ this.runInterpolateUpdate(this.fromProps, this.props, easedRatio), this.syncParentClipPathToTarget(), this.onUpdate(end, easedRatio, out);
40346
+ }
40347
+ syncParentClipPathToTarget() {
40348
+ var _a, _b, _c, _d;
40349
+ if (this.clipPathSyncDisabled) return;
40350
+ const target = this.target,
40351
+ parent = target.parent,
40352
+ path = null === (_a = null == parent ? void 0 : parent.attribute) || void 0 === _a ? void 0 : _a.path;
40353
+ if (!(null === (_b = null == parent ? void 0 : parent.attribute) || void 0 === _b ? void 0 : _b.clip) || !Array.isArray(path) || !path.length) return;
40354
+ const childIndex = this.getClipPathSyncChildIndex(parent);
40355
+ if (childIndex < 0 || childIndex >= path.length) return;
40356
+ const clipGraphic = path[childIndex];
40357
+ if (!(null == clipGraphic ? void 0 : clipGraphic.attribute) || clipGraphic.type !== target.type || !this.isClipPathStaticTarget(clipGraphic)) return;
40358
+ const syncAttrs = this.buildClipPathTransientAttrs(clipGraphic);
40359
+ syncAttrs && (applyAnimationFrameAttributes(clipGraphic, syncAttrs), null === (_c = clipGraphic.addUpdatePositionTag) || void 0 === _c || _c.call(clipGraphic), null === (_d = clipGraphic.addUpdateShapeAndBoundsTag) || void 0 === _d || _d.call(clipGraphic));
40360
+ }
40361
+ getClipPathSyncChildIndex(parent) {
40362
+ var _a;
40363
+ if (this.clipPathSyncParent === parent && this.clipPathSyncChildIndex >= 0) return this.clipPathSyncChildIndex;
40364
+ const target = this.target;
40365
+ let childIndex = -1;
40366
+ 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;
40367
+ }
40368
+ isClipPathStaticTarget(clipGraphic) {
40369
+ var _a, _b;
40370
+ const target = this.target,
40371
+ targetFinalAttrs = this.getTargetFinalAttrs(),
40372
+ clipGraphicFinalAttrs = "function" == typeof clipGraphic.getFinalAttribute ? clipGraphic.getFinalAttribute() : clipGraphic.finalAttribute,
40373
+ clipFinalAttrs = null !== (_a = null != clipGraphicFinalAttrs ? clipGraphicFinalAttrs : clipGraphic.baseAttributes) && void 0 !== _a ? _a : clipGraphic.attribute,
40374
+ keys = null !== (_b = this.clipPathSyncKeys) && void 0 !== _b ? _b : [];
40375
+ return !!(keys.length && targetFinalAttrs && clipFinalAttrs) && keys.every(key => {
40376
+ var _a, _b;
40377
+ return this.isSameClipPathValue(clipFinalAttrs[key], null !== (_a = targetFinalAttrs[key]) && void 0 !== _a ? _a : null === (_b = target.attribute) || void 0 === _b ? void 0 : _b[key]);
40378
+ });
40379
+ }
40380
+ getTargetFinalAttrs() {
40381
+ var _a, _b, _c;
40382
+ const target = this.target;
40383
+ 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;
40384
+ }
40385
+ isSameClipPathValue(a, b) {
40386
+ return "number" == typeof a && "number" == typeof b ? Math.abs(a - b) < 1e-8 : a === b;
40387
+ }
40388
+ buildClipPathTransientAttrs(clipGraphic) {
40389
+ var _a;
40390
+ const target = this.target,
40391
+ attrs = {};
40392
+ return (null !== (_a = this.clipPathSyncKeys) && void 0 !== _a ? _a : []).forEach(key => {
40393
+ var _a;
40394
+ const nextValue = null === (_a = target.attribute) || void 0 === _a ? void 0 : _a[key];
40395
+ Object.prototype.hasOwnProperty.call(clipGraphic.attribute, key) && void 0 !== nextValue && !this.isSameClipPathValue(clipGraphic.attribute[key], nextValue) && (attrs[key] = nextValue);
40396
+ }), Object.keys(attrs).length ? attrs : null;
39710
40397
  }
39711
40398
  }
39712
40399
 
@@ -39813,10 +40500,10 @@
39813
40500
  super(from, to, duration, easing, params);
39814
40501
  }
39815
40502
  onUpdate(end, ratio, out) {
39816
- const attribute = this.target.attribute;
40503
+ const attrs = {};
39817
40504
  this.propKeys.forEach(key => {
39818
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
39819
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
40505
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
40506
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
39820
40507
  }
39821
40508
  }
39822
40509
  class MoveIn extends MoveBase {
@@ -39872,10 +40559,10 @@
39872
40559
  super(from, to, duration, easing, params);
39873
40560
  }
39874
40561
  onUpdate(end, ratio, out) {
39875
- const attribute = this.target.attribute;
40562
+ const attrs = {};
39876
40563
  this.propKeys.forEach(key => {
39877
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
39878
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
40564
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
40565
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
39879
40566
  }
39880
40567
  }
39881
40568
  class RotateIn extends RotateBase {
@@ -39918,7 +40605,7 @@
39918
40605
  pos: pos,
39919
40606
  angle: angle
39920
40607
  } = this.path.getAttrAt(at);
39921
- 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) : applyAnimationTransientAttributes(this.target, attrs);
40608
+ 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());
39922
40609
  }
39923
40610
  }
39924
40611
 
@@ -41437,7 +42124,10 @@
41437
42124
  }), this.completeBind(animator);
41438
42125
  }
41439
42126
  deleteSelfAttr(key) {
41440
- super.deleteSelfAttr(key), this._animator.deleteSelfAttr(key);
42127
+ this.deleteSelfAttrs([key]);
42128
+ }
42129
+ deleteSelfAttrs(keys) {
42130
+ super.deleteSelfAttrs(keys), this._animator.deleteSelfAttrs(keys);
41441
42131
  }
41442
42132
  tryPreventConflict() {}
41443
42133
  }
@@ -41983,8 +42673,8 @@
41983
42673
  const orient = this.attribute.orient;
41984
42674
  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;
41985
42675
  }
41986
- release() {
41987
- super.release(), this._breaks = null;
42676
+ release(all) {
42677
+ super.release(all), this._breaks = null;
41988
42678
  }
41989
42679
  }
41990
42680
  LineAxis.defaultAttributes = DEFAULT_AXIS_THEME, mixin(LineAxis, LineAxisMixin);
@@ -44357,6 +45047,14 @@
44357
45047
  }
44358
45048
  return t;
44359
45049
  };
45050
+ function cloneAttributeSnapshot(value) {
45051
+ if (!isObject$2(value) || isArray$1(value)) return value;
45052
+ const snapshot = {};
45053
+ return Object.keys(value).forEach(key => {
45054
+ const nextValue = value[key];
45055
+ snapshot[key] = isObject$2(nextValue) && !isArray$1(nextValue) ? cloneAttributeSnapshot(nextValue) : nextValue;
45056
+ }), snapshot;
45057
+ }
44360
45058
  loadLabelComponent();
44361
45059
  class LabelBase extends AnimateComponent {
44362
45060
  setBitmap(bitmap) {
@@ -44421,11 +45119,56 @@
44421
45119
  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;
44422
45120
  }
44423
45121
  }
45122
+ _finalizeExitRelease() {
45123
+ var _a, _b, _c, _d;
45124
+ const state = this._exitReleaseState;
45125
+ if (null == state ? void 0 : state.finalized) return;
45126
+ state && (state.finalized = !0);
45127
+ const parent = this.parent,
45128
+ removeFromParent = !!(null == state ? void 0 : state.removeFromParent),
45129
+ callbacks = null !== (_a = null == state ? void 0 : state.onComplete) && void 0 !== _a ? _a : [];
45130
+ 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);
45131
+ }
45132
+ _runExitAnimationBeforeRelease(options = {}) {
45133
+ var _a, _b;
45134
+ if (this._exitReleaseState && !this._exitReleaseState.finalized) return this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent, appendExitReleaseCallback(this._exitReleaseState, options.onComplete), !0;
45135
+ if (!this.stage || !1 === this.attribute.animation || !1 === this.attribute.animationExit || !(null === (_a = this._graphicToText) || void 0 === _a ? void 0 : _a.size)) return !1;
45136
+ if (this._prepareAnimate(DefaultLabelAnimation), !(null === (_b = this._animationConfig) || void 0 === _b ? void 0 : _b.exit)) return !1;
45137
+ const exitTargets = new Set();
45138
+ if (this._graphicToText.forEach(label => {
45139
+ (null == label ? void 0 : label.text) && exitTargets.add(label.text), (null == label ? void 0 : label.labelLine) && exitTargets.add(label.labelLine);
45140
+ }), !exitTargets.size) return !1;
45141
+ const existingAnimates = collectTrackedAnimates(this);
45142
+ exitTargets.forEach(target => {
45143
+ var _a;
45144
+ target.applyAnimationState(["exit"], [{
45145
+ name: "exit",
45146
+ animation: Object.assign(Object.assign({}, this._animationConfig.exit), {
45147
+ type: null !== (_a = this._animationConfig.exit.type) && void 0 !== _a ? _a : "fadeOut",
45148
+ selfOnly: !0
45149
+ })
45150
+ }]);
45151
+ });
45152
+ const exitAnimates = collectTrackedAnimates(this).filter(animate => !existingAnimates.includes(animate));
45153
+ if (!exitAnimates.length) return !1;
45154
+ this.setAttribute("childrenPickable", !1), this.releaseStatus = "willRelease";
45155
+ const pendingAnimates = new Set(exitAnimates);
45156
+ return this._exitReleaseState = {
45157
+ pendingAnimates: pendingAnimates,
45158
+ finalized: !1,
45159
+ removeFromParent: !!options.removeFromParent,
45160
+ onComplete: options.onComplete ? [options.onComplete] : []
45161
+ }, bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease()), !0;
45162
+ }
45163
+ releaseWithExitAnimation(options = {}) {
45164
+ return "released" !== this.releaseStatus && this._runExitAnimationBeforeRelease(options);
45165
+ }
44424
45166
  render() {
45167
+ if (this._exitReleaseState) return;
44425
45168
  if (this._prepare(), isNil$1(this._idToGraphic) || this._isCollectionBase && isNil$1(this._idToPoint)) return;
44426
45169
  const markAttributeList = [];
44427
45170
  !1 !== this._enableAnimation && this._baseMarks.forEach(mark => {
44428
- markAttributeList.push(mark.attribute), mark.initAttributes(mark.getAttributes(!0));
45171
+ markAttributeList.push(cloneAttributeSnapshot(mark.attribute)), mark.initAttributes(mark.getAttributes(!0));
44429
45172
  });
44430
45173
  const {
44431
45174
  overlap: overlap,
@@ -44991,6 +45734,10 @@
44991
45734
  _canPlaceInside(textBound, shapeBound) {
44992
45735
  return !(!textBound || !shapeBound) && shapeBound.encloses(textBound);
44993
45736
  }
45737
+ release(all) {
45738
+ var _a, _b;
45739
+ 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);
45740
+ }
44994
45741
  setLocation(point) {
44995
45742
  this.translateTo(point.x, point.y);
44996
45743
  }
@@ -45760,6 +46507,7 @@
45760
46507
  }
45761
46508
  render() {
45762
46509
  var _a;
46510
+ if (this._exitReleaseState) return;
45763
46511
  const {
45764
46512
  dataLabels: dataLabels,
45765
46513
  size: size
@@ -45794,6 +46542,47 @@
45794
46542
  currentComponentMap.get(key) || this.removeChild(cp);
45795
46543
  }), this._componentMap = currentComponentMap;
45796
46544
  }
46545
+ _finalizeExitRelease() {
46546
+ var _a, _b, _c;
46547
+ const state = this._exitReleaseState;
46548
+ if (null == state ? void 0 : state.finalized) return;
46549
+ state && (state.finalized = !0);
46550
+ const parent = this.parent,
46551
+ removeFromParent = !!(null == state ? void 0 : state.removeFromParent),
46552
+ callbacks = null !== (_a = null == state ? void 0 : state.onComplete) && void 0 !== _a ? _a : [];
46553
+ 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);
46554
+ }
46555
+ releaseWithExitAnimation(options = {}) {
46556
+ var _a;
46557
+ if ("released" === this.releaseStatus) return !1;
46558
+ if (this._exitReleaseState && !this._exitReleaseState.finalized) return this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent, appendExitReleaseCallback(this._exitReleaseState, options.onComplete), !0;
46559
+ if (!this.stage || !(null === (_a = this._componentMap) || void 0 === _a ? void 0 : _a.size)) return !1;
46560
+ const state = {
46561
+ pendingCount: 0,
46562
+ finalized: !1,
46563
+ removeFromParent: !!options.removeFromParent,
46564
+ onComplete: options.onComplete ? [options.onComplete] : []
46565
+ },
46566
+ exitingComponents = [],
46567
+ fallbackComponents = [];
46568
+ let initializing = !0;
46569
+ const finish = () => {
46570
+ state.finalized || (state.pendingCount -= 1, state.pendingCount <= 0 && !initializing && this._finalizeExitRelease());
46571
+ };
46572
+ return this._exitReleaseState = state, this._componentMap.forEach(component => {
46573
+ state.pendingCount += 1;
46574
+ component.releaseWithExitAnimation({
46575
+ removeFromParent: !1,
46576
+ onComplete: finish
46577
+ }) ? exitingComponents.push(component) : (state.pendingCount -= 1, fallbackComponents.push(component));
46578
+ }), exitingComponents.length ? (fallbackComponents.forEach(component => {
46579
+ component.release(!0), this.removeChild(component);
46580
+ }), this.setAttribute("childrenPickable", !1), this.releaseStatus = "willRelease", initializing = !1, state.pendingCount <= 0 && this._finalizeExitRelease(), !0) : (this._exitReleaseState = void 0, !1);
46581
+ }
46582
+ release(all) {
46583
+ var _a;
46584
+ this._exitReleaseState ? this._finalizeExitRelease() : (all && this.removeAllChild(!0), super.release(all), null === (_a = this._componentMap) || void 0 === _a || _a.clear());
46585
+ }
45797
46586
  setLocation(point) {
45798
46587
  this.translateTo(point.x, point.y);
45799
46588
  }
@@ -47427,14 +48216,51 @@
47427
48216
  y: clipInRange ? -(null !== (_b = limitRect.y) && void 0 !== _b ? _b : 0) : 0
47428
48217
  });
47429
48218
  }
48219
+ _finalizeExitRelease() {
48220
+ var _a, _b;
48221
+ const state = this._exitReleaseState;
48222
+ if (null == state ? void 0 : state.finalized) return;
48223
+ state && (state.finalized = !0);
48224
+ const parent = this.parent,
48225
+ removeFromParent = !!(null == state ? void 0 : state.removeFromParent),
48226
+ releaseSelf = !!(null == state ? void 0 : state.releaseSelf),
48227
+ callbacks = null !== (_a = null == state ? void 0 : state.onComplete) && void 0 !== _a ? _a : [];
48228
+ 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);
48229
+ }
48230
+ _runExitAnimationBeforeCleanup(options = {}) {
48231
+ var _a;
48232
+ const releaseSelf = !!options.releaseSelf;
48233
+ 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;
48234
+ if (!this.stage || !1 === this.attribute.animation || !1 === this.attribute.animationExit || !this._container) return !1;
48235
+ if (this.transAnimationConfig(), !(null === (_a = this._animationConfig) || void 0 === _a ? void 0 : _a.exit)) return !1;
48236
+ const existingAnimates = collectTrackedAnimates(this);
48237
+ this.markerAnimate("exit");
48238
+ const exitAnimates = collectTrackedAnimates(this).filter(animate => !existingAnimates.includes(animate));
48239
+ if (!exitAnimates.length) return !1;
48240
+ this._releaseEvent(), this.setAttribute("childrenPickable", !1), releaseSelf && (this.releaseStatus = "willRelease");
48241
+ const pendingAnimates = new Set(exitAnimates);
48242
+ return this._exitReleaseState = {
48243
+ pendingAnimates: pendingAnimates,
48244
+ finalized: !1,
48245
+ releaseSelf: releaseSelf,
48246
+ removeFromParent: !!options.removeFromParent,
48247
+ onComplete: options.onComplete ? [options.onComplete] : []
48248
+ }, bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease()), !0;
48249
+ }
48250
+ releaseWithExitAnimation(options = {}) {
48251
+ return "released" !== this.releaseStatus && this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({}, options), {
48252
+ releaseSelf: !0
48253
+ }));
48254
+ }
47430
48255
  render() {
47431
- var _a;
48256
+ var _a, _b;
48257
+ if (null === (_a = this._exitReleaseState) || void 0 === _a ? void 0 : _a.releaseSelf) return;
47432
48258
  this.transAnimationConfig(), this.setAttribute("pickable", !1);
47433
- const markerVisible = null === (_a = this.attribute.visible) || void 0 === _a || _a;
47434
- !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();
48259
+ const markerVisible = null === (_b = this.attribute.visible) || void 0 === _b || _b;
48260
+ !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();
47435
48261
  }
47436
- release() {
47437
- this.markerAnimate("exit"), super.release(), this._releaseEvent(), this._container = null;
48262
+ release(all) {
48263
+ 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);
47438
48264
  }
47439
48265
  }
47440
48266
 
@@ -49697,7 +50523,10 @@
49697
50523
  const innerGroupHeight = innerGroupBounds.height(),
49698
50524
  itemGroupWidth = isValid$1(this.attribute.item.width) ? this.attribute.item.width : innerGroupWidth + parsedPadding[1] + parsedPadding[3],
49699
50525
  itemGroupHeight = this._itemHeightByUser || innerGroupHeight + parsedPadding[0] + parsedPadding[2];
49700
- 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;
50526
+ return itemGroup.setAttributes({
50527
+ width: itemGroupWidth,
50528
+ height: itemGroupHeight
50529
+ }), focusShape && focusShape.setAttribute("visible", !1), innerGroup.translateTo(-innerGroupBounds.x1 + parsedPadding[3], -innerGroupBounds.y1 + parsedPadding[0]), itemGroup;
49701
50530
  }
49702
50531
  _createPager(compStyle) {
49703
50532
  var _a, _b;
@@ -51334,7 +52163,11 @@
51334
52163
  subTextBoundsWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;
51335
52164
  let totalWidth = Math.max(mainTextBoundsWidth, subTextBoundsWidth),
51336
52165
  totalHeight = mainTextBoundsHeight + (null !== (_q = subtextStyle.height) && void 0 !== _q ? _q : subTextBoundsHeight);
51337
- 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) {
52166
+ 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({
52167
+ width: totalWidth,
52168
+ height: totalHeight,
52169
+ boundsPadding: parsedPadding
52170
+ }), this._mainTitle) {
51338
52171
  if (isValid$1(align) || isValid$1(textStyle.align)) {
51339
52172
  const mainTitleAlign = textStyle.align ? textStyle.align : align,
51340
52173
  mainTitleWidth = null !== (_r = textStyle.width) && void 0 !== _r ? _r : totalWidth;
@@ -55221,12 +56054,12 @@
55221
56054
  rootGroup = this._rootGroup,
55222
56055
  shouldReleaseStage = !!stage && !this._isExternalStage,
55223
56056
  releaseVRenderAppRef = this._releaseVRenderAppRef;
55224
- this.clearNextRender(), this.releaseEvent(), this.releaseGrammar(!0), stage && (shouldReleaseStage ? stage.release() : rootGroup && (stage.defaultLayer.removeChild(rootGroup), rootGroup.release())), null == releaseVRenderAppRef || releaseVRenderAppRef(), this._stage = null, this._rootGroup = null, this._isExternalStage = !1, this._releaseVRenderAppRef = void 0, this._option = this._container = null, this.isInited = !1, this._compileChart = null, this._released = !0;
56057
+ this.clearNextRender(), this.releaseEvent(), this.releaseGrammar(!0), stage && (shouldReleaseStage ? stage.release() : rootGroup && (stage.defaultLayer.removeChild(rootGroup, !0), rootGroup.release())), null == releaseVRenderAppRef || releaseVRenderAppRef(), this._stage = null, this._rootGroup = null, this._isExternalStage = !1, this._releaseVRenderAppRef = void 0, this._option = this._container = null, this.isInited = !1, this._compileChart = null, this._released = !0;
55225
56058
  }
55226
56059
  releaseGrammar(removeGraphicItems = !1) {
55227
56060
  removeGraphicItems ? this._rootMarks.forEach(g => {
55228
56061
  traverseGroupMark(g, m => {
55229
- m.removeProduct();
56062
+ m.removeProduct(!0);
55230
56063
  }, null, !0);
55231
56064
  }) : this._cachedMarks = findSimpleMarks(this._rootMarks), this._rootMarks = [];
55232
56065
  }
@@ -55375,6 +56208,26 @@
55375
56208
  height: height
55376
56209
  };
55377
56210
  }
56211
+ const UPDATE_SPEC_EFFECT_KEYS = ["remake", "compile", "render", "layout", "data", "scaleDomain", "series", "component", "animation", "localOnly"];
56212
+ function mergeUpdateSpecEffects(target, ...sources) {
56213
+ sources.forEach(source => {
56214
+ const sourceEffects = null == source ? void 0 : source.effects;
56215
+ if (!sourceEffects) return;
56216
+ target.effects || (target.effects = {});
56217
+ const targetEffects = target.effects;
56218
+ UPDATE_SPEC_EFFECT_KEYS.forEach(key => {
56219
+ sourceEffects[key] && (targetEffects[key] = targetEffects[key] || sourceEffects[key]);
56220
+ });
56221
+ });
56222
+ }
56223
+ function isUpdateSpecResultLocalOnly(result) {
56224
+ const effects = result.effects;
56225
+ return !(!(null == effects ? void 0 : effects.localOnly) || result.reMake || result.reCompile || result.reRender || result.reSize || effects.remake || effects.compile || effects.render || effects.layout || effects.data || effects.scaleDomain || effects.series || result.reTransformSpec || result.reAnimate || result.changeTheme || result.changeBackground);
56226
+ }
56227
+ function isUpdateSpecResultComponentOnly(result) {
56228
+ const effects = result.effects;
56229
+ return !(!(null == effects ? void 0 : effects.component) || result.reMake || result.reCompile || result.reSize || effects.remake || effects.compile || effects.data || effects.scaleDomain || effects.series || effects.animation || result.reTransformSpec || result.reAnimate || result.changeTheme || result.changeBackground);
56230
+ }
55378
56231
  function mergeUpdateResult(target, ...sources) {
55379
56232
  const merge = key => sources.reduce((value, cur) => value || (null == cur ? void 0 : cur[key]), target[key]);
55380
56233
  return Object.assign(target, {
@@ -55386,7 +56239,7 @@
55386
56239
  reTransformSpec: merge("reTransformSpec"),
55387
56240
  changeTheme: merge("changeTheme"),
55388
56241
  changeBackground: merge("changeBackground")
55389
- }), target;
56242
+ }), mergeUpdateSpecEffects(target, ...sources), target;
55390
56243
  }
55391
56244
  function getTrimPaddingConfig(chartType, spec) {
55392
56245
  return "line" === chartType || "area" === chartType || "common" === chartType && spec.series.every(item => "area" === item.type || "line" === item.type) ? {
@@ -57001,7 +57854,7 @@
57001
57854
  constructor(option, dataView) {
57002
57855
  super(option), this._data = null, this._data = dataView;
57003
57856
  }
57004
- removeProduct() {
57857
+ removeProduct(_releaseDetach) {
57005
57858
  this._product = null, this._prevProduct = null, this._compiledProductId = null;
57006
57859
  }
57007
57860
  release() {
@@ -57128,20 +57981,33 @@
57128
57981
  }), 0 === morphCount && onMorphEnd(), !0;
57129
57982
  };
57130
57983
 
57131
- const normalizeStates = states => Array.isArray(states) ? states : states ? [states] : [];
57984
+ const normalizeStates = states => Array.isArray(states) ? states : states ? [states] : [],
57985
+ isSameStates = (currentStates, nextStates) => {
57986
+ const current = null != currentStates ? currentStates : [];
57987
+ return current.length === nextStates.length && current.every((stateName, index) => stateName === nextStates[index]);
57988
+ };
57989
+ const setGraphicStates = (graphic, nextStates, hasAnimation) => {
57990
+ var _a;
57991
+ if (graphic.setStates) return void graphic.setStates(nextStates, {
57992
+ animate: hasAnimation,
57993
+ animateSameStatePatchChange: !0
57994
+ });
57995
+ const normalizedNextStates = null != nextStates ? nextStates : [];
57996
+ isSameStates(graphic.currentStates, normalizedNextStates) ? null === (_a = graphic.invalidateResolver) || void 0 === _a || _a.call(graphic) : normalizedNextStates.length ? graphic.useStates(normalizedNextStates, hasAnimation) : graphic.clearStates(hasAnimation);
57997
+ };
57132
57998
  const addGraphicState = (graphic, state, keepCurrentStates = !0, hasAnimation) => {
57133
57999
  var _a;
57134
58000
  if (!state) return;
57135
58001
  const currentStates = keepCurrentStates && null !== (_a = graphic.currentStates) && void 0 !== _a ? _a : [],
57136
58002
  nextStates = keepCurrentStates ? Array.from(new Set([...currentStates, state])) : [state];
57137
- graphic.useStates(nextStates, hasAnimation);
58003
+ setGraphicStates(graphic, nextStates, hasAnimation);
57138
58004
  };
57139
58005
  const removeGraphicState = (graphic, state, hasAnimation) => {
57140
58006
  var _a;
57141
58007
  const states = normalizeStates(state);
57142
58008
  if (!states.length) return;
57143
58009
  const nextStates = (null !== (_a = graphic.currentStates) && void 0 !== _a ? _a : []).filter(stateName => !states.includes(stateName));
57144
- graphic.useStates(nextStates, hasAnimation);
58010
+ setGraphicStates(graphic, nextStates, hasAnimation);
57145
58011
  };
57146
58012
 
57147
58013
  var __rest$h = undefined && undefined.__rest || function (s, e) {
@@ -57153,6 +58019,7 @@
57153
58019
  }
57154
58020
  return t;
57155
58021
  };
58022
+ const statesClearedBeforeReInitKey = Symbol("statesClearedBeforeReInit");
57156
58023
  class BaseMark extends GrammarItem {
57157
58024
  commit(render, recursion) {
57158
58025
  recursion && this.getMarks().length > 0 && this.getMarks().forEach(m => m.commit(!1, recursion)), this._isCommited = !0, render && this.getCompiler().renderNextTick();
@@ -57305,8 +58172,8 @@
57305
58172
  stopAnimationByState(state) {}
57306
58173
  pauseAnimationByState(state) {}
57307
58174
  resumeAnimationByState(state) {}
57308
- removeProduct() {
57309
- this._product && this._product.parent && this._product.parent.removeChild(this._product), this._product = null, this._compiledProductId = null;
58175
+ removeProduct(releaseDetach) {
58176
+ this._product && this._product.parent && this._product.parent.removeChild(this._product, releaseDetach), this._product = null, this._compiledProductId = null;
57310
58177
  }
57311
58178
  release() {
57312
58179
  this.state.release(), super.release(), this._lastMark = null;
@@ -57322,7 +58189,7 @@
57322
58189
  super(option), this.type = void 0, this.name = "mark", this._markConfig = {
57323
58190
  zIndex: LayoutZIndex.Mark,
57324
58191
  morph: !1
57325
- }, this._visible = !0, this.stateStyle = {}, this._unCompileChannel = {}, this._disabledAnimationStates = [], this._skipBeforeLayouted = !1, this._extensionChannel = {}, this._computeExChannel = {}, this._graphicMap = new Map(), this._graphics = [], this._getEncoderOfStyle = (stateName, style) => {
58192
+ }, this._visible = !0, this.stateStyle = {}, this._unCompileChannel = {}, this._disabledAnimationStates = [], this._skipBeforeLayouted = !1, this._sharedStateDefinitionRefIds = new WeakMap(), this._sharedStateDefinitionRefId = 0, this._dynamicSharedStateNames = new Set(), this._extensionChannel = {}, this._computeExChannel = {}, this._graphicMap = new Map(), this._graphics = [], this._getEncoderOfStyle = (stateName, style) => {
57326
58193
  if (style && stateName) {
57327
58194
  const validEncoder = {};
57328
58195
  return Object.keys(style).forEach(key => {
@@ -57337,7 +58204,11 @@
57337
58204
  } = this._markConfig;
57338
58205
  setCustomizedShape && (g.pathProxy = attrs => setCustomizedShape(g.context.data, attrs, new CustomPath2D())), graphicName && (isFunction$1(graphicName) ? g.name = graphicName(g) : g.name = graphicName);
57339
58206
  }, this._setStateOfGraphic = (g, hasAnimation) => {
57340
- g.clearStates(), g.stateProxy = null, g.context.diffState !== DiffState.enter && g.context.diffState !== DiffState.update || g.context.states && g.useStates(g.context.states, hasAnimation);
58207
+ var _a, _b, _c;
58208
+ g.stateProxy = null;
58209
+ const targetStates = g.context.diffState === DiffState.enter || g.context.diffState === DiffState.update ? g.context.states : void 0,
58210
+ hasCurrentState = !!((null === (_a = g.currentStates) || void 0 === _a ? void 0 : _a.length) || (null === (_b = g.effectiveStates) || void 0 === _b ? void 0 : _b.length) || g.resolvedStatePatch || (null === (_c = g.registeredActiveScopes) || void 0 === _c ? void 0 : _c.size));
58211
+ ((null == targetStates ? void 0 : targetStates.length) || hasCurrentState) && setGraphicStates(g, targetStates, hasAnimation);
57341
58212
  }, this.name = name, this.model = option.model, this.key = option.key, this.state = new MarkStateManager(option, this), this._attributeContext = option.attributeContext, null === (_a = option.map) || void 0 === _a || _a.set(this.id, this);
57342
58213
  }
57343
58214
  created() {
@@ -57684,6 +58555,7 @@
57684
58555
  if (graphics.forEach(g => {
57685
58556
  const state = g.context.animationState;
57686
58557
  if ("appear" === state) return;
58558
+ if ("update" === state && !this._hasDiffAttrs(g)) return;
57687
58559
  const config = animationConfig[state];
57688
58560
  if (config && config.length > 0) {
57689
58561
  const configList = config.map((item, index) => ({
@@ -57783,28 +58655,63 @@
57783
58655
  groupStyles: groupStyles
57784
58656
  };
57785
58657
  }
58658
+ _getSharedStateDefinitionRefId(value) {
58659
+ if ("object" != typeof value && "function" != typeof value || null === value) return `${value}`;
58660
+ const objectValue = value;
58661
+ let id = this._sharedStateDefinitionRefIds.get(objectValue);
58662
+ return id || (id = ++this._sharedStateDefinitionRefId, this._sharedStateDefinitionRefIds.set(objectValue, id)), `ref:${id}`;
58663
+ }
58664
+ _getSharedStateDefinitionValueKey(value) {
58665
+ try {
58666
+ const jsonValue = JSON.stringify(value);
58667
+ return null != jsonValue ? jsonValue : `${value}`;
58668
+ } catch (_error) {
58669
+ return this._getSharedStateDefinitionRefId(value);
58670
+ }
58671
+ }
58672
+ _isStaticSharedStateAttribute(stateName, key) {
58673
+ var _a, _b;
58674
+ const stateStyle = null === (_a = this.stateStyle[stateName]) || void 0 === _a ? void 0 : _a[key];
58675
+ if (!stateStyle || stateStyle.referer || isFunction$1(stateStyle.postProcess) || key in this._computeExChannel) return !1;
58676
+ const style = stateStyle.style;
58677
+ return !isFunction$1(style) && !GradientType.includes(null == style ? void 0 : style.gradient) && !["outerBorder", "innerBorder"].includes(key) && !isValidScaleType(null === (_b = null == style ? void 0 : style.scale) || void 0 === _b ? void 0 : _b.type);
58678
+ }
57786
58679
  _applySharedStateDefinitions() {
57787
58680
  var _a;
57788
58681
  if (!this._product) return;
57789
58682
  const stateNames = Object.keys(null !== (_a = this._encoderOfState) && void 0 !== _a ? _a : {}).filter(stateName => "group" !== stateName && "update" !== stateName);
57790
- if (!stateNames.length) return void (this._product.sharedStateDefinitions = void 0);
58683
+ if (!stateNames.length) return this._dynamicSharedStateNames.clear(), void (void 0 !== this._product.sharedStateDefinitions && (this._product.sharedStateDefinitions = void 0));
57791
58684
  const sortedStateNames = this._stateSort ? stateNames.slice().sort(this._stateSort) : stateNames,
57792
58685
  statePriority = new Map();
57793
58686
  sortedStateNames.forEach((stateName, index) => {
57794
58687
  statePriority.set(stateName, index);
57795
58688
  });
57796
- const sharedStateDefinitions = {};
57797
- stateNames.forEach(stateName => {
58689
+ const sharedStateDefinitions = {},
58690
+ cacheKeys = [],
58691
+ dynamicSharedStateNames = new Set();
58692
+ if (stateNames.forEach(stateName => {
57798
58693
  var _a;
57799
- const encoder = this._encoderOfState[stateName];
57800
- sharedStateDefinitions[stateName] = {
57801
- priority: null !== (_a = statePriority.get(stateName)) && void 0 !== _a ? _a : 0,
57802
- declaredAffectedKeys: Object.keys(null != encoder ? encoder : {}),
57803
- resolver: ({
57804
- graphic: graphic
57805
- }) => this._runEncoderOfGraphic(encoder, graphic)
58694
+ const encoder = this._encoderOfState[stateName],
58695
+ patch = {},
58696
+ dynamicEncoder = {},
58697
+ patchKeys = [],
58698
+ dynamicKeys = [];
58699
+ if (Object.keys(null != encoder ? encoder : {}).forEach(key => {
58700
+ this._isStaticSharedStateAttribute(stateName, key) ? (patch[key] = this._computeAttribute(key, stateName)(void 0), patchKeys.push(key)) : (dynamicEncoder[key] = encoder[key], dynamicKeys.push(key));
58701
+ }), !patchKeys.length && !dynamicKeys.length) return;
58702
+ const definition = {
58703
+ priority: null !== (_a = statePriority.get(stateName)) && void 0 !== _a ? _a : 0
57806
58704
  };
57807
- }), this._product.sharedStateDefinitions = sharedStateDefinitions;
58705
+ patchKeys.length && (definition.patch = patch), dynamicKeys.length && (dynamicSharedStateNames.add(stateName), definition.declaredAffectedKeys = dynamicKeys, definition.resolver = ({
58706
+ graphic: graphic
58707
+ }) => this._runEncoderOfGraphic(dynamicEncoder, graphic)), sharedStateDefinitions[stateName] = definition, cacheKeys.push([stateName, definition.priority, patchKeys.sort().map(key => `${key}:${this._getSharedStateDefinitionValueKey(patch[key])}`), dynamicKeys.sort().map(key => {
58708
+ var _a;
58709
+ const stateStyle = null === (_a = this.stateStyle[stateName]) || void 0 === _a ? void 0 : _a[key];
58710
+ return `${key}:${this._getSharedStateDefinitionRefId(null == stateStyle ? void 0 : stateStyle.style)}:${this._getSharedStateDefinitionRefId(null == stateStyle ? void 0 : stateStyle.postProcess)}:${this._getSharedStateDefinitionRefId(null == stateStyle ? void 0 : stateStyle.referer)}`;
58711
+ })].join("|"));
58712
+ }), !cacheKeys.length) return this._dynamicSharedStateNames.clear(), void (void 0 !== this._product.sharedStateDefinitions && (this._product.sharedStateDefinitions = void 0));
58713
+ const cacheKey = cacheKeys.sort().join("||");
58714
+ this._dynamicSharedStateNames = dynamicSharedStateNames, cacheKey === this._sharedStateDefinitionsCacheKey && this._sharedStateDefinitionsCache ? this._product.sharedStateDefinitions !== this._sharedStateDefinitionsCache && (this._product.sharedStateDefinitions = this._sharedStateDefinitionsCache) : (this._sharedStateDefinitionsCacheKey = cacheKey, this._sharedStateDefinitionsCache = sharedStateDefinitions, this._product.sharedStateDefinitions = sharedStateDefinitions);
57808
58715
  }
57809
58716
  _addProgressiveGraphic(parent, g) {
57810
58717
  parent.incrementalAppendChild(g);
@@ -57820,6 +58727,22 @@
57820
58727
  g.context.finalAttrs = finalAttrs;
57821
58728
  });
57822
58729
  }
58730
+ _excludeStateControlledDiffAttrs(g, diffAttrs) {
58731
+ var _a;
58732
+ if (!diffAttrs || !Object.keys(diffAttrs).length) return diffAttrs;
58733
+ let nextDiffAttrs;
58734
+ const excludeKey = key => {
58735
+ key in diffAttrs && (nextDiffAttrs || (nextDiffAttrs = Object.assign({}, diffAttrs)), delete nextDiffAttrs[key]);
58736
+ };
58737
+ return g.resolvedStatePatch && Object.keys(g.resolvedStatePatch).forEach(excludeKey), null === (_a = g.context.states) || void 0 === _a || _a.forEach(stateName => {
58738
+ var _a;
58739
+ const encoder = null === (_a = this._encoderOfState) || void 0 === _a ? void 0 : _a[stateName];
58740
+ encoder && Object.keys(encoder).forEach(excludeKey);
58741
+ }), null != nextDiffAttrs ? nextDiffAttrs : diffAttrs;
58742
+ }
58743
+ _hasDiffAttrs(g) {
58744
+ return !!g.context.diffAttrs && Object.keys(g.context.diffAttrs).length > 0;
58745
+ }
57823
58746
  _runApplyGraphic(graphics) {
57824
58747
  const hasAnimation = this.hasAnimation();
57825
58748
  graphics.forEach((g, index) => {
@@ -57827,8 +58750,8 @@
57827
58750
  const finalAttrs = g.context.finalAttrs,
57828
58751
  hasStateAnimation = this.hasAnimationByState(g.context.animationState);
57829
58752
  if (g.setAttributes) {
57830
- const diffAttrs = getDiffAttributesOfGraphic(g, finalAttrs);
57831
- g.context.diffAttrs = diffAttrs, g.context.reusing ? (g.context.lastAttrs = g.attribute, g.initAttributes({}), g.context.reusing = !1) : hasStateAnimation || (hasAnimation ? g.setAttributesAndPreventAnimate(diffAttrs) : g.setAttributes(diffAttrs)), !(null === (_c = this.renderContext) || void 0 === _c ? void 0 : _c.progressive) && this._product && g.parent !== this._product && this._product.appendChild(g), hasAnimation && g.setFinalAttributes(finalAttrs);
58753
+ const diffAttrs = this._excludeStateControlledDiffAttrs(g, getDiffAttributesOfGraphic(g, finalAttrs));
58754
+ g.context.diffAttrs = diffAttrs, g.context.reusing ? (g.context.lastAttrs = g.attribute, g.initAttributes(finalAttrs), g.context.reusing = !1) : hasStateAnimation || (hasAnimation ? g.setAttributesAndPreventAnimate(diffAttrs) : g.setAttributes(diffAttrs)), !(null === (_c = this.renderContext) || void 0 === _c ? void 0 : _c.progressive) && this._product && g.parent !== this._product && this._product.appendChild(g), hasAnimation && g.setFinalAttributes(finalAttrs);
57832
58755
  } else {
57833
58756
  const mockGraphic = g;
57834
58757
  g = this._createGraphic(finalAttrs), hasAnimation && (null === (_a = g.setFinalAttributes) || void 0 === _a || _a.call(g, finalAttrs)), g.context = mockGraphic.context, g.context.diffAttrs = finalAttrs, g.stateSort = this._stateSort;
@@ -57924,7 +58847,14 @@
57924
58847
  if (!this._product) return;
57925
58848
  const stateInfo = this.state.getStateInfo(key);
57926
58849
  this._graphics.forEach(g => {
57927
- "in" === this.state.checkOneState(g, g.context.data, stateInfo) ? addGraphicState(g, key, !0, this.hasAnimationByState("state")) : removeGraphicState(g, key, this.hasAnimationByState("state"));
58850
+ const reinitStateGraphic = g,
58851
+ statesClearedBeforeReInit = reinitStateGraphic[statesClearedBeforeReInitKey],
58852
+ wasStateClearedBeforeReInit = null == statesClearedBeforeReInit ? void 0 : statesClearedBeforeReInit.includes(key),
58853
+ hasStateAnimation = !wasStateClearedBeforeReInit && this.hasAnimationByState("state");
58854
+ if ("in" === this.state.checkOneState(g, g.context.data, stateInfo) ? addGraphicState(g, key, !0, hasStateAnimation) : removeGraphicState(g, key, hasStateAnimation), wasStateClearedBeforeReInit) {
58855
+ const nextStates = statesClearedBeforeReInit.filter(stateName => stateName !== key);
58856
+ nextStates.length ? reinitStateGraphic[statesClearedBeforeReInitKey] = nextStates : delete reinitStateGraphic[statesClearedBeforeReInitKey];
58857
+ }
57928
58858
  });
57929
58859
  }
57930
58860
  clearExitGraphics() {
@@ -57944,7 +58874,7 @@
57944
58874
  })
57945
58875
  }));
57946
58876
  g.applyAnimationState(["exit"], [1 === exitConfigList.length ? exitConfigList[0] : exitConfigList], () => {
57947
- doRemove(g, key);
58877
+ g.context.diffState === DiffState.exit && g.isExiting && this._graphicMap.get(key) === g && doRemove(g, key);
57948
58878
  });
57949
58879
  }
57950
58880
  } else doRemove(g, key);
@@ -58061,7 +58991,8 @@
58061
58991
  }
58062
58992
  clearBeforeReInit() {
58063
58993
  this.state.clearAllStateInfo(), this.uncommit(), this.stateStyle = {}, this.getGraphics().forEach(g => {
58064
- g.clearStates();
58994
+ var _a;
58995
+ (null === (_a = g.currentStates) || void 0 === _a ? void 0 : _a.length) && (g[statesClearedBeforeReInitKey] = g.currentStates.slice());
58065
58996
  });
58066
58997
  }
58067
58998
  }
@@ -58136,7 +59067,7 @@
58136
59067
  });
58137
59068
  }
58138
59069
  release() {
58139
- super.release(), this.removeProduct();
59070
+ super.release(), this.removeProduct(!0);
58140
59071
  }
58141
59072
  }
58142
59073
  GroupMark.type = "group";
@@ -58714,6 +59645,31 @@
58714
59645
  }
58715
59646
  }
58716
59647
 
59648
+ const releaseVRenderComponentSync = (component, removeFromParent = !0) => {
59649
+ var _a, _b, _c, _d, _e;
59650
+ const parent = component.parent;
59651
+ null === (_a = component.release) || void 0 === _a || _a.call(component, !0), null === (_c = (_b = component).removeAllChild) || void 0 === _c || _c.call(_b, !0), removeFromParent && (null === (_e = null !== (_d = component.parent) && void 0 !== _d ? _d : parent) || void 0 === _e || _e.removeChild(component, !0));
59652
+ };
59653
+ const collectVRenderComponents = component => {
59654
+ var _a, _b;
59655
+ const components = [component];
59656
+ return null === (_b = (_a = component).forEachChildren) || void 0 === _b || _b.call(_a, child => {
59657
+ components.push(...collectVRenderComponents(child));
59658
+ }), components;
59659
+ };
59660
+ const releaseVRenderComponent = (component, options = {}) => {
59661
+ var _a, _b;
59662
+ const {
59663
+ enableExitAnimation = !0,
59664
+ removeFromParent = !0,
59665
+ onComplete: onComplete
59666
+ } = options;
59667
+ return !(!enableExitAnimation || !(null === (_b = (_a = component).releaseWithExitAnimation) || void 0 === _b ? void 0 : _b.call(_a, {
59668
+ removeFromParent: removeFromParent,
59669
+ onComplete: onComplete
59670
+ }))) || (releaseVRenderComponentSync(component, removeFromParent), !1);
59671
+ };
59672
+
58717
59673
  var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
58718
59674
  return new (P || (P = Promise))(function (resolve, reject) {
58719
59675
  function fulfilled(value) {
@@ -58985,14 +59941,14 @@
58985
59941
  for (const key in Factory.dataParser) registerDataSetInstanceParser(this._dataSet, key, Factory.dataParser[key]);
58986
59942
  }
58987
59943
  updateCustomConfigAndRerender(updateSpecResult, sync, option = {}) {
58988
- if (!this._isReleased && updateSpecResult) return isFunction$1(updateSpecResult) && (updateSpecResult = updateSpecResult()), updateSpecResult.reAnimate && (this.stopAnimation(), this._updateAnimateState(!0)), this._reCompile(updateSpecResult), sync ? this._renderSync(option) : this._renderAsync(option);
59944
+ if (!this._isReleased && updateSpecResult) return isFunction$1(updateSpecResult) && (updateSpecResult = updateSpecResult()), updateSpecResult.reAnimate && (this.stopAnimation(), this._updateAnimateState(!0)), this._reCompile(updateSpecResult), isUpdateSpecResultLocalOnly(updateSpecResult) ? this : sync ? this._renderSync(option) : this._renderAsync(option);
58989
59945
  }
58990
59946
  _updateCustomConfigAndRecompile(updateSpecResult, option = {}) {
58991
59947
  return !!updateSpecResult && (this._reCompile(updateSpecResult), this._beforeRender(option));
58992
59948
  }
58993
59949
  _reCompile(updateResult, morphConfig) {
58994
59950
  var _a, _b, _c, _d, _e, _f, _g;
58995
- if (updateResult.reMake && (this._releaseData(), this._initDataSet(), null === (_a = this._chart) || void 0 === _a || _a.release(), this._chart = null), updateResult.reTransformSpec && (this._chartSpecTransformer = null), updateResult.changeTheme ? (this._setCurrentTheme(), this._setFontFamilyTheme(this.getTheme("fontFamily"))) : updateResult.changeBackground && (null === (_b = this._compiler) || void 0 === _b || _b.setBackground(this._getBackground())), updateResult.reMake ? (null === (_c = this._compiler) || void 0 === _c || _c.releaseGrammar(!0), this._userEvents.forEach(e => {
59951
+ if (updateResult.reMake && (this._releaseData(), this._initDataSet(), null === (_a = this._chart) || void 0 === _a || _a.release(!1), this._chart = null), updateResult.reTransformSpec && (this._chartSpecTransformer = null), updateResult.changeTheme ? (this._setCurrentTheme(), this._setFontFamilyTheme(this.getTheme("fontFamily"))) : updateResult.changeBackground && (null === (_b = this._compiler) || void 0 === _b || _b.setBackground(this._getBackground())), updateResult.reMake ? (null === (_c = this._compiler) || void 0 === _c || _c.releaseGrammar(!0), this._userEvents.forEach(e => {
58996
59952
  var _a;
58997
59953
  return null === (_a = this._event) || void 0 === _a ? void 0 : _a.on(e.eType, e.query, e.handler);
58998
59954
  })) : updateResult.reCompile && (null === (_d = this._compiler) || void 0 === _d || _d.clear({
@@ -59069,7 +60025,21 @@
59069
60025
  }
59070
60026
  release() {
59071
60027
  var _a, _b, _c, _d;
59072
- (null === (_a = this._onResize) || void 0 === _a ? void 0 : _a.cancel) && this._onResize.cancel(), this._chartPluginApply("releaseAll"), this._chartPlugin = null, this._chartSpecTransformer = null, null === (_b = this._chart) || void 0 === _b || _b.release(), null === (_c = this._eventDispatcher) || void 0 === _c || _c.release(), null === (_d = this._compiler) || void 0 === _d || _d.release(), this._unBindResizeEvent(), this._releaseData(), this._onError = null, this._onResize = null, this._container = null, this._currentTheme = null, this._cachedProcessedTheme = null, this._option = null, this._chart = null, this._compiler = null, this._spec = null, this._specInfo = null, this._originalSpec = null, this._userEvents = null, this._event = null, this._eventDispatcher = null, this._isReleased = !0, InstanceManager.unregisterInstance(this);
60028
+ (null === (_a = this._onResize) || void 0 === _a ? void 0 : _a.cancel) && this._onResize.cancel(), this._chartPluginApply("releaseAll"), this._chartPlugin = null, this._chartSpecTransformer = null, this._forceReleaseExitingVRenderComponents(), null === (_b = this._chart) || void 0 === _b || _b.release(), null === (_c = this._eventDispatcher) || void 0 === _c || _c.release(), null === (_d = this._compiler) || void 0 === _d || _d.release(), this._unBindResizeEvent(), this._releaseData(), this._onError = null, this._onResize = null, this._container = null, this._currentTheme = null, this._cachedProcessedTheme = null, this._option = null, this._chart = null, this._compiler = null, this._spec = null, this._specInfo = null, this._originalSpec = null, this._userEvents = null, this._event = null, this._eventDispatcher = null, this._isReleased = !0, InstanceManager.unregisterInstance(this);
60029
+ }
60030
+ _registerExitingVRenderComponent(component) {
60031
+ var _a;
60032
+ this._exitingVRenderComponents = null !== (_a = this._exitingVRenderComponents) && void 0 !== _a ? _a : new Set(), this._exitingVRenderComponents.add(component);
60033
+ }
60034
+ _unregisterExitingVRenderComponent(component) {
60035
+ var _a;
60036
+ null === (_a = this._exitingVRenderComponents) || void 0 === _a || _a.delete(component);
60037
+ }
60038
+ _forceReleaseExitingVRenderComponents() {
60039
+ var _a;
60040
+ (null === (_a = this._exitingVRenderComponents) || void 0 === _a ? void 0 : _a.size) && (this._exitingVRenderComponents.forEach(component => {
60041
+ releaseVRenderComponentSync(component);
60042
+ }), this._exitingVRenderComponents.clear());
59073
60043
  }
59074
60044
  updateData(id, data, parserOptions, userUpdateOptions) {
59075
60045
  return __awaiter(this, void 0, void 0, function* () {
@@ -59166,8 +60136,10 @@
59166
60136
  }
59167
60137
  _updateModelSpec(model, spec, sync = !1, forceMerge = !1, morphConfig) {
59168
60138
  forceMerge && (spec = mergeSpec({}, model.getSpec(), spec));
59169
- const result = model.updateSpec(spec);
59170
- return model.reInit(spec), (result.change || result.reCompile || result.reMake || result.reSize || result.reRender) && this._chart.reDataFlow(), this.updateCustomConfigAndRerender(result, sync, {
60139
+ const result = model.updateSpec(spec),
60140
+ localOnly = isUpdateSpecResultLocalOnly(result),
60141
+ componentOnly = isUpdateSpecResultComponentOnly(result);
60142
+ return localOnly || (model.reInit(spec), !componentOnly && (result.change || result.reCompile || result.reMake || result.reSize || result.reRender) && this._chart.reDataFlow()), this.updateCustomConfigAndRerender(result, sync, {
59171
60143
  morphConfig: morphConfig,
59172
60144
  transformSpec: !1,
59173
60145
  actionSource: "updateModelSpec"
@@ -60039,6 +61011,8 @@
60039
61011
  data: !0
60040
61012
  };
60041
61013
  const defaultSeriesCompileCheckKeys = {
61014
+ xField: !0,
61015
+ yField: !0,
60042
61016
  invalidType: !0,
60043
61017
  animation: !0,
60044
61018
  animationAppear: !0,
@@ -60047,6 +61021,13 @@
60047
61021
  animationExit: !0,
60048
61022
  animationNormal: !0
60049
61023
  };
61024
+ const defaultSeriesCompileOnlyCheckKeys = {
61025
+ animationAppear: !0,
61026
+ animationEnter: !0,
61027
+ animationUpdate: !0,
61028
+ animationExit: !0,
61029
+ animationNormal: !0
61030
+ };
60050
61031
 
60051
61032
  const AnimationStates = [...Object.keys(DEFAULT_ANIMATION_CONFIG), "normal"];
60052
61033
  function animationConfig(defaultConfig = {}, userConfig, params) {
@@ -60277,6 +61258,30 @@
60277
61258
  } : null;
60278
61259
  }
60279
61260
 
61261
+ const defaultSeriesDataRelatedCheckKeys = Object.keys(defaultSeriesCompileCheckKeys).reduce((keys, key) => (defaultSeriesCompileOnlyCheckKeys[key] || (keys[key] = !0), keys), {}),
61262
+ defaultSeriesSpecUpdatePolicy = {
61263
+ compileOnlyKeys: defaultSeriesCompileOnlyCheckKeys,
61264
+ dataRelatedKeys: defaultSeriesDataRelatedCheckKeys
61265
+ },
61266
+ isSpecObject = value => isObject$2(value) && !isArray$1(value) && !isFunction$1(value),
61267
+ hasOnlyAllowedSubKeyChanges = (specValue, prevSpecValue, allowedSubKeys) => {
61268
+ if (!isSpecObject(specValue) || !isSpecObject(prevSpecValue)) return !1;
61269
+ let changed = !1;
61270
+ const subKeys = Array.from(new Set([...Object.keys(prevSpecValue), ...Object.keys(specValue)]));
61271
+ for (const subKey of subKeys) if (!isEqual(specValue[subKey], prevSpecValue[subKey])) {
61272
+ if (!allowedSubKeys[subKey]) return !1;
61273
+ changed = !0;
61274
+ }
61275
+ return changed;
61276
+ };
61277
+ function markSeriesCompileEffect(compareResult, dataRelated = !1) {
61278
+ compareResult.effects = Object.assign(Object.assign({}, compareResult.effects), {
61279
+ series: !0,
61280
+ compile: !0,
61281
+ layout: !0,
61282
+ render: !0
61283
+ }), dataRelated && (compareResult.effects.data = !0, compareResult.effects.scaleDomain = !0);
61284
+ }
60280
61285
  class BaseSeries extends BaseModel {
60281
61286
  getRegion() {
60282
61287
  return this._region;
@@ -60771,22 +61776,37 @@
60771
61776
  newMarks.length !== prevMarks.length || prevMarks.some((prev, index) => prev.type !== newMarks[index].type || prev.id !== newMarks[index].id || prev.name !== newMarks[index].name) ? compareResult.reMake = !0 : prevMarks.some((prev, index) => prev.visible !== newMarks[index].visible) && (compareResult.reCompile = !0);
60772
61777
  }
60773
61778
  _compareLabelSpec(newLabels, prevLabels, compareResult) {
60774
- newLabels.length !== prevLabels.length || prevLabels.some((prev, index) => prev.labelLayout !== newLabels[index].labelLayout || prev.visible !== newLabels[index].visible) ? compareResult.reMake = !0 : !compareResult.reCompile && prevLabels.some((prev, index) => !isEqual(prev, newLabels[index])) && (compareResult.reCompile = !0);
61779
+ newLabels.length !== prevLabels.length || prevLabels.some((prev, index) => prev.labelLayout !== newLabels[index].labelLayout || prev.visible !== newLabels[index].visible) ? compareResult.reMake = !0 : !compareResult.reCompile && prevLabels.some((prev, index) => !isEqual(prev, newLabels[index])) && (compareResult.reCompile = !0, markSeriesCompileEffect(compareResult));
61780
+ }
61781
+ _getSpecUpdatePolicy() {
61782
+ return defaultSeriesSpecUpdatePolicy;
60775
61783
  }
60776
61784
  _compareSpec(spec, prevSpec, ignoreCheckKeys) {
61785
+ var _a, _b, _c, _d;
60777
61786
  const result = super._compareSpec(spec, prevSpec),
60778
61787
  currentKeys = Object.keys(prevSpec || {}).sort(),
60779
61788
  nextKeys = Object.keys(spec || {}).sort();
60780
61789
  if (!isEqual(currentKeys, nextKeys)) return result.reMake = !0, result;
60781
- const ignores = Object.assign(Object.assign(Object.assign(Object.assign({}, defaultSeriesIgnoreCheckKeys), defaultSeriesCompileCheckKeys), ignoreCheckKeys), {
60782
- extensionMark: !0,
60783
- label: !0,
60784
- totalLabel: !0
60785
- });
60786
- return this._compareExtensionMarksSpec(array(spec.extensionMark), array(prevSpec.extensionMark), result), !result.reMake && this._compareLabelSpec(array(spec.label), array(prevSpec.label), result), !result.reMake && this._compareLabelSpec(array(spec.totalLabel), array(prevSpec.totalLabel), result), result.reMake ? result : (!result.reCompile && this._marks.getMarks().some(m => {
61790
+ const specUpdatePolicy = this._getSpecUpdatePolicy(),
61791
+ compileOnlyKeys = null !== (_a = specUpdatePolicy.compileOnlyKeys) && void 0 !== _a ? _a : {},
61792
+ dataRelatedKeys = null !== (_b = specUpdatePolicy.dataRelatedKeys) && void 0 !== _b ? _b : {},
61793
+ compileOnlySubKeys = null !== (_c = specUpdatePolicy.compileOnlySubKeys) && void 0 !== _c ? _c : {},
61794
+ compileCheckKeys = Object.assign(Object.assign({}, compileOnlyKeys), dataRelatedKeys),
61795
+ ignores = Object.assign(Object.assign(Object.assign(Object.assign({}, defaultSeriesIgnoreCheckKeys), compileCheckKeys), ignoreCheckKeys), {
61796
+ extensionMark: !0,
61797
+ label: !0,
61798
+ totalLabel: !0
61799
+ });
61800
+ if (this._compareExtensionMarksSpec(array(spec.extensionMark), array(prevSpec.extensionMark), result), !result.reMake && this._compareLabelSpec(array(spec.label), array(prevSpec.label), result), !result.reMake && this._compareLabelSpec(array(spec.totalLabel), array(prevSpec.totalLabel), result), result.reMake) return result;
61801
+ !result.reCompile && this._marks.getMarks().some(m => {
60787
61802
  var _a, _b;
60788
61803
  return ignores[m.name] = !0, (null === (_a = prevSpec[m.name]) || void 0 === _a ? void 0 : _a.visible) !== (null === (_b = spec[m.name]) || void 0 === _b ? void 0 : _b.visible);
60789
- }) && (result.reCompile = !0), !result.reCompile && currentKeys.some(k => defaultSeriesCompileCheckKeys[k] && !isEqual(spec[k], prevSpec[k])) && (result.reCompile = !0), currentKeys.some(k => !ignores[k] && !isEqual(spec[k], prevSpec[k])) ? (result.reMake = !0, result) : result);
61804
+ }) && (result.reCompile = !0);
61805
+ const changedCompileKeys = currentKeys.filter(k => compileCheckKeys[k] && !isEqual(spec[k], prevSpec[k])),
61806
+ changedCompileOnlySubKeys = currentKeys.filter(k => compileOnlySubKeys[k] && hasOnlyAllowedSubKeyChanges(spec[k], prevSpec[k], compileOnlySubKeys[k]));
61807
+ return changedCompileOnlySubKeys.forEach(k => {
61808
+ ignores[k] = !0;
61809
+ }), result.reCompile || !changedCompileKeys.length && !changedCompileOnlySubKeys.length || (result.reCompile = !0), changedCompileKeys.some(k => dataRelatedKeys[k]) ? markSeriesCompileEffect(result, !0) : result.reCompile && !(null === (_d = result.effects) || void 0 === _d ? void 0 : _d.series) && (changedCompileKeys.length || changedCompileOnlySubKeys.length) && markSeriesCompileEffect(result), currentKeys.some(k => !ignores[k] && !isEqual(spec[k], prevSpec[k])) ? (result.reMake = !0, result) : result;
60790
61810
  }
60791
61811
  _updateSpecData() {
60792
61812
  !this._rawData || !this._spec.data || this._spec.data instanceof DataView || updateDataViewInData(this._rawData, this._spec.data, !0);
@@ -60926,10 +61946,17 @@
60926
61946
  _getSeriesDataKey(datum) {
60927
61947
  let key = "";
60928
61948
  if (!datum) return key;
60929
- const dimensionFields = this.getDimensionField();
60930
- key = dimensionFields.map(field => datum[field]).join("_");
60931
- const seriesField = this.getSeriesField();
60932
- return seriesField && !dimensionFields.includes(seriesField) && (key += `_${datum[seriesField]}`), key;
61949
+ const seriesField = this.getSeriesField(),
61950
+ dimensionFields = this.getDimensionField(),
61951
+ seriesFieldValue = seriesField ? datum[seriesField] : void 0;
61952
+ let lastDimensionValue,
61953
+ hasSeriesFieldInDimension = !1;
61954
+ for (let i = 0; i < dimensionFields.length; i++) {
61955
+ const field = dimensionFields[i],
61956
+ dimensionValue = datum[field];
61957
+ key += `${i > 0 ? "_" : ""}${isNil$1(dimensionValue) ? "" : dimensionValue}`, hasSeriesFieldInDimension || (hasSeriesFieldInDimension = field === seriesField), lastDimensionValue = dimensionValue;
61958
+ }
61959
+ return !seriesField || hasSeriesFieldInDimension || dimensionFields.length > 1 && lastDimensionValue === seriesFieldValue || (key += `_${seriesFieldValue}`), key;
60933
61960
  }
60934
61961
  addViewDataFilter(option) {
60935
61962
  var _a, _b;
@@ -61573,6 +62600,10 @@
61573
62600
  }
61574
62601
  };
61575
62602
 
62603
+ const LINE_LIKE_SERIES_DATA_RELATED_KEYS = {
62604
+ sampling: !0,
62605
+ samplingFactor: !0
62606
+ };
61576
62607
  class LineLikeSeriesMixin {
61577
62608
  addSamplingCompile() {
61578
62609
  if (this._spec.sampling) {
@@ -62503,7 +63534,7 @@
62503
63534
  };
62504
63535
  class BaseComponent extends LayoutModel {
62505
63536
  constructor() {
62506
- super(...arguments), this.name = "component", this.modelType = "component", this.transformerConstructor = BaseComponentSpecTransformer, this._delegateEvent = (component, event, type, item = null, datum = null) => {
63537
+ super(...arguments), this.name = "component", this.modelType = "component", this.transformerConstructor = BaseComponentSpecTransformer, this._forceReleaseVRenderComponents = !1, this._delegateEvent = (component, event, type, item = null, datum = null) => {
62507
63538
  var _a, _b;
62508
63539
  event instanceof CustomEvent || this.event.emit(type, {
62509
63540
  model: this,
@@ -62550,16 +63581,49 @@
62550
63581
  const result = super._compareSpec(spec, prevSpec);
62551
63582
  return result.reMake || (result.reMake = ["seriesId", "seriesIndex", "regionId", "regionIndex"].some(k => !isEqual(null == prevSpec ? void 0 : prevSpec[k], spec[k]))), (null == prevSpec ? void 0 : prevSpec.visible) !== spec.visible && (result.reCompile = !0), result;
62552
63583
  }
63584
+ beforeRelease() {
63585
+ super.beforeRelease(), this._forceReleaseVRenderComponents = !0, this._forceReleaseExitingVRenderComponents();
63586
+ }
62553
63587
  release() {
62554
63588
  var _a;
62555
- super.release(), this.clear(), null === (_a = this.pluginService) || void 0 === _a || _a.releaseAll(), this.pluginService = null;
63589
+ this._shouldReleaseVRenderComponentsImmediately() && this._forceReleaseExitingVRenderComponents(), this.clear(), super.release(), null === (_a = this.pluginService) || void 0 === _a || _a.releaseAll(), this.pluginService = null;
63590
+ }
63591
+ _shouldReleaseVRenderComponentsImmediately() {
63592
+ return this._forceReleaseVRenderComponents;
63593
+ }
63594
+ _forceReleaseExitingVRenderComponents() {
63595
+ var _a;
63596
+ (null === (_a = this._exitingVRenderComponents) || void 0 === _a ? void 0 : _a.size) && (this._exitingVRenderComponents.forEach(component => {
63597
+ var _a, _b, _c;
63598
+ releaseVRenderComponentSync(component), null === (_c = null === (_b = null === (_a = this._option) || void 0 === _a ? void 0 : _a.globalInstance) || void 0 === _b ? void 0 : _b._unregisterExitingVRenderComponent) || void 0 === _c || _c.call(_b, component);
63599
+ }), this._exitingVRenderComponents.clear());
63600
+ }
63601
+ _releaseVRenderComponent(component) {
63602
+ var _a;
63603
+ if (!this._shouldReleaseVRenderComponentsImmediately()) {
63604
+ const exitingComponents = collectVRenderComponents(component),
63605
+ releasedWithExit = releaseVRenderComponent(component, {
63606
+ enableExitAnimation: !0,
63607
+ removeFromParent: !0,
63608
+ onComplete: () => {
63609
+ exitingComponents.forEach(exitingComponent => {
63610
+ var _a, _b, _c, _d;
63611
+ null === (_a = this._exitingVRenderComponents) || void 0 === _a || _a.delete(exitingComponent), null === (_d = null === (_c = null === (_b = this._option) || void 0 === _b ? void 0 : _b.globalInstance) || void 0 === _c ? void 0 : _c._unregisterExitingVRenderComponent) || void 0 === _d || _d.call(_c, exitingComponent);
63612
+ });
63613
+ }
63614
+ });
63615
+ return releasedWithExit ? (this._exitingVRenderComponents = null !== (_a = this._exitingVRenderComponents) && void 0 !== _a ? _a : new Set(), void exitingComponents.forEach(exitingComponent => {
63616
+ var _a, _b, _c;
63617
+ this._exitingVRenderComponents.add(exitingComponent), null === (_c = null === (_b = null === (_a = this._option) || void 0 === _a ? void 0 : _a.globalInstance) || void 0 === _b ? void 0 : _b._registerExitingVRenderComponent) || void 0 === _c || _c.call(_b, exitingComponent);
63618
+ })) : void 0;
63619
+ }
63620
+ releaseVRenderComponentSync(component);
62556
63621
  }
62557
63622
  clear() {
62558
63623
  var _a;
62559
63624
  const components = this._getNeedClearVRenderComponents();
62560
63625
  components && components.length && components.forEach(c => {
62561
- var _a;
62562
- c && (c.release(!0), null === (_a = this.getContainer()) || void 0 === _a || _a.removeChild(c), c = null);
63626
+ c && this._releaseVRenderComponent(c);
62563
63627
  }), this._container = null, null === (_a = this.pluginService) || void 0 === _a || _a.clearAll();
62564
63628
  }
62565
63629
  compile() {
@@ -62613,8 +63677,45 @@
62613
63677
  getComponent() {
62614
63678
  return this._component;
62615
63679
  }
63680
+ _clearExitingComponent(component) {
63681
+ this._exitingComponent === component && (this._unregisterExitingComponent(component), this._exitingComponent = void 0, this._exitingProduct = void 0);
63682
+ }
63683
+ _removeProductAfterExit(component, product) {
63684
+ product.parent && product.parent.removeChild(product, !0), this._product === product && (this._product = null, this._compiledProductId = null), this._clearExitingComponent(component);
63685
+ }
63686
+ _registerExitingComponent(component) {
63687
+ var _a, _b, _c, _d, _e;
63688
+ null === (_e = null === (_d = null === (_c = null === (_b = null === (_a = this.model) || void 0 === _a ? void 0 : _a.getOption) || void 0 === _b ? void 0 : _b.call(_a)) || void 0 === _c ? void 0 : _c.globalInstance) || void 0 === _d ? void 0 : _d._registerExitingVRenderComponent) || void 0 === _e || _e.call(_d, component);
63689
+ }
63690
+ _unregisterExitingComponent(component) {
63691
+ var _a, _b, _c, _d, _e;
63692
+ null === (_e = null === (_d = null === (_c = null === (_b = null === (_a = this.model) || void 0 === _a ? void 0 : _a.getOption) || void 0 === _b ? void 0 : _b.call(_a)) || void 0 === _c ? void 0 : _c.globalInstance) || void 0 === _d ? void 0 : _d._unregisterExitingVRenderComponent) || void 0 === _e || _e.call(_d, component);
63693
+ }
63694
+ _releaseComponentWithExitAnimation(component, releaseProduct) {
63695
+ var _a, _b;
63696
+ const product = this._product;
63697
+ if (!component || (null === (_b = null === (_a = this.model) || void 0 === _a ? void 0 : _a._shouldReleaseVRenderComponentsImmediately) || void 0 === _b ? void 0 : _b.call(_a))) return !1;
63698
+ const releasedWithExit = releaseVRenderComponent(component, {
63699
+ enableExitAnimation: !0,
63700
+ removeFromParent: !0,
63701
+ onComplete: () => {
63702
+ releaseProduct && product ? this._removeProductAfterExit(component, product) : this._clearExitingComponent(component);
63703
+ }
63704
+ });
63705
+ return releasedWithExit && (this._exitingComponent = component, this._exitingProduct = releaseProduct ? product : void 0, this._registerExitingComponent(component)), releasedWithExit;
63706
+ }
62616
63707
  clearComponent() {
62617
- this._component && (this._component.parent && this._component.parent.removeChild(this._component), this._component = null);
63708
+ var _a, _b;
63709
+ const component = this._component;
63710
+ component && ((null === (_b = null === (_a = this.model) || void 0 === _a ? void 0 : _a._shouldReleaseVRenderComponentsImmediately) || void 0 === _b ? void 0 : _b.call(_a)) ? releaseVRenderComponentSync(component) : this._releaseComponentWithExitAnimation(component, !1), this._component = null);
63711
+ }
63712
+ releaseWithExitAnimation() {
63713
+ const component = this._component;
63714
+ return !!this._releaseComponentWithExitAnimation(component, !0) && (this._component = null, this._exitingComponent = component, !0);
63715
+ }
63716
+ forceReleaseExitAnimation() {
63717
+ var _a;
63718
+ this._exitingComponent && (releaseVRenderComponentSync(this._exitingComponent), this._unregisterExitingComponent(this._exitingComponent), (null === (_a = this._exitingProduct) || void 0 === _a ? void 0 : _a.parent) && this._exitingProduct.parent.removeChild(this._exitingProduct, !0), this._exitingComponent = void 0, this._exitingProduct = void 0);
62618
63719
  }
62619
63720
  _getAttrsFromConfig(attrs = {}) {
62620
63721
  const configAttrs = super._getAttrsFromConfig(attrs);
@@ -62642,7 +63743,8 @@
62642
63743
  }), this.needClear = !0;
62643
63744
  }
62644
63745
  release() {
62645
- super.release(), this.removeProduct();
63746
+ var _a, _b;
63747
+ return (null === (_b = null === (_a = this.model) || void 0 === _a ? void 0 : _a._shouldReleaseVRenderComponentsImmediately) || void 0 === _b ? void 0 : _b.call(_a)) ? (this.forceReleaseExitAnimation(), super.release(), void this.removeProduct(!0)) : this._exitingComponent ? (this._releaseComponentWithExitAnimation(this._exitingComponent, !0) || this.removeProduct(!0), void super.release()) : void (this.releaseWithExitAnimation() ? super.release() : (super.release(), this.removeProduct(!0)));
62646
63748
  }
62647
63749
  }
62648
63750
  ComponentMark.type = "component";
@@ -62661,6 +63763,19 @@
62661
63763
  }
62662
63764
  return t;
62663
63765
  };
63766
+ const AXIS_COMPONENT_ONLY_CHANGE_KEYS = {
63767
+ grid: !0,
63768
+ subGrid: !0,
63769
+ tick: !0,
63770
+ subTick: !0,
63771
+ label: !0,
63772
+ domainLine: !0,
63773
+ title: !0,
63774
+ maxWidth: !0,
63775
+ minWidth: !0,
63776
+ maxHeight: !0,
63777
+ minHeight: !0
63778
+ };
62664
63779
  class AxisComponent extends BaseComponent {
62665
63780
  getOrient() {
62666
63781
  return this._orient;
@@ -62894,10 +64009,19 @@
62894
64009
  }
62895
64010
  _compareSpec(spec, prevSpec) {
62896
64011
  const result = super._compareSpec(spec, prevSpec);
62897
- return result.reMake ? result : (result.reRender = !0, (null == prevSpec ? void 0 : prevSpec.type) !== (null == spec ? void 0 : spec.type) || (null == prevSpec ? void 0 : prevSpec.visible) !== (null == spec ? void 0 : spec.visible) ? (result.reMake = !0, result) : (result.reMake = ["grid", "subGrid", "tick", "subTick", "label", "domainLine", "title"].some(k => {
64012
+ if (result.reMake) return result;
64013
+ const specChanged = !isEqual(prevSpec, spec);
64014
+ return result.reRender = !0, (null == prevSpec ? void 0 : prevSpec.type) !== (null == spec ? void 0 : spec.type) || (null == prevSpec ? void 0 : prevSpec.visible) !== (null == spec ? void 0 : spec.visible) ? (result.reMake = !0, result) : (result.reMake = ["grid", "subGrid", "tick", "subTick", "label", "domainLine", "title"].some(k => {
62898
64015
  var _a, _b;
62899
64016
  return (null === (_a = null == prevSpec ? void 0 : prevSpec[k]) || void 0 === _a ? void 0 : _a.visible) !== (null === (_b = null == spec ? void 0 : spec[k]) || void 0 === _b ? void 0 : _b.visible);
62900
- }), result));
64017
+ }), specChanged && !result.reMake && this._isComponentOnlySpecChange(spec, prevSpec) && (result.effects = Object.assign(Object.assign({}, result.effects), {
64018
+ component: !0,
64019
+ layout: !0,
64020
+ render: !0
64021
+ })), result);
64022
+ }
64023
+ _isComponentOnlySpecChange(spec, prevSpec) {
64024
+ return Object.keys(Object.assign(Object.assign({}, prevSpec), spec)).every(key => isEqual(null == prevSpec ? void 0 : prevSpec[key], null == spec ? void 0 : spec[key]) || AXIS_COMPONENT_ONLY_CHANGE_KEYS[key]);
62901
64025
  }
62902
64026
  _getAxisAttributes() {
62903
64027
  const spec = this._spec,
@@ -64800,6 +65924,12 @@
64800
65924
  constructor() {
64801
65925
  super(...arguments), this.type = SeriesTypeEnum.line, this.transformerConstructor = LineLikeSeriesSpecTransformer, this._sortDataByAxis = !1;
64802
65926
  }
65927
+ _getSpecUpdatePolicy() {
65928
+ const policy = super._getSpecUpdatePolicy();
65929
+ return Object.assign(Object.assign({}, policy), {
65930
+ dataRelatedKeys: Object.assign(Object.assign({}, policy.dataRelatedKeys), LINE_LIKE_SERIES_DATA_RELATED_KEYS)
65931
+ });
65932
+ }
64803
65933
  compile() {
64804
65934
  super.compile(), this.addSamplingCompile(), this.addOverlapCompile();
64805
65935
  }
@@ -65182,6 +66312,11 @@
65182
66312
  }
65183
66313
  return t;
65184
66314
  };
66315
+ const MARKER_COMPONENT_SPEC_KEYS = {
66316
+ [ComponentTypeEnum.markPoint]: !0,
66317
+ [ComponentTypeEnum.markLine]: !0,
66318
+ [ComponentTypeEnum.markArea]: !0
66319
+ };
65185
66320
  let BaseChart$1 = class BaseChart extends CompilableBase {
65186
66321
  getSpec() {
65187
66322
  return this._spec;
@@ -65224,7 +66359,7 @@
65224
66359
  _setModelOption() {}
65225
66360
  constructor(spec, option) {
65226
66361
  var _a, _b, _c, _d;
65227
- super(option), this.type = "chart", this.id = createID(), this._regions = [], this._series = [], this._components = [], this._layoutRect = {
66362
+ super(option), this.type = "chart", this.id = createID(), this._regions = [], this._series = [], this._components = [], this._specTransformer = null, this._layoutRect = {
65228
66363
  x: 0,
65229
66364
  y: 0,
65230
66365
  width: DEFAULT_CHART_WIDTH,
@@ -65272,7 +66407,7 @@
65272
66407
  }), this._setModelOption && this._setModelOption(), this._spec = spec;
65273
66408
  }
65274
66409
  created(transformer) {
65275
- this._chartData.parseData(this._spec.data), this._createGlobalScale(), this._createBackground(), this._createLayout(), transformer.forEachRegionInSpec(this._spec, this._createRegion.bind(this)), transformer.forEachSeriesInSpec(this._spec, this._createSeries.bind(this)), transformer.forEachComponentInSpec(this._spec, this._createComponent.bind(this), this._option.getSpecInfo());
66410
+ this._specTransformer = transformer, this._chartData.parseData(this._spec.data), this._createGlobalScale(), this._createBackground(), this._createLayout(), transformer.forEachRegionInSpec(this._spec, this._createRegion.bind(this)), transformer.forEachSeriesInSpec(this._spec, this._createSeries.bind(this)), transformer.forEachComponentInSpec(this._spec, this._createComponent.bind(this), this._option.getSpecInfo());
65276
66411
  }
65277
66412
  _initInteractions() {
65278
66413
  if (this._option.disableTriggerEvent) return;
@@ -65564,11 +66699,14 @@
65564
66699
  _getSpecKeys(spec) {
65565
66700
  const ignoreKeys = {
65566
66701
  width: !0,
65567
- height: !0
66702
+ height: !0,
66703
+ xField: !0,
66704
+ yField: !0
65568
66705
  };
65569
66706
  return Object.keys(spec).filter(key => !ignoreKeys[key]).sort();
65570
66707
  }
65571
66708
  updateSpec(spec) {
66709
+ var _a;
65572
66710
  const result = {
65573
66711
  change: !1,
65574
66712
  reMake: !1,
@@ -65576,16 +66714,28 @@
65576
66714
  reSize: !1,
65577
66715
  reCompile: !1
65578
66716
  };
65579
- if (this.setLayoutTag(!0, null, !1), spec.type !== this.type) return result.reMake = !0, result;
66717
+ if (spec.type !== this.type) return result.reMake = !0, this.setLayoutTag(!0, null, !1), result;
65580
66718
  const currentKeys = this._getSpecKeys(this._spec),
65581
66719
  nextKeys = this._getSpecKeys(spec);
65582
- if (!isEqual(currentKeys, nextKeys)) return result.reMake = !0, result;
66720
+ if (!isEqual(currentKeys, nextKeys)) return result.reMake = !0, this.setLayoutTag(!0, null, !1), result;
65583
66721
  for (let i = 0; i < currentKeys.length; i++) {
65584
- const key = currentKeys[i];
65585
- if (isArray$1(this._spec[key]) && this._spec[key].length !== array(spec[key]).length) return result.reMake = !0, result;
65586
- }
65587
- const oldSpec = this._spec;
65588
- return this._spec = spec, this.updateChartConfig(result, oldSpec), result.reMake ? result : (this.updateGlobalScale(result), result.reMake ? result : (this.updateRegionSpec(result), result.reMake ? result : (this.updateComponentSpec(result), result.reMake ? result : (this.updateSeriesSpec(result), result.reMake || (this.reInit(), this.updateDataSpec(), this.updateGlobalScaleDomain()), result))));
66722
+ const key = currentKeys[i],
66723
+ currentSpec = this._spec[key],
66724
+ nextSpec = spec[key];
66725
+ if (isArray$1(currentSpec) && currentSpec.length !== array(nextSpec).length && !this._canRemoveMarkerComponentsWithoutRemake(key, currentSpec, nextSpec)) return result.reMake = !0, this.setLayoutTag(!0, null, !1), result;
66726
+ }
66727
+ const oldSpec = this._spec,
66728
+ onlyMarkerComponentsRemoved = this._isOnlyMarkerComponentsRemoved(this._spec, spec, currentKeys),
66729
+ onlyComponentSpecsChanged = this._isOnlyComponentSpecsChanged(this._spec, spec, currentKeys),
66730
+ onlySeriesSpecsChanged = this._isOnlySeriesSpecsChanged(this._spec, spec, currentKeys);
66731
+ if (this._spec = spec, onlyMarkerComponentsRemoved) return this._removeMarkerComponentsForEmptySpecs(result), result;
66732
+ if (this.updateChartConfig(result, oldSpec), result.reMake) return this.setLayoutTag(!0, null, !1), result;
66733
+ if (this.updateGlobalScale(result), result.reMake) return this.setLayoutTag(!0, null, !1), result;
66734
+ if (this.updateRegionSpec(result), result.reMake) return this.setLayoutTag(!0, null, !1), result;
66735
+ const componentUpdateResult = this.updateComponentSpec(result);
66736
+ return result.reMake ? (this.setLayoutTag(!0, null, !1), result) : isUpdateSpecResultLocalOnly(result) ? result : onlyComponentSpecsChanged && !componentUpdateResult.hasNonComponentOnlyUpdate && isUpdateSpecResultComponentOnly(result) ? (componentUpdateResult.componentOnlyUpdatedComponents.forEach(component => {
66737
+ component.reInit(component.getSpec());
66738
+ }), (null === (_a = result.effects) || void 0 === _a ? void 0 : _a.layout) && this.setLayoutTag(!0, null, !1), result) : (this.setLayoutTag(!0, null, !1), this.updateSeriesSpec(result), result.reMake || (this.reInit(), onlySeriesSpecsChanged && this._canSkipChartDataStages(result) || (this.updateDataSpec(), this.updateGlobalScaleDomain())), result);
65589
66739
  }
65590
66740
  updateChartConfig(result, oldSpec) {
65591
66741
  var _a, _b;
@@ -65601,34 +66751,105 @@
65601
66751
  }) : result.reMake = !0);
65602
66752
  }
65603
66753
  updateComponentSpec(result) {
66754
+ const componentOnlyUpdatedComponents = [];
66755
+ let hasNonComponentOnlyUpdate = !1;
65604
66756
  const componentCache = {},
65605
66757
  checkVisibleComponents = {
65606
66758
  [ComponentTypeEnum.title]: !0,
65607
66759
  [ComponentTypeEnum.brush]: !0,
65608
66760
  [ComponentTypeEnum.indicator]: !0
65609
- };
66761
+ },
66762
+ removedComponents = [];
65610
66763
  this._components.forEach(c => {
65611
66764
  var _a, _b;
65612
66765
  if (c.type === ComponentTypeEnum.label || c.type === ComponentTypeEnum.totalLabel) return;
65613
66766
  checkVisibleComponents[c.type] && (checkVisibleComponents[c.type] = !1);
65614
66767
  const compSpecKey = c.specKey || c.type,
65615
66768
  cmpSpec = null !== (_a = this._spec[compSpecKey]) && void 0 !== _a ? _a : {};
65616
- isArray$1(cmpSpec) ? (componentCache[compSpecKey] = componentCache[compSpecKey] || {
65617
- specCount: cmpSpec.length,
65618
- componentCount: 0
65619
- }, componentCache[compSpecKey].componentCount++, mergeUpdateResult(result, c.updateSpec(null !== (_b = cmpSpec[c.getSpecIndex()]) && void 0 !== _b ? _b : {}, cmpSpec))) : mergeUpdateResult(result, c.updateSpec(cmpSpec));
66769
+ if (isArray$1(cmpSpec)) {
66770
+ if (componentCache[compSpecKey] = componentCache[compSpecKey] || {
66771
+ specCount: cmpSpec.length,
66772
+ componentCount: 0
66773
+ }, this._canRemoveMarkerComponentsWithoutRemake(compSpecKey, [c.getSpec()], cmpSpec)) return void removedComponents.push(c);
66774
+ componentCache[compSpecKey].componentCount++;
66775
+ const componentSpec = null !== (_b = cmpSpec[c.getSpecIndex()]) && void 0 !== _b ? _b : {},
66776
+ previousComponentSpec = c.getSpec(),
66777
+ componentResult = c.updateSpec(componentSpec, cmpSpec);
66778
+ isUpdateSpecResultComponentOnly(componentResult) ? componentOnlyUpdatedComponents.push(c) : isEqual(previousComponentSpec, componentSpec) || (hasNonComponentOnlyUpdate = !0), mergeUpdateResult(result, componentResult);
66779
+ } else {
66780
+ const previousComponentSpec = c.getSpec(),
66781
+ componentResult = c.updateSpec(cmpSpec);
66782
+ isUpdateSpecResultComponentOnly(componentResult) ? componentOnlyUpdatedComponents.push(c) : isEqual(previousComponentSpec, cmpSpec) || (hasNonComponentOnlyUpdate = !0), mergeUpdateResult(result, componentResult);
66783
+ }
65620
66784
  });
65621
66785
  for (const key in componentCache) if (Object.prototype.hasOwnProperty.call(componentCache, key)) {
65622
66786
  const element = componentCache[key];
65623
66787
  element.componentCount !== element.specCount && (result.reMake = !0);
65624
66788
  }
66789
+ removedComponents.length && (removedComponents.forEach(component => {
66790
+ this._removeComponent(component);
66791
+ }), result.change = !0, result.effects = Object.assign(Object.assign({}, result.effects), {
66792
+ component: !0,
66793
+ localOnly: !0
66794
+ }));
65625
66795
  const isVisible = compSpec => compSpec && !1 !== compSpec.visible;
65626
- Object.keys(checkVisibleComponents).forEach(type => {
66796
+ return Object.keys(checkVisibleComponents).forEach(type => {
65627
66797
  if (checkVisibleComponents[type]) {
65628
66798
  const compSpec = this._spec[type];
65629
66799
  (isArray$1(compSpec) ? compSpec.some(isVisible) : isVisible(compSpec)) && (result.reMake = !0);
65630
66800
  }
66801
+ }), {
66802
+ componentOnlyUpdatedComponents: componentOnlyUpdatedComponents,
66803
+ hasNonComponentOnlyUpdate: hasNonComponentOnlyUpdate
66804
+ };
66805
+ }
66806
+ _canRemoveMarkerComponentsWithoutRemake(key, currentSpec, nextSpec) {
66807
+ return MARKER_COMPONENT_SPEC_KEYS[key] && isArray$1(currentSpec) && currentSpec.length > 0 && isArray$1(nextSpec) && 0 === nextSpec.length;
66808
+ }
66809
+ _isOnlyMarkerComponentsRemoved(currentSpec, nextSpec, specKeys) {
66810
+ let hasMarkerRemoval = !1;
66811
+ const onlyMarkerRemoval = specKeys.every(key => this._canRemoveMarkerComponentsWithoutRemake(key, currentSpec[key], nextSpec[key]) ? (hasMarkerRemoval = !0, !0) : isEqual(currentSpec[key], nextSpec[key]));
66812
+ return hasMarkerRemoval && onlyMarkerRemoval;
66813
+ }
66814
+ _isComponentSpecKey(key) {
66815
+ return this._components.some(component => (component.specKey || component.type) === key);
66816
+ }
66817
+ _isOnlyComponentSpecsChanged(currentSpec, nextSpec, specKeys) {
66818
+ let hasComponentSpecChange = !1;
66819
+ const currentSpecRecord = currentSpec,
66820
+ nextSpecRecord = nextSpec,
66821
+ onlyComponentSpecChange = specKeys.every(key => !!isEqual(currentSpecRecord[key], nextSpecRecord[key]) || !!this._isComponentSpecKey(key) && (hasComponentSpecChange = !0, !0));
66822
+ return hasComponentSpecChange && onlyComponentSpecChange;
66823
+ }
66824
+ _isOnlySeriesSpecsChanged(currentSpec, nextSpec, specKeys) {
66825
+ var _a, _b;
66826
+ let hasSeriesSpecChange = !1;
66827
+ const currentSpecRecord = currentSpec,
66828
+ nextSpecRecord = nextSpec,
66829
+ seriesRelatedSpecKeys = null !== (_b = null === (_a = this._specTransformer) || void 0 === _a ? void 0 : _a.getSeriesRelatedSpecKeys()) && void 0 !== _b ? _b : {},
66830
+ onlySeriesSpecChange = specKeys.every(key => !!isEqual(currentSpecRecord[key], nextSpecRecord[key]) || !!seriesRelatedSpecKeys[key] && (hasSeriesSpecChange = !0, !0));
66831
+ return hasSeriesSpecChange && onlySeriesSpecChange;
66832
+ }
66833
+ _canSkipChartDataStages(result) {
66834
+ const effects = result.effects;
66835
+ return !(!(null == effects ? void 0 : effects.series) || effects.remake || effects.data || effects.scaleDomain || result.reMake);
66836
+ }
66837
+ _removeMarkerComponentsForEmptySpecs(result) {
66838
+ const removedComponents = this._components.filter(component => {
66839
+ var _a;
66840
+ const compSpecKey = component.specKey || component.type,
66841
+ cmpSpec = null !== (_a = this._spec[compSpecKey]) && void 0 !== _a ? _a : {};
66842
+ return this._canRemoveMarkerComponentsWithoutRemake(compSpecKey, [component.getSpec()], cmpSpec);
65631
66843
  });
66844
+ removedComponents.length && (removedComponents.forEach(component => {
66845
+ this._removeComponent(component);
66846
+ }), result.change = !0, result.effects = Object.assign(Object.assign({}, result.effects), {
66847
+ component: !0,
66848
+ localOnly: !0
66849
+ }));
66850
+ }
66851
+ _removeComponent(component) {
66852
+ this._components = this._components.filter(c => c !== component), this._idMap.delete(component.id), component.release();
65632
66853
  }
65633
66854
  updateSeriesSpec(result) {
65634
66855
  this._spec.series.length === this._series.length ? this._series.forEach(s => {
@@ -65725,8 +66946,8 @@
65725
66946
  c.compile();
65726
66947
  }), null === (_d = null === (_c = this._option.performanceHook) || void 0 === _c ? void 0 : _c.afterComponentCompile) || void 0 === _d || _d.call(_c, this._option.globalInstance);
65727
66948
  }
65728
- release() {
65729
- [...this._components, ...this._regions, ...this._series].forEach(m => {
66949
+ release(forceReleaseVRenderComponents = !0) {
66950
+ forceReleaseVRenderComponents && [...this._components, ...this._regions, ...this._series].forEach(m => {
65730
66951
  m.beforeRelease();
65731
66952
  }), super.release(), this.clear(), [...this._components, ...this._regions, ...this._series].forEach(m => {
65732
66953
  m.release();
@@ -65926,9 +67147,18 @@
65926
67147
  }).filter(isValid$1);
65927
67148
  };
65928
67149
 
67150
+ const DEFAULT_SERIES_RELATED_CHART_SPEC_KEYS = {
67151
+ series: !0,
67152
+ label: !0,
67153
+ animationAppear: !0,
67154
+ animationEnter: !0,
67155
+ animationUpdate: !0,
67156
+ animationExit: !0,
67157
+ animationNormal: !0
67158
+ };
65929
67159
  class BaseChartSpecTransformer {
65930
67160
  constructor(option) {
65931
- this._option = option, this.type = option.type, this.seriesType = option.seriesType;
67161
+ this._seriesRelatedSpecKeys = Object.assign({}, DEFAULT_SERIES_RELATED_CHART_SPEC_KEYS), this._option = option, this.type = option.type, this.seriesType = option.seriesType;
65932
67162
  }
65933
67163
  initChartSpec(chartSpec) {
65934
67164
  return this.transformSpec(chartSpec), this.transformModelSpec(chartSpec);
@@ -65993,8 +67223,19 @@
65993
67223
  _isValidSeries(seriesType) {
65994
67224
  return !0;
65995
67225
  }
67226
+ getSeriesRelatedSpecKeys() {
67227
+ return this._seriesRelatedSpecKeys;
67228
+ }
67229
+ _addSeriesRelatedSpecKeys(...keysList) {
67230
+ keysList.forEach(keys => {
67231
+ null == keys || keys.forEach(key => {
67232
+ this._seriesRelatedSpecKeys[key] = !0;
67233
+ });
67234
+ });
67235
+ }
65996
67236
  _getDefaultSeriesSpec(chartSpec, pickKeys, pickKeys2) {
65997
67237
  var _a, _b, _c, _d, _e;
67238
+ this._addSeriesRelatedSpecKeys(pickKeys, pickKeys2);
65998
67239
  const series = {
65999
67240
  dataKey: chartSpec.dataKey,
66000
67241
  hover: chartSpec.hover,
@@ -67071,6 +68312,12 @@
67071
68312
  constructor() {
67072
68313
  super(...arguments), this.type = SeriesTypeEnum.area, this.transformerConstructor = AreaSeriesSpecTransformer, this._sortDataByAxis = !1;
67073
68314
  }
68315
+ _getSpecUpdatePolicy() {
68316
+ const policy = super._getSpecUpdatePolicy();
68317
+ return Object.assign(Object.assign({}, policy), {
68318
+ dataRelatedKeys: Object.assign(Object.assign({}, policy.dataRelatedKeys), LINE_LIKE_SERIES_DATA_RELATED_KEYS)
68319
+ });
68320
+ }
67074
68321
  initMark() {
67075
68322
  var _a;
67076
68323
  const seriesMark = null !== (_a = this._spec.seriesMark) && void 0 !== _a ? _a : "area",
@@ -67347,6 +68594,14 @@
67347
68594
  }
67348
68595
  };
67349
68596
 
68597
+ const BAR_SERIES_COMPILE_ONLY_KEYS = {
68598
+ barWidth: !0,
68599
+ barMinWidth: !0,
68600
+ barMaxWidth: !0,
68601
+ barGapInGroup: !0,
68602
+ barMinHeight: !0,
68603
+ stackCornerRadius: !0
68604
+ };
67350
68605
  class BarSeries extends CartesianSeries {
67351
68606
  constructor() {
67352
68607
  super(...arguments), this.type = SeriesTypeEnum.bar, this._barMarkName = "bar", this._barMarkType = "rect", this.transformerConstructor = BarSeriesSpecTransformer, this._bandPosition = 0, this._getLinearBarRange = (start, end) => {
@@ -67395,6 +68650,12 @@
67395
68650
  this._barBackgroundPositionYEncoder = encoder.bind(this);
67396
68651
  };
67397
68652
  }
68653
+ _getSpecUpdatePolicy() {
68654
+ const policy = super._getSpecUpdatePolicy();
68655
+ return Object.assign(Object.assign({}, policy), {
68656
+ compileOnlyKeys: Object.assign(Object.assign({}, policy.compileOnlyKeys), BAR_SERIES_COMPILE_ONLY_KEYS)
68657
+ });
68658
+ }
67398
68659
  initMark() {
67399
68660
  this._initBarBackgroundMark(), this._barMark = this._createMark(Object.assign(Object.assign({}, BarSeries.mark.bar), {
67400
68661
  name: this._barMarkName,
@@ -67416,7 +68677,14 @@
67416
68677
  initMarkStyle() {
67417
68678
  this._barMark && this.setMarkStyle(this._barMark, {
67418
68679
  fill: this.getColorAttribute()
67419
- }, "normal", AttributeLevel.Series);
68680
+ }, "normal", AttributeLevel.Series), this.initRectMarkStyle();
68681
+ }
68682
+ initRectMarkStyle() {
68683
+ var _a;
68684
+ if (!this._barMark) return;
68685
+ const bandAxisHelper = "vertical" === this.direction ? this._xAxisHelper : this._yAxisHelper,
68686
+ scale = null === (_a = null == bandAxisHelper ? void 0 : bandAxisHelper.getScale) || void 0 === _a ? void 0 : _a.call(bandAxisHelper, 0);
68687
+ scale && ("band" === scale.type ? this.initBandRectMarkStyle() : this.initLinearRectMarkStyle());
67420
68688
  }
67421
68689
  initLabelMarkStyle(textMark) {
67422
68690
  textMark && this.setMarkStyle(textMark, {
@@ -67506,8 +68774,7 @@
67506
68774
  this._barBackgroundViewData = new CompilableData(this._option, barBackgroundData);
67507
68775
  }
67508
68776
  init(option) {
67509
- var _a, _b;
67510
- super.init(option), "vertical" === this.direction ? "band" === (null === (_a = this._xAxisHelper) || void 0 === _a ? void 0 : _a.getScale(0).type) ? this.initBandRectMarkStyle() : this.initLinearRectMarkStyle() : "band" === (null === (_b = this._yAxisHelper) || void 0 === _b ? void 0 : _b.getScale(0).type) ? this.initBandRectMarkStyle() : this.initLinearRectMarkStyle();
68777
+ super.init(option), this.initRectMarkStyle();
67511
68778
  }
67512
68779
  _shouldDoPreCalculate() {
67513
68780
  const region = this.getRegion();
@@ -67576,7 +68843,13 @@
67576
68843
  }
67577
68844
  _initStackBarMarkStyle() {
67578
68845
  var _a, _b, _c, _d;
67579
- if (!this._spec.stackCornerRadius) return;
68846
+ if (!this._spec.stackCornerRadius) {
68847
+ const markConfig = this._barMark.getMarkConfig();
68848
+ return void (!markConfig.clip && isNil$1(markConfig.clipPath) || this._barMark.setMarkConfig({
68849
+ clip: !1,
68850
+ clipPath: []
68851
+ }));
68852
+ }
67580
68853
  const xScale = null === (_b = null === (_a = this._xAxisHelper) || void 0 === _a ? void 0 : _a.getScale) || void 0 === _b ? void 0 : _b.call(_a, 0),
67581
68854
  yScale = null === (_d = null === (_c = this._yAxisHelper) || void 0 === _c ? void 0 : _c.getScale) || void 0 === _d ? void 0 : _d.call(_c, 0),
67582
68855
  isVertical = "vertical" === this.direction;
@@ -67909,10 +69182,19 @@
67909
69182
  }
67910
69183
  };
67911
69184
 
69185
+ const SCATTER_SERIES_DATA_RELATED_KEYS = {
69186
+ sizeField: !0
69187
+ };
67912
69188
  class ScatterSeries extends CartesianSeries {
67913
69189
  constructor() {
67914
69190
  super(...arguments), this.type = SeriesTypeEnum.scatter, this.transformerConstructor = ScatterSeriesSpecTransformer, this._invalidType = "zero";
67915
69191
  }
69192
+ _getSpecUpdatePolicy() {
69193
+ const policy = super._getSpecUpdatePolicy();
69194
+ return Object.assign(Object.assign({}, policy), {
69195
+ dataRelatedKeys: Object.assign(Object.assign({}, policy.dataRelatedKeys), SCATTER_SERIES_DATA_RELATED_KEYS)
69196
+ });
69197
+ }
67916
69198
  setAttrFromSpec() {
67917
69199
  super.setAttrFromSpec(), this._size = this._spec.size, this._sizeField = this._spec.sizeField, this._shape = this._spec.shape, this._shapeField = this._spec.shapeField;
67918
69200
  }
@@ -69810,6 +71092,9 @@
69810
71092
  }
69811
71093
  };
69812
71094
 
71095
+ const WATERFALL_SERIES_DATA_RELATED_KEYS = {
71096
+ calculationMode: !0
71097
+ };
69813
71098
  class WaterfallSeries extends BarSeries {
69814
71099
  constructor() {
69815
71100
  super(...arguments), this.type = SeriesTypeEnum.waterfall, this.transformerConstructor = WaterfallSeriesSpecTransformer, this._leaderLineMark = null, this._stackLabelMark = null, this._labelMark = null, this._reStackTotal = () => {
@@ -69822,6 +71107,12 @@
69822
71107
  var _a;
69823
71108
  return null === (_a = this._totalData) || void 0 === _a ? void 0 : _a.getLatestData();
69824
71109
  }
71110
+ _getSpecUpdatePolicy() {
71111
+ const policy = super._getSpecUpdatePolicy();
71112
+ return Object.assign(Object.assign({}, policy), {
71113
+ dataRelatedKeys: Object.assign(Object.assign({}, policy.dataRelatedKeys), WATERFALL_SERIES_DATA_RELATED_KEYS)
71114
+ });
71115
+ }
69825
71116
  initGroups() {
69826
71117
  const groupFields = this.getGroupFields();
69827
71118
  groupFields && groupFields.length && (this._groups = new Group(groupFields), this._data && this._groups.initData(this._data.getDataView(), this._dataSet));
@@ -70614,6 +71905,12 @@
70614
71905
  }
70615
71906
  }
70616
71907
 
71908
+ const BOX_PLOT_SERIES_COMPILE_ONLY_KEYS = {
71909
+ boxWidth: !0,
71910
+ boxMinWidth: !0,
71911
+ boxMaxWidth: !0,
71912
+ boxGapInGroup: !0
71913
+ };
70617
71914
  class BoxPlotSeries extends CartesianSeries {
70618
71915
  constructor() {
70619
71916
  super(...arguments), this.type = SeriesTypeEnum.boxPlot, this.transformerConstructor = BoxPlotSeriesSpecTransformer, this._bandPosition = 0;
@@ -70648,6 +71945,12 @@
70648
71945
  getOutliersStyle() {
70649
71946
  return this._outliersStyle;
70650
71947
  }
71948
+ _getSpecUpdatePolicy() {
71949
+ const policy = super._getSpecUpdatePolicy();
71950
+ return Object.assign(Object.assign({}, policy), {
71951
+ compileOnlyKeys: Object.assign(Object.assign({}, policy.compileOnlyKeys), BOX_PLOT_SERIES_COMPILE_ONLY_KEYS)
71952
+ });
71953
+ }
70651
71954
  setAttrFromSpec() {
70652
71955
  var _a, _b, _c, _d, _e, _f, _g;
70653
71956
  super.setAttrFromSpec();
@@ -70721,7 +72024,7 @@
70721
72024
  fill: null !== (_e = null !== (_d = null === (_c = this._outliersStyle) || void 0 === _c ? void 0 : _c.fill) && void 0 !== _d ? _d : this._boxFillColor) && void 0 !== _e ? _e : this.getColorAttribute(),
70722
72025
  stroke: this.getColorAttribute(),
70723
72026
  size: isNumber$2(null === (_f = this._outliersStyle) || void 0 === _f ? void 0 : _f.size) ? this._outliersStyle.size : 10
70724
- }, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series);
72027
+ }, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series), this.initBoxPlotMarkStyle();
70725
72028
  }
70726
72029
  initBoxPlotMarkStyle() {
70727
72030
  var _a, _b;
@@ -71686,6 +72989,16 @@
71686
72989
  }
71687
72990
  };
71688
72991
 
72992
+ const PIE_SERIES_DATA_RELATED_KEYS = {
72993
+ valueField: !0,
72994
+ angleField: !0,
72995
+ startAngle: !0,
72996
+ endAngle: !0,
72997
+ minAngle: !0
72998
+ },
72999
+ PIE_SERIES_COMPILE_ONLY_KEYS = {
73000
+ outerRadius: !0
73001
+ };
71689
73002
  class BasePieSeries extends PolarSeries {
71690
73003
  constructor() {
71691
73004
  super(...arguments), this.transformerConstructor = PieSeriesSpecTransformer, this._pieMarkName = "pie", this._pieMarkType = "arc", this.getCenter = () => {
@@ -71873,6 +73186,13 @@
71873
73186
  computeDatumRadius(datum, state) {
71874
73187
  return this._computeLayoutRadius() * this.getRadius(state) + this._centerOffset;
71875
73188
  }
73189
+ _getSpecUpdatePolicy() {
73190
+ const policy = super._getSpecUpdatePolicy();
73191
+ return Object.assign(Object.assign({}, policy), {
73192
+ compileOnlyKeys: Object.assign(Object.assign({}, policy.compileOnlyKeys), PIE_SERIES_COMPILE_ONLY_KEYS),
73193
+ dataRelatedKeys: Object.assign(Object.assign({}, policy.dataRelatedKeys), PIE_SERIES_DATA_RELATED_KEYS)
73194
+ });
73195
+ }
71876
73196
  _compareSpec(spec, prevSpec, ignoreCheckKeys) {
71877
73197
  ignoreCheckKeys = null != ignoreCheckKeys ? ignoreCheckKeys : {
71878
73198
  data: !0
@@ -73857,6 +75177,9 @@
73857
75177
  }
73858
75178
  };
73859
75179
 
75180
+ const CIRCULAR_PROGRESS_SERIES_COMPILE_ONLY_KEYS = {
75181
+ cornerRadius: !0
75182
+ };
73860
75183
  class CircularProgressSeries extends ProgressLikeSeries {
73861
75184
  constructor() {
73862
75185
  super(...arguments), this.type = SeriesTypeEnum.circularProgress, this.transformerConstructor = CircularProgressSeriesSpecTransformer, this._progressMark = null, this._trackMark = null, this._getRadiusValueStart = datum => {
@@ -73874,6 +75197,12 @@
73874
75197
  return this.radiusAxisHelper.dataToPosition([datum[this._radiusField[0]]]) + this.radiusAxisHelper.getScale(0).step();
73875
75198
  };
73876
75199
  }
75200
+ _getSpecUpdatePolicy() {
75201
+ const policy = super._getSpecUpdatePolicy();
75202
+ return Object.assign(Object.assign({}, policy), {
75203
+ compileOnlyKeys: Object.assign(Object.assign({}, policy.compileOnlyKeys), CIRCULAR_PROGRESS_SERIES_COMPILE_ONLY_KEYS)
75204
+ });
75205
+ }
73877
75206
  getStackGroupFields() {
73878
75207
  return this.getGroupFields();
73879
75208
  }
@@ -74044,6 +75373,17 @@
74044
75373
  }
74045
75374
  };
74046
75375
 
75376
+ const LINEAR_PROGRESS_SERIES_COMPILE_ONLY_KEYS = {
75377
+ bandWidth: !0
75378
+ },
75379
+ LINEAR_PROGRESS_SERIES_COMPILE_ONLY_SUB_KEYS = {
75380
+ progress: {
75381
+ topPadding: !0,
75382
+ bottomPadding: !0,
75383
+ leftPadding: !0,
75384
+ rightPadding: !0
75385
+ }
75386
+ };
74047
75387
  class LinearProgressSeries extends CartesianSeries {
74048
75388
  constructor() {
74049
75389
  super(...arguments), this.type = SeriesTypeEnum.linearProgress, this._progressMark = null, this._trackMark = null, this._defaultProgressCustomShape = (datum, attrs, path) => {
@@ -74071,6 +75411,13 @@
74071
75411
  return path;
74072
75412
  };
74073
75413
  }
75414
+ _getSpecUpdatePolicy() {
75415
+ const policy = super._getSpecUpdatePolicy();
75416
+ return Object.assign(Object.assign({}, policy), {
75417
+ compileOnlyKeys: Object.assign(Object.assign({}, policy.compileOnlyKeys), LINEAR_PROGRESS_SERIES_COMPILE_ONLY_KEYS),
75418
+ compileOnlySubKeys: Object.assign(Object.assign({}, policy.compileOnlySubKeys), LINEAR_PROGRESS_SERIES_COMPILE_ONLY_SUB_KEYS)
75419
+ });
75420
+ }
74074
75421
  initMark() {
74075
75422
  this._initTrackMark(), this._initProgressMark();
74076
75423
  }
@@ -81907,6 +83254,9 @@
81907
83254
  }
81908
83255
  };
81909
83256
 
83257
+ const HEATMAP_SERIES_DATA_RELATED_KEYS = {
83258
+ valueField: !0
83259
+ };
81910
83260
  class HeatmapSeries extends CartesianSeries {
81911
83261
  constructor() {
81912
83262
  super(...arguments), this.type = SeriesTypeEnum.heatmap, this.transformerConstructor = HeatmapSeriesSpecTransformer;
@@ -81917,6 +83267,12 @@
81917
83267
  setFieldValue(f) {
81918
83268
  this._fieldValue = array(f);
81919
83269
  }
83270
+ _getSpecUpdatePolicy() {
83271
+ const policy = super._getSpecUpdatePolicy();
83272
+ return Object.assign(Object.assign({}, policy), {
83273
+ dataRelatedKeys: Object.assign(Object.assign({}, policy.dataRelatedKeys), HEATMAP_SERIES_DATA_RELATED_KEYS)
83274
+ });
83275
+ }
81920
83276
  setAttrFromSpec() {
81921
83277
  super.setAttrFromSpec(), this.setFieldValue(this._spec.valueField);
81922
83278
  }
@@ -83446,7 +84802,7 @@
83446
84802
  _getDefaultSeriesSpec(spec) {
83447
84803
  var _a;
83448
84804
  const seriesSpec = super._getDefaultSeriesSpec(spec, ["center", "centerOffset", "cornerRadius", "padAngle", "minAngle", "emptyPlaceholder", "showAllZero", "supportNegative", "useSequentialAnimation", "layoutRadius"]);
83449
- return seriesSpec.categoryField = spec.categoryField || spec.seriesField, seriesSpec.valueField = spec.valueField || spec.angleField, seriesSpec.emptyCircle = null === (_a = spec.emptyPlaceholder) || void 0 === _a ? void 0 : _a.emptyCircle, seriesSpec;
84805
+ return this._addSeriesRelatedSpecKeys(["valueField", "angleField"]), seriesSpec.categoryField = spec.categoryField || spec.seriesField, seriesSpec.valueField = spec.valueField || spec.angleField, seriesSpec.emptyCircle = null === (_a = spec.emptyPlaceholder) || void 0 === _a ? void 0 : _a.emptyCircle, seriesSpec;
83450
84806
  }
83451
84807
  }
83452
84808
 
@@ -83945,7 +85301,7 @@
83945
85301
  _getDefaultSeriesSpec(spec) {
83946
85302
  var _a, _b;
83947
85303
  const series = super._getDefaultSeriesSpec(spec);
83948
- return series.progress = spec.progress, series.track = spec.track, series.tickMask = spec.tickMask, series.cornerRadius = null !== (_a = spec.cornerRadius) && void 0 !== _a ? _a : 0, series.roundCap = null !== (_b = spec.roundCap) && void 0 !== _b && _b, series;
85304
+ return this._addSeriesRelatedSpecKeys(["cornerRadius"]), series.progress = spec.progress, series.track = spec.track, series.tickMask = spec.tickMask, series.cornerRadius = null !== (_a = spec.cornerRadius) && void 0 !== _a ? _a : 0, series.roundCap = null !== (_b = spec.roundCap) && void 0 !== _b && _b, series;
83949
85305
  }
83950
85306
  transformSpec(spec) {
83951
85307
  super.transformSpec(spec), this._transformProgressAxisSpec(spec, {
@@ -84250,7 +85606,7 @@
84250
85606
  }
84251
85607
  _getDefaultSeriesSpec(spec) {
84252
85608
  const series = super._getDefaultSeriesSpec(spec);
84253
- return series.bar = spec.bar, series.stackLabel = spec.stackLabel, series.leaderLine = spec.leaderLine, series.total = spec.total, series.calculationMode = spec.calculationMode, series;
85609
+ return this._addSeriesRelatedSpecKeys(["bar", "stackLabel", "leaderLine", "total", "calculationMode"]), series.bar = spec.bar, series.stackLabel = spec.stackLabel, series.leaderLine = spec.leaderLine, series.total = spec.total, series.calculationMode = spec.calculationMode, series;
84254
85610
  }
84255
85611
  }
84256
85612
 
@@ -84465,6 +85821,13 @@
84465
85821
  return customFilter ? customFilter(data, selectedData, datumField) : (isArray$1(data) && (null === (_b = data[0]) || void 0 === _b ? void 0 : _b.nodes) ? (data[0].nodes = data[0].nodes.filter(d => !0 === selectedFilter[d.key]), (null === (_c = data[0]) || void 0 === _c ? void 0 : _c.links) && (data[0].links = data[0].links.filter(d => !0 === selectedFilter[d.source] && !0 === selectedFilter[d.target]))) : isValid$1(datumField) && (data = data.filter(d => !0 === selectedFilter[series.getSeriesFieldValue(d, datumField)])), data);
84466
85822
  };
84467
85823
 
85824
+ const LEGEND_COMPONENT_ONLY_CHANGE_KEYS = {
85825
+ position: !0,
85826
+ item: !0,
85827
+ title: !0,
85828
+ pager: !0,
85829
+ background: !0
85830
+ };
84468
85831
  class BaseLegend extends BaseComponent {
84469
85832
  constructor() {
84470
85833
  super(...arguments), this.layoutType = "normal", this.layoutZIndex = LayoutZIndex.Legend, this.layoutLevel = LayoutLevel.Legend, this.specKey = "legends", this._orient = "left", this._visible = !0, this._position = "middle", this._preSelectedData = [], this._selectedData = [], this.effect = {
@@ -84515,7 +85878,18 @@
84515
85878
  }
84516
85879
  _compareSpec(spec, prevSpec) {
84517
85880
  const result = super._compareSpec(spec, prevSpec);
84518
- return result.reRender = !0, (null == spec ? void 0 : spec.orient) !== (null == prevSpec ? void 0 : prevSpec.orient) ? (result.reMake = !0, result) : (isEqual(prevSpec, spec) || (result.reCompile = !0), result);
85881
+ result.reRender = !0;
85882
+ const specChanged = !isEqual(prevSpec, spec);
85883
+ return result.reMake ? result : (null == spec ? void 0 : spec.orient) !== (null == prevSpec ? void 0 : prevSpec.orient) ? (result.reMake = !0, result) : specChanged && !result.reCompile && this._isComponentOnlySpecChange(spec, prevSpec) ? (result.effects = Object.assign(Object.assign({}, result.effects), {
85884
+ component: !0,
85885
+ layout: !0,
85886
+ render: !0
85887
+ }), result) : (specChanged && (result.reCompile = !0), result);
85888
+ }
85889
+ _isComponentOnlySpecChange(spec, prevSpec) {
85890
+ const prevSpecRecord = prevSpec,
85891
+ specRecord = spec;
85892
+ return Object.keys(Object.assign(Object.assign({}, prevSpec), spec)).every(key => isEqual(null == prevSpecRecord ? void 0 : prevSpecRecord[key], null == specRecord ? void 0 : specRecord[key]) || LEGEND_COMPONENT_ONLY_CHANGE_KEYS[key]);
84519
85893
  }
84520
85894
  _bindLegendDataChange() {
84521
85895
  this._preSelectedData = this._selectedData.slice(), this._initSelectedData(), this._forceLayout();
@@ -89161,9 +90535,48 @@
89161
90535
  return data;
89162
90536
  }
89163
90537
 
90538
+ const getDataViewsInDataSet = dataView => {
90539
+ var _a;
90540
+ const dataViewMap = null === (_a = null == dataView ? void 0 : dataView.dataSet) || void 0 === _a ? void 0 : _a.dataViewMap;
90541
+ return dataViewMap ? Object.values(dataViewMap).filter(Boolean) : [];
90542
+ },
90543
+ detachDataViewListener = (source, target) => {
90544
+ var _a, _b;
90545
+ null === (_a = null == source ? void 0 : source.target) || void 0 === _a || _a.removeListener("change", target.reRunAllTransform), null === (_b = null == source ? void 0 : source.target) || void 0 === _b || _b.removeListener("markRunning", target.markRunning);
90546
+ };
90547
+ const detachDataViewDependencies = dataView => {
90548
+ if (!dataView) return;
90549
+ getDataViewsInDataSet(dataView).forEach(source => {
90550
+ detachDataViewListener(source, dataView);
90551
+ });
90552
+ const dependencies = null == dataView ? void 0 : dataView.rawData;
90553
+ Array.isArray(dependencies) && dependencies.forEach(dependency => {
90554
+ detachDataViewListener(dependency, dataView);
90555
+ });
90556
+ };
90557
+ const releaseDataViews = dataViews => {
90558
+ const releaseDataViews = Array.from(new Set(dataViews.filter(Boolean)));
90559
+ releaseDataViews.length && (releaseDataViews.forEach(detachDataViewDependencies), releaseDataViews.forEach(dataView => {
90560
+ var _a;
90561
+ null === (_a = dataView.destroy) || void 0 === _a || _a.call(dataView);
90562
+ }));
90563
+ };
90564
+ const releaseDataViewWithDependencies = (dataView, shouldReleaseDependency) => {
90565
+ if (!dataView) return;
90566
+ const dataViewsInDataSet = new Set(getDataViewsInDataSet(dataView)),
90567
+ releaseDependencies = [],
90568
+ collectReleaseDependencies = currentDataView => {
90569
+ const dependencies = null == currentDataView ? void 0 : currentDataView.rawData;
90570
+ Array.isArray(dependencies) && dependencies.forEach(dependency => {
90571
+ dataViewsInDataSet.has(dependency) && shouldReleaseDependency(dependency) && !releaseDependencies.includes(dependency) && (releaseDependencies.push(dependency), collectReleaseDependencies(dependency));
90572
+ });
90573
+ };
90574
+ collectReleaseDependencies(dataView), releaseDataViews([dataView, ...releaseDependencies]);
90575
+ };
90576
+
89164
90577
  class BaseMarker extends BaseComponent {
89165
90578
  constructor() {
89166
- super(...arguments), this.layoutType = "none", this._layoutOffsetX = 0, this._layoutOffsetY = 0;
90579
+ super(...arguments), this.layoutType = "none", this._markerDataChangeHandler = null, this._markerDataOwned = !1, this._layoutOffsetX = 0, this._layoutOffsetY = 0;
89167
90580
  }
89168
90581
  getRelativeSeries() {
89169
90582
  return this._relativeSeries;
@@ -89237,6 +90650,19 @@
89237
90650
  }
89238
90651
  return this._relativeSeries.getViewData();
89239
90652
  }
90653
+ _setMarkerData(data, owned = !1) {
90654
+ this._releaseMarkerData(), this._markerData = data, this._markerDataOwned = owned;
90655
+ }
90656
+ _bindMarkerDataChange() {
90657
+ var _a;
90658
+ (null === (_a = this._markerData) || void 0 === _a ? void 0 : _a.target) && (this._markerDataChangeHandler = () => {
90659
+ this._markerLayout();
90660
+ }, this._markerData.target.on("change", this._markerDataChangeHandler));
90661
+ }
90662
+ _releaseMarkerData() {
90663
+ const markerData = this._markerData;
90664
+ (null == markerData ? void 0 : markerData.target) && this._markerDataChangeHandler && markerData.target.removeListener("change", this._markerDataChangeHandler), this._markerDataChangeHandler = null, this._markerDataOwned && releaseDataViewWithDependencies(markerData, dataView => dataView.name === `${this.type}_${this.id}_data`), this._markerData = null, this._markerDataOwned = !1;
90665
+ }
89240
90666
  updateLayoutAttribute() {
89241
90667
  var _a, _b, _c;
89242
90668
  if (null === (_a = this._spec.visible) || void 0 === _a || _a) {
@@ -89263,7 +90689,10 @@
89263
90689
  "cartesian" !== this._relativeSeries.coordinate && (this._relativeSeries.event.on("zoom", this._markerLayout.bind(this)), this._relativeSeries.event.on("panmove", this._markerLayout.bind(this)), this._relativeSeries.event.on("scroll", this._markerLayout.bind(this)));
89264
90690
  }
89265
90691
  clear() {
89266
- super.clear(), this._firstSeries = null;
90692
+ super.clear(), this._markerComponent = null, this._firstSeries = null;
90693
+ }
90694
+ release() {
90695
+ this._releaseMarkerData(), super.release();
89267
90696
  }
89268
90697
  _getFirstSeries() {
89269
90698
  var _a;
@@ -89298,9 +90727,7 @@
89298
90727
  }), data.transform({
89299
90728
  type: "markerFilter",
89300
90729
  options: this._getAllRelativeSeries()
89301
- }), data.target.on("change", () => {
89302
- this._markerLayout();
89303
- }), this._markerData = data;
90730
+ }), this._setMarkerData(data, !0), this._bindMarkerDataChange();
89304
90731
  }
89305
90732
  }
89306
90733
 
@@ -89444,7 +90871,7 @@
89444
90871
  doRadAngAng1Process: doRadAngAng1Process,
89445
90872
  doRadAngProcess: doRadAngProcess
89446
90873
  } = getMarkLineProcessInfo(spec);
89447
- if (this._markerData = this._getRelativeDataView(), !(doXProcess || doYProcess || doXYY1Process || doYXX1Process || doXYProcess || doAngleProcess || doRadiusProcess || doAngRadRad1Process || doRadAngAng1Process || doRadAngProcess || isCoordinateProcess)) return;
90874
+ if (this._setMarkerData(this._getRelativeDataView()), !(doXProcess || doYProcess || doXYY1Process || doYXX1Process || doXYProcess || doAngleProcess || doRadiusProcess || doAngRadRad1Process || doRadAngAng1Process || doRadAngProcess || isCoordinateProcess)) return;
89448
90875
  registerDataSetInstanceTransform(this._option.dataSet, "markerAggregation", markerAggregation), registerDataSetInstanceTransform(this._option.dataSet, "markerRegression", markerRegression), registerDataSetInstanceTransform(this._option.dataSet, "markerFilter", markerFilter);
89449
90876
  const {
89450
90877
  options: options,
@@ -89464,9 +90891,7 @@
89464
90891
  }), data.transform({
89465
90892
  type: "markerFilter",
89466
90893
  options: this._getAllRelativeSeries()
89467
- }), data.target.on("change", () => {
89468
- this._markerLayout();
89469
- }), this._markerData = data;
90894
+ }), this._setMarkerData(data, !0), this._bindMarkerDataChange();
89470
90895
  }
89471
90896
  }
89472
90897
  BaseMarkLine.specKey = "markLine";
@@ -89905,8 +91330,13 @@
89905
91330
  return getSpecInfo(chartSpec, this.specKey, ComponentTypeEnum.title, s => !1 !== s.visible);
89906
91331
  }
89907
91332
  _compareSpec(spec, prevSpec) {
89908
- const result = super._compareSpec(spec, prevSpec);
89909
- return (null == prevSpec ? void 0 : prevSpec.orient) === (null == spec ? void 0 : spec.orient) && (null == prevSpec ? void 0 : prevSpec.visible) === spec.visible || (result.reMake = !0), result.change = !0, result.reRender = !0, result;
91333
+ const result = super._compareSpec(spec, prevSpec),
91334
+ specChanged = !isEqual(prevSpec, spec);
91335
+ return (null == prevSpec ? void 0 : prevSpec.orient) === (null == spec ? void 0 : spec.orient) && (null == prevSpec ? void 0 : prevSpec.visible) === spec.visible || (result.reMake = !0), result.change = !0, result.reRender = !0, specChanged && !result.reMake && (result.effects = Object.assign(Object.assign({}, result.effects), {
91336
+ component: !0,
91337
+ layout: !0,
91338
+ render: !0
91339
+ })), result;
89910
91340
  }
89911
91341
  afterSetLayoutStartPoint(pos) {
89912
91342
  isValidNumber$1(pos.x) && this._titleComponent && this._titleComponent.setAttribute("x", pos.x), isValidNumber$1(pos.y) && this._titleComponent && this._titleComponent.setAttribute("y", pos.y), super.afterSetLayoutStartPoint(pos);
@@ -90903,7 +92333,7 @@
90903
92333
  });
90904
92334
  }), Object.keys(removedComponents).forEach(name => {
90905
92335
  const comp = removedComponents[name];
90906
- comp && (comp.release(), this._labelComponentMap.delete(comp));
92336
+ comp && (comp.releaseWithExitAnimation() || comp.release(), this._labelComponentMap.delete(comp));
90907
92337
  });
90908
92338
  }
90909
92339
  _initTextMarkStyle() {
@@ -91552,6 +92982,9 @@
91552
92982
  });
91553
92983
  });
91554
92984
  }
92985
+ reInit(spec) {
92986
+ super.reInit(spec), this.init();
92987
+ }
91555
92988
  _initNeedOperatedItem() {
91556
92989
  const seriesUserId = this._spec.seriesId,
91557
92990
  seriesIndex = this._spec.seriesIndex;