@visactor/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.
Files changed (262) hide show
  1. package/build/es5/index.js +3 -3
  2. package/build/index.es.js +2290 -473
  3. package/build/index.js +2290 -473
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/chart/base/base-chart-transformer.d.ts +3 -0
  7. package/cjs/chart/base/base-chart-transformer.js +21 -1
  8. package/cjs/chart/base/base-chart-transformer.js.map +1 -1
  9. package/cjs/chart/base/base-chart.d.ts +15 -9
  10. package/cjs/chart/base/base-chart.js +115 -24
  11. package/cjs/chart/base/base-chart.js.map +1 -1
  12. package/cjs/chart/interface/chart.d.ts +1 -0
  13. package/cjs/chart/interface/chart.js.map +1 -1
  14. package/cjs/chart/pie/base/pie-transformer.js +2 -2
  15. package/cjs/chart/pie/base/pie-transformer.js.map +1 -1
  16. package/cjs/chart/progress/circular/circular-progress-transformer.js +2 -2
  17. package/cjs/chart/progress/circular/circular-progress-transformer.js.map +1 -1
  18. package/cjs/chart/util.d.ts +4 -1
  19. package/cjs/chart/util.js +40 -4
  20. package/cjs/chart/util.js.map +1 -1
  21. package/cjs/chart/waterfall/waterfall-transformer.js +2 -1
  22. package/cjs/chart/waterfall/waterfall-transformer.js.map +1 -1
  23. package/cjs/compile/compiler.js +2 -2
  24. package/cjs/compile/compiler.js.map +1 -1
  25. package/cjs/compile/data/compilable-data.d.ts +1 -1
  26. package/cjs/compile/data/compilable-data.js +1 -1
  27. package/cjs/compile/data/compilable-data.js.map +1 -1
  28. package/cjs/compile/grammar-item.d.ts +1 -1
  29. package/cjs/compile/grammar-item.js.map +1 -1
  30. package/cjs/compile/interface/compilable-item.d.ts +1 -1
  31. package/cjs/compile/interface/compilable-item.js.map +1 -1
  32. package/cjs/component/axis/base-axis.d.ts +2 -7
  33. package/cjs/component/axis/base-axis.js +25 -3
  34. package/cjs/component/axis/base-axis.js.map +1 -1
  35. package/cjs/component/axis/cartesian/band-axis.d.ts +1 -7
  36. package/cjs/component/base/base-component.d.ts +7 -7
  37. package/cjs/component/base/base-component.js +41 -6
  38. package/cjs/component/base/base-component.js.map +1 -1
  39. package/cjs/component/base/release-vrender-component.d.ts +10 -0
  40. package/cjs/component/base/release-vrender-component.js +37 -0
  41. package/cjs/component/base/release-vrender-component.js.map +1 -0
  42. package/cjs/component/brush/brush.d.ts +2 -7
  43. package/cjs/component/brush/brush.js +3 -0
  44. package/cjs/component/brush/brush.js.map +1 -1
  45. package/cjs/component/crosshair/base.d.ts +1 -7
  46. package/cjs/component/custom-mark/custom-mark.d.ts +1 -7
  47. package/cjs/component/data-zoom/data-filter-base-component.d.ts +1 -7
  48. package/cjs/component/geo/geo-coordinate.d.ts +1 -7
  49. package/cjs/component/index.js +1 -2
  50. package/cjs/component/label/base-label.d.ts +1 -7
  51. package/cjs/component/label/label.js +1 -1
  52. package/cjs/component/label/label.js.map +1 -1
  53. package/cjs/component/legend/base-legend.d.ts +2 -7
  54. package/cjs/component/legend/base-legend.js +20 -3
  55. package/cjs/component/legend/base-legend.js.map +1 -1
  56. package/cjs/component/marker/base-marker.d.ts +7 -7
  57. package/cjs/component/marker/base-marker.js +23 -6
  58. package/cjs/component/marker/base-marker.js.map +1 -1
  59. package/cjs/component/marker/mark-line/base-mark-line.js +2 -4
  60. package/cjs/component/marker/mark-line/base-mark-line.js.map +1 -1
  61. package/cjs/component/title/title.d.ts +1 -7
  62. package/cjs/component/title/title.js +6 -2
  63. package/cjs/component/title/title.js.map +1 -1
  64. package/cjs/constant/attribute.js +2 -1
  65. package/cjs/constant/scatter.js +1 -2
  66. package/cjs/constant/waterfall.js +2 -1
  67. package/cjs/core/factory.js +1 -1
  68. package/cjs/core/index.js +1 -1
  69. package/cjs/core/vchart.d.ts +5 -1
  70. package/cjs/core/vchart.js +28 -12
  71. package/cjs/core/vchart.js.map +1 -1
  72. package/cjs/data/data-view-utils.d.ts +5 -0
  73. package/cjs/data/data-view-utils.js +58 -0
  74. package/cjs/data/data-view-utils.js.map +1 -0
  75. package/cjs/env/env.js +1 -1
  76. package/cjs/env/index.js +1 -1
  77. package/cjs/mark/base/base-mark.d.ts +12 -2
  78. package/cjs/mark/base/base-mark.js +85 -21
  79. package/cjs/mark/base/base-mark.js.map +1 -1
  80. package/cjs/mark/component.d.ts +9 -0
  81. package/cjs/mark/component.js +51 -3
  82. package/cjs/mark/component.js.map +1 -1
  83. package/cjs/mark/group.js +1 -1
  84. package/cjs/mark/group.js.map +1 -1
  85. package/cjs/mark/interface/mark.d.ts +2 -0
  86. package/cjs/mark/interface/mark.js.map +1 -1
  87. package/cjs/model/base-model.d.ts +3 -15
  88. package/cjs/model/base-model.js.map +1 -1
  89. package/cjs/model/interface.d.ts +13 -0
  90. package/cjs/model/interface.js.map +1 -1
  91. package/cjs/region/region.d.ts +1 -7
  92. package/cjs/series/area/area.d.ts +2 -0
  93. package/cjs/series/area/area.js +6 -0
  94. package/cjs/series/area/area.js.map +1 -1
  95. package/cjs/series/bar/bar.d.ts +3 -0
  96. package/cjs/series/bar/bar.js +30 -4
  97. package/cjs/series/bar/bar.js.map +1 -1
  98. package/cjs/series/base/base-series.d.ts +8 -7
  99. package/cjs/series/base/base-series.js +54 -13
  100. package/cjs/series/base/base-series.js.map +1 -1
  101. package/cjs/series/base/constant.d.ts +3 -0
  102. package/cjs/series/base/constant.js +9 -1
  103. package/cjs/series/base/constant.js.map +1 -1
  104. package/cjs/series/box-plot/box-plot.d.ts +2 -0
  105. package/cjs/series/box-plot/box-plot.js +14 -2
  106. package/cjs/series/box-plot/box-plot.js.map +1 -1
  107. package/cjs/series/heatmap/heatmap.d.ts +2 -0
  108. package/cjs/series/heatmap/heatmap.js +10 -0
  109. package/cjs/series/heatmap/heatmap.js.map +1 -1
  110. package/cjs/series/line/line.d.ts +2 -0
  111. package/cjs/series/line/line.js +6 -0
  112. package/cjs/series/line/line.js.map +1 -1
  113. package/cjs/series/mixin/line-mixin.d.ts +1 -0
  114. package/cjs/series/mixin/line-mixin.js +6 -1
  115. package/cjs/series/mixin/line-mixin.js.map +1 -1
  116. package/cjs/series/pie/pie.d.ts +3 -7
  117. package/cjs/series/pie/pie.js +16 -1
  118. package/cjs/series/pie/pie.js.map +1 -1
  119. package/cjs/series/progress/circular/circular.d.ts +2 -0
  120. package/cjs/series/progress/circular/circular.js +9 -1
  121. package/cjs/series/progress/circular/circular.js.map +1 -1
  122. package/cjs/series/progress/linear/linear.d.ts +2 -0
  123. package/cjs/series/progress/linear/linear.js +17 -1
  124. package/cjs/series/progress/linear/linear.js.map +1 -1
  125. package/cjs/series/scatter/scatter.d.ts +2 -0
  126. package/cjs/series/scatter/scatter.js +9 -1
  127. package/cjs/series/scatter/scatter.js.map +1 -1
  128. package/cjs/series/waterfall/waterfall.d.ts +2 -0
  129. package/cjs/series/waterfall/waterfall.js +10 -0
  130. package/cjs/series/waterfall/waterfall.js.map +1 -1
  131. package/cjs/util/graphic-state.d.ts +1 -0
  132. package/cjs/util/graphic-state.js +19 -4
  133. package/cjs/util/graphic-state.js.map +1 -1
  134. package/esm/chart/base/base-chart-transformer.d.ts +3 -0
  135. package/esm/chart/base/base-chart-transformer.js +22 -0
  136. package/esm/chart/base/base-chart-transformer.js.map +1 -1
  137. package/esm/chart/base/base-chart.d.ts +15 -9
  138. package/esm/chart/base/base-chart.js +111 -23
  139. package/esm/chart/base/base-chart.js.map +1 -1
  140. package/esm/chart/interface/chart.d.ts +1 -0
  141. package/esm/chart/interface/chart.js.map +1 -1
  142. package/esm/chart/pie/base/pie-transformer.js +2 -2
  143. package/esm/chart/pie/base/pie-transformer.js.map +1 -1
  144. package/esm/chart/progress/circular/circular-progress-transformer.js +2 -2
  145. package/esm/chart/progress/circular/circular-progress-transformer.js.map +1 -1
  146. package/esm/chart/util.d.ts +4 -1
  147. package/esm/chart/util.js +34 -1
  148. package/esm/chart/util.js.map +1 -1
  149. package/esm/chart/waterfall/waterfall-transformer.js +2 -1
  150. package/esm/chart/waterfall/waterfall-transformer.js.map +1 -1
  151. package/esm/compile/compiler.js +2 -2
  152. package/esm/compile/compiler.js.map +1 -1
  153. package/esm/compile/data/compilable-data.d.ts +1 -1
  154. package/esm/compile/data/compilable-data.js +1 -1
  155. package/esm/compile/data/compilable-data.js.map +1 -1
  156. package/esm/compile/grammar-item.d.ts +1 -1
  157. package/esm/compile/grammar-item.js.map +1 -1
  158. package/esm/compile/interface/compilable-item.d.ts +1 -1
  159. package/esm/compile/interface/compilable-item.js.map +1 -1
  160. package/esm/component/axis/base-axis.d.ts +2 -7
  161. package/esm/component/axis/base-axis.js +25 -2
  162. package/esm/component/axis/base-axis.js.map +1 -1
  163. package/esm/component/axis/cartesian/band-axis.d.ts +1 -7
  164. package/esm/component/base/base-component.d.ts +7 -7
  165. package/esm/component/base/base-component.js +41 -5
  166. package/esm/component/base/base-component.js.map +1 -1
  167. package/esm/component/base/release-vrender-component.d.ts +10 -0
  168. package/esm/component/base/release-vrender-component.js +24 -0
  169. package/esm/component/base/release-vrender-component.js.map +1 -0
  170. package/esm/component/brush/brush.d.ts +2 -7
  171. package/esm/component/brush/brush.js +3 -0
  172. package/esm/component/brush/brush.js.map +1 -1
  173. package/esm/component/crosshair/base.d.ts +1 -7
  174. package/esm/component/custom-mark/custom-mark.d.ts +1 -7
  175. package/esm/component/data-zoom/data-filter-base-component.d.ts +1 -7
  176. package/esm/component/geo/geo-coordinate.d.ts +1 -7
  177. package/esm/component/index.js +1 -2
  178. package/esm/component/label/base-label.d.ts +1 -7
  179. package/esm/component/label/label.js +1 -1
  180. package/esm/component/label/label.js.map +1 -1
  181. package/esm/component/legend/base-legend.d.ts +2 -7
  182. package/esm/component/legend/base-legend.js +20 -2
  183. package/esm/component/legend/base-legend.js.map +1 -1
  184. package/esm/component/marker/base-marker.d.ts +7 -7
  185. package/esm/component/marker/base-marker.js +24 -5
  186. package/esm/component/marker/base-marker.js.map +1 -1
  187. package/esm/component/marker/mark-line/base-mark-line.js +2 -4
  188. package/esm/component/marker/mark-line/base-mark-line.js.map +1 -1
  189. package/esm/component/title/title.d.ts +1 -7
  190. package/esm/component/title/title.js +6 -2
  191. package/esm/component/title/title.js.map +1 -1
  192. package/esm/constant/attribute.js +2 -1
  193. package/esm/constant/scatter.js +1 -2
  194. package/esm/constant/waterfall.js +2 -1
  195. package/esm/core/factory.js +1 -1
  196. package/esm/core/index.js +1 -1
  197. package/esm/core/vchart.d.ts +5 -1
  198. package/esm/core/vchart.js +29 -12
  199. package/esm/core/vchart.js.map +1 -1
  200. package/esm/data/data-view-utils.d.ts +5 -0
  201. package/esm/data/data-view-utils.js +46 -0
  202. package/esm/data/data-view-utils.js.map +1 -0
  203. package/esm/env/env.js +1 -1
  204. package/esm/env/index.js +1 -1
  205. package/esm/mark/base/base-mark.d.ts +12 -2
  206. package/esm/mark/base/base-mark.js +85 -20
  207. package/esm/mark/base/base-mark.js.map +1 -1
  208. package/esm/mark/component.d.ts +9 -0
  209. package/esm/mark/component.js +51 -2
  210. package/esm/mark/component.js.map +1 -1
  211. package/esm/mark/group.js +1 -1
  212. package/esm/mark/group.js.map +1 -1
  213. package/esm/mark/interface/mark.d.ts +2 -0
  214. package/esm/mark/interface/mark.js.map +1 -1
  215. package/esm/model/base-model.d.ts +3 -15
  216. package/esm/model/base-model.js.map +1 -1
  217. package/esm/model/interface.d.ts +13 -0
  218. package/esm/model/interface.js.map +1 -1
  219. package/esm/region/region.d.ts +1 -7
  220. package/esm/series/area/area.d.ts +2 -0
  221. package/esm/series/area/area.js +7 -1
  222. package/esm/series/area/area.js.map +1 -1
  223. package/esm/series/bar/bar.d.ts +3 -0
  224. package/esm/series/bar/bar.js +30 -4
  225. package/esm/series/bar/bar.js.map +1 -1
  226. package/esm/series/base/base-series.d.ts +8 -7
  227. package/esm/series/base/base-series.js +50 -11
  228. package/esm/series/base/base-series.js.map +1 -1
  229. package/esm/series/base/constant.d.ts +3 -0
  230. package/esm/series/base/constant.js +10 -0
  231. package/esm/series/base/constant.js.map +1 -1
  232. package/esm/series/box-plot/box-plot.d.ts +2 -0
  233. package/esm/series/box-plot/box-plot.js +13 -2
  234. package/esm/series/box-plot/box-plot.js.map +1 -1
  235. package/esm/series/heatmap/heatmap.d.ts +2 -0
  236. package/esm/series/heatmap/heatmap.js +10 -0
  237. package/esm/series/heatmap/heatmap.js.map +1 -1
  238. package/esm/series/line/line.d.ts +2 -0
  239. package/esm/series/line/line.js +7 -1
  240. package/esm/series/line/line.js.map +1 -1
  241. package/esm/series/mixin/line-mixin.d.ts +1 -0
  242. package/esm/series/mixin/line-mixin.js +5 -0
  243. package/esm/series/mixin/line-mixin.js.map +1 -1
  244. package/esm/series/pie/pie.d.ts +3 -7
  245. package/esm/series/pie/pie.js +17 -0
  246. package/esm/series/pie/pie.js.map +1 -1
  247. package/esm/series/progress/circular/circular.d.ts +2 -0
  248. package/esm/series/progress/circular/circular.js +10 -0
  249. package/esm/series/progress/circular/circular.js.map +1 -1
  250. package/esm/series/progress/linear/linear.d.ts +2 -0
  251. package/esm/series/progress/linear/linear.js +18 -0
  252. package/esm/series/progress/linear/linear.js.map +1 -1
  253. package/esm/series/scatter/scatter.d.ts +2 -0
  254. package/esm/series/scatter/scatter.js +10 -0
  255. package/esm/series/scatter/scatter.js.map +1 -1
  256. package/esm/series/waterfall/waterfall.d.ts +2 -0
  257. package/esm/series/waterfall/waterfall.js +10 -0
  258. package/esm/series/waterfall/waterfall.js.map +1 -1
  259. package/esm/util/graphic-state.d.ts +1 -0
  260. package/esm/util/graphic-state.js +16 -3
  261. package/esm/util/graphic-state.js.map +1 -1
  262. package/package.json +11 -10
package/build/index.es.js CHANGED
@@ -14961,6 +14961,12 @@ function ensureStageStatePerfMonitor(stage) {
14961
14961
  function getStageStatePerfMonitor(stage) {
14962
14962
  if (stage) return stage[STAGE_PERF_MONITOR];
14963
14963
  }
14964
+ function getActiveStageStatePerfMonitor(stage) {
14965
+ var _a;
14966
+ if (!stage) return;
14967
+ const current = getStageStatePerfMonitor(stage);
14968
+ return current || (!0 === (null === (_a = stage.statePerfConfig) || void 0 === _a ? void 0 : _a.enabled) ? ensureStageStatePerfMonitor(stage) : void 0);
14969
+ }
14964
14970
 
14965
14971
  function isPlainObject$1(value) {
14966
14972
  return null != value && "object" == typeof value && !Array.isArray(value);
@@ -15056,7 +15062,7 @@ class StateEngine {
15056
15062
  }
15057
15063
  invalidateResolverCache() {
15058
15064
  var _a, _b;
15059
- 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");
15065
+ 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");
15060
15066
  }
15061
15067
  hasState(stateName) {
15062
15068
  return !!this._activeStates.length && (null == stateName || this._activeStates.includes(stateName));
@@ -15103,7 +15109,7 @@ class StateEngine {
15103
15109
  }
15104
15110
  recomputePatch(effectiveStates) {
15105
15111
  var _a;
15106
- const perfMonitor = getStageStatePerfMonitor(null === (_a = this.graphic) || void 0 === _a ? void 0 : _a.stage),
15112
+ const perfMonitor = getActiveStageStatePerfMonitor(null === (_a = this.graphic) || void 0 === _a ? void 0 : _a.stage),
15107
15113
  patchStart = perfMonitor ? performance.now() : 0;
15108
15114
  let resolverCost = 0;
15109
15115
  const cacheKey = effectiveStates.join(","),
@@ -15351,32 +15357,6 @@ class StateStyleResolver {
15351
15357
  }
15352
15358
  }), resolvedAttrs;
15353
15359
  }
15354
- resolveWithCompiled(normalAttrs, compiledDefinitions, stateProxy, effectiveStates, resolvedPatch) {
15355
- var _a, _b;
15356
- const mergeMode = null !== (_a = this.options.mergeMode) && void 0 !== _a ? _a : "shallow",
15357
- resolvedAttrs = null !== (_b = cloneValue(resolvedPatch)) && void 0 !== _b ? _b : {};
15358
- return effectiveStates.forEach(stateName => {
15359
- const proxyPatch = null == stateProxy ? void 0 : stateProxy(stateName, effectiveStates);
15360
- null != proxyPatch && Object.keys(proxyPatch).forEach(key => {
15361
- const nextValue = proxyPatch[key],
15362
- hasCompiledDefinition = compiledDefinitions.has(stateName);
15363
- if ("deep" === mergeMode && isPlainObject(nextValue) && (isPlainObject(resolvedAttrs[key]) || !hasCompiledDefinition && isPlainObject(normalAttrs[key]))) {
15364
- const baseValue = isPlainObject(resolvedAttrs[key]) ? resolvedAttrs[key] : isPlainObject(normalAttrs[key]) ? normalAttrs[key] : {};
15365
- resolvedAttrs[key] = deepMerge(baseValue, nextValue);
15366
- } else resolvedAttrs[key] = cloneValue(nextValue);
15367
- });
15368
- }), resolvedAttrs;
15369
- }
15370
- computeNormalAttrsBackup(normalAttrs, targetAttrs, finalAttribute) {
15371
- const nextNormalAttrs = {},
15372
- nextTargetAttrs = Object.assign({}, targetAttrs);
15373
- for (const key in targetAttrs) Object.prototype.hasOwnProperty.call(targetAttrs, key) && (nextNormalAttrs[key] = cloneValue(normalAttrs && key in normalAttrs ? normalAttrs[key] : finalAttribute[key]));
15374
- if (normalAttrs) for (const key in normalAttrs) Object.prototype.hasOwnProperty.call(normalAttrs, key) && !(key in targetAttrs) && (nextTargetAttrs[key] = cloneValue(normalAttrs[key]));
15375
- return {
15376
- attrs: nextTargetAttrs,
15377
- normalAttrs: nextNormalAttrs
15378
- };
15379
- }
15380
15360
  }
15381
15361
 
15382
15362
  function hasOwnKeys(value) {
@@ -15511,7 +15491,7 @@ function rebuildSharedStateScope(scope) {
15511
15491
  }
15512
15492
  function ensureSharedStateScopeFresh(scope) {
15513
15493
  var _a;
15514
- 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;
15494
+ 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;
15515
15495
  }
15516
15496
  function collectSharedStateScopeChain(scope) {
15517
15497
  const chain = [];
@@ -15522,7 +15502,7 @@ function collectSharedStateScopeChain(scope) {
15522
15502
 
15523
15503
  function scheduleStageSharedStateRefresh(stage) {
15524
15504
  var _a;
15525
- stage && "released" !== stage.releaseStatus && (null === (_a = getStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordRefresh("renderScheduled"), stage.renderNextFrame());
15505
+ stage && "released" !== stage.releaseStatus && (null === (_a = getActiveStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordRefresh("renderScheduled"), stage.renderNextFrame());
15526
15506
  }
15527
15507
  function enqueueGraphicSharedStateRefresh(stage, graphic) {
15528
15508
  var _a;
@@ -15530,7 +15510,7 @@ function enqueueGraphicSharedStateRefresh(stage, graphic) {
15530
15510
  const pending = null !== (_a = stage._pendingSharedStateRefreshGraphics) && void 0 !== _a ? _a : stage._pendingSharedStateRefreshGraphics = new Set();
15531
15511
  if (!pending.has(graphic)) {
15532
15512
  pending.add(graphic);
15533
- const perfMonitor = getStageStatePerfMonitor(stage);
15513
+ const perfMonitor = getActiveStageStatePerfMonitor(stage);
15534
15514
  null == perfMonitor || perfMonitor.recordRefresh("queuedGraphics"), null == perfMonitor || perfMonitor.recordAllocation("refreshQueuePushes");
15535
15515
  }
15536
15516
  }
@@ -15545,12 +15525,13 @@ function markScopeActiveDescendantsDirty(scope, stage) {
15545
15525
  function flushStageSharedStateRefresh(stage) {
15546
15526
  const pending = stage._pendingSharedStateRefreshGraphics;
15547
15527
  if (!pending || !pending.size) return;
15548
- const perfMonitor = getStageStatePerfMonitor(stage),
15528
+ const perfMonitor = getActiveStageStatePerfMonitor(stage),
15549
15529
  start = perfMonitor ? performance.now() : 0,
15550
15530
  graphics = Array.from(pending.values());
15551
15531
  pending.clear(), null == perfMonitor || perfMonitor.recordRefresh("flushedGraphics", graphics.length), graphics.forEach(graphic => {
15552
15532
  if ("released" === graphic.releaseStatus) return;
15553
15533
  if (graphic.stage !== stage) return;
15534
+ if (!graphic.sharedStateDirty) return;
15554
15535
  const refresh = graphic.refreshSharedStateBeforeRender;
15555
15536
  "function" == typeof refresh && (refresh.call(graphic), null == perfMonitor || perfMonitor.incrementCounter("sharedRefreshCommits"));
15556
15537
  }), perfMonitor && (perfMonitor.recordCost("sharedRefresh", performance.now() - start), perfMonitor.recordEvent("shared-refresh-flush", {
@@ -15567,9 +15548,12 @@ const tempConstantXYKey = ["x", "y"],
15567
15548
  tempConstantScaleXYKey = ["scaleX", "scaleY"],
15568
15549
  tempConstantAngleKey = ["angle"],
15569
15550
  builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
15570
- point = new Point();
15551
+ FULL_STATE_DEFINITION_KEYS = new Set(["name", "patch", "priority", "exclude", "suppress", "resolver", "declaredAffectedKeys"]),
15552
+ point = new Point(),
15553
+ EMPTY_STATE_NAMES = [],
15554
+ BROAD_UPDATE_CATEGORY = UpdateCategory.PAINT | UpdateCategory.SHAPE | UpdateCategory.BOUNDS | UpdateCategory.TRANSFORM | UpdateCategory.LAYOUT;
15571
15555
  function isPlainObjectValue(value) {
15572
- return "object" == typeof value && null != value && !isArray$1(value);
15556
+ return "object" == typeof value && null != value && !Array.isArray(value);
15573
15557
  }
15574
15558
  function cloneAttributeValue(value) {
15575
15559
  if (!isPlainObjectValue(value)) return value;
@@ -15580,12 +15564,6 @@ function cloneAttributeValue(value) {
15580
15564
  clone[key] = isPlainObjectValue(nextValue) ? cloneAttributeValue(nextValue) : nextValue;
15581
15565
  }), clone;
15582
15566
  }
15583
- function cloneSimpleAttributeRecord(value) {
15584
- return isPlainObjectValue(value) ? Object.assign({}, value) : value;
15585
- }
15586
- function shouldUseSimpleAttributeFastPath(value) {
15587
- return !!isPlainObjectValue(value) && !Object.keys(value).some(key => isPlainObjectValue(value[key]));
15588
- }
15589
15567
  function cloneAttributeSurface(value) {
15590
15568
  if (!isPlainObjectValue(value)) return value;
15591
15569
  const source = value,
@@ -15595,6 +15573,9 @@ function cloneAttributeSurface(value) {
15595
15573
  clone[key] = isPlainObjectValue(nextValue) ? Object.assign({}, nextValue) : nextValue;
15596
15574
  }), clone;
15597
15575
  }
15576
+ function areAttributeValuesEqual(left, right) {
15577
+ return left === right || !!(isPlainObjectValue(left) || isPlainObjectValue(right) || Array.isArray(left) || Array.isArray(right)) && isEqual(left, right);
15578
+ }
15598
15579
  function deepMergeAttributeValue(base, value) {
15599
15580
  var _a;
15600
15581
  const result = null !== (_a = cloneAttributeValue(base)) && void 0 !== _a ? _a : {};
@@ -15657,18 +15638,24 @@ class Graphic extends Node {
15657
15638
  get globalTransMatrix() {
15658
15639
  return this.tryUpdateGlobalTransMatrix(!0);
15659
15640
  }
15641
+ get baseAttributes() {
15642
+ var _a;
15643
+ return null !== (_a = this._baseAttributes) && void 0 !== _a ? _a : this.attribute;
15644
+ }
15645
+ set baseAttributes(value) {
15646
+ value !== this.attribute ? this._baseAttributes = value : this._baseAttributes = void 0;
15647
+ }
15660
15648
  constructor(params = {}) {
15661
15649
  var _a;
15662
- super(), this.resolverEpoch = 0, this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT;
15663
- const useSimpleAttributeFastPath = shouldUseSimpleAttributeFastPath(params),
15664
- initialBaseAttributes = useSimpleAttributeFastPath ? cloneSimpleAttributeRecord(params) : cloneAttributeValue(params);
15665
- 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);
15650
+ 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);
15666
15651
  }
15667
15652
  get normalAttrs() {
15668
15653
  return this.baseAttributes;
15669
15654
  }
15670
- set normalAttrs(value) {
15671
- this._deprecatedNormalAttrsView = null != value ? value : void 0;
15655
+ set normalAttrs(_value) {}
15656
+ getBaseAttributesStorage() {
15657
+ var _a;
15658
+ return null !== (_a = this._baseAttributes) && void 0 !== _a ? _a : this.attribute;
15672
15659
  }
15673
15660
  getGraphicService() {
15674
15661
  var _a, _b;
@@ -15699,10 +15686,18 @@ class Graphic extends Node {
15699
15686
  const nextScope = this.resolveBoundSharedStateScope();
15700
15687
  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);
15701
15688
  }
15702
- syncSharedStateActiveRegistrations() {
15689
+ syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
15703
15690
  var _a, _b;
15704
- const nextScopes = (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && this.boundSharedStateScope ? new Set(collectSharedStateScopeChain(this.boundSharedStateScope)) : new Set();
15705
- (null !== (_b = this.registeredActiveScopes) && void 0 !== _b ? _b : new Set()).forEach(scope => {
15691
+ 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);
15692
+ }
15693
+ syncSharedStateActiveRegistrations() {
15694
+ var _a;
15695
+ const previousScopes = this.registeredActiveScopes;
15696
+ if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach(scope => {
15697
+ scope.subtreeActiveDescendants.delete(this);
15698
+ }), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
15699
+ const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
15700
+ null == previousScopes || previousScopes.forEach(scope => {
15706
15701
  nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
15707
15702
  }), nextScopes.forEach(scope => {
15708
15703
  scope.subtreeActiveDescendants.add(this);
@@ -15718,15 +15713,13 @@ class Graphic extends Node {
15718
15713
  this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this), scheduleStageSharedStateRefresh(this.stage);
15719
15714
  }
15720
15715
  onParentSharedStateTreeChanged(stage, layer) {
15721
- this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingFromTree() : this.setStage(stage, layer);
15716
+ this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
15722
15717
  }
15723
15718
  refreshSharedStateBeforeRender() {
15724
15719
  var _a;
15725
15720
  (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({
15726
15721
  type: AttributeUpdateType.STATE
15727
- }), this._emitCustomEvent("afterStateUpdate", {
15728
- type: AttributeUpdateType.STATE
15729
- }), this.sharedStateDirty = !1) : this.sharedStateDirty = !1;
15722
+ }), this.emitStateUpdateEvent(), this.sharedStateDirty = !1) : this.sharedStateDirty = !1;
15730
15723
  }
15731
15724
  getLocalStatesVersion() {
15732
15725
  var _a, _b;
@@ -15784,7 +15777,7 @@ class Graphic extends Node {
15784
15777
  const transition = stateModel.useStates(this.currentStates),
15785
15778
  effectiveStates = null !== (_d = transition.effectiveStates) && void 0 !== _d ? _d : transition.states,
15786
15779
  resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
15787
- this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs), this.syncSharedStateActiveRegistrations();
15780
+ this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.syncSharedStateActiveRegistrations();
15788
15781
  }
15789
15782
  buildStaticAttributeSnapshot() {
15790
15783
  var _a;
@@ -15823,16 +15816,17 @@ class Graphic extends Node {
15823
15816
  next: void 0
15824
15817
  }), delete target[key]));
15825
15818
  const nextValue = snapshot[key];
15826
- isEqual(previousValue, nextValue) || (delta.set(key, {
15819
+ areAttributeValuesEqual(previousValue, nextValue) || (delta.set(key, {
15827
15820
  prev: previousValue,
15828
15821
  next: nextValue
15829
15822
  }), target[key] = cloneAttributeValue(nextValue));
15830
15823
  }), delta;
15831
15824
  }
15832
15825
  _syncAttribute() {
15826
+ this.attribute === this.baseAttributes && this.resolvedStatePatch && this.detachAttributeFromBaseAttributes();
15833
15827
  const snapshot = this.buildStaticAttributeSnapshot(),
15834
15828
  delta = this.syncObjectToSnapshot(this.attribute, snapshot);
15835
- return this.valid = this.isValid(), delta;
15829
+ return this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, delta;
15836
15830
  }
15837
15831
  _syncFinalAttributeFromStaticTruth() {
15838
15832
  const target = this.finalAttribute;
@@ -15840,47 +15834,146 @@ class Graphic extends Node {
15840
15834
  const snapshot = this.buildStaticAttributeSnapshot();
15841
15835
  this.syncObjectToSnapshot(target, snapshot);
15842
15836
  }
15843
- submitUpdateByDelta(delta, forceUpdateTag = !1) {
15837
+ mergeAttributeDeltaCategory(category, key, prev, next) {
15838
+ var _a;
15839
+ let nextCategory = "stroke" === key || "shadowBlur" === key ? classifyAttributeDelta(key, prev, next) : null !== (_a = ATTRIBUTE_CATEGORY[key]) && void 0 !== _a ? _a : UpdateCategory.PAINT;
15840
+ return nextCategory & UpdateCategory.PICK && (nextCategory |= UpdateCategory.BOUNDS), nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key) && (nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS), category | nextCategory;
15841
+ }
15842
+ submitUpdateByCategory(category, forceUpdateTag = !1) {
15844
15843
  var _a;
15845
15844
  if (forceUpdateTag) return this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), void this.addUpdateLayoutTag();
15845
+ if (category !== UpdateCategory.NONE) {
15846
+ const stage = this.stage;
15847
+ stage && (null === (_a = getActiveStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordCategory(category));
15848
+ }
15849
+ (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();
15850
+ }
15851
+ submitUpdateByDelta(delta, forceUpdateTag = !1) {
15846
15852
  let category = UpdateCategory.NONE;
15847
15853
  delta.forEach((entry, key) => {
15848
- let nextCategory = classifyAttributeDelta(key, entry.prev, entry.next);
15849
- nextCategory & UpdateCategory.PICK && (nextCategory |= UpdateCategory.BOUNDS), nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key) && (nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS), category |= nextCategory;
15850
- }), 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();
15854
+ category = this.mergeAttributeDeltaCategory(category, key, entry.prev, entry.next);
15855
+ }), this.submitUpdateByCategory(category, forceUpdateTag);
15856
+ }
15857
+ submitTouchedKeyUpdate(keys, forceUpdateTag = !1) {
15858
+ this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTags(keys));
15859
+ }
15860
+ submitTouchedUpdate(needsShapeAndBounds) {
15861
+ !this.updateShapeAndBoundsTagSetted() && needsShapeAndBounds ? this.addUpdateShapeAndBoundsTag() : this.addUpdateBoundTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag();
15851
15862
  }
15852
15863
  commitBaseAttributeMutation(forceUpdateTag = !1, context) {
15853
- var _a, _b;
15854
- (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());
15864
+ var _a, _b, _c;
15865
+ (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());
15855
15866
  const delta = this._syncAttribute();
15856
15867
  this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
15857
15868
  }
15869
+ canCommitBaseAttributesByTouchedKeys() {
15870
+ var _a, _b;
15871
+ 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());
15872
+ }
15873
+ detachAttributeFromBaseAttributes() {
15874
+ this.attribute === this.baseAttributes && (this._baseAttributes = this.attribute, this.attribute = cloneAttributeSurface(this.attribute));
15875
+ }
15876
+ commitInternalBaseAttributes(params, context) {
15877
+ params && Object.keys(params).length && (this.canCommitBaseAttributesByTouchedKeys() ? this.commitBaseAttributesByTouchedKeys(params, !1, context) : (this.detachAttributeFromBaseAttributes(), this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context)));
15878
+ }
15879
+ commitBaseAttributesByTouchedKeys(params, forceUpdateTag = !1, context) {
15880
+ const source = params,
15881
+ baseAttributes = this.getBaseAttributesStorage();
15882
+ let hasKeys = !1,
15883
+ needsShapeAndBounds = forceUpdateTag;
15884
+ for (const key in source) Object.prototype.hasOwnProperty.call(source, key) && (hasKeys = !0, baseAttributes[key] = source[key], !needsShapeAndBounds && this.needUpdateTag(key) && (needsShapeAndBounds = !0));
15885
+ hasKeys && (this.attribute = baseAttributes, this._baseAttributes = void 0, this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, this.submitTouchedUpdate(needsShapeAndBounds), this.onAttributeUpdate(context));
15886
+ }
15887
+ commitBaseAttributeBySingleKey(key, value, forceUpdateTag = !1, context) {
15888
+ 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);
15889
+ }
15858
15890
  applyBaseAttributes(params) {
15859
15891
  const keys = Object.keys(params);
15860
15892
  for (let i = 0; i < keys.length; i++) {
15861
15893
  const key = keys[i];
15862
- this.baseAttributes[key] = cloneAttributeValue(params[key]);
15894
+ this.getBaseAttributesStorage()[key] = params[key];
15863
15895
  }
15864
15896
  }
15897
+ applyAnimationTransientAttributes(params, forceUpdateTag = !1, context) {
15898
+ const source = params;
15899
+ let target,
15900
+ needsShapeAndBounds = forceUpdateTag;
15901
+ 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));
15902
+ target && (this.attributeMayContainTransientAttrs = !0, this.valid = this.isValid(), this.submitTouchedUpdate(needsShapeAndBounds), this.onAttributeUpdate(context));
15903
+ }
15865
15904
  applyTransientAttributes(params, forceUpdateTag = !1, context) {
15905
+ this.detachAttributeFromBaseAttributes();
15866
15906
  const delta = new Map(),
15867
15907
  keys = Object.keys(params);
15868
15908
  for (let i = 0; i < keys.length; i++) {
15869
15909
  const key = keys[i],
15870
15910
  previousValue = this.attribute[key],
15871
15911
  nextValue = params[key];
15872
- isEqual(previousValue, nextValue) || (delta.set(key, {
15912
+ areAttributeValuesEqual(previousValue, nextValue) || (delta.set(key, {
15873
15913
  prev: previousValue,
15874
15914
  next: nextValue
15875
- }), this.attribute[key] = cloneAttributeValue(nextValue));
15915
+ }), this.attribute[key] = nextValue);
15876
15916
  }
15877
- this.valid = this.isValid(), this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
15917
+ delta.size && (this.attributeMayContainTransientAttrs = !0), this.valid = this.isValid(), this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
15878
15918
  }
15879
15919
  _restoreAttributeFromStaticTruth(context) {
15880
15920
  this._syncFinalAttributeFromStaticTruth();
15881
15921
  const delta = this._syncAttribute();
15882
15922
  this.submitUpdateByDelta(delta), this.onAttributeUpdate(context);
15883
15923
  }
15924
+ collectStatePatchDeltaKeys(previousPatch, nextPatch) {
15925
+ const keys = previousPatch ? Object.keys(previousPatch) : [];
15926
+ if (!nextPatch) return keys;
15927
+ for (const key in nextPatch) Object.prototype.hasOwnProperty.call(nextPatch, key) && !Object.prototype.hasOwnProperty.call(null != previousPatch ? previousPatch : {}, key) && keys.push(key);
15928
+ return keys;
15929
+ }
15930
+ getStaticTruthValueForStateKey(key, nextPatch) {
15931
+ var _a;
15932
+ const baseAttributes = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : {},
15933
+ patch = nextPatch;
15934
+ if (patch && Object.prototype.hasOwnProperty.call(patch, key)) {
15935
+ const patchValue = patch[key],
15936
+ baseValue = baseAttributes[key];
15937
+ return "deep" === this.stateMergeMode && isPlainObjectValue(baseValue) && isPlainObjectValue(patchValue) ? {
15938
+ hasValue: !0,
15939
+ value: deepMergeAttributeValue(baseValue, patchValue)
15940
+ } : {
15941
+ hasValue: !0,
15942
+ value: patchValue
15943
+ };
15944
+ }
15945
+ return Object.prototype.hasOwnProperty.call(baseAttributes, key) ? {
15946
+ hasValue: !0,
15947
+ value: baseAttributes[key]
15948
+ } : {
15949
+ hasValue: !1,
15950
+ value: void 0
15951
+ };
15952
+ }
15953
+ syncStatePatchDeltaToTarget(target, keys, nextPatch, collectCategory = !1) {
15954
+ let category = UpdateCategory.NONE;
15955
+ for (let i = 0; i < keys.length; i++) {
15956
+ const key = keys[i],
15957
+ previousValue = target[key],
15958
+ next = this.getStaticTruthValueForStateKey(key, nextPatch);
15959
+ if (!next.hasValue) {
15960
+ Object.prototype.hasOwnProperty.call(target, key) && (delete target[key], collectCategory && (category = this.mergeAttributeDeltaCategory(category, key, previousValue, void 0)));
15961
+ continue;
15962
+ }
15963
+ if (areAttributeValuesEqual(previousValue, next.value)) continue;
15964
+ const nextValue = cloneAttributeValue(next.value);
15965
+ target[key] = nextValue, collectCategory && (category = this.mergeAttributeDeltaCategory(category, key, previousValue, nextValue));
15966
+ }
15967
+ return category;
15968
+ }
15969
+ restoreAttributeFromStatePatchDelta(previousPatch, nextPatch, context) {
15970
+ this.detachAttributeFromBaseAttributes();
15971
+ const keys = this.collectStatePatchDeltaKeys(previousPatch, nextPatch),
15972
+ finalAttribute = this.finalAttribute;
15973
+ finalAttribute && this.syncStatePatchDeltaToTarget(finalAttribute, keys, nextPatch, !1);
15974
+ const category = this.syncStatePatchDeltaToTarget(this.attribute, keys, nextPatch, !0);
15975
+ this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, this.submitUpdateByCategory(category), this.onAttributeUpdate(context);
15976
+ }
15884
15977
  setMode(mode) {
15885
15978
  "3d" === mode ? this.set3dMode() : this.set2dMode();
15886
15979
  }
@@ -15903,7 +15996,7 @@ class Graphic extends Node {
15903
15996
  return point;
15904
15997
  }
15905
15998
  onAnimateBind(animate) {
15906
- this._emitCustomEvent("animate-bind", animate);
15999
+ this.detachAttributeFromBaseAttributes(), this._emitCustomEvent("animate-bind", animate);
15907
16000
  }
15908
16001
  visitTrackedAnimates(cb) {
15909
16002
  const hook = this.forEachTrackedAnimate;
@@ -15916,8 +16009,22 @@ class Graphic extends Node {
15916
16009
  const getTrackedAnimates = this.getTrackedAnimates;
15917
16010
  return "function" == typeof getTrackedAnimates ? getTrackedAnimates.call(this).size > 0 : !!(null === (_a = this.animates) || void 0 === _a ? void 0 : _a.size);
15918
16011
  }
16012
+ mayHaveTrackedAnimates() {
16013
+ var _a;
16014
+ return !!(null === (_a = this.animates) || void 0 === _a ? void 0 : _a.size) || !!this._animationStateManager;
16015
+ }
15919
16016
  tryUpdateAABBBounds() {
16017
+ if (!(this.shadowRoot || this._updateTag & UpdateTag.UPDATE_BOUNDS)) return this._AABBBounds;
15920
16018
  const full = "imprecise" === this.attribute.boundsMode;
16019
+ if (!this.shadowRoot) {
16020
+ const graphicService = this.getGraphicService(),
16021
+ graphicTheme = this.getGraphicTheme();
16022
+ if (!graphicService.validCheck(this.attribute, graphicTheme, this._AABBBounds, this)) return this._AABBBounds;
16023
+ if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
16024
+ graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
16025
+ const bounds = this.doUpdateAABBBounds(full, graphicTheme);
16026
+ return graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
16027
+ }
15921
16028
  if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
15922
16029
  if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
15923
16030
  this.getGraphicService().beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
@@ -15990,14 +16097,14 @@ class Graphic extends Node {
15990
16097
  const _parsedPath = new CustomSymbolClass(symbolType, cache);
15991
16098
  return Graphic.userSymbolMap[symbolType] = _parsedPath, _parsedPath;
15992
16099
  }
15993
- doUpdateAABBBounds(full) {
16100
+ doUpdateAABBBounds(full, graphicTheme) {
15994
16101
  this.updateAABBBoundsStamp++;
15995
- const graphicTheme = this.getGraphicTheme();
16102
+ const resolvedGraphicTheme = null != graphicTheme ? graphicTheme : this.getGraphicTheme();
15996
16103
  this._AABBBounds.clear();
15997
16104
  const attribute = this.attribute,
15998
- bounds = this.updateAABBBounds(attribute, graphicTheme, this._AABBBounds, full),
16105
+ bounds = this.updateAABBBounds(attribute, resolvedGraphicTheme, this._AABBBounds, full),
15999
16106
  {
16000
- boundsPadding = graphicTheme.boundsPadding
16107
+ boundsPadding = resolvedGraphicTheme.boundsPadding
16001
16108
  } = attribute,
16002
16109
  paddingArray = parsePadding(boundsPadding);
16003
16110
  return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(), bounds;
@@ -16065,25 +16172,63 @@ class Graphic extends Node {
16065
16172
  this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
16066
16173
  }
16067
16174
  setAttributesAndPreventAnimate(params, forceUpdateTag = !1, context, ignorePriority) {
16068
- this.visitTrackedAnimates(animate => {
16069
- (animate.priority !== 1 / 0 || ignorePriority) && Object.keys(params).forEach(key => {
16070
- animate.preventAttr(key);
16071
- });
16175
+ if (!params) return;
16176
+ const keys = Object.keys(params);
16177
+ this.captureTransientFromAttrsBeforePreventAnimate(params, keys, context), this.visitTrackedAnimates(animate => {
16178
+ (animate.priority !== 1 / 0 || ignorePriority) && animate.preventAttrs(keys);
16072
16179
  }), this.applyTransientAttributes(params, forceUpdateTag, context);
16073
16180
  }
16181
+ captureTransientFromAttrsBeforePreventAnimate(params, keys, context) {
16182
+ var _a, _b;
16183
+ const graphicContext = this.context,
16184
+ diffAttrs = null !== (_a = null == graphicContext ? void 0 : graphicContext.diffAttrs) && void 0 !== _a ? _a : params,
16185
+ updateType = null == context ? void 0 : context.type;
16186
+ if (!keys.length || !diffAttrs || updateType === AttributeUpdateType.STATE || null != updateType && updateType >= AttributeUpdateType.ANIMATE_BIND && updateType <= AttributeUpdateType.ANIMATE_END) return;
16187
+ const sameDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs === diffAttrs;
16188
+ let fromAttrs = sameDiffAttrs && null !== (_b = this.transientFromAttrsBeforePreventAnimate) && void 0 !== _b ? _b : null;
16189
+ sameDiffAttrs || (this.transientFromAttrsBeforePreventAnimate = null, this.transientFromAttrsBeforePreventAnimateDiffAttrs = null);
16190
+ let captured = !1;
16191
+ for (let i = 0; i < keys.length; i++) {
16192
+ const key = keys[i];
16193
+ if (!Object.prototype.hasOwnProperty.call(diffAttrs, key)) continue;
16194
+ const previousValue = this.attribute[key],
16195
+ nextValue = params[key];
16196
+ isEqual(previousValue, nextValue) || (null != fromAttrs || (fromAttrs = {}), fromAttrs[key] = cloneAttributeValue(previousValue), captured = !0);
16197
+ }
16198
+ captured && (this.transientFromAttrsBeforePreventAnimate = fromAttrs, this.transientFromAttrsBeforePreventAnimateDiffAttrs = diffAttrs);
16199
+ }
16200
+ consumeTransientFromAttrsBeforePreventAnimate(diffAttrs) {
16201
+ const transientFromAttrs = this.transientFromAttrsBeforePreventAnimate,
16202
+ sourceDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs;
16203
+ if (!transientFromAttrs || !sourceDiffAttrs) return null;
16204
+ 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;
16205
+ let fromAttrs = null,
16206
+ remaining = !1;
16207
+ 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);
16208
+ if (remaining) {
16209
+ const nextTransientFromAttrs = {};
16210
+ for (const key in transientFromAttrs) Object.prototype.hasOwnProperty.call(transientFromAttrs, key) && !Object.prototype.hasOwnProperty.call(diffAttrs, key) && (nextTransientFromAttrs[key] = transientFromAttrs[key]);
16211
+ this.transientFromAttrsBeforePreventAnimate = nextTransientFromAttrs;
16212
+ } else this.transientFromAttrsBeforePreventAnimate = null, this.transientFromAttrsBeforePreventAnimateDiffAttrs = null;
16213
+ return fromAttrs;
16214
+ }
16074
16215
  setAttributes(params, forceUpdateTag = !1, context) {
16075
- 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));
16216
+ 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));
16076
16217
  }
16077
16218
  _setAttributes(params, forceUpdateTag = !1, context) {
16078
- this.applyBaseAttributes(params), this.commitBaseAttributeMutation(forceUpdateTag, context);
16219
+ this.canCommitBaseAttributesByTouchedKeys() ? this.commitBaseAttributesByTouchedKeys(params, forceUpdateTag, context) : (this.detachAttributeFromBaseAttributes(), this.applyBaseAttributes(params), this.commitBaseAttributeMutation(forceUpdateTag, context));
16079
16220
  }
16080
16221
  setAttribute(key, value, forceUpdateTag, context) {
16081
16222
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
16082
16223
  [key]: value
16083
16224
  }, this.attribute, key, context);
16084
- params ? this._setAttributes(params, forceUpdateTag, context) : (this.applyBaseAttributes({
16085
- [key]: value
16086
- }), this.commitBaseAttributeMutation(!!forceUpdateTag, context)), "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
16225
+ if (params) this._setAttributes(params, forceUpdateTag, context);else if (this.canCommitBaseAttributesByTouchedKeys()) this.commitBaseAttributeBySingleKey(key, value, !!forceUpdateTag, context);else {
16226
+ const nextAttrs = {
16227
+ [key]: value
16228
+ };
16229
+ this.applyBaseAttributes(nextAttrs), this.commitBaseAttributeMutation(!!forceUpdateTag, context);
16230
+ }
16231
+ "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
16087
16232
  }
16088
16233
  needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
16089
16234
  for (let i = 0; i < k.length; i++) {
@@ -16102,7 +16247,7 @@ class Graphic extends Node {
16102
16247
  const context = {
16103
16248
  type: AttributeUpdateType.INIT
16104
16249
  };
16105
- 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);
16250
+ 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);
16106
16251
  }
16107
16252
  translate(x, y) {
16108
16253
  var _a, _b;
@@ -16114,10 +16259,15 @@ class Graphic extends Node {
16114
16259
  x: x,
16115
16260
  y: y
16116
16261
  }, this.attribute, tempConstantXYKey, context);
16117
- params && (x = params.x, y = params.y, delete params.x, delete params.y, this.applyBaseAttributes(params));
16262
+ params && (x = params.x, y = params.y, delete params.x, delete params.y);
16118
16263
  const attribute = this.baseAttributes,
16119
- postMatrix = attribute.postMatrix;
16120
- 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;
16264
+ postMatrix = attribute.postMatrix,
16265
+ nextAttrs = params || {};
16266
+ if (postMatrix) {
16267
+ const nextPostMatrix = postMatrix.clone();
16268
+ application.transformUtil.fromMatrix(nextPostMatrix, nextPostMatrix).translate(x, y), nextAttrs.postMatrix = nextPostMatrix;
16269
+ } 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;
16270
+ return this.commitInternalBaseAttributes(nextAttrs, context), this;
16121
16271
  }
16122
16272
  translateTo(x, y) {
16123
16273
  const attribute = this.baseAttributes;
@@ -16129,7 +16279,10 @@ class Graphic extends Node {
16129
16279
  x: x,
16130
16280
  y: y
16131
16281
  }, this.attribute, tempConstantXYKey, context);
16132
- return params ? (this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context), this) : (attribute.x = x, attribute.y = y, this.commitBaseAttributeMutation(!1, context), this);
16282
+ return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
16283
+ x: x,
16284
+ y: y
16285
+ }, context), this);
16133
16286
  }
16134
16287
  scale(scaleX, scaleY, scaleCenter) {
16135
16288
  var _a, _b;
@@ -16142,15 +16295,16 @@ class Graphic extends Node {
16142
16295
  scaleY: scaleY,
16143
16296
  scaleCenter: scaleCenter
16144
16297
  }, this.attribute, tempConstantScaleXYKey, context);
16145
- params && (scaleX = params.scaleX, scaleY = params.scaleY, delete params.scaleX, delete params.scaleY, this.applyBaseAttributes(params));
16146
- const attribute = this.baseAttributes;
16298
+ params && (scaleX = params.scaleX, scaleY = params.scaleY, delete params.scaleX, delete params.scaleY);
16299
+ const attribute = this.baseAttributes,
16300
+ nextAttrs = params || {};
16147
16301
  if (scaleCenter) {
16148
16302
  let {
16149
16303
  postMatrix: postMatrix
16150
- } = this.attribute;
16151
- postMatrix || (postMatrix = new Matrix(), attribute.postMatrix = postMatrix), application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter);
16152
- } 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;
16153
- return this.commitBaseAttributeMutation(!1, context), this;
16304
+ } = this.baseAttributes;
16305
+ postMatrix = postMatrix ? postMatrix.clone() : new Matrix(), application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter), nextAttrs.postMatrix = postMatrix;
16306
+ } 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;
16307
+ return this.commitInternalBaseAttributes(nextAttrs, context), this;
16154
16308
  }
16155
16309
  scaleTo(scaleX, scaleY) {
16156
16310
  const attribute = this.baseAttributes;
@@ -16162,7 +16316,10 @@ class Graphic extends Node {
16162
16316
  scaleX: scaleX,
16163
16317
  scaleY: scaleY
16164
16318
  }, this.attribute, tempConstantScaleXYKey, context);
16165
- return params ? (this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context), this) : (attribute.scaleX = scaleX, attribute.scaleY = scaleY, this.commitBaseAttributeMutation(!1, context), this);
16319
+ return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
16320
+ scaleX: scaleX,
16321
+ scaleY: scaleY
16322
+ }, context), this);
16166
16323
  }
16167
16324
  rotate(angle, rotateCenter) {
16168
16325
  var _a;
@@ -16174,24 +16331,26 @@ class Graphic extends Node {
16174
16331
  angle: angle,
16175
16332
  rotateCenter: rotateCenter
16176
16333
  }, this.attribute, tempConstantAngleKey, context);
16177
- params && (delete params.angle, this.applyBaseAttributes(params));
16178
- const attribute = this.baseAttributes;
16334
+ params && delete params.angle;
16335
+ const attribute = this.baseAttributes,
16336
+ nextAttrs = params || {};
16179
16337
  if (rotateCenter) {
16180
16338
  let {
16181
16339
  postMatrix: postMatrix
16182
16340
  } = this.baseAttributes;
16183
- postMatrix || (postMatrix = new Matrix(), this.baseAttributes.postMatrix = postMatrix), application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter);
16184
- } else attribute.angle = (null !== (_a = attribute.angle) && void 0 !== _a ? _a : DefaultTransform.angle) + angle;
16185
- return this.commitBaseAttributeMutation(!1, context), this;
16341
+ postMatrix = postMatrix ? postMatrix.clone() : new Matrix(), application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter), nextAttrs.postMatrix = postMatrix;
16342
+ } else nextAttrs.angle = (null !== (_a = attribute.angle) && void 0 !== _a ? _a : DefaultTransform.angle) + angle;
16343
+ return this.commitInternalBaseAttributes(nextAttrs, context), this;
16186
16344
  }
16187
16345
  rotateTo(angle) {
16188
- const attribute = this.baseAttributes;
16189
- if (attribute.angle === angle) return this;
16346
+ if (this.baseAttributes.angle === angle) return this;
16190
16347
  const context = {
16191
16348
  type: AttributeUpdateType.ROTATE_TO
16192
16349
  },
16193
16350
  params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(angle, this.attribute, tempConstantAngleKey, context);
16194
- return params ? (this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context), this) : (attribute.angle = angle, this.commitBaseAttributeMutation(!1, context), this);
16351
+ return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
16352
+ angle: angle
16353
+ }, context), this);
16195
16354
  }
16196
16355
  skewTo(b, c) {
16197
16356
  return this;
@@ -16230,6 +16389,131 @@ class Graphic extends Node {
16230
16389
  stateEngine: this.stateEngine
16231
16390
  });
16232
16391
  }
16392
+ resolveSimpleLocalStateTransition(states, previousStates) {
16393
+ var _a;
16394
+ 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;
16395
+ if (1 === states.length) {
16396
+ const stateName = states[0],
16397
+ hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName),
16398
+ nextStates = [stateName],
16399
+ changed = !this.sameStateNames(previousStates, nextStates),
16400
+ resolvedStateAttrs = {};
16401
+ if (hasDefinition) {
16402
+ const attrs = this.states[stateName];
16403
+ if (null != attrs) {
16404
+ if (!isPlainObjectValue(attrs)) return null;
16405
+ const keys = Object.keys(attrs);
16406
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
16407
+ const key = keys[keyIndex];
16408
+ if (FULL_STATE_DEFINITION_KEYS.has(key)) return null;
16409
+ const attrValue = attrs[key];
16410
+ resolvedStateAttrs[key] = isPlainObjectValue(attrValue) ? cloneAttributeValue(attrValue) : attrValue;
16411
+ }
16412
+ }
16413
+ }
16414
+ return {
16415
+ changed: changed,
16416
+ states: nextStates,
16417
+ effectiveStates: nextStates,
16418
+ resolvedStateAttrs: resolvedStateAttrs
16419
+ };
16420
+ }
16421
+ const uniqueStates = Array.from(new Set(states)),
16422
+ withDefinition = [],
16423
+ withoutDefinition = [];
16424
+ for (let i = 0; i < uniqueStates.length; i++) {
16425
+ const stateName = uniqueStates[i];
16426
+ Object.prototype.hasOwnProperty.call(this.states, stateName) ? withDefinition.push(stateName) : withoutDefinition.push(stateName);
16427
+ }
16428
+ withDefinition.sort((left, right) => left.localeCompare(right));
16429
+ const nextStates = withDefinition.concat(withoutDefinition),
16430
+ changed = !this.sameStateNames(previousStates, nextStates),
16431
+ resolvedStateAttrs = {};
16432
+ for (let i = 0; i < nextStates.length; i++) {
16433
+ const stateName = nextStates[i];
16434
+ if (!Object.prototype.hasOwnProperty.call(this.states, stateName)) continue;
16435
+ const attrs = this.states[stateName];
16436
+ if (null == attrs) continue;
16437
+ if (!isPlainObjectValue(attrs)) return null;
16438
+ const keys = Object.keys(attrs);
16439
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
16440
+ const key = keys[keyIndex];
16441
+ if (FULL_STATE_DEFINITION_KEYS.has(key)) return null;
16442
+ const attrValue = attrs[key];
16443
+ resolvedStateAttrs[key] = isPlainObjectValue(attrValue) ? cloneAttributeValue(attrValue) : attrValue;
16444
+ }
16445
+ }
16446
+ return {
16447
+ changed: changed,
16448
+ states: nextStates,
16449
+ effectiveStates: nextStates,
16450
+ resolvedStateAttrs: resolvedStateAttrs
16451
+ };
16452
+ }
16453
+ resolveGraphicStateTransition(states, previousStates, forceResolverRefresh = !1) {
16454
+ var _a, _b, _c, _d;
16455
+ let transition = this.resolveSimpleLocalStateTransition(states, previousStates);
16456
+ const isSimpleLocalTransition = !!transition;
16457
+ let resolvedStateAttrs;
16458
+ if (transition) resolvedStateAttrs = transition.resolvedStateAttrs;else {
16459
+ const stateResolveBaseAttrs = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute,
16460
+ stateModel = this.createStateModel();
16461
+ 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);
16462
+ }
16463
+ return {
16464
+ transition: transition,
16465
+ effectiveStates: null !== (_d = transition.effectiveStates) && void 0 !== _d ? _d : transition.states,
16466
+ resolvedStateAttrs: resolvedStateAttrs,
16467
+ isSimpleLocalTransition: isSimpleLocalTransition
16468
+ };
16469
+ }
16470
+ normalizeSetStatesOptions(options) {
16471
+ return options && "object" == typeof options ? {
16472
+ hasAnimation: options.animate,
16473
+ animateSameStatePatchChange: !0 === options.animateSameStatePatchChange,
16474
+ shouldRefreshSameStatePatch: !0
16475
+ } : {
16476
+ hasAnimation: "boolean" == typeof options ? options : void 0,
16477
+ animateSameStatePatchChange: !1,
16478
+ shouldRefreshSameStatePatch: !1
16479
+ };
16480
+ }
16481
+ sameStatePatches(left, right) {
16482
+ const leftRecord = null != left ? left : {},
16483
+ rightRecord = null != right ? right : {},
16484
+ keys = new Set([...Object.keys(leftRecord), ...Object.keys(rightRecord)]);
16485
+ for (const key of keys) {
16486
+ if (Object.prototype.hasOwnProperty.call(leftRecord, key) !== Object.prototype.hasOwnProperty.call(rightRecord, key)) return !1;
16487
+ if (!areAttributeValuesEqual(leftRecord[key], rightRecord[key])) return !1;
16488
+ }
16489
+ return !0;
16490
+ }
16491
+ commitSameStatePatchRefresh(states, hasAnimation, animateSameStatePatchChange = !1) {
16492
+ var _a;
16493
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
16494
+ previousResolvedStatePatch = this.resolvedStatePatch,
16495
+ {
16496
+ transition: transition,
16497
+ effectiveStates: effectiveStates,
16498
+ resolvedStateAttrs: resolvedStateAttrs,
16499
+ isSimpleLocalTransition: isSimpleLocalTransition
16500
+ } = this.resolveGraphicStateTransition(states, previousStates, !0),
16501
+ patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
16502
+ 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)) {
16503
+ if (this.stage) {
16504
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
16505
+ null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
16506
+ graphicId: this._uid,
16507
+ targetStates: [...transition.states]
16508
+ });
16509
+ }
16510
+ hasAnimation && animateSameStatePatchChange ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
16511
+ type: AttributeUpdateType.STATE
16512
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
16513
+ type: AttributeUpdateType.STATE
16514
+ }), this.emitStateUpdateEvent());
16515
+ }
16516
+ }
16233
16517
  resolveStateAnimateConfig(animateConfig) {
16234
16518
  var _a, _b, _c;
16235
16519
  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;
@@ -16250,9 +16534,7 @@ class Graphic extends Node {
16250
16534
  });
16251
16535
  this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
16252
16536
  }
16253
- updateNormalAttrs(stateAttrs) {
16254
- this._deprecatedNormalAttrsView = cloneAttributeValue(this.baseAttributes);
16255
- }
16537
+ updateNormalAttrs(_stateAttrs) {}
16256
16538
  getStateTransitionDefaultAttribute(key, targetAttrs) {
16257
16539
  return this.getDefaultAttribute(key);
16258
16540
  }
@@ -16262,6 +16544,7 @@ class Graphic extends Node {
16262
16544
  stopStateAnimates(type = "end") {
16263
16545
  const stopAnimationState = this.stopAnimationState;
16264
16546
  if ("function" == typeof stopAnimationState) return void stopAnimationState.call(this, "state", type);
16547
+ if (!this.mayHaveTrackedAnimates()) return;
16265
16548
  const stateAnimates = [];
16266
16549
  this.visitTrackedAnimates(animate => {
16267
16550
  animate.stateNames && stateAnimates.push(animate);
@@ -16274,19 +16557,25 @@ class Graphic extends Node {
16274
16557
  }
16275
16558
  clearStates(hasAnimation) {
16276
16559
  var _a, _b, _c;
16277
- const previousStates = this.currentStates ? this.currentStates.slice() : [],
16278
- previousResolvedStatePatch = this.resolvedStatePatch ? cloneAttributeValue(this.resolvedStatePatch) : void 0,
16560
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
16561
+ previousResolvedStatePatch = this.resolvedStatePatch,
16279
16562
  transition = this.createStateModel().clearStates();
16280
16563
  if (!transition.changed && 0 === previousStates.length) return this.currentStates = [], this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, void this.clearSharedStateActiveRegistrations();
16281
- const resolvedStateAttrs = cloneAttributeValue(null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : {});
16282
- 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", {
16283
- graphicId: this._uid,
16284
- targetStates: []
16285
- }), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
16286
- type: AttributeUpdateType.STATE
16287
- }), this._emitCustomEvent("afterStateUpdate", {
16288
- type: AttributeUpdateType.STATE
16289
- })));
16564
+ const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
16565
+ if (!transition.changed || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0)) {
16566
+ if (this.currentStates = transition.states, this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, this.clearSharedStateActiveRegistrations(), this.stage) {
16567
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
16568
+ null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
16569
+ graphicId: this._uid,
16570
+ targetStates: []
16571
+ });
16572
+ }
16573
+ hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
16574
+ type: AttributeUpdateType.STATE
16575
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
16576
+ type: AttributeUpdateType.STATE
16577
+ }), this.emitStateUpdateEvent());
16578
+ }
16290
16579
  }
16291
16580
  removeState(stateName, hasAnimation) {
16292
16581
  const transition = this.createStateModel().removeState(stateName);
@@ -16300,39 +16589,59 @@ class Graphic extends Node {
16300
16589
  const transition = this.createStateModel().addState(stateName, keepCurrentStates);
16301
16590
  transition.changed && this.useStates(transition.states, hasAnimation);
16302
16591
  }
16592
+ setStates(states, options) {
16593
+ var _a, _b, _c;
16594
+ const {
16595
+ hasAnimation: hasAnimation,
16596
+ animateSameStatePatchChange: animateSameStatePatchChange,
16597
+ shouldRefreshSameStatePatch: shouldRefreshSameStatePatch
16598
+ } = this.normalizeSetStatesOptions(options),
16599
+ nextStates = (null == states ? void 0 : states.length) ? states : EMPTY_STATE_NAMES,
16600
+ 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));
16601
+ if (nextStates.length) {
16602
+ if (this.sameStateNames(this.currentStates, nextStates)) return shouldRefreshSameStatePatch ? void this.commitSameStatePatchRefresh(nextStates, hasAnimation, animateSameStatePatchChange) : void (this.sharedStateDirty && this.refreshSharedStateBeforeRender());
16603
+ this.useStates(nextStates, hasAnimation);
16604
+ } else {
16605
+ if (!hasCurrentState && !this.sharedStateDirty) return;
16606
+ this.clearStates(hasAnimation);
16607
+ }
16608
+ }
16303
16609
  useStates(states, hasAnimation) {
16304
- var _a, _b, _c, _d, _e;
16610
+ var _a;
16305
16611
  if (!states.length) return void this.clearStates(hasAnimation);
16306
- const previousStates = this.currentStates ? this.currentStates.slice() : [],
16307
- previousResolvedStatePatch = this.resolvedStatePatch ? cloneAttributeValue(this.resolvedStatePatch) : void 0,
16308
- stateResolveBaseAttrs = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute,
16309
- stateModel = this.createStateModel();
16310
- null === (_b = this.stateEngine) || void 0 === _b || _b.setResolveContext(this, stateResolveBaseAttrs);
16311
- const transition = stateModel.useStates(states);
16312
- if (!transition.changed && this.sameStateNames(previousStates, transition.states)) return;
16313
- const effectiveStates = null !== (_c = transition.effectiveStates) && void 0 !== _c ? _c : transition.states,
16314
- resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
16315
- 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", {
16316
- graphicId: this._uid,
16317
- targetStates: [...transition.states]
16318
- }), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
16319
- type: AttributeUpdateType.STATE
16320
- }), this._emitCustomEvent("afterStateUpdate", {
16321
- type: AttributeUpdateType.STATE
16322
- })));
16612
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
16613
+ previousResolvedStatePatch = this.resolvedStatePatch,
16614
+ {
16615
+ transition: transition,
16616
+ effectiveStates: effectiveStates,
16617
+ resolvedStateAttrs: resolvedStateAttrs,
16618
+ isSimpleLocalTransition: isSimpleLocalTransition
16619
+ } = this.resolveGraphicStateTransition(states, previousStates);
16620
+ if ((transition.changed || !this.sameStateNames(previousStates, transition.states)) && this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) {
16621
+ if (this.currentStates = transition.states, this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stage) {
16622
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
16623
+ null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
16624
+ graphicId: this._uid,
16625
+ targetStates: [...transition.states]
16626
+ });
16627
+ }
16628
+ hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
16629
+ type: AttributeUpdateType.STATE
16630
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
16631
+ type: AttributeUpdateType.STATE
16632
+ }), this.emitStateUpdateEvent());
16633
+ }
16323
16634
  }
16324
16635
  invalidateResolver() {
16325
- var _a, _b;
16636
+ var _a, _b, _c;
16326
16637
  if (!this.stateEngine || !(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.compiledStateDefinitions) return;
16327
16638
  const stateResolveBaseAttrs = null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : this.attribute;
16328
- this.stateEngine.setResolveContext(this, stateResolveBaseAttrs), this.resolverEpoch += 1, this.stateEngine.invalidateResolverCache();
16639
+ this.stateEngine.setResolveContext(this, stateResolveBaseAttrs), this.resolverEpoch = (null !== (_c = this.resolverEpoch) && void 0 !== _c ? _c : 0) + 1, this.stateEngine.invalidateResolverCache();
16329
16640
  const transition = this.stateEngine.applyStates(this.currentStates),
16330
16641
  resolvedStateAttrs = Object.assign({}, this.stateEngine.resolvedPatch);
16331
- this.effectiveStates = [...transition.effectiveStates], this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs), this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
16332
- type: AttributeUpdateType.STATE
16333
- }), this._emitCustomEvent("afterStateUpdate", {
16642
+ this.effectiveStates = [...transition.effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
16334
16643
  type: AttributeUpdateType.STATE
16335
- });
16644
+ }), this.emitStateUpdateEvent();
16336
16645
  }
16337
16646
  sameStateNames(left, right) {
16338
16647
  const normalizedLeft = null != left ? left : [],
@@ -16353,6 +16662,9 @@ class Graphic extends Node {
16353
16662
  addUpdateShapeAndBoundsTag() {
16354
16663
  this._updateTag |= UpdateTag.UPDATE_SHAPE_AND_BOUNDS, this.parent && this.parent.addChildUpdateBoundTag(), this.glyphHost && this.glyphHost.addUpdateBoundTag();
16355
16664
  }
16665
+ addBroadUpdateTag() {
16666
+ 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();
16667
+ }
16356
16668
  updateShapeAndBoundsTagSetted() {
16357
16669
  return (this._updateTag & UpdateTag.UPDATE_SHAPE_AND_BOUNDS) === UpdateTag.UPDATE_SHAPE_AND_BOUNDS;
16358
16670
  }
@@ -16440,13 +16752,13 @@ class Graphic extends Node {
16440
16752
  }
16441
16753
  }
16442
16754
  setStage(stage, layer) {
16443
- var _a, _b, _c, _d, _e, _f, _g, _h;
16755
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
16444
16756
  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,
16445
16757
  previousStage = this.stage;
16446
16758
  if (this.stage !== stage || this.layer !== layer) {
16447
- 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()) {
16448
- const previousTimeline = null === (_e = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _e ? void 0 : _e.call(previousStage),
16449
- nextTimeline = null === (_f = null == stage ? void 0 : stage.getTimeline) || void 0 === _f ? void 0 : _f.call(stage),
16759
+ 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()) {
16760
+ const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
16761
+ nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
16450
16762
  detachedStageAnimates = [];
16451
16763
  this.visitTrackedAnimates(a => {
16452
16764
  (!!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)));
@@ -16459,9 +16771,13 @@ class Graphic extends Node {
16459
16771
  type: AttributeUpdateType.ANIMATE_END
16460
16772
  }));
16461
16773
  }
16462
- 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));
16774
+ 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));
16463
16775
  }
16464
- this.syncSharedStateScopeBindingFromTree(!!(null === (_h = this.currentStates) || void 0 === _h ? void 0 : _h.length));
16776
+ ((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);
16777
+ }
16778
+ detachStageForRelease() {
16779
+ var _a, _b, _c;
16780
+ (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));
16465
16781
  }
16466
16782
  setStageToShadowRoot(stage, layer) {
16467
16783
  this.shadowRoot && this.shadowRoot.setStage(stage, layer);
@@ -16528,6 +16844,7 @@ class Graphic extends Node {
16528
16844
  res && (res.state = "fail", cb && cb());
16529
16845
  }
16530
16846
  _stopAnimates() {
16847
+ if (!this.mayHaveTrackedAnimates()) return;
16531
16848
  const animates = [];
16532
16849
  this.visitTrackedAnimates(animate => {
16533
16850
  animates.push(animate);
@@ -16541,14 +16858,17 @@ class Graphic extends Node {
16541
16858
  });
16542
16859
  }
16543
16860
  release() {
16544
- var _a, _b, _c;
16545
- this.releaseStatus = "released", this.clearSharedStateActiveRegistrations(), this.stopAnimates();
16546
- const graphicService = null !== (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.graphicService) && void 0 !== _b ? _b : application.graphicService;
16547
- null === (_c = null == graphicService ? void 0 : graphicService.onRelease) || void 0 === _c || _c.call(graphicService, this), super.release();
16861
+ var _a, _b, _c, _d;
16862
+ this.releaseStatus = "released", (null === (_a = this.registeredActiveScopes) || void 0 === _a ? void 0 : _a.size) && this.clearSharedStateActiveRegistrations(), (this.mayHaveTrackedAnimates() || this.shadowRoot) && this.stopAnimates();
16863
+ const graphicService = null !== (_c = null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService;
16864
+ null === (_d = null == graphicService ? void 0 : graphicService.onRelease) || void 0 === _d || _d.call(graphicService, this), super.release();
16865
+ }
16866
+ hasCustomEvent(type) {
16867
+ return !!this._events && type in this._events;
16548
16868
  }
16549
16869
  _dispatchCustomEvent(type, context) {
16550
16870
  var _a, _b;
16551
- if (this._events && type in this._events) {
16871
+ if (this.hasCustomEvent(type)) {
16552
16872
  const changeEvent = new CustomEvent(type, context);
16553
16873
  changeEvent.bubbles = !1;
16554
16874
  const manager = null === (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventSystem) || void 0 === _b ? void 0 : _b.manager;
@@ -16557,7 +16877,7 @@ class Graphic extends Node {
16557
16877
  return !0;
16558
16878
  }
16559
16879
  beforeStateUpdate(attrs, prevStates, nextStates, hasAnimation, isClear) {
16560
- return this._dispatchCustomEvent("beforeStateUpdate", {
16880
+ return !this.hasCustomEvent("beforeStateUpdate") || this._dispatchCustomEvent("beforeStateUpdate", {
16561
16881
  type: AttributeUpdateType.STATE,
16562
16882
  attrs: Object.assign({}, attrs),
16563
16883
  prevStates: prevStates.slice(),
@@ -16566,6 +16886,11 @@ class Graphic extends Node {
16566
16886
  isClear: !!isClear
16567
16887
  });
16568
16888
  }
16889
+ emitStateUpdateEvent() {
16890
+ this.hasCustomEvent("afterStateUpdate") && this._emitCustomEvent("afterStateUpdate", {
16891
+ type: AttributeUpdateType.STATE
16892
+ });
16893
+ }
16569
16894
  _emitCustomEvent(type, context) {
16570
16895
  this._dispatchCustomEvent(type, context);
16571
16896
  }
@@ -19572,13 +19897,15 @@ var GroupUpdateAABBBoundsMode;
19572
19897
  }(GroupUpdateAABBBoundsMode || (GroupUpdateAABBBoundsMode = {}));
19573
19898
  let Group$1 = class Group extends Graphic {
19574
19899
  constructor(params) {
19575
- super(params), this.type = "group", this.parent = null, this.isContainer = !0, this.numberType = GROUP_NUMBER_TYPE, this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
19900
+ super(params), this.type = "group", this.parent = null, this.isContainer = !0, this._hasSharedStateDefinitions = !1, this.numberType = GROUP_NUMBER_TYPE, this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
19576
19901
  }
19577
19902
  get sharedStateDefinitions() {
19578
19903
  return this._sharedStateDefinitions;
19579
19904
  }
19580
19905
  set sharedStateDefinitions(value) {
19581
- this._sharedStateDefinitions !== value && (this._sharedStateDefinitions = value, this.ensureSharedStateScopeBound(), this.sharedStateScope && (setSharedStateScopeLocalDefinitions(this.sharedStateScope, value), markScopeActiveDescendantsDirty(this.sharedStateScope, this.stage)));
19906
+ if (this._sharedStateDefinitions === value) return;
19907
+ const previousScope = this.sharedStateScope;
19908
+ 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();
19582
19909
  }
19583
19910
  setMode(mode) {
19584
19911
  "3d" === mode ? this.set3dMode() : this.set2dMode();
@@ -19703,9 +20030,10 @@ let Group$1 = class Group extends Graphic {
19703
20030
  insertInto(newNode, idx) {
19704
20031
  return this._updateChildToStage(super.insertInto(newNode, idx));
19705
20032
  }
19706
- removeChild(child) {
20033
+ removeChild(child, highPerformance = !1) {
20034
+ var _a;
19707
20035
  const data = super.removeChild(child);
19708
- return this.getGraphicService().onRemove(child), child.setStage(null, null), this.addUpdateBoundTag(), data;
20036
+ 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;
19709
20037
  }
19710
20038
  removeAllChild(deep = !1) {
19711
20039
  const children = this.children.slice();
@@ -19717,11 +20045,13 @@ let Group$1 = class Group extends Graphic {
19717
20045
  }
19718
20046
  setStage(stage, layer) {
19719
20047
  var _a, _b, _c, _d, _e, _f;
19720
- 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;
19721
- 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 => {
20048
+ 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,
20049
+ 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;
20050
+ 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 => {
19722
20051
  item.setStage(stage, this.layer);
19723
20052
  });
19724
- this.layer !== layer && (this.layer = layer), this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingFromTree(!!(null === (_f = this.currentStates) || void 0 === _f ? void 0 : _f.length)), this.forEachChildren(item => {
20053
+ const layerChanged = this.layer !== layer;
20054
+ layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.forEachChildren(item => {
19725
20055
  item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(stage, this.layer);
19726
20056
  });
19727
20057
  }
@@ -19768,15 +20098,29 @@ let Group$1 = class Group extends Graphic {
19768
20098
  g.release(all);
19769
20099
  }), super.release();
19770
20100
  }
20101
+ detachStageForRelease() {
20102
+ super.detachStageForRelease(), this.sharedStateScope = void 0, this.forEachChildren(item => {
20103
+ var _a;
20104
+ null === (_a = item.detachStageForRelease) || void 0 === _a || _a.call(item);
20105
+ });
20106
+ }
19771
20107
  ensureSharedStateScopeBound() {
19772
20108
  var _a, _b, _c;
20109
+ if (!this.hasSharedStateDefinitions()) return void (this.sharedStateScope = void 0);
19773
20110
  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;
19774
20111
  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);
19775
20112
  }
20113
+ hasSharedStateDefinitions() {
20114
+ return this._hasSharedStateDefinitions;
20115
+ }
20116
+ notifyChildrenSharedStateTreeChanged() {
20117
+ this.forEachChildren(item => {
20118
+ item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(this.stage, this.layer);
20119
+ });
20120
+ }
19776
20121
  onParentSharedStateTreeChanged(stage, layer) {
19777
- this.stage === stage && this.layer === layer ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingFromTree(), this.forEachChildren(item => {
19778
- item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(stage, this.layer);
19779
- })) : this.setStage(stage, layer);
20122
+ var _a;
20123
+ 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);
19780
20124
  }
19781
20125
  };
19782
20126
  Group$1.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
@@ -20124,7 +20468,10 @@ class DefaultGraphicService {
20124
20468
  beforeUpdateAABBBounds: new SyncHook(["graphic", "stage", "willUpdate", "aabbBounds"]),
20125
20469
  afterUpdateAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds", "globalAABBBounds", "selfChange"]),
20126
20470
  clearAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds"])
20127
- }, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds();
20471
+ }, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds(), this.tempAABBBoundsResult = {
20472
+ tb1: this.tempAABBBounds1,
20473
+ tb2: this.tempAABBBounds2
20474
+ };
20128
20475
  }
20129
20476
  onAttributeUpdate(graphic) {
20130
20477
  this.hooks.onAttributeUpdate.taps.length && this.hooks.onAttributeUpdate.call(graphic);
@@ -20224,10 +20571,7 @@ class DefaultGraphicService {
20224
20571
  updateTempAABBBounds(aabbBounds) {
20225
20572
  const tb1 = this.tempAABBBounds1,
20226
20573
  tb2 = this.tempAABBBounds2;
20227
- return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), {
20228
- tb1: tb1,
20229
- tb2: tb2
20230
- };
20574
+ return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), this.tempAABBBoundsResult;
20231
20575
  }
20232
20576
  }
20233
20577
 
@@ -21569,7 +21913,7 @@ class IncrementalAutoRenderPlugin {
21569
21913
  const globalBounds = new AABBBounds();
21570
21914
  class DirtyBoundsPlugin {
21571
21915
  constructor() {
21572
- this.name = "DirtyBoundsPlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.handlePaintOnlyUpdate = graphic => {
21916
+ this.name = "DirtyBoundsPlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.dirtyBoundsHooksRegistered = !1, this.handlePaintOnlyUpdate = graphic => {
21573
21917
  var _a, _b, _c, _d;
21574
21918
  const stage = this.pluginService.stage;
21575
21919
  if (!stage || stage !== graphic.stage || !stage.renderCount) return;
@@ -21589,12 +21933,13 @@ class DirtyBoundsPlugin {
21589
21933
  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));
21590
21934
  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;
21591
21935
  }
21592
- activate(context) {
21593
- this.pluginService = context, context.stage.hooks.afterRender.tap(this.key, stage => {
21594
- stage && stage === this.pluginService.stage && stage.dirtyBounds.clear();
21595
- });
21596
- const stage = this.pluginService.stage;
21597
- stage && (stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handlePaintOnlyUpdate), stage.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, (graphic, stage, willUpdate, bounds) => {
21936
+ getRemoveDirtyBounds(graphic) {
21937
+ var _a;
21938
+ const cachedBounds = (null !== (_a = graphic.glyphHost) && void 0 !== _a ? _a : graphic)._globalAABBBounds;
21939
+ if (cachedBounds && "function" == typeof cachedBounds.empty && !cachedBounds.empty()) return cachedBounds;
21940
+ }
21941
+ registerDirtyBoundsHooks(stage) {
21942
+ this.dirtyBoundsHooksRegistered || (stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handlePaintOnlyUpdate), stage.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, (graphic, stage, willUpdate, bounds) => {
21598
21943
  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)));
21599
21944
  }), stage.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, (graphic, stage, bounds, params, selfChange) => {
21600
21945
  stage && stage === this.pluginService.stage && stage.renderCount && (graphic.isContainer && !selfChange || stage.dirty(params.globalAABBBounds));
@@ -21602,12 +21947,21 @@ class DirtyBoundsPlugin {
21602
21947
  stage && stage === this.pluginService.stage && stage.renderCount && stage && stage.dirty(bounds);
21603
21948
  }), stage.graphicService.hooks.onRemove.tap(this.key, graphic => {
21604
21949
  const stage = graphic.stage;
21605
- stage && stage === this.pluginService.stage && stage.renderCount && stage && stage.dirty(graphic.globalAABBBounds);
21606
- }));
21950
+ if (!stage || stage !== this.pluginService.stage || !stage.renderCount) return;
21951
+ const bounds = this.getRemoveDirtyBounds(graphic);
21952
+ bounds && !bounds.empty() && stage.dirty(bounds);
21953
+ }), this.dirtyBoundsHooksRegistered = !0);
21954
+ }
21955
+ activate(context) {
21956
+ this.pluginService = context, context.stage.hooks.afterRender.tap(this.key, stage => {
21957
+ stage && stage === this.pluginService.stage && (stage.dirtyBounds.clear(), this.registerDirtyBoundsHooks(stage));
21958
+ });
21959
+ const stage = this.pluginService.stage;
21960
+ stage && stage.renderCount && this.registerDirtyBoundsHooks(stage);
21607
21961
  }
21608
21962
  deactivate(context) {
21609
21963
  const stage = this.pluginService.stage;
21610
- 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));
21964
+ 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));
21611
21965
  }
21612
21966
  }
21613
21967
 
@@ -21963,7 +22317,7 @@ class Stage extends Group$1 {
21963
22317
  ticker.bindStage(this), this._ticker && this._ticker.removeListener("tick", this.afterTickCb), ticker.addTimeline(this.timeline), this._ticker = ticker, this._ticker.on("tick", this.afterTickCb);
21964
22318
  }
21965
22319
  constructor(params = {}, deps = {}) {
21966
- var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
22320
+ var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
21967
22321
  super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
21968
22322
  if (!(this._skipRender < 0)) if (visible) {
21969
22323
  if (this.dirtyBounds) {
@@ -21973,7 +22327,8 @@ class Stage extends Group$1 {
21973
22327
  this._skipRender > 1 && this.renderNextFrame(), this._skipRender = 0;
21974
22328
  } else this._skipRender = 1;
21975
22329
  }, this.beforeRender = stage => {
21976
- flushStageSharedStateRefresh(this), this._beforeRenderList.forEach(cb => cb(stage));
22330
+ const pendingSharedRefresh = this._pendingSharedStateRefreshGraphics;
22331
+ (null == pendingSharedRefresh ? void 0 : pendingSharedRefresh.size) && flushStageSharedStateRefresh(this), this._beforeRenderList.forEach(cb => cb(stage));
21977
22332
  }, this.afterClearScreen = drawParams => {
21978
22333
  this._afterClearScreen && this._afterClearScreen(drawParams);
21979
22334
  }, this.afterClearRect = drawParams => {
@@ -21998,14 +22353,17 @@ class Stage extends Group$1 {
21998
22353
  canvas: params.canvas
21999
22354
  }), 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, {
22000
22355
  main: !0
22001
- })), 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 = () => {
22356
+ })), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.theme.onStateDefinitionsChange = () => {
22002
22357
  var _a;
22003
- this.rootSharedStateScope && (setRootSharedStateScopeThemeDefinitions(this.rootSharedStateScope, null === (_a = this.theme) || void 0 === _a ? void 0 : _a.stateDefinitions), markScopeActiveDescendantsDirty(this.rootSharedStateScope, this));
22358
+ const definitions = null === (_a = this.theme) || void 0 === _a ? void 0 : _a.stateDefinitions;
22359
+ if (!definitions || !Object.keys(definitions).length) return void (this.rootSharedStateScope && (setRootSharedStateScopeThemeDefinitions(this.rootSharedStateScope, definitions), markScopeActiveDescendantsDirty(this.rootSharedStateScope, this)));
22360
+ const rootScope = this.ensureRootSharedStateScope(definitions);
22361
+ setRootSharedStateScopeThemeDefinitions(rootScope, definitions), markScopeActiveDescendantsDirty(rootScope, this);
22004
22362
  }, 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 = {
22005
22363
  tickRenderMode: "effect"
22006
22364
  }), this.optmize(params.optimize), params.background && isString$1(this._background) && this._background.includes("/") && this.setAttributes({
22007
22365
  background: this._background
22008
- }), this.initAnimate(params), this.rafId = null !== (_y = params.rafId) && void 0 !== _y ? _y : Math.floor(6 * Math.random());
22366
+ }), this.initAnimate(params), this.rafId = null !== (_x = params.rafId) && void 0 !== _x ? _x : Math.floor(6 * Math.random());
22009
22367
  }
22010
22368
  initAnimate(params) {
22011
22369
  var _a;
@@ -22265,8 +22623,14 @@ class Stage extends Group$1 {
22265
22623
  this._doRenderInThisFrame(), this.willNextFrameRender = !1;
22266
22624
  }));
22267
22625
  }
22626
+ ensureRootSharedStateScope(themeStateDefinitions) {
22627
+ return this.rootSharedStateScope ? (this.rootSharedStateScope.ownerStage = this, this.rootSharedStateScope) : (this.rootSharedStateScope = createRootSharedStateScope(this, themeStateDefinitions), this.rootSharedStateScope);
22628
+ }
22629
+ getStateBatchScheduler() {
22630
+ return this._stateBatchScheduler || (this._stateBatchScheduler = new StateBatchScheduler(this, ensureStageStatePerfMonitor(this))), this._stateBatchScheduler;
22631
+ }
22268
22632
  scheduleStateBatch(graphics, targetStates) {
22269
- this._stateBatchScheduler.schedule(graphics, targetStates);
22633
+ this.getStateBatchScheduler().schedule(graphics, targetStates);
22270
22634
  }
22271
22635
  getStatePerfSnapshot() {
22272
22636
  return ensureStageStatePerfMonitor(this).getSnapshot();
@@ -24767,7 +25131,11 @@ const result = {
24767
25131
  };
24768
25132
  class BaseRender {
24769
25133
  init(contributions) {
24770
- 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));
25134
+ this.builtinContributions || (this.builtinContributions = []), this._renderContribitions = contributions ? contributions.getContributions().slice() : [];
25135
+ const addContribution = item => {
25136
+ this._renderContribitions.includes(item) || this._renderContribitions.push(item);
25137
+ };
25138
+ 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 = []);
24771
25139
  }
24772
25140
  reInit() {
24773
25141
  this.init(this.graphicRenderContributions);
@@ -29816,8 +30184,8 @@ class FlexLayoutPlugin {
29816
30184
  graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === this.pluginService.stage && graphic.isContainer && !this.skipBoundsTrigger && _tempBounds.copy(bounds);
29817
30185
  }), stage.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, (graphic, stage, bounds, params, selfChange) => {
29818
30186
  stage && stage === this.pluginService.stage && graphic.isContainer && !this.skipBoundsTrigger && (_tempBounds.equals(bounds) || this.tryLayout(graphic, !1));
29819
- }), stage.graphicService.hooks.onSetStage.tap(this.key, graphic => {
29820
- graphic.glyphHost && (graphic = graphic.glyphHost), this.tryLayout(graphic, !1);
30187
+ }), stage.graphicService.hooks.onSetStage.tap(this.key, (graphic, nextStage) => {
30188
+ nextStage && nextStage === this.pluginService.stage && (graphic.glyphHost && (graphic = graphic.glyphHost), this.tryLayout(graphic, !1));
29821
30189
  }));
29822
30190
  }
29823
30191
  deactivate(context) {
@@ -30380,7 +30748,6 @@ var VRenderCore = /*#__PURE__*/Object.freeze({
30380
30748
  segments: segments,
30381
30749
  shouldClipImageByLayout: shouldClipImageByLayout,
30382
30750
  shouldUseMat4: shouldUseMat4,
30383
- shouldUseSimpleAttributeFastPath: shouldUseSimpleAttributeFastPath,
30384
30751
  snapLength: snapLength,
30385
30752
  splitArc: splitArc,
30386
30753
  splitArea: splitArea,
@@ -38062,15 +38429,38 @@ function commitUpdateAnimationTarget(graphic, targetAttrs, startAttrs) {
38062
38429
  if (!graphic || !targetAttrs) return;
38063
38430
  const committedTargetAttrs = cloneDeep(targetAttrs),
38064
38431
  transientStartAttrs = cloneDeep(null != startAttrs ? startAttrs : graphic.attribute);
38065
- graphic.setAttributes(committedTargetAttrs);
38066
- const baseAttributes = graphic.baseAttributes;
38067
- baseAttributes && "object" == typeof baseAttributes && Object.keys(committedTargetAttrs).forEach(key => {
38068
- baseAttributes[key] = cloneDeep(committedTargetAttrs[key]);
38069
- }), 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, {
38432
+ 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, {
38070
38433
  type: AttributeUpdateType.ANIMATE_BIND
38071
38434
  });
38072
38435
  }
38073
38436
 
38437
+ function collectTrackedAnimates(graphic, animates = [], visited = new Set()) {
38438
+ var _a, _b, _c, _d, _e;
38439
+ const trackedAnimates = null !== (_c = null === (_b = (_a = graphic).getTrackedAnimates) || void 0 === _b ? void 0 : _b.call(_a)) && void 0 !== _c ? _c : graphic.animates;
38440
+ return null == trackedAnimates || trackedAnimates.forEach(animate => {
38441
+ animate && !visited.has(animate) && (visited.add(animate), animates.push(animate));
38442
+ }), null === (_e = (_d = graphic).forEachChildren) || void 0 === _e || _e.call(_d, child => {
38443
+ collectTrackedAnimates(child, animates, visited);
38444
+ }), animates;
38445
+ }
38446
+ function appendExitReleaseCallback(state, callback) {
38447
+ callback && (null == state || state.onComplete.push(callback));
38448
+ }
38449
+ function runExitReleaseCallbacks(callbacks) {
38450
+ callbacks.forEach(callback => {
38451
+ callback();
38452
+ });
38453
+ }
38454
+ function bindExitReleaseAnimates(exitAnimates, getState, finalize) {
38455
+ const finish = animate => {
38456
+ const state = getState();
38457
+ state && !state.finalized && state.pendingAnimates.has(animate) && (state.pendingAnimates.delete(animate), state.pendingAnimates.size || finalize());
38458
+ };
38459
+ exitAnimates.forEach(animate => {
38460
+ animate.onEnd(() => finish(animate)), animate.onRemove(() => finish(animate));
38461
+ });
38462
+ }
38463
+
38074
38464
  const DefaultAxisAnimation = {
38075
38465
  type: "default",
38076
38466
  duration: 300,
@@ -38102,12 +38492,65 @@ class AxisBase extends AnimateComponent {
38102
38492
  });
38103
38493
  return this.add(offscreenGroup), this._renderInner(offscreenGroup), this.removeChild(offscreenGroup), this.attribute = currentAttribute, offscreenGroup.AABBBounds;
38104
38494
  }
38495
+ _finalizeExitRelease() {
38496
+ var _a, _b;
38497
+ const state = this._exitReleaseState;
38498
+ if (null == state ? void 0 : state.finalized) return;
38499
+ state && (state.finalized = !0);
38500
+ const parent = this.parent,
38501
+ removeFromParent = !!(null == state ? void 0 : state.removeFromParent),
38502
+ callbacks = null !== (_a = null == state ? void 0 : state.onComplete) && void 0 !== _a ? _a : [];
38503
+ 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);
38504
+ }
38505
+ _runExitAnimationBeforeRelease(options = {}) {
38506
+ var _a, _b, _c;
38507
+ if (this._exitReleaseState && !this._exitReleaseState.finalized) return this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent, appendExitReleaseCallback(this._exitReleaseState, options.onComplete), !0;
38508
+ if (!this.stage || !1 === this.attribute.animation || !1 === this.attribute.animationExit || !this._innerView) return !1;
38509
+ if (this._prepare(), !(null === (_a = this._animationConfig) || void 0 === _a ? void 0 : _a.exit)) return !1;
38510
+ const exitTargets = new Set();
38511
+ if (traverseGroup(this._innerView, el => {
38512
+ "group" !== el.type && exitTargets.add(el);
38513
+ }), !exitTargets.size) return !1;
38514
+ const existingAnimates = collectTrackedAnimates(this),
38515
+ {
38516
+ delay = 0,
38517
+ duration = DefaultAxisAnimation.duration,
38518
+ easing = DefaultAxisAnimation.easing
38519
+ } = this._animationConfig.exit;
38520
+ exitTargets.forEach(target => {
38521
+ var _a, _b, _c;
38522
+ const startAttrs = {
38523
+ opacity: null !== (_a = target.attribute.opacity) && void 0 !== _a ? _a : 1,
38524
+ fillOpacity: null !== (_b = target.attribute.fillOpacity) && void 0 !== _b ? _b : 1,
38525
+ strokeOpacity: null !== (_c = target.attribute.strokeOpacity) && void 0 !== _c ? _c : 1
38526
+ },
38527
+ endAttrs = {
38528
+ opacity: 0,
38529
+ fillOpacity: 0,
38530
+ strokeOpacity: 0
38531
+ };
38532
+ commitUpdateAnimationTarget(target, endAttrs, startAttrs), target.animate().wait(delay).to(endAttrs, duration, easing);
38533
+ });
38534
+ const exitAnimates = collectTrackedAnimates(this).filter(animate => !existingAnimates.includes(animate));
38535
+ if (!exitAnimates.length) return !1;
38536
+ this.setAttribute("childrenPickable", !1), null === (_c = (_b = this._innerView).removeAllEventListeners) || void 0 === _c || _c.call(_b), this.releaseStatus = "willRelease";
38537
+ const pendingAnimates = new Set(exitAnimates);
38538
+ return this._exitReleaseState = {
38539
+ pendingAnimates: pendingAnimates,
38540
+ finalized: !1,
38541
+ removeFromParent: !!options.removeFromParent,
38542
+ onComplete: options.onComplete ? [options.onComplete] : []
38543
+ }, bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease()), !0;
38544
+ }
38545
+ releaseWithExitAnimation(options = {}) {
38546
+ return "released" !== this.releaseStatus && this._runExitAnimationBeforeRelease(options);
38547
+ }
38105
38548
  render() {
38106
- this._prepare(), this._prevInnerView = this._innerView && getElMap(this._innerView), this.removeAllChild(!0), this._innerView = graphicCreator.group({
38549
+ this._exitReleaseState || (this._prepare(), this._prevInnerView = this._innerView && getElMap(this._innerView), this.removeAllChild(!0), this._innerView = graphicCreator.group({
38107
38550
  x: 0,
38108
38551
  y: 0,
38109
38552
  pickable: !1
38110
- }), this.add(this._innerView), this._renderInner(this._innerView), this._bindEvent(), this.runAnimation();
38553
+ }), this.add(this._innerView), this._renderInner(this._innerView), this._bindEvent(), this.runAnimation());
38111
38554
  }
38112
38555
  _prepare() {
38113
38556
  this._prepareAnimate(DefaultAxisAnimation);
@@ -38439,8 +38882,8 @@ class AxisBase extends AnimateComponent {
38439
38882
  });
38440
38883
  }
38441
38884
  }
38442
- release() {
38443
- super.release(), this._prevInnerView = null, this._innerView = null;
38885
+ release(all) {
38886
+ this._exitReleaseState ? this._finalizeExitRelease() : (all && this.removeAllChild(!0), super.release(all), all && this.removeAllChild(!0), this._prevInnerView = null, this._innerView = null);
38444
38887
  }
38445
38888
  }
38446
38889
 
@@ -38952,20 +39395,67 @@ function commonInterpolateUpdate(key, from, to, ratio, step, target) {
38952
39395
  return !1;
38953
39396
  }
38954
39397
 
39398
+ const animateUpdateContext = {
39399
+ type: AttributeUpdateType.ANIMATE_UPDATE
39400
+ },
39401
+ animateBindContext = {
39402
+ type: AttributeUpdateType.ANIMATE_BIND
39403
+ },
39404
+ animateStartContext = {
39405
+ type: AttributeUpdateType.ANIMATE_START
39406
+ };
39407
+ function getAnimationContext(type) {
39408
+ switch (type) {
39409
+ case AttributeUpdateType.ANIMATE_UPDATE:
39410
+ return animateUpdateContext;
39411
+ case AttributeUpdateType.ANIMATE_BIND:
39412
+ return animateBindContext;
39413
+ case AttributeUpdateType.ANIMATE_START:
39414
+ return animateStartContext;
39415
+ default:
39416
+ return {
39417
+ type: type
39418
+ };
39419
+ }
39420
+ }
39421
+ function prepareAnimationFrameAttribute(target) {
39422
+ const transientTarget = target;
39423
+ return transientTarget.attribute || (transientTarget.attribute = {}), transientTarget.attribute === transientTarget.baseAttributes && "function" == typeof transientTarget.detachAttributeFromBaseAttributes && transientTarget.detachAttributeFromBaseAttributes(), transientTarget.attributeMayContainTransientAttrs = !0, transientTarget.attribute;
39424
+ }
39425
+ function commitAnimationFrameAttribute(target) {
39426
+ var _a, _b;
39427
+ null === (_b = (_a = target).onAttributeUpdate) || void 0 === _b || _b.call(_a, animateUpdateContext);
39428
+ }
39429
+ function applyAnimationFrameAttributes(target, attributes) {
39430
+ if (!attributes) return;
39431
+ const targetAttribute = prepareAnimationFrameAttribute(target);
39432
+ for (const key in attributes) Object.prototype.hasOwnProperty.call(attributes, key) && (targetAttribute[key] = attributes[key]);
39433
+ commitAnimationFrameAttribute(target);
39434
+ }
39435
+ function applyAnimationFrameNumberAttributes(target, keys, from, to, ratio) {
39436
+ const targetAttribute = prepareAnimationFrameAttribute(target);
39437
+ for (let i = 0; i < keys.length; i++) {
39438
+ const key = keys[i];
39439
+ targetAttribute[key] = from[key] + (to[key] - from[key]) * ratio;
39440
+ }
39441
+ commitAnimationFrameAttribute(target);
39442
+ }
38955
39443
  function applyAnimationTransientAttributes(target, attributes, type = AttributeUpdateType.ANIMATE_UPDATE) {
38956
39444
  var _a;
38957
39445
  if (!attributes) return;
38958
- const context = {
38959
- type: type
38960
- },
39446
+ const context = getAnimationContext(type),
38961
39447
  transientTarget = target;
38962
- "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);
39448
+ "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);
38963
39449
  }
38964
39450
  function applyAppearStartAttributes(target, attributes) {
38965
39451
  applyAnimationTransientAttributes(target, attributes, AttributeUpdateType.ANIMATE_BIND);
38966
39452
  }
38967
39453
 
38968
39454
  function noop() {}
39455
+ function includesKey$1(keys, key) {
39456
+ for (let i = 0; i < keys.length; i++) if (keys[i] === key) return !0;
39457
+ return !1;
39458
+ }
38969
39459
  class Step {
38970
39460
  constructor(type, props, duration, easing) {
38971
39461
  var _a;
@@ -39021,6 +39511,17 @@ class Step {
39021
39511
  onBind() {
39022
39512
  "glyph" === this.target.type && (this.syncAttributeUpdate = this._syncAttributeUpdate);
39023
39513
  }
39514
+ runInterpolateUpdate(fromProps, toProps, ratio) {
39515
+ if (this.animate.interpolateUpdateFunction) return void this.animate.interpolateUpdateFunction(fromProps, toProps, ratio, this, this.target);
39516
+ const funcs = this.interpolateUpdateFunctions,
39517
+ propKeys = this.propKeys;
39518
+ if (funcs && propKeys) for (let index = 0; index < funcs.length; index++) {
39519
+ const key = propKeys[index],
39520
+ fromValue = fromProps[key],
39521
+ toValue = toProps[key];
39522
+ funcs[index](key, fromValue, toValue, ratio, this, this.target);
39523
+ }
39524
+ }
39024
39525
  onFirstRun() {}
39025
39526
  onStart() {
39026
39527
  if (!this._hasFirstRun) {
@@ -39035,23 +39536,49 @@ class Step {
39035
39536
  tryPreventConflict() {
39036
39537
  var _a, _b;
39037
39538
  const animate = this.animate,
39038
- target = this.target;
39039
- (null !== (_b = null === (_a = target.forEachTrackedAnimate) || void 0 === _a ? void 0 : _a.bind(target)) && void 0 !== _b ? _b : cb => {
39040
- var _a;
39041
- null === (_a = target.animates) || void 0 === _a || _a.forEach(cb);
39042
- })(a => {
39539
+ target = this.target,
39540
+ forEachTrackedAnimate = null !== (_b = null === (_a = target.forEachTrackedAnimate) || void 0 === _a ? void 0 : _a.bind(target)) && void 0 !== _b ? _b : cb => {
39541
+ var _a;
39542
+ null === (_a = target.animates) || void 0 === _a || _a.forEach(cb);
39543
+ },
39544
+ propKeys = this.propKeys;
39545
+ forEachTrackedAnimate(a => {
39043
39546
  if (a === animate || a.priority > animate.priority || a.priority === 1 / 0) return;
39044
39547
  const fromProps = a.getStartProps();
39045
- this.propKeys.forEach(key => {
39046
- null != fromProps[key] && a.preventAttr(key);
39047
- });
39548
+ let conflictKeys = null;
39549
+ for (let i = 0; i < propKeys.length; i++) {
39550
+ const key = propKeys[i];
39551
+ null != fromProps[key] && (null != conflictKeys ? conflictKeys : conflictKeys = []).push(key);
39552
+ }
39553
+ conflictKeys && a.preventAttrs(conflictKeys);
39048
39554
  });
39049
39555
  }
39556
+ removeKeysFromRecord(record, keys) {
39557
+ if (!record) return record;
39558
+ let hasBlockedKey = !1;
39559
+ for (const key in record) if (Object.prototype.hasOwnProperty.call(record, key) && includesKey$1(keys, key)) {
39560
+ hasBlockedKey = !0;
39561
+ break;
39562
+ }
39563
+ if (!hasBlockedKey) return record;
39564
+ const nextRecord = {};
39565
+ for (const key in record) Object.prototype.hasOwnProperty.call(record, key) && !includesKey$1(keys, key) && (nextRecord[key] = record[key]);
39566
+ return nextRecord;
39567
+ }
39050
39568
  deleteSelfAttr(key) {
39569
+ this.deleteSelfAttrs([key]);
39570
+ }
39571
+ deleteSelfAttrs(keys) {
39051
39572
  var _a;
39052
- delete this.props[key], this.fromProps && delete this.fromProps[key];
39053
- const index = this.propKeys.indexOf(key);
39054
- -1 !== index && (this.propKeys.splice(index, 1), null === (_a = this.interpolateUpdateFunctions) || void 0 === _a || _a.splice(index, 1));
39573
+ 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)) {
39574
+ const funcs = this.interpolateUpdateFunctions;
39575
+ let writeIndex = 0;
39576
+ for (let readIndex = 0; readIndex < this.propKeys.length; readIndex++) {
39577
+ const propKey = this.propKeys[readIndex];
39578
+ includesKey$1(keys, propKey) || (writeIndex !== readIndex && (this.propKeys[writeIndex] = propKey, funcs && (funcs[writeIndex] = funcs[readIndex])), writeIndex++);
39579
+ }
39580
+ this.propKeys.length = writeIndex, funcs && (funcs.length = writeIndex);
39581
+ }
39055
39582
  }
39056
39583
  trySyncStartProps() {
39057
39584
  this.propKeys.forEach(key => {
@@ -39061,11 +39588,7 @@ class Step {
39061
39588
  update(end, ratio, out) {
39062
39589
  if (this.onStart(), !this.props || !this.propKeys) return;
39063
39590
  const easedRatio = this.easing(ratio);
39064
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
39065
- if (!this.animate.validAttr(this.propKeys[index])) return;
39066
- const key = this.propKeys[index];
39067
- func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
39068
- }), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
39591
+ this.runInterpolateUpdate(this.fromProps, this.props, easedRatio), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
39069
39592
  }
39070
39593
  onUpdate(end, ratio, out) {}
39071
39594
  onEnd(cb) {
@@ -39269,19 +39792,34 @@ class FromTo extends ACustomAnimate {
39269
39792
  }), this.applyTransientFromAttributes();
39270
39793
  }
39271
39794
  deleteSelfAttr(key) {
39272
- super.deleteSelfAttr(key), delete this.from[key];
39795
+ this.deleteSelfAttrs([key]);
39796
+ }
39797
+ deleteSelfAttrs(keys) {
39798
+ super.deleteSelfAttrs(keys), this.from = this.removeKeysFromRecord(this.from, keys);
39273
39799
  }
39274
39800
  update(end, ratio, out) {
39275
39801
  if (this.onStart(), !this.props || !this.propKeys) return;
39276
39802
  const easedRatio = this.easing(ratio);
39277
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.from, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
39278
- if (!this.animate.validAttr(this.propKeys[index])) return;
39279
- const key = this.propKeys[index];
39280
- func(key, this.from[key], this.props[key], easedRatio, this, this.target);
39281
- }), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
39803
+ this.runInterpolateUpdate(this.from, this.props, easedRatio), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
39282
39804
  }
39283
39805
  }
39284
39806
 
39807
+ function includesKey(keys, key) {
39808
+ for (let i = 0; i < keys.length; i++) if (keys[i] === key) return !0;
39809
+ return !1;
39810
+ }
39811
+ function removeKeysFromRecord(record, keys) {
39812
+ if (!record) return record;
39813
+ let hasBlockedKey = !1;
39814
+ for (const key in record) if (Object.prototype.hasOwnProperty.call(record, key) && includesKey(keys, key)) {
39815
+ hasBlockedKey = !0;
39816
+ break;
39817
+ }
39818
+ if (!hasBlockedKey) return record;
39819
+ const nextRecord = {};
39820
+ for (const key in record) Object.prototype.hasOwnProperty.call(record, key) && !includesKey(keys, key) && (nextRecord[key] = record[key]);
39821
+ return nextRecord;
39822
+ }
39285
39823
  class Animate {
39286
39824
  constructor(id = Generator.GenAutoIncrementId(), timeline = defaultTimeline, slience) {
39287
39825
  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;
@@ -39304,7 +39842,7 @@ class Animate {
39304
39842
  bind(target) {
39305
39843
  this.target = target;
39306
39844
  const trackerTarget = this.target;
39307
- 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(() => {
39845
+ 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(() => {
39308
39846
  this.stop(), this.__skipRestoreStaticAttributeOnRemove || "function" != typeof trackerTarget.restoreStaticAttribute || trackerTarget.restoreStaticAttribute(), "function" == typeof trackerTarget.untrackAnimate ? trackerTarget.untrackAnimate(this.id) : this.target.animates.delete(this.id);
39309
39847
  }), this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.target.animationAttribute || (this.target.animationAttribute = {}), this;
39310
39848
  }
@@ -39369,12 +39907,14 @@ class Animate {
39369
39907
  cb ? (this._onRemove || (this._onRemove = []), this._onRemove.push(cb)) : null === (_a = this._onRemove) || void 0 === _a || _a.forEach(cb => cb());
39370
39908
  }
39371
39909
  preventAttr(key) {
39372
- this._preventAttrs.add(key), delete this._startProps[key], delete this._endProps[key];
39373
- let step = this._firstStep;
39374
- for (; step;) step.deleteSelfAttr(key), step = step.next;
39910
+ this.preventAttrs([key]);
39375
39911
  }
39376
39912
  preventAttrs(keys) {
39377
- keys.forEach(key => this._preventAttrs.add(key));
39913
+ if (!(null == keys ? void 0 : keys.length)) return;
39914
+ for (let i = 0; i < keys.length; i++) this._preventAttrs.add(keys[i]);
39915
+ this._startProps = removeKeysFromRecord(this._startProps, keys), this._endProps = removeKeysFromRecord(this._endProps, keys);
39916
+ let step = this._firstStep;
39917
+ for (; step;) step.deleteSelfAttrs(keys), step = step.next;
39378
39918
  }
39379
39919
  validAttr(key) {
39380
39920
  return !this._preventAttrs.has(key);
@@ -39793,6 +40333,33 @@ class AnimateExecutor {
39793
40333
  cb();
39794
40334
  });
39795
40335
  }
40336
+ getActiveAttrKeys() {
40337
+ const keys = [];
40338
+ for (let i = 0; i < this._animates.length; i++) {
40339
+ const animate = this._animates[i];
40340
+ if (animate.status === AnimateStatus.END) continue;
40341
+ const endProps = animate.getEndProps();
40342
+ if (endProps) for (const key in endProps) Object.prototype.hasOwnProperty.call(endProps, key) && keys.indexOf(key) < 0 && keys.push(key);
40343
+ }
40344
+ return keys;
40345
+ }
40346
+ hasActiveAttrs() {
40347
+ for (let i = 0; i < this._animates.length; i++) {
40348
+ const animate = this._animates[i];
40349
+ if (animate.status === AnimateStatus.END) continue;
40350
+ const endProps = animate.getEndProps();
40351
+ if (endProps) for (const key in endProps) if (Object.prototype.hasOwnProperty.call(endProps, key)) return !0;
40352
+ }
40353
+ return !1;
40354
+ }
40355
+ preventAttrs(keys) {
40356
+ if (!(null == keys ? void 0 : keys.length)) return this.hasActiveAttrs();
40357
+ for (let i = 0; i < this._animates.length; i++) {
40358
+ const animate = this._animates[i];
40359
+ animate.status !== AnimateStatus.END && animate.preventAttrs(keys);
40360
+ }
40361
+ return this.hasActiveAttrs();
40362
+ }
39796
40363
  _trackAnimation(animate) {
39797
40364
  this._animates.push(animate), this._activeCount++, 1 !== this._activeCount || this._started || (this._started = !0, this.onStart()), animate.onEnd(() => {
39798
40365
  this._activeCount--;
@@ -39915,7 +40482,8 @@ class AnimateExecutor {
39915
40482
  let parsedFromProps = null,
39916
40483
  props = params.to,
39917
40484
  from = params.from;
39918
- 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);
40485
+ const commitAttrOutChannel = this.shouldCommitAttrOutChannel(type);
40486
+ 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);
39919
40487
  let totalDelay = 0;
39920
40488
  oneByOneDelay && (totalDelay = oneByOneDelay * (count - index - 1));
39921
40489
  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;
@@ -39978,7 +40546,8 @@ class AnimateExecutor {
39978
40546
  let parsedFromProps = null,
39979
40547
  props = effect.to,
39980
40548
  from = effect.from;
39981
- 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);
40549
+ const commitAttrOutChannel = this.shouldCommitAttrOutChannel(type);
40550
+ 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);
39982
40551
  const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
39983
40552
  customType = effect.custom ? effect.customType : getCustomType(custom);
39984
40553
  this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
@@ -39992,11 +40561,14 @@ class AnimateExecutor {
39992
40561
  interpolator(ratio, from, to, step, target, animate.target, customParams);
39993
40562
  }, animate.to(props, duration, easing);
39994
40563
  }
40564
+ shouldCommitAttrOutChannel(type) {
40565
+ return "update" !== type;
40566
+ }
39995
40567
  createCustomAnimation(animate, CustomAnimateConstructor, from, props, duration, easing, customParams) {
39996
40568
  const customAnimate = new CustomAnimateConstructor(from, props, duration, easing, customParams);
39997
40569
  animate.play(customAnimate);
39998
40570
  }
39999
- createPropsFromChannel(channel, graphic) {
40571
+ createPropsFromChannel(channel, graphic, includeAttrOutChannel = !0) {
40000
40572
  var _a;
40001
40573
  const props = {};
40002
40574
  let from = null;
@@ -40005,7 +40577,7 @@ class AnimateExecutor {
40005
40577
  props: props,
40006
40578
  attrOutChannel: null
40007
40579
  };
40008
- const attrOutChannel = {};
40580
+ const attrOutChannel = includeAttrOutChannel ? {} : null;
40009
40581
  let hasAttrs = !1;
40010
40582
  const diffAttrs = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs;
40011
40583
  if (Array.isArray(channel) && (channel = channel.reduce((res, key) => (void 0 === diffAttrs[key] || (res[key] = {
@@ -40014,7 +40586,7 @@ class AnimateExecutor {
40014
40586
  var _a, _b, _c, _d;
40015
40587
  const config = channel[key];
40016
40588
  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);
40017
- }), diffAttrs) for (const key in diffAttrs) {
40589
+ }), diffAttrs && attrOutChannel) for (const key in diffAttrs) {
40018
40590
  const value = diffAttrs[key];
40019
40591
  if (void 0 === value) continue;
40020
40592
  props.hasOwnProperty(key) || !!(null == from ? void 0 : from.hasOwnProperty(key)) || (attrOutChannel[key] = value, hasAttrs = !0);
@@ -40093,8 +40665,22 @@ class AnimationStateManager {
40093
40665
  hasTrackedAnimate() {
40094
40666
  return this.trackedAnimates.size > 0;
40095
40667
  }
40668
+ hasStateInfo(list, target) {
40669
+ for (let i = 0; i < list.length; i++) if (list[i] === target) return !0;
40670
+ return !1;
40671
+ }
40672
+ takeOverUpdateAttrs(nextState, currentStates, shouldStopState) {
40673
+ if (nextState.state !== AnimationStates$1.UPDATE || !currentStates.length) return;
40674
+ const nextKeys = nextState.executor.getActiveAttrKeys();
40675
+ if (nextKeys.length) for (let i = 0; i < currentStates.length; i++) {
40676
+ const currentState = currentStates[i];
40677
+ currentState.state !== AnimationStates$1.UPDATE || currentState === nextState || this.hasStateInfo(shouldStopState, currentState) || currentState.executor.preventAttrs(nextKeys) || (currentState.executor.stop(null, !1), shouldStopState.push(currentState));
40678
+ }
40679
+ }
40096
40680
  applyState(nextState, animationConfig, callback) {
40681
+ var _a;
40097
40682
  const registry = AnimationTransitionRegistry.getInstance(),
40683
+ currentStateList = null !== (_a = this.stateList) && void 0 !== _a ? _a : [],
40098
40684
  shouldStopState = [],
40099
40685
  shouldApplyState = [];
40100
40686
  if (this.stateList && this.stateList.length ? nextState.forEach((state, index) => {
@@ -40102,14 +40688,14 @@ class AnimationStateManager {
40102
40688
  allowTransition: !0,
40103
40689
  stopOriginalTransition: !0
40104
40690
  };
40105
- this.stateList.forEach(currState => {
40691
+ currentStateList.forEach(currState => {
40106
40692
  const _result = registry.isTransitionAllowed(currState.state, state, this.graphic);
40107
40693
  result.allowTransition = result.allowTransition && _result.allowTransition;
40108
40694
  }), result.allowTransition && (shouldApplyState.push({
40109
40695
  state: state,
40110
40696
  animationConfig: isArray$1(animationConfig[index]) ? animationConfig[index].map(item => item.animation) : animationConfig[index].animation,
40111
40697
  executor: new AnimateExecutor(this.graphic)
40112
- }), this.stateList.forEach(currState => {
40698
+ }), currentStateList.forEach(currState => {
40113
40699
  registry.isTransitionAllowed(currState.state, state, this.graphic).stopOriginalTransition && shouldStopState.push(currState);
40114
40700
  }));
40115
40701
  }) : nextState.forEach((state, index) => {
@@ -40121,12 +40707,18 @@ class AnimationStateManager {
40121
40707
  }), shouldStopState.forEach(state => {
40122
40708
  state.executor.stop(null, !1);
40123
40709
  }), shouldApplyState.length) {
40124
- shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig);
40710
+ shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig), this.takeOverUpdateAttrs(shouldApplyState[0], currentStateList, shouldStopState);
40125
40711
  for (let i = 0; i < shouldApplyState.length; i++) {
40126
40712
  const nextState = shouldApplyState[i + 1],
40127
40713
  currentState = shouldApplyState[i];
40128
40714
  currentState.executor.onEnd(() => {
40129
- nextState && nextState.executor.execute(nextState.animationConfig), this.stateList = this.stateList.filter(state => state !== currentState), i === shouldApplyState.length - 1 && callback && callback(!1);
40715
+ var _a;
40716
+ if (nextState) {
40717
+ nextState.executor.execute(nextState.animationConfig);
40718
+ const stoppedStates = [];
40719
+ 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)));
40720
+ }
40721
+ this.stateList = this.stateList.filter(state => state !== currentState), i === shouldApplyState.length - 1 && callback && callback(!1);
40130
40722
  });
40131
40723
  }
40132
40724
  } else callback && callback(!0);
@@ -40369,8 +40961,11 @@ class ComponentAnimator {
40369
40961
  }), this));
40370
40962
  }
40371
40963
  deleteSelfAttr(key) {
40964
+ this.deleteSelfAttrs([key]);
40965
+ }
40966
+ deleteSelfAttrs(keys) {
40372
40967
  this.tasks.forEach(task => {
40373
- task.animate && task.animate.forEach(animate => animate.preventAttr(key));
40968
+ task.animate && task.animate.forEach(animate => animate.preventAttrs(keys));
40374
40969
  });
40375
40970
  }
40376
40971
  stop(type) {
@@ -40934,6 +41529,25 @@ class ClipDirectionAnimate extends ClipGraphicAnimate {
40934
41529
  }
40935
41530
  }
40936
41531
 
41532
+ function buildAnimationStaticCommitAttrs(target, keys, animate, fallbackAttrs) {
41533
+ var _a;
41534
+ const commitTarget = target,
41535
+ contextFinalAttrs = null === (_a = commitTarget.context) || void 0 === _a ? void 0 : _a.finalAttrs,
41536
+ finalAttribute = "function" == typeof commitTarget.getFinalAttribute ? commitTarget.getFinalAttribute() : commitTarget.finalAttribute;
41537
+ let commitAttrs = null;
41538
+ for (let i = 0; i < keys.length; i++) {
41539
+ const key = keys[i];
41540
+ 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]));
41541
+ }
41542
+ return commitAttrs;
41543
+ }
41544
+ function commitAnimationStaticAttrs(target, keys, animate, fallbackAttrs) {
41545
+ const commitAttrs = buildAnimationStaticCommitAttrs(target, keys, animate, fallbackAttrs);
41546
+ return !!commitAttrs && (target.setAttributes(commitAttrs, !1, {
41547
+ type: AttributeUpdateType.ANIMATE_END
41548
+ }), !0);
41549
+ }
41550
+
40937
41551
  class TagPointsUpdate extends ACustomAnimate {
40938
41552
  constructor(from, to, duration, easing, params) {
40939
41553
  var _a, _b;
@@ -40952,21 +41566,9 @@ class TagPointsUpdate extends ACustomAnimate {
40952
41566
  }
40953
41567
  onBind() {
40954
41568
  super.onBind();
40955
- const {
40956
- points: points,
40957
- segments: segments
40958
- } = this.target.attribute,
40959
- {
40960
- points: pointsTo,
40961
- segments: segmentsTo
40962
- } = this.target.getFinalAttribute();
40963
- this.from = {
40964
- points: points,
40965
- segments: segments
40966
- }, this.to = {
40967
- points: pointsTo,
40968
- segments: segmentsTo
40969
- }, this.props = this.to;
41569
+ const currentAttribute = this.target.attribute,
41570
+ finalAttribute = this.target.getFinalAttribute();
41571
+ 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;
40970
41572
  const originFromPoints = this.getPoints(this.from),
40971
41573
  originToPoints = this.getPoints(this.to, !0);
40972
41574
  this.fromPoints = originFromPoints ? Array.isArray(originFromPoints) ? originFromPoints : [originFromPoints] : [], this.toPoints = originToPoints ? Array.isArray(originToPoints) ? originToPoints : [originToPoints] : [];
@@ -41002,31 +41604,42 @@ class TagPointsUpdate extends ACustomAnimate {
41002
41604
  const lastClipRange = this.target.attribute.clipRange;
41003
41605
  isValidNumber$1(lastClipRange * this.clipRange) && (this.clipRange *= lastClipRange);
41004
41606
  }
41607
+ onEnd(cb) {
41608
+ cb ? super.onEnd(cb) : (this.to && commitAnimationStaticAttrs(this.target, Object.keys(this.to), this.animate, this.to), super.onEnd());
41609
+ }
41610
+ applyPointTransientAttributes(attributes) {
41611
+ const validAttrs = {};
41612
+ Object.keys(attributes).forEach(key => {
41613
+ this.animate.validAttr(key) && (validAttrs[key] = attributes[key]);
41614
+ }), Object.keys(validAttrs).length && (applyAnimationFrameAttributes(this.target, validAttrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag());
41615
+ }
41005
41616
  onUpdate(end, ratio, out) {
41006
- if (end) return Object.keys(this.to).forEach(k => {
41007
- this.target.attribute[k] = this.to[k];
41008
- }), this.target.addUpdatePositionTag(), void this.target.addUpdateShapeAndBoundsTag();
41009
- if (this.points = this.points.map((point, index) => {
41010
- const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
41011
- return newPoint.context = point.context, newPoint;
41012
- }), this.clipRange) {
41013
- 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));
41014
- applyAnimationTransientAttributes(this.target, {
41015
- clipRange: this.clipRange + (1 - this.clipRange) * ratio
41016
- });
41017
- }
41018
- if (this.segmentsCache && this.to.segments) {
41019
- let start = 0;
41020
- const segments = this.to.segments.map((segment, index) => {
41021
- const end = start + this.segmentsCache[index],
41022
- points = this.points.slice(start, end);
41023
- return start = end, Object.assign(Object.assign({}, segment), {
41024
- points: points
41617
+ if (end) this.applyPointTransientAttributes(this.to);else {
41618
+ if (this.points = this.points.map((point, index) => {
41619
+ const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
41620
+ return newPoint.context = point.context, newPoint;
41621
+ }), this.clipRange) {
41622
+ 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));
41623
+ applyAnimationTransientAttributes(this.target, {
41624
+ clipRange: this.clipRange + (1 - this.clipRange) * ratio
41625
+ });
41626
+ }
41627
+ if (this.segmentsCache && this.to.segments) {
41628
+ let start = 0;
41629
+ const segments = this.to.segments.map((segment, index) => {
41630
+ const end = start + this.segmentsCache[index],
41631
+ points = this.points.slice(start, end);
41632
+ return start = end, Object.assign(Object.assign({}, segment), {
41633
+ points: points
41634
+ });
41635
+ });
41636
+ this.applyPointTransientAttributes({
41637
+ segments: segments
41025
41638
  });
41639
+ } else this.applyPointTransientAttributes({
41640
+ points: this.points
41026
41641
  });
41027
- this.target.attribute.segments = segments;
41028
- } else this.target.attribute.points = this.points;
41029
- this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41642
+ }
41030
41643
  }
41031
41644
  }
41032
41645
 
@@ -41047,10 +41660,10 @@ class CommonIn extends ACustomAnimate {
41047
41660
  }), 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);
41048
41661
  }
41049
41662
  onUpdate(end, ratio, out) {
41050
- const attribute = this.target.attribute;
41663
+ const attrs = {};
41051
41664
  this.propKeys.forEach(key => {
41052
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
41053
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41665
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
41666
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41054
41667
  }
41055
41668
  }
41056
41669
  class CommonOut extends ACustomAnimate {
@@ -41065,16 +41678,16 @@ class CommonOut extends ACustomAnimate {
41065
41678
  this.keys.forEach(key => {
41066
41679
  var _a;
41067
41680
  to[key] = 0, from[key] = null !== (_a = attrs[key]) && void 0 !== _a ? _a : 1;
41068
- }), 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();
41681
+ }), 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();
41069
41682
  }
41070
41683
  onEnd(cb) {
41071
41684
  super.onEnd(cb);
41072
41685
  }
41073
41686
  onUpdate(end, ratio, out) {
41074
- const attribute = this.target.attribute;
41687
+ const attrs = {};
41075
41688
  this.propKeys.forEach(key => {
41076
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
41077
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41689
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
41690
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41078
41691
  }
41079
41692
  }
41080
41693
 
@@ -41104,8 +41717,7 @@ class RotateBySphereAnimate extends ACustomAnimate {
41104
41717
  onEnd() {}
41105
41718
  onUpdate(end, ratio, out) {
41106
41719
  if (null == this.phi || null == this.theta) return;
41107
- const target = this.target,
41108
- {
41720
+ const {
41109
41721
  center: center,
41110
41722
  r: r,
41111
41723
  cb: cb
@@ -41116,8 +41728,15 @@ class RotateBySphereAnimate extends ACustomAnimate {
41116
41728
  x = r * Math.sin(phi) * Math.cos(theta) + center.x,
41117
41729
  y = r * Math.cos(phi) + center.y,
41118
41730
  z = r * Math.sin(phi) * Math.sin(theta) + center.z;
41119
- 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;
41120
- target.attribute.alpha = pi2 - target.attribute.alpha, target.attribute.zIndex = -1e4 * target.attribute.z, cb && cb(out);
41731
+ let alpha = theta + pi$1 / 2;
41732
+ for (; alpha > pi2;) alpha -= pi2;
41733
+ alpha = pi2 - alpha, applyAnimationFrameAttributes(this.target, {
41734
+ x: x,
41735
+ y: y,
41736
+ z: z,
41737
+ alpha: alpha,
41738
+ zIndex: -1e4 * z
41739
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag(), cb && cb(out);
41121
41740
  }
41122
41741
  }
41123
41742
 
@@ -41259,15 +41878,23 @@ class GrowAngleBase extends ACustomAnimate {
41259
41878
  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;
41260
41879
  }
41261
41880
  deleteSelfAttr(key) {
41262
- delete this.props[key], this.fromProps && delete this.fromProps[key];
41263
- const index = this.propKeys.indexOf(key);
41264
- -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;
41881
+ this.deleteSelfAttrs([key]);
41882
+ }
41883
+ deleteSelfAttrs(keys) {
41884
+ var _a;
41885
+ super.deleteSelfAttrs(keys);
41886
+ const firstKey = null === (_a = this.propKeys) || void 0 === _a ? void 0 : _a[0];
41887
+ this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateAngle : this._updateFunction = "startAngle" === firstKey ? this.updateStartAngle : "endAngle" === firstKey ? this.updateEndAngle : null;
41265
41888
  }
41266
41889
  updateStartAngle(ratio) {
41267
- this.target.attribute.startAngle = this.from.startAngle + (this.to.startAngle - this.from.startAngle) * ratio;
41890
+ applyAnimationFrameAttributes(this.target, {
41891
+ startAngle: this.from.startAngle + (this.to.startAngle - this.from.startAngle) * ratio
41892
+ });
41268
41893
  }
41269
41894
  updateEndAngle(ratio) {
41270
- this.target.attribute.endAngle = this.from.endAngle + (this.to.endAngle - this.from.endAngle) * ratio;
41895
+ applyAnimationFrameAttributes(this.target, {
41896
+ endAngle: this.from.endAngle + (this.to.endAngle - this.from.endAngle) * ratio
41897
+ });
41271
41898
  }
41272
41899
  updateAngle(ratio) {
41273
41900
  this.updateStartAngle(ratio), this.updateEndAngle(ratio);
@@ -41441,10 +42068,10 @@ class GrowCenterIn extends ACustomAnimate {
41441
42068
  super.onEnd(cb);
41442
42069
  }
41443
42070
  onUpdate(end, ratio, out) {
41444
- const attribute = this.target.attribute;
42071
+ const attrs = {};
41445
42072
  this.propKeys.forEach(key => {
41446
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
41447
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
42073
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
42074
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41448
42075
  }
41449
42076
  }
41450
42077
  class GrowCenterOut extends ACustomAnimate {
@@ -41463,10 +42090,10 @@ class GrowCenterOut extends ACustomAnimate {
41463
42090
  super.onEnd(cb);
41464
42091
  }
41465
42092
  onUpdate(end, ratio, out) {
41466
- const attribute = this.target.attribute;
42093
+ const attrs = {};
41467
42094
  this.propKeys.forEach(key => {
41468
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
41469
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
42095
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
42096
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41470
42097
  }
41471
42098
  }
41472
42099
 
@@ -41546,10 +42173,7 @@ class GrowHeightIn extends ACustomAnimate {
41546
42173
  super.onEnd(cb);
41547
42174
  }
41548
42175
  onUpdate(end, ratio, out) {
41549
- const attribute = this.target.attribute;
41550
- this.propKeys.forEach(key => {
41551
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
41552
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
42176
+ applyAnimationFrameNumberAttributes(this.target, this.propKeys, this.from, this.to, ratio), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41553
42177
  }
41554
42178
  }
41555
42179
  function growHeightOutIndividual(graphic, options, animationParameters) {
@@ -41607,10 +42231,7 @@ class GrowHeightOut extends ACustomAnimate {
41607
42231
  super.onEnd(cb);
41608
42232
  }
41609
42233
  onUpdate(end, ratio, out) {
41610
- const attribute = this.target.attribute;
41611
- this.propKeys.forEach(key => {
41612
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
41613
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
42234
+ applyAnimationFrameNumberAttributes(this.target, this.propKeys, this.from, this.to, ratio), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41614
42235
  }
41615
42236
  }
41616
42237
 
@@ -41643,7 +42264,9 @@ class GworPointsBase extends ACustomAnimate {
41643
42264
  var _a, _b;
41644
42265
  const fromPoints = null === (_a = this.from) || void 0 === _a ? void 0 : _a.points,
41645
42266
  toPoints = null === (_b = this.to) || void 0 === _b ? void 0 : _b.points;
41646
- fromPoints && toPoints && (this.target.attribute.points = fromPoints.map((point, index) => pointInterpolation(fromPoints[index], toPoints[index], ratio)), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag());
42267
+ fromPoints && toPoints && (applyAnimationFrameAttributes(this.target, {
42268
+ points: fromPoints.map((point, index) => pointInterpolation(fromPoints[index], toPoints[index], ratio))
42269
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag());
41647
42270
  }
41648
42271
  }
41649
42272
  class GrowPointsIn extends GworPointsBase {
@@ -41875,10 +42498,10 @@ class GrowPointsBase extends ACustomAnimate {
41875
42498
  super(from, to, duration, easing, params);
41876
42499
  }
41877
42500
  onUpdate(end, ratio, out) {
41878
- const attribute = this.target.attribute;
42501
+ const attrs = {};
41879
42502
  this.propKeys.forEach(key => {
41880
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
41881
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
42503
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
42504
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41882
42505
  }
41883
42506
  }
41884
42507
  class GrowRadiusIn extends GrowPointsBase {
@@ -42018,10 +42641,7 @@ class GrowWidthIn extends ACustomAnimate {
42018
42641
  super.onEnd(cb);
42019
42642
  }
42020
42643
  onUpdate(end, ratio, out) {
42021
- const attribute = this.target.attribute;
42022
- this.propKeys.forEach(key => {
42023
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
42024
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
42644
+ applyAnimationFrameNumberAttributes(this.target, this.propKeys, this.from, this.to, ratio), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
42025
42645
  }
42026
42646
  }
42027
42647
  class GrowWidthOut extends ACustomAnimate {
@@ -42041,10 +42661,7 @@ class GrowWidthOut extends ACustomAnimate {
42041
42661
  super.onEnd(cb);
42042
42662
  }
42043
42663
  onUpdate(end, ratio, out) {
42044
- const attribute = this.target.attribute;
42045
- this.propKeys.forEach(key => {
42046
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
42047
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
42664
+ applyAnimationFrameNumberAttributes(this.target, this.propKeys, this.from, this.to, ratio), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
42048
42665
  }
42049
42666
  }
42050
42667
 
@@ -42817,18 +43434,26 @@ class ScaleIn extends ACustomAnimate {
42817
43434
  super.onEnd(cb);
42818
43435
  }
42819
43436
  updateX(ratio) {
42820
- this.target.attribute.scaleX = this.from.scaleX + (this.to.scaleX - this.from.scaleX) * ratio;
43437
+ this.applyScaleTransientAttrs(ratio, !0, !1);
42821
43438
  }
42822
43439
  updateY(ratio) {
42823
- this.target.attribute.scaleY = this.from.scaleY + (this.to.scaleY - this.from.scaleY) * ratio;
43440
+ this.applyScaleTransientAttrs(ratio, !1, !0);
42824
43441
  }
42825
43442
  updateXY(ratio) {
42826
- this.updateX(ratio), this.updateY(ratio);
43443
+ this.applyScaleTransientAttrs(ratio, !0, !0);
43444
+ }
43445
+ applyScaleTransientAttrs(ratio, scaleX, scaleY) {
43446
+ const attrs = {};
43447
+ 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);
42827
43448
  }
42828
43449
  deleteSelfAttr(key) {
42829
- delete this.props[key], this.fromProps && delete this.fromProps[key];
42830
- const index = this.propKeys.indexOf(key);
42831
- -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;
43450
+ this.deleteSelfAttrs([key]);
43451
+ }
43452
+ deleteSelfAttrs(keys) {
43453
+ var _a;
43454
+ super.deleteSelfAttrs(keys);
43455
+ const firstKey = null === (_a = this.propKeys) || void 0 === _a ? void 0 : _a[0];
43456
+ this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateXY : this._updateFunction = "scaleX" === firstKey ? this.updateX : "scaleY" === firstKey ? this.updateY : null;
42832
43457
  }
42833
43458
  onUpdate(end, ratio, out) {
42834
43459
  this._updateFunction && (this._updateFunction(ratio), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag());
@@ -42873,10 +43498,10 @@ class ScaleOut extends ACustomAnimate {
42873
43498
  super.onEnd(cb);
42874
43499
  }
42875
43500
  onUpdate(end, ratio, out) {
42876
- const attribute = this.target.attribute;
43501
+ const attrs = {};
42877
43502
  this.propKeys.forEach(key => {
42878
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
42879
- }), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
43503
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
43504
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
42880
43505
  }
42881
43506
  }
42882
43507
 
@@ -42887,14 +43512,19 @@ class State extends ACustomAnimate {
42887
43512
  update(end, ratio, out) {
42888
43513
  if (this.onStart(), !this.props || !this.propKeys) return;
42889
43514
  const easedRatio = this.easing(ratio);
42890
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
42891
- if (!this.animate.validAttr(this.propKeys[index])) return;
42892
- const key = this.propKeys[index];
42893
- func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
42894
- }), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
43515
+ this.runInterpolateUpdate(this.fromProps, this.props, easedRatio), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
42895
43516
  }
42896
43517
  }
42897
43518
 
43519
+ function buildInterpolatedAttrs(keys, from, to, ratio) {
43520
+ const attrs = {};
43521
+ return keys.forEach(key => {
43522
+ attrs[key] = from[key] + (to[key] - from[key]) * ratio;
43523
+ }), attrs;
43524
+ }
43525
+ function applyStoryFrame(target, attrs) {
43526
+ applyAnimationFrameAttributes(target, attrs), target.addUpdatePositionTag(), target.addUpdateShapeAndBoundsTag();
43527
+ }
42898
43528
  class SlideIn extends ACustomAnimate {
42899
43529
  constructor(from, to, duration, easing, params) {
42900
43530
  super(from, to, duration, easing, params);
@@ -42917,10 +43547,7 @@ class SlideIn extends ACustomAnimate {
42917
43547
  "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);
42918
43548
  }
42919
43549
  onUpdate(end, ratio, out) {
42920
- const attribute = this.target.attribute;
42921
- this.propKeys.forEach(key => {
42922
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
42923
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
43550
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
42924
43551
  }
42925
43552
  }
42926
43553
  class GrowIn extends ACustomAnimate {
@@ -42945,10 +43572,7 @@ class GrowIn extends ACustomAnimate {
42945
43572
  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);
42946
43573
  }
42947
43574
  onUpdate(end, ratio, out) {
42948
- const attribute = this.target.attribute;
42949
- this.propKeys.forEach(key => {
42950
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
42951
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
43575
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
42952
43576
  }
42953
43577
  }
42954
43578
  class SpinIn extends ACustomAnimate {
@@ -42979,10 +43603,7 @@ class SpinIn extends ACustomAnimate {
42979
43603
  this.propKeys = ["opacity", "baseOpacity", "angle", "scaleX", "scaleY"], this.from = from, this.to = to, this.props = to, applyAppearStartAttributes(this.target, from);
42980
43604
  }
42981
43605
  onUpdate(end, ratio, out) {
42982
- const attribute = this.target.attribute;
42983
- this.propKeys.forEach(key => {
42984
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
42985
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
43606
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
42986
43607
  }
42987
43608
  }
42988
43609
  class StrokeIn extends ACustomAnimate {
@@ -43027,8 +43648,10 @@ class StrokeIn extends ACustomAnimate {
43027
43648
  }
43028
43649
  onUpdate(end, ratio, out) {
43029
43650
  var _a;
43030
- const attribute = this.target.attribute;
43031
- 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);
43651
+ const attrs = {
43652
+ lineDashOffset: this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio
43653
+ };
43654
+ (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);
43032
43655
  }
43033
43656
  onEnd() {
43034
43657
  var _a;
@@ -43079,8 +43702,10 @@ class StrokeOut extends ACustomAnimate {
43079
43702
  }
43080
43703
  onUpdate(end, ratio, out) {
43081
43704
  var _a;
43082
- const attribute = this.target.attribute;
43083
- 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);
43705
+ const attrs = {
43706
+ lineDashOffset: this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio
43707
+ };
43708
+ (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);
43084
43709
  }
43085
43710
  }
43086
43711
  class MoveScaleIn extends ACustomAnimate {
@@ -43177,10 +43802,7 @@ class SlideOut extends ACustomAnimate {
43177
43802
  "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;
43178
43803
  }
43179
43804
  onUpdate(end, ratio, out) {
43180
- const attribute = this.target.attribute;
43181
- this.propKeys.forEach(key => {
43182
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
43183
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
43805
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
43184
43806
  }
43185
43807
  }
43186
43808
  class GrowOut extends ACustomAnimate {
@@ -43205,10 +43827,7 @@ class GrowOut extends ACustomAnimate {
43205
43827
  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;
43206
43828
  }
43207
43829
  onUpdate(end, ratio, out) {
43208
- const attribute = this.target.attribute;
43209
- this.propKeys.forEach(key => {
43210
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
43211
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
43830
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
43212
43831
  }
43213
43832
  }
43214
43833
  class SpinOut extends ACustomAnimate {
@@ -43239,10 +43858,7 @@ class SpinOut extends ACustomAnimate {
43239
43858
  this.propKeys = ["opacity", "baseOpacity", "angle", "scaleX", "scaleY"], this.from = from, this.to = to, this.props = to;
43240
43859
  }
43241
43860
  onUpdate(end, ratio, out) {
43242
- const attribute = this.target.attribute;
43243
- this.propKeys.forEach(key => {
43244
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
43245
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
43861
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
43246
43862
  }
43247
43863
  }
43248
43864
  class MoveScaleOut extends ACustomAnimate {
@@ -43327,56 +43943,127 @@ class PulseAnimate extends ACustomAnimate {
43327
43943
  onUpdate(end, ratio, out) {
43328
43944
  const angle = ratio * Math.PI * this.pulseCount,
43329
43945
  pulseValue = Math.abs(Math.sin(angle)),
43330
- attribute = this.target.attribute;
43946
+ attrs = {};
43331
43947
  if (this.useOpacity) {
43332
43948
  const opacity = 1 + (this.pulseOpacity - 1) * pulseValue;
43333
- this.useStroke && (attribute.strokeOpacity = (this.originalAttributes.strokeOpacity || 1) * opacity), this.useFill && (attribute.fillOpacity = (this.originalAttributes.fillOpacity || 1) * opacity);
43949
+ this.useStroke && (attrs.strokeOpacity = (this.originalAttributes.strokeOpacity || 1) * opacity), this.useFill && (attrs.fillOpacity = (this.originalAttributes.fillOpacity || 1) * opacity);
43334
43950
  }
43335
43951
  if (this.useScale) {
43336
43952
  const scale = 1 + (this.pulseScale - 1) * pulseValue;
43337
- attribute.scaleX = (this.originalAttributes.scaleX || 1) * scale, attribute.scaleY = (this.originalAttributes.scaleY || 1) * scale;
43953
+ attrs.scaleX = (this.originalAttributes.scaleX || 1) * scale, attrs.scaleY = (this.originalAttributes.scaleY || 1) * scale;
43338
43954
  }
43339
- this.useColor && this.pulseColor && this.applyColorPulse(attribute, pulseValue), this.target.addUpdateShapeAndBoundsTag(), this.target.addUpdatePositionTag();
43955
+ this.useColor && this.pulseColor && this.applyColorPulse(attrs, pulseValue), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdateShapeAndBoundsTag(), this.target.addUpdatePositionTag();
43340
43956
  }
43341
- applyColorPulse(attribute, pulseValue) {
43957
+ applyColorPulse(attrs, pulseValue) {
43342
43958
  const colorRatio = this.pulseColorIntensity * pulseValue;
43343
- 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));
43959
+ 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));
43344
43960
  }
43345
43961
  onEnd() {
43346
43962
  super.onEnd(), this.target.setAttributes(this.originalAttributes);
43347
43963
  }
43348
43964
  }
43349
43965
 
43966
+ const clipPathGeometryAttrs = {
43967
+ x: !0,
43968
+ y: !0,
43969
+ x1: !0,
43970
+ y1: !0,
43971
+ width: !0,
43972
+ height: !0
43973
+ };
43974
+ function includesChannel(channels, key) {
43975
+ for (let i = 0; i < channels.length; i++) if (channels[i] === key) return !0;
43976
+ return !1;
43977
+ }
43978
+ function filterExcludedChannels(diffAttrs, excludeChannels) {
43979
+ if (!(null == excludeChannels ? void 0 : excludeChannels.length)) return diffAttrs;
43980
+ const nextAttrs = {};
43981
+ for (const key in diffAttrs) Object.prototype.hasOwnProperty.call(diffAttrs, key) && !includesChannel(excludeChannels, key) && (nextAttrs[key] = diffAttrs[key]);
43982
+ return nextAttrs;
43983
+ }
43350
43984
  class Update extends ACustomAnimate {
43351
43985
  constructor(from, to, duration, easing, params) {
43352
- super(from, to, duration, easing, params);
43986
+ super(from, to, duration, easing, params), this.updateFromAttrs = null, this.clipPathSyncKeys = null, this.clipPathSyncParent = null, this.clipPathSyncChildIndex = -1, this.clipPathSyncDisabled = !1;
43353
43987
  }
43354
43988
  onBind() {
43355
- var _a, _b;
43989
+ var _a;
43356
43990
  super.onBind();
43991
+ const targetContext = null !== (_a = this.target.context) && void 0 !== _a ? _a : {};
43357
43992
  let {
43358
43993
  diffAttrs = {}
43359
- } = null !== (_a = this.target.context) && void 0 !== _a ? _a : {};
43994
+ } = targetContext;
43360
43995
  const {
43361
43996
  options: options
43362
43997
  } = this.params;
43363
- diffAttrs = Object.assign({}, diffAttrs), (null === (_b = null == options ? void 0 : options.excludeChannels) || void 0 === _b ? void 0 : _b.length) && options.excludeChannels.forEach(channel => {
43364
- delete diffAttrs[channel];
43365
- }), this.props = diffAttrs;
43998
+ diffAttrs = filterExcludedChannels(diffAttrs, null == options ? void 0 : options.excludeChannels), this.props = diffAttrs;
43999
+ const consumeTransientFromAttrs = this.target.consumeTransientFromAttrsBeforePreventAnimate;
44000
+ 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();
44001
+ }
44002
+ trySyncStartProps() {
44003
+ const updateFromAttrs = this.updateFromAttrs;
44004
+ this.propKeys.forEach(key => {
44005
+ this.fromProps[key] = updateFromAttrs && Object.prototype.hasOwnProperty.call(updateFromAttrs, key) ? updateFromAttrs[key] : this.animate.target.getComputedAttribute(key);
44006
+ });
43366
44007
  }
43367
44008
  onEnd(cb) {
43368
- cb ? super.onEnd(cb) : (this.props && Object.keys(this.props).length && this.target.setAttributes(this.props, !1, {
43369
- type: AttributeUpdateType.ANIMATE_END
43370
- }), super.onEnd());
44009
+ var _a;
44010
+ 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());
43371
44011
  }
43372
44012
  update(end, ratio, out) {
43373
44013
  if (this.onStart(), !this.props || !this.propKeys) return;
43374
44014
  const easedRatio = this.easing(ratio);
43375
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
43376
- if (!this.animate.validAttr(this.propKeys[index])) return;
43377
- const key = this.propKeys[index];
43378
- func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
43379
- }), this.onUpdate(end, easedRatio, out);
44015
+ this.runInterpolateUpdate(this.fromProps, this.props, easedRatio), this.syncParentClipPathToTarget(), this.onUpdate(end, easedRatio, out);
44016
+ }
44017
+ syncParentClipPathToTarget() {
44018
+ var _a, _b, _c, _d;
44019
+ if (this.clipPathSyncDisabled) return;
44020
+ const target = this.target,
44021
+ parent = target.parent,
44022
+ path = null === (_a = null == parent ? void 0 : parent.attribute) || void 0 === _a ? void 0 : _a.path;
44023
+ if (!(null === (_b = null == parent ? void 0 : parent.attribute) || void 0 === _b ? void 0 : _b.clip) || !Array.isArray(path) || !path.length) return;
44024
+ const childIndex = this.getClipPathSyncChildIndex(parent);
44025
+ if (childIndex < 0 || childIndex >= path.length) return;
44026
+ const clipGraphic = path[childIndex];
44027
+ if (!(null == clipGraphic ? void 0 : clipGraphic.attribute) || clipGraphic.type !== target.type || !this.isClipPathStaticTarget(clipGraphic)) return;
44028
+ const syncAttrs = this.buildClipPathTransientAttrs(clipGraphic);
44029
+ syncAttrs && (applyAnimationFrameAttributes(clipGraphic, syncAttrs), null === (_c = clipGraphic.addUpdatePositionTag) || void 0 === _c || _c.call(clipGraphic), null === (_d = clipGraphic.addUpdateShapeAndBoundsTag) || void 0 === _d || _d.call(clipGraphic));
44030
+ }
44031
+ getClipPathSyncChildIndex(parent) {
44032
+ var _a;
44033
+ if (this.clipPathSyncParent === parent && this.clipPathSyncChildIndex >= 0) return this.clipPathSyncChildIndex;
44034
+ const target = this.target;
44035
+ let childIndex = -1;
44036
+ 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;
44037
+ }
44038
+ isClipPathStaticTarget(clipGraphic) {
44039
+ var _a, _b;
44040
+ const target = this.target,
44041
+ targetFinalAttrs = this.getTargetFinalAttrs(),
44042
+ clipGraphicFinalAttrs = "function" == typeof clipGraphic.getFinalAttribute ? clipGraphic.getFinalAttribute() : clipGraphic.finalAttribute,
44043
+ clipFinalAttrs = null !== (_a = null != clipGraphicFinalAttrs ? clipGraphicFinalAttrs : clipGraphic.baseAttributes) && void 0 !== _a ? _a : clipGraphic.attribute,
44044
+ keys = null !== (_b = this.clipPathSyncKeys) && void 0 !== _b ? _b : [];
44045
+ return !!(keys.length && targetFinalAttrs && clipFinalAttrs) && keys.every(key => {
44046
+ var _a, _b;
44047
+ return this.isSameClipPathValue(clipFinalAttrs[key], null !== (_a = targetFinalAttrs[key]) && void 0 !== _a ? _a : null === (_b = target.attribute) || void 0 === _b ? void 0 : _b[key]);
44048
+ });
44049
+ }
44050
+ getTargetFinalAttrs() {
44051
+ var _a, _b, _c;
44052
+ const target = this.target;
44053
+ 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;
44054
+ }
44055
+ isSameClipPathValue(a, b) {
44056
+ return "number" == typeof a && "number" == typeof b ? Math.abs(a - b) < 1e-8 : a === b;
44057
+ }
44058
+ buildClipPathTransientAttrs(clipGraphic) {
44059
+ var _a;
44060
+ const target = this.target,
44061
+ attrs = {};
44062
+ return (null !== (_a = this.clipPathSyncKeys) && void 0 !== _a ? _a : []).forEach(key => {
44063
+ var _a;
44064
+ const nextValue = null === (_a = target.attribute) || void 0 === _a ? void 0 : _a[key];
44065
+ Object.prototype.hasOwnProperty.call(clipGraphic.attribute, key) && void 0 !== nextValue && !this.isSameClipPathValue(clipGraphic.attribute[key], nextValue) && (attrs[key] = nextValue);
44066
+ }), Object.keys(attrs).length ? attrs : null;
43380
44067
  }
43381
44068
  }
43382
44069
 
@@ -43483,10 +44170,10 @@ class MoveBase extends ACustomAnimate {
43483
44170
  super(from, to, duration, easing, params);
43484
44171
  }
43485
44172
  onUpdate(end, ratio, out) {
43486
- const attribute = this.target.attribute;
44173
+ const attrs = {};
43487
44174
  this.propKeys.forEach(key => {
43488
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
43489
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
44175
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
44176
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
43490
44177
  }
43491
44178
  }
43492
44179
  class MoveIn extends MoveBase {
@@ -43542,10 +44229,10 @@ class RotateBase extends ACustomAnimate {
43542
44229
  super(from, to, duration, easing, params);
43543
44230
  }
43544
44231
  onUpdate(end, ratio, out) {
43545
- const attribute = this.target.attribute;
44232
+ const attrs = {};
43546
44233
  this.propKeys.forEach(key => {
43547
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
43548
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
44234
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
44235
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
43549
44236
  }
43550
44237
  }
43551
44238
  class RotateIn extends RotateBase {
@@ -43588,7 +44275,7 @@ class MotionPath extends ACustomAnimate {
43588
44275
  pos: pos,
43589
44276
  angle: angle
43590
44277
  } = this.path.getAttrAt(at);
43591
- 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);
44278
+ 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());
43592
44279
  }
43593
44280
  }
43594
44281
 
@@ -45107,7 +45794,10 @@ class AxisUpdate extends AComponentAnimate {
45107
45794
  }), this.completeBind(animator);
45108
45795
  }
45109
45796
  deleteSelfAttr(key) {
45110
- super.deleteSelfAttr(key), this._animator.deleteSelfAttr(key);
45797
+ this.deleteSelfAttrs([key]);
45798
+ }
45799
+ deleteSelfAttrs(keys) {
45800
+ super.deleteSelfAttrs(keys), this._animator.deleteSelfAttrs(keys);
45111
45801
  }
45112
45802
  tryPreventConflict() {}
45113
45803
  }
@@ -45653,8 +46343,8 @@ class LineAxis extends AxisBase {
45653
46343
  const orient = this.attribute.orient;
45654
46344
  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;
45655
46345
  }
45656
- release() {
45657
- super.release(), this._breaks = null;
46346
+ release(all) {
46347
+ super.release(all), this._breaks = null;
45658
46348
  }
45659
46349
  }
45660
46350
  LineAxis.defaultAttributes = DEFAULT_AXIS_THEME, mixin(LineAxis, LineAxisMixin);
@@ -48027,6 +48717,14 @@ var __rest$8 = undefined && undefined.__rest || function (s, e) {
48027
48717
  }
48028
48718
  return t;
48029
48719
  };
48720
+ function cloneAttributeSnapshot(value) {
48721
+ if (!isObject$2(value) || isArray$1(value)) return value;
48722
+ const snapshot = {};
48723
+ return Object.keys(value).forEach(key => {
48724
+ const nextValue = value[key];
48725
+ snapshot[key] = isObject$2(nextValue) && !isArray$1(nextValue) ? cloneAttributeSnapshot(nextValue) : nextValue;
48726
+ }), snapshot;
48727
+ }
48030
48728
  loadLabelComponent();
48031
48729
  class LabelBase extends AnimateComponent {
48032
48730
  setBitmap(bitmap) {
@@ -48091,11 +48789,56 @@ class LabelBase extends AnimateComponent {
48091
48789
  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;
48092
48790
  }
48093
48791
  }
48792
+ _finalizeExitRelease() {
48793
+ var _a, _b, _c, _d;
48794
+ const state = this._exitReleaseState;
48795
+ if (null == state ? void 0 : state.finalized) return;
48796
+ state && (state.finalized = !0);
48797
+ const parent = this.parent,
48798
+ removeFromParent = !!(null == state ? void 0 : state.removeFromParent),
48799
+ callbacks = null !== (_a = null == state ? void 0 : state.onComplete) && void 0 !== _a ? _a : [];
48800
+ 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);
48801
+ }
48802
+ _runExitAnimationBeforeRelease(options = {}) {
48803
+ var _a, _b;
48804
+ if (this._exitReleaseState && !this._exitReleaseState.finalized) return this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent, appendExitReleaseCallback(this._exitReleaseState, options.onComplete), !0;
48805
+ if (!this.stage || !1 === this.attribute.animation || !1 === this.attribute.animationExit || !(null === (_a = this._graphicToText) || void 0 === _a ? void 0 : _a.size)) return !1;
48806
+ if (this._prepareAnimate(DefaultLabelAnimation), !(null === (_b = this._animationConfig) || void 0 === _b ? void 0 : _b.exit)) return !1;
48807
+ const exitTargets = new Set();
48808
+ if (this._graphicToText.forEach(label => {
48809
+ (null == label ? void 0 : label.text) && exitTargets.add(label.text), (null == label ? void 0 : label.labelLine) && exitTargets.add(label.labelLine);
48810
+ }), !exitTargets.size) return !1;
48811
+ const existingAnimates = collectTrackedAnimates(this);
48812
+ exitTargets.forEach(target => {
48813
+ var _a;
48814
+ target.applyAnimationState(["exit"], [{
48815
+ name: "exit",
48816
+ animation: Object.assign(Object.assign({}, this._animationConfig.exit), {
48817
+ type: null !== (_a = this._animationConfig.exit.type) && void 0 !== _a ? _a : "fadeOut",
48818
+ selfOnly: !0
48819
+ })
48820
+ }]);
48821
+ });
48822
+ const exitAnimates = collectTrackedAnimates(this).filter(animate => !existingAnimates.includes(animate));
48823
+ if (!exitAnimates.length) return !1;
48824
+ this.setAttribute("childrenPickable", !1), this.releaseStatus = "willRelease";
48825
+ const pendingAnimates = new Set(exitAnimates);
48826
+ return this._exitReleaseState = {
48827
+ pendingAnimates: pendingAnimates,
48828
+ finalized: !1,
48829
+ removeFromParent: !!options.removeFromParent,
48830
+ onComplete: options.onComplete ? [options.onComplete] : []
48831
+ }, bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease()), !0;
48832
+ }
48833
+ releaseWithExitAnimation(options = {}) {
48834
+ return "released" !== this.releaseStatus && this._runExitAnimationBeforeRelease(options);
48835
+ }
48094
48836
  render() {
48837
+ if (this._exitReleaseState) return;
48095
48838
  if (this._prepare(), isNil$1(this._idToGraphic) || this._isCollectionBase && isNil$1(this._idToPoint)) return;
48096
48839
  const markAttributeList = [];
48097
48840
  !1 !== this._enableAnimation && this._baseMarks.forEach(mark => {
48098
- markAttributeList.push(mark.attribute), mark.initAttributes(mark.getAttributes(!0));
48841
+ markAttributeList.push(cloneAttributeSnapshot(mark.attribute)), mark.initAttributes(mark.getAttributes(!0));
48099
48842
  });
48100
48843
  const {
48101
48844
  overlap: overlap,
@@ -48661,6 +49404,10 @@ class LabelBase extends AnimateComponent {
48661
49404
  _canPlaceInside(textBound, shapeBound) {
48662
49405
  return !(!textBound || !shapeBound) && shapeBound.encloses(textBound);
48663
49406
  }
49407
+ release(all) {
49408
+ var _a, _b;
49409
+ 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);
49410
+ }
48664
49411
  setLocation(point) {
48665
49412
  this.translateTo(point.x, point.y);
48666
49413
  }
@@ -49430,6 +50177,7 @@ class DataLabel extends AbstractComponent {
49430
50177
  }
49431
50178
  render() {
49432
50179
  var _a;
50180
+ if (this._exitReleaseState) return;
49433
50181
  const {
49434
50182
  dataLabels: dataLabels,
49435
50183
  size: size
@@ -49464,6 +50212,47 @@ class DataLabel extends AbstractComponent {
49464
50212
  currentComponentMap.get(key) || this.removeChild(cp);
49465
50213
  }), this._componentMap = currentComponentMap;
49466
50214
  }
50215
+ _finalizeExitRelease() {
50216
+ var _a, _b, _c;
50217
+ const state = this._exitReleaseState;
50218
+ if (null == state ? void 0 : state.finalized) return;
50219
+ state && (state.finalized = !0);
50220
+ const parent = this.parent,
50221
+ removeFromParent = !!(null == state ? void 0 : state.removeFromParent),
50222
+ callbacks = null !== (_a = null == state ? void 0 : state.onComplete) && void 0 !== _a ? _a : [];
50223
+ 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);
50224
+ }
50225
+ releaseWithExitAnimation(options = {}) {
50226
+ var _a;
50227
+ if ("released" === this.releaseStatus) return !1;
50228
+ if (this._exitReleaseState && !this._exitReleaseState.finalized) return this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent, appendExitReleaseCallback(this._exitReleaseState, options.onComplete), !0;
50229
+ if (!this.stage || !(null === (_a = this._componentMap) || void 0 === _a ? void 0 : _a.size)) return !1;
50230
+ const state = {
50231
+ pendingCount: 0,
50232
+ finalized: !1,
50233
+ removeFromParent: !!options.removeFromParent,
50234
+ onComplete: options.onComplete ? [options.onComplete] : []
50235
+ },
50236
+ exitingComponents = [],
50237
+ fallbackComponents = [];
50238
+ let initializing = !0;
50239
+ const finish = () => {
50240
+ state.finalized || (state.pendingCount -= 1, state.pendingCount <= 0 && !initializing && this._finalizeExitRelease());
50241
+ };
50242
+ return this._exitReleaseState = state, this._componentMap.forEach(component => {
50243
+ state.pendingCount += 1;
50244
+ component.releaseWithExitAnimation({
50245
+ removeFromParent: !1,
50246
+ onComplete: finish
50247
+ }) ? exitingComponents.push(component) : (state.pendingCount -= 1, fallbackComponents.push(component));
50248
+ }), exitingComponents.length ? (fallbackComponents.forEach(component => {
50249
+ component.release(!0), this.removeChild(component);
50250
+ }), this.setAttribute("childrenPickable", !1), this.releaseStatus = "willRelease", initializing = !1, state.pendingCount <= 0 && this._finalizeExitRelease(), !0) : (this._exitReleaseState = void 0, !1);
50251
+ }
50252
+ release(all) {
50253
+ var _a;
50254
+ this._exitReleaseState ? this._finalizeExitRelease() : (all && this.removeAllChild(!0), super.release(all), null === (_a = this._componentMap) || void 0 === _a || _a.clear());
50255
+ }
49467
50256
  setLocation(point) {
49468
50257
  this.translateTo(point.x, point.y);
49469
50258
  }
@@ -51097,14 +51886,51 @@ class Marker extends AbstractComponent {
51097
51886
  y: clipInRange ? -(null !== (_b = limitRect.y) && void 0 !== _b ? _b : 0) : 0
51098
51887
  });
51099
51888
  }
51100
- render() {
51889
+ _finalizeExitRelease() {
51890
+ var _a, _b;
51891
+ const state = this._exitReleaseState;
51892
+ if (null == state ? void 0 : state.finalized) return;
51893
+ state && (state.finalized = !0);
51894
+ const parent = this.parent,
51895
+ removeFromParent = !!(null == state ? void 0 : state.removeFromParent),
51896
+ releaseSelf = !!(null == state ? void 0 : state.releaseSelf),
51897
+ callbacks = null !== (_a = null == state ? void 0 : state.onComplete) && void 0 !== _a ? _a : [];
51898
+ 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);
51899
+ }
51900
+ _runExitAnimationBeforeCleanup(options = {}) {
51101
51901
  var _a;
51902
+ const releaseSelf = !!options.releaseSelf;
51903
+ 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;
51904
+ if (!this.stage || !1 === this.attribute.animation || !1 === this.attribute.animationExit || !this._container) return !1;
51905
+ if (this.transAnimationConfig(), !(null === (_a = this._animationConfig) || void 0 === _a ? void 0 : _a.exit)) return !1;
51906
+ const existingAnimates = collectTrackedAnimates(this);
51907
+ this.markerAnimate("exit");
51908
+ const exitAnimates = collectTrackedAnimates(this).filter(animate => !existingAnimates.includes(animate));
51909
+ if (!exitAnimates.length) return !1;
51910
+ this._releaseEvent(), this.setAttribute("childrenPickable", !1), releaseSelf && (this.releaseStatus = "willRelease");
51911
+ const pendingAnimates = new Set(exitAnimates);
51912
+ return this._exitReleaseState = {
51913
+ pendingAnimates: pendingAnimates,
51914
+ finalized: !1,
51915
+ releaseSelf: releaseSelf,
51916
+ removeFromParent: !!options.removeFromParent,
51917
+ onComplete: options.onComplete ? [options.onComplete] : []
51918
+ }, bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease()), !0;
51919
+ }
51920
+ releaseWithExitAnimation(options = {}) {
51921
+ return "released" !== this.releaseStatus && this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({}, options), {
51922
+ releaseSelf: !0
51923
+ }));
51924
+ }
51925
+ render() {
51926
+ var _a, _b;
51927
+ if (null === (_a = this._exitReleaseState) || void 0 === _a ? void 0 : _a.releaseSelf) return;
51102
51928
  this.transAnimationConfig(), this.setAttribute("pickable", !1);
51103
- const markerVisible = null === (_a = this.attribute.visible) || void 0 === _a || _a;
51104
- !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();
51929
+ const markerVisible = null === (_b = this.attribute.visible) || void 0 === _b || _b;
51930
+ !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();
51105
51931
  }
51106
- release() {
51107
- this.markerAnimate("exit"), super.release(), this._releaseEvent(), this._container = null;
51932
+ release(all) {
51933
+ 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);
51108
51934
  }
51109
51935
  }
51110
51936
 
@@ -53367,7 +54193,10 @@ let DiscreteLegend$1 = class DiscreteLegend extends LegendBase {
53367
54193
  const innerGroupHeight = innerGroupBounds.height(),
53368
54194
  itemGroupWidth = isValid$1(this.attribute.item.width) ? this.attribute.item.width : innerGroupWidth + parsedPadding[1] + parsedPadding[3],
53369
54195
  itemGroupHeight = this._itemHeightByUser || innerGroupHeight + parsedPadding[0] + parsedPadding[2];
53370
- 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;
54196
+ return itemGroup.setAttributes({
54197
+ width: itemGroupWidth,
54198
+ height: itemGroupHeight
54199
+ }), focusShape && focusShape.setAttribute("visible", !1), innerGroup.translateTo(-innerGroupBounds.x1 + parsedPadding[3], -innerGroupBounds.y1 + parsedPadding[0]), itemGroup;
53371
54200
  }
53372
54201
  _createPager(compStyle) {
53373
54202
  var _a, _b;
@@ -55004,7 +55833,11 @@ let Title$1 = class Title extends AbstractComponent {
55004
55833
  subTextBoundsWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;
55005
55834
  let totalWidth = Math.max(mainTextBoundsWidth, subTextBoundsWidth),
55006
55835
  totalHeight = mainTextBoundsHeight + (null !== (_q = subtextStyle.height) && void 0 !== _q ? _q : subTextBoundsHeight);
55007
- 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) {
55836
+ 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({
55837
+ width: totalWidth,
55838
+ height: totalHeight,
55839
+ boundsPadding: parsedPadding
55840
+ }), this._mainTitle) {
55008
55841
  if (isValid$1(align) || isValid$1(textStyle.align)) {
55009
55842
  const mainTitleAlign = textStyle.align ? textStyle.align : align,
55010
55843
  mainTitleWidth = null !== (_r = textStyle.width) && void 0 !== _r ? _r : totalWidth;
@@ -60237,7 +61070,7 @@ class Compiler {
60237
61070
  stage.release();
60238
61071
  }
60239
61072
  else if (rootGroup) {
60240
- stage.defaultLayer.removeChild(rootGroup);
61073
+ stage.defaultLayer.removeChild(rootGroup, true);
60241
61074
  rootGroup.release();
60242
61075
  }
60243
61076
  }
@@ -60255,7 +61088,7 @@ class Compiler {
60255
61088
  if (removeGraphicItems) {
60256
61089
  this._rootMarks.forEach(g => {
60257
61090
  traverseGroupMark(g, m => {
60258
- m.removeProduct();
61091
+ m.removeProduct(true);
60259
61092
  }, null, true);
60260
61093
  });
60261
61094
  }
@@ -60430,6 +61263,71 @@ function calculateChartSize(spec, option, defaultSize) {
60430
61263
  height
60431
61264
  };
60432
61265
  }
61266
+ const UPDATE_SPEC_EFFECT_KEYS = [
61267
+ 'remake',
61268
+ 'compile',
61269
+ 'render',
61270
+ 'layout',
61271
+ 'data',
61272
+ 'scaleDomain',
61273
+ 'series',
61274
+ 'component',
61275
+ 'animation',
61276
+ 'localOnly'
61277
+ ];
61278
+ function mergeUpdateSpecEffects(target, ...sources) {
61279
+ sources.forEach(source => {
61280
+ const sourceEffects = source === null || source === void 0 ? void 0 : source.effects;
61281
+ if (!sourceEffects) {
61282
+ return;
61283
+ }
61284
+ if (!target.effects) {
61285
+ target.effects = {};
61286
+ }
61287
+ const targetEffects = target.effects;
61288
+ UPDATE_SPEC_EFFECT_KEYS.forEach(key => {
61289
+ if (sourceEffects[key]) {
61290
+ targetEffects[key] = targetEffects[key] || sourceEffects[key];
61291
+ }
61292
+ });
61293
+ });
61294
+ }
61295
+ function isUpdateSpecResultLocalOnly(result) {
61296
+ const effects = result.effects;
61297
+ return (!!(effects === null || effects === void 0 ? void 0 : effects.localOnly) &&
61298
+ !result.reMake &&
61299
+ !result.reCompile &&
61300
+ !result.reRender &&
61301
+ !result.reSize &&
61302
+ !effects.remake &&
61303
+ !effects.compile &&
61304
+ !effects.render &&
61305
+ !effects.layout &&
61306
+ !effects.data &&
61307
+ !effects.scaleDomain &&
61308
+ !effects.series &&
61309
+ !result.reTransformSpec &&
61310
+ !result.reAnimate &&
61311
+ !result.changeTheme &&
61312
+ !result.changeBackground);
61313
+ }
61314
+ function isUpdateSpecResultComponentOnly(result) {
61315
+ const effects = result.effects;
61316
+ return (!!(effects === null || effects === void 0 ? void 0 : effects.component) &&
61317
+ !result.reMake &&
61318
+ !result.reCompile &&
61319
+ !result.reSize &&
61320
+ !effects.remake &&
61321
+ !effects.compile &&
61322
+ !effects.data &&
61323
+ !effects.scaleDomain &&
61324
+ !effects.series &&
61325
+ !effects.animation &&
61326
+ !result.reTransformSpec &&
61327
+ !result.reAnimate &&
61328
+ !result.changeTheme &&
61329
+ !result.changeBackground);
61330
+ }
60433
61331
  function mergeUpdateResult(target, ...sources) {
60434
61332
  const merge = (key) => sources.reduce((value, cur) => value || (cur === null || cur === void 0 ? void 0 : cur[key]), target[key]);
60435
61333
  Object.assign(target, {
@@ -60442,6 +61340,7 @@ function mergeUpdateResult(target, ...sources) {
60442
61340
  changeTheme: merge('changeTheme'),
60443
61341
  changeBackground: merge('changeBackground')
60444
61342
  });
61343
+ mergeUpdateSpecEffects(target, ...sources);
60445
61344
  return target;
60446
61345
  }
60447
61346
  function getTrimPaddingConfig(chartType, spec) {
@@ -62656,7 +63555,7 @@ class CompilableData extends GrammarItem {
62656
63555
  this._data = null;
62657
63556
  this._data = dataView;
62658
63557
  }
62659
- removeProduct() {
63558
+ removeProduct(_releaseDetach) {
62660
63559
  this._product = null;
62661
63560
  this._prevProduct = null;
62662
63561
  this._compiledProductId = null;
@@ -62830,6 +63729,34 @@ const morph = (prevMarks, nextMarks, morphConfig = {}) => {
62830
63729
  };
62831
63730
 
62832
63731
  const normalizeStates = (states) => (Array.isArray(states) ? states : states ? [states] : []);
63732
+ const isSameStates = (currentStates, nextStates) => {
63733
+ const current = currentStates !== null && currentStates !== void 0 ? currentStates : [];
63734
+ if (current.length !== nextStates.length) {
63735
+ return false;
63736
+ }
63737
+ return current.every((stateName, index) => stateName === nextStates[index]);
63738
+ };
63739
+ const setGraphicStates = (graphic, nextStates, hasAnimation) => {
63740
+ var _a;
63741
+ if (graphic.setStates) {
63742
+ graphic.setStates(nextStates, {
63743
+ animate: hasAnimation,
63744
+ animateSameStatePatchChange: true
63745
+ });
63746
+ return;
63747
+ }
63748
+ const normalizedNextStates = nextStates !== null && nextStates !== void 0 ? nextStates : [];
63749
+ if (isSameStates(graphic.currentStates, normalizedNextStates)) {
63750
+ (_a = graphic.invalidateResolver) === null || _a === void 0 ? void 0 : _a.call(graphic);
63751
+ return;
63752
+ }
63753
+ if (normalizedNextStates.length) {
63754
+ graphic.useStates(normalizedNextStates, hasAnimation);
63755
+ }
63756
+ else {
63757
+ graphic.clearStates(hasAnimation);
63758
+ }
63759
+ };
62833
63760
  const addGraphicState = (graphic, state, keepCurrentStates = true, hasAnimation) => {
62834
63761
  var _a;
62835
63762
  if (!state) {
@@ -62837,7 +63764,7 @@ const addGraphicState = (graphic, state, keepCurrentStates = true, hasAnimation)
62837
63764
  }
62838
63765
  const currentStates = keepCurrentStates ? (_a = graphic.currentStates) !== null && _a !== void 0 ? _a : [] : [];
62839
63766
  const nextStates = keepCurrentStates ? Array.from(new Set([...currentStates, state])) : [state];
62840
- graphic.useStates(nextStates, hasAnimation);
63767
+ setGraphicStates(graphic, nextStates, hasAnimation);
62841
63768
  };
62842
63769
  const removeGraphicState = (graphic, state, hasAnimation) => {
62843
63770
  var _a;
@@ -62847,9 +63774,10 @@ const removeGraphicState = (graphic, state, hasAnimation) => {
62847
63774
  }
62848
63775
  const currentStates = ((_a = graphic.currentStates) !== null && _a !== void 0 ? _a : []);
62849
63776
  const nextStates = currentStates.filter((stateName) => !states.includes(stateName));
62850
- graphic.useStates(nextStates, hasAnimation);
63777
+ setGraphicStates(graphic, nextStates, hasAnimation);
62851
63778
  };
62852
63779
 
63780
+ const statesClearedBeforeReInitKey = Symbol('statesClearedBeforeReInit');
62853
63781
  class BaseMark extends GrammarItem {
62854
63782
  commit(render, recursion) {
62855
63783
  if (recursion && this.getMarks().length > 0) {
@@ -63055,9 +63983,9 @@ class BaseMark extends GrammarItem {
63055
63983
  }
63056
63984
  resumeAnimationByState(state) {
63057
63985
  }
63058
- removeProduct() {
63986
+ removeProduct(releaseDetach) {
63059
63987
  if (this._product && this._product.parent) {
63060
- this._product.parent.removeChild(this._product);
63988
+ this._product.parent.removeChild(this._product, releaseDetach);
63061
63989
  }
63062
63990
  this._product = null;
63063
63991
  this._compiledProductId = null;
@@ -63087,6 +64015,9 @@ class BaseMark extends GrammarItem {
63087
64015
  this._unCompileChannel = {};
63088
64016
  this._disabledAnimationStates = [];
63089
64017
  this._skipBeforeLayouted = false;
64018
+ this._sharedStateDefinitionRefIds = new WeakMap();
64019
+ this._sharedStateDefinitionRefId = 0;
64020
+ this._dynamicSharedStateNames = new Set();
63090
64021
  this._extensionChannel = {};
63091
64022
  this._computeExChannel = {};
63092
64023
  this._graphicMap = new Map();
@@ -63121,11 +64052,19 @@ class BaseMark extends GrammarItem {
63121
64052
  }
63122
64053
  };
63123
64054
  this._setStateOfGraphic = (g, hasAnimation) => {
63124
- g.clearStates();
64055
+ var _a, _b, _c;
63125
64056
  g.stateProxy = null;
63126
- if (g.context.diffState === DiffState.enter || g.context.diffState === DiffState.update) {
63127
- g.context.states && g.useStates(g.context.states, hasAnimation);
64057
+ const targetStates = g.context.diffState === DiffState.enter || g.context.diffState === DiffState.update
64058
+ ? g.context.states
64059
+ : undefined;
64060
+ const hasCurrentState = !!((_a = g.currentStates) === null || _a === void 0 ? void 0 : _a.length) ||
64061
+ !!((_b = g.effectiveStates) === null || _b === void 0 ? void 0 : _b.length) ||
64062
+ !!g.resolvedStatePatch ||
64063
+ !!((_c = g.registeredActiveScopes) === null || _c === void 0 ? void 0 : _c.size);
64064
+ if (!(targetStates === null || targetStates === void 0 ? void 0 : targetStates.length) && !hasCurrentState) {
64065
+ return;
63128
64066
  }
64067
+ setGraphicStates(g, targetStates, hasAnimation);
63129
64068
  };
63130
64069
  this.name = name;
63131
64070
  this.model = option.model;
@@ -63659,6 +64598,9 @@ class BaseMark extends GrammarItem {
63659
64598
  if (state === 'appear') {
63660
64599
  return;
63661
64600
  }
64601
+ if (state === 'update' && !this._hasDiffAttrs(g)) {
64602
+ return;
64603
+ }
63662
64604
  const config = animationConfig[state];
63663
64605
  if (config && config.length > 0) {
63664
64606
  const configList = config.map((item, index) => ({
@@ -63824,6 +64766,48 @@ class BaseMark extends GrammarItem {
63824
64766
  });
63825
64767
  return { updateStyles, groupStyles };
63826
64768
  }
64769
+ _getSharedStateDefinitionRefId(value) {
64770
+ if ((typeof value !== 'object' && typeof value !== 'function') || value === null) {
64771
+ return `${value}`;
64772
+ }
64773
+ const objectValue = value;
64774
+ let id = this._sharedStateDefinitionRefIds.get(objectValue);
64775
+ if (!id) {
64776
+ id = ++this._sharedStateDefinitionRefId;
64777
+ this._sharedStateDefinitionRefIds.set(objectValue, id);
64778
+ }
64779
+ return `ref:${id}`;
64780
+ }
64781
+ _getSharedStateDefinitionValueKey(value) {
64782
+ try {
64783
+ const jsonValue = JSON.stringify(value);
64784
+ return jsonValue !== null && jsonValue !== void 0 ? jsonValue : `${value}`;
64785
+ }
64786
+ catch (_error) {
64787
+ return this._getSharedStateDefinitionRefId(value);
64788
+ }
64789
+ }
64790
+ _isStaticSharedStateAttribute(stateName, key) {
64791
+ var _a, _b;
64792
+ const stateStyle = (_a = this.stateStyle[stateName]) === null || _a === void 0 ? void 0 : _a[key];
64793
+ if (!stateStyle || stateStyle.referer || isFunction$1(stateStyle.postProcess) || key in this._computeExChannel) {
64794
+ return false;
64795
+ }
64796
+ const style = stateStyle.style;
64797
+ if (isFunction$1(style)) {
64798
+ return false;
64799
+ }
64800
+ if (GradientType.includes(style === null || style === void 0 ? void 0 : style.gradient)) {
64801
+ return false;
64802
+ }
64803
+ if (['outerBorder', 'innerBorder'].includes(key)) {
64804
+ return false;
64805
+ }
64806
+ if (isValidScaleType((_b = style === null || style === void 0 ? void 0 : style.scale) === null || _b === void 0 ? void 0 : _b.type)) {
64807
+ return false;
64808
+ }
64809
+ return true;
64810
+ }
63827
64811
  _applySharedStateDefinitions() {
63828
64812
  var _a;
63829
64813
  if (!this._product) {
@@ -63831,7 +64815,10 @@ class BaseMark extends GrammarItem {
63831
64815
  }
63832
64816
  const stateNames = Object.keys((_a = this._encoderOfState) !== null && _a !== void 0 ? _a : {}).filter(stateName => stateName !== 'group' && stateName !== 'update');
63833
64817
  if (!stateNames.length) {
63834
- this._product.sharedStateDefinitions = undefined;
64818
+ this._dynamicSharedStateNames.clear();
64819
+ if (this._product.sharedStateDefinitions !== undefined) {
64820
+ this._product.sharedStateDefinitions = undefined;
64821
+ }
63835
64822
  return;
63836
64823
  }
63837
64824
  const sortedStateNames = this._stateSort ? stateNames.slice().sort(this._stateSort) : stateNames;
@@ -63840,15 +64827,71 @@ class BaseMark extends GrammarItem {
63840
64827
  statePriority.set(stateName, index);
63841
64828
  });
63842
64829
  const sharedStateDefinitions = {};
64830
+ const cacheKeys = [];
64831
+ const dynamicSharedStateNames = new Set();
63843
64832
  stateNames.forEach(stateName => {
63844
64833
  var _a;
63845
64834
  const encoder = this._encoderOfState[stateName];
63846
- sharedStateDefinitions[stateName] = {
63847
- priority: (_a = statePriority.get(stateName)) !== null && _a !== void 0 ? _a : 0,
63848
- declaredAffectedKeys: Object.keys(encoder !== null && encoder !== void 0 ? encoder : {}),
63849
- resolver: ({ graphic }) => this._runEncoderOfGraphic(encoder, graphic)
64835
+ const patch = {};
64836
+ const dynamicEncoder = {};
64837
+ const patchKeys = [];
64838
+ const dynamicKeys = [];
64839
+ Object.keys(encoder !== null && encoder !== void 0 ? encoder : {}).forEach(key => {
64840
+ if (this._isStaticSharedStateAttribute(stateName, key)) {
64841
+ patch[key] = this._computeAttribute(key, stateName)(undefined);
64842
+ patchKeys.push(key);
64843
+ }
64844
+ else {
64845
+ dynamicEncoder[key] = encoder[key];
64846
+ dynamicKeys.push(key);
64847
+ }
64848
+ });
64849
+ if (!patchKeys.length && !dynamicKeys.length) {
64850
+ return;
64851
+ }
64852
+ const definition = {
64853
+ priority: (_a = statePriority.get(stateName)) !== null && _a !== void 0 ? _a : 0
63850
64854
  };
64855
+ if (patchKeys.length) {
64856
+ definition.patch = patch;
64857
+ }
64858
+ if (dynamicKeys.length) {
64859
+ dynamicSharedStateNames.add(stateName);
64860
+ definition.declaredAffectedKeys = dynamicKeys;
64861
+ definition.resolver = ({ graphic }) => this._runEncoderOfGraphic(dynamicEncoder, graphic);
64862
+ }
64863
+ sharedStateDefinitions[stateName] = definition;
64864
+ cacheKeys.push([
64865
+ stateName,
64866
+ definition.priority,
64867
+ patchKeys.sort().map(key => `${key}:${this._getSharedStateDefinitionValueKey(patch[key])}`),
64868
+ dynamicKeys.sort().map(key => {
64869
+ var _a;
64870
+ const stateStyle = (_a = this.stateStyle[stateName]) === null || _a === void 0 ? void 0 : _a[key];
64871
+ const styleId = this._getSharedStateDefinitionRefId(stateStyle === null || stateStyle === void 0 ? void 0 : stateStyle.style);
64872
+ const postProcessId = this._getSharedStateDefinitionRefId(stateStyle === null || stateStyle === void 0 ? void 0 : stateStyle.postProcess);
64873
+ const refererId = this._getSharedStateDefinitionRefId(stateStyle === null || stateStyle === void 0 ? void 0 : stateStyle.referer);
64874
+ return `${key}:${styleId}:${postProcessId}:${refererId}`;
64875
+ })
64876
+ ].join('|'));
63851
64877
  });
64878
+ if (!cacheKeys.length) {
64879
+ this._dynamicSharedStateNames.clear();
64880
+ if (this._product.sharedStateDefinitions !== undefined) {
64881
+ this._product.sharedStateDefinitions = undefined;
64882
+ }
64883
+ return;
64884
+ }
64885
+ const cacheKey = cacheKeys.sort().join('||');
64886
+ this._dynamicSharedStateNames = dynamicSharedStateNames;
64887
+ if (cacheKey === this._sharedStateDefinitionsCacheKey && this._sharedStateDefinitionsCache) {
64888
+ if (this._product.sharedStateDefinitions !== this._sharedStateDefinitionsCache) {
64889
+ this._product.sharedStateDefinitions = this._sharedStateDefinitionsCache;
64890
+ }
64891
+ return;
64892
+ }
64893
+ this._sharedStateDefinitionsCacheKey = cacheKey;
64894
+ this._sharedStateDefinitionsCache = sharedStateDefinitions;
63852
64895
  this._product.sharedStateDefinitions = sharedStateDefinitions;
63853
64896
  }
63854
64897
  _addProgressiveGraphic(parent, g) {
@@ -63867,6 +64910,36 @@ class BaseMark extends GrammarItem {
63867
64910
  g.context.finalAttrs = finalAttrs;
63868
64911
  });
63869
64912
  }
64913
+ _excludeStateControlledDiffAttrs(g, diffAttrs) {
64914
+ var _a;
64915
+ if (!diffAttrs || !Object.keys(diffAttrs).length) {
64916
+ return diffAttrs;
64917
+ }
64918
+ let nextDiffAttrs;
64919
+ const excludeKey = (key) => {
64920
+ if (!(key in diffAttrs)) {
64921
+ return;
64922
+ }
64923
+ if (!nextDiffAttrs) {
64924
+ nextDiffAttrs = Object.assign({}, diffAttrs);
64925
+ }
64926
+ delete nextDiffAttrs[key];
64927
+ };
64928
+ if (g.resolvedStatePatch) {
64929
+ Object.keys(g.resolvedStatePatch).forEach(excludeKey);
64930
+ }
64931
+ (_a = g.context.states) === null || _a === void 0 ? void 0 : _a.forEach(stateName => {
64932
+ var _a;
64933
+ const encoder = (_a = this._encoderOfState) === null || _a === void 0 ? void 0 : _a[stateName];
64934
+ if (encoder) {
64935
+ Object.keys(encoder).forEach(excludeKey);
64936
+ }
64937
+ });
64938
+ return nextDiffAttrs !== null && nextDiffAttrs !== void 0 ? nextDiffAttrs : diffAttrs;
64939
+ }
64940
+ _hasDiffAttrs(g) {
64941
+ return !!g.context.diffAttrs && Object.keys(g.context.diffAttrs).length > 0;
64942
+ }
63870
64943
  _runApplyGraphic(graphics) {
63871
64944
  const hasAnimation = this.hasAnimation();
63872
64945
  graphics.forEach((g, index) => {
@@ -63899,11 +64972,11 @@ class BaseMark extends GrammarItem {
63899
64972
  }
63900
64973
  }
63901
64974
  else {
63902
- const diffAttrs = getDiffAttributesOfGraphic(g, finalAttrs);
64975
+ const diffAttrs = this._excludeStateControlledDiffAttrs(g, getDiffAttributesOfGraphic(g, finalAttrs));
63903
64976
  g.context.diffAttrs = diffAttrs;
63904
64977
  if (g.context.reusing) {
63905
64978
  g.context.lastAttrs = g.attribute;
63906
- g.initAttributes({});
64979
+ g.initAttributes(finalAttrs);
63907
64980
  g.context.reusing = false;
63908
64981
  }
63909
64982
  else if (!hasStateAnimation) {
@@ -64055,11 +65128,24 @@ class BaseMark extends GrammarItem {
64055
65128
  }
64056
65129
  const stateInfo = this.state.getStateInfo(key);
64057
65130
  this._graphics.forEach(g => {
65131
+ const reinitStateGraphic = g;
65132
+ const statesClearedBeforeReInit = reinitStateGraphic[statesClearedBeforeReInitKey];
65133
+ const wasStateClearedBeforeReInit = statesClearedBeforeReInit === null || statesClearedBeforeReInit === void 0 ? void 0 : statesClearedBeforeReInit.includes(key);
65134
+ const hasStateAnimation = wasStateClearedBeforeReInit ? false : this.hasAnimationByState('state');
64058
65135
  if (this.state.checkOneState(g, g.context.data, stateInfo) === 'in') {
64059
- addGraphicState(g, key, true, this.hasAnimationByState('state'));
65136
+ addGraphicState(g, key, true, hasStateAnimation);
64060
65137
  }
64061
65138
  else {
64062
- removeGraphicState(g, key, this.hasAnimationByState('state'));
65139
+ removeGraphicState(g, key, hasStateAnimation);
65140
+ }
65141
+ if (wasStateClearedBeforeReInit) {
65142
+ const nextStates = statesClearedBeforeReInit.filter(stateName => stateName !== key);
65143
+ if (nextStates.length) {
65144
+ reinitStateGraphic[statesClearedBeforeReInitKey] = nextStates;
65145
+ }
65146
+ else {
65147
+ delete reinitStateGraphic[statesClearedBeforeReInitKey];
65148
+ }
64063
65149
  }
64064
65150
  });
64065
65151
  }
@@ -64087,7 +65173,9 @@ class BaseMark extends GrammarItem {
64087
65173
  animation: Object.assign(Object.assign({}, item), { customParameters: g.context })
64088
65174
  }));
64089
65175
  g.applyAnimationState(['exit'], [exitConfigList.length === 1 ? exitConfigList[0] : exitConfigList], () => {
64090
- doRemove(g, key);
65176
+ if (g.context.diffState === DiffState.exit && g.isExiting && this._graphicMap.get(key) === g) {
65177
+ doRemove(g, key);
65178
+ }
64091
65179
  });
64092
65180
  }
64093
65181
  }
@@ -64262,7 +65350,10 @@ class BaseMark extends GrammarItem {
64262
65350
  this.uncommit();
64263
65351
  this.stateStyle = {};
64264
65352
  this.getGraphics().forEach(g => {
64265
- g.clearStates();
65353
+ var _a;
65354
+ if ((_a = g.currentStates) === null || _a === void 0 ? void 0 : _a.length) {
65355
+ g[statesClearedBeforeReInitKey] = g.currentStates.slice();
65356
+ }
64266
65357
  });
64267
65358
  }
64268
65359
  }
@@ -64393,7 +65484,7 @@ class GroupMark extends BaseMark {
64393
65484
  }
64394
65485
  release() {
64395
65486
  super.release();
64396
- this.removeProduct();
65487
+ this.removeProduct(true);
64397
65488
  }
64398
65489
  }
64399
65490
  GroupMark.type = "group";
@@ -65207,6 +66298,38 @@ class VChartPluginService extends BasePluginService {
65207
66298
  }
65208
66299
  }
65209
66300
 
66301
+ const releaseVRenderComponentSync = (component, removeFromParent = true) => {
66302
+ var _a, _b, _c, _d, _e;
66303
+ const parent = component.parent;
66304
+ (_a = component.release) === null || _a === void 0 ? void 0 : _a.call(component, true);
66305
+ (_c = (_b = component).removeAllChild) === null || _c === void 0 ? void 0 : _c.call(_b, true);
66306
+ if (removeFromParent) {
66307
+ (_e = ((_d = component.parent) !== null && _d !== void 0 ? _d : parent)) === null || _e === void 0 ? void 0 : _e.removeChild(component, true);
66308
+ }
66309
+ };
66310
+ const collectVRenderComponents = (component) => {
66311
+ var _a, _b;
66312
+ const components = [component];
66313
+ (_b = (_a = component).forEachChildren) === null || _b === void 0 ? void 0 : _b.call(_a, child => {
66314
+ components.push(...collectVRenderComponents(child));
66315
+ });
66316
+ return components;
66317
+ };
66318
+ const releaseVRenderComponent = (component, options = {}) => {
66319
+ var _a, _b;
66320
+ const { enableExitAnimation = true, removeFromParent = true, onComplete } = options;
66321
+ const releasedWithExit = enableExitAnimation &&
66322
+ ((_b = (_a = component).releaseWithExitAnimation) === null || _b === void 0 ? void 0 : _b.call(_a, {
66323
+ removeFromParent,
66324
+ onComplete
66325
+ }));
66326
+ if (releasedWithExit) {
66327
+ return true;
66328
+ }
66329
+ releaseVRenderComponentSync(component, removeFromParent);
66330
+ return false;
66331
+ };
66332
+
65210
66333
  class VChart {
65211
66334
  static useRegisters(comps) {
65212
66335
  comps.forEach((fn) => {
@@ -65456,7 +66579,7 @@ class VChart {
65456
66579
  this._compiler.updateLayoutTag();
65457
66580
  this._setFontFamilyTheme(this.getTheme('fontFamily'));
65458
66581
  this._initDataSet(this._option.dataSet);
65459
- this._autoSize = isTrueBrowseEnv ? ((_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true) : false;
66582
+ this._autoSize = isTrueBrowseEnv ? (_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true : false;
65460
66583
  this._bindResizeEvent();
65461
66584
  this._bindViewEvent();
65462
66585
  this._initChartPlugin();
@@ -65610,6 +66733,9 @@ class VChart {
65610
66733
  this._updateAnimateState(true);
65611
66734
  }
65612
66735
  this._reCompile(updateSpecResult);
66736
+ if (isUpdateSpecResultLocalOnly(updateSpecResult)) {
66737
+ return this;
66738
+ }
65613
66739
  if (sync) {
65614
66740
  return this._renderSync(option);
65615
66741
  }
@@ -65627,7 +66753,7 @@ class VChart {
65627
66753
  if (updateResult.reMake) {
65628
66754
  this._releaseData();
65629
66755
  this._initDataSet();
65630
- (_a = this._chart) === null || _a === void 0 ? void 0 : _a.release();
66756
+ (_a = this._chart) === null || _a === void 0 ? void 0 : _a.release(false);
65631
66757
  this._chart = null;
65632
66758
  }
65633
66759
  if (updateResult.reTransformSpec) {
@@ -65738,6 +66864,7 @@ class VChart {
65738
66864
  this._chartPluginApply('releaseAll');
65739
66865
  this._chartPlugin = null;
65740
66866
  this._chartSpecTransformer = null;
66867
+ this._forceReleaseExitingVRenderComponents();
65741
66868
  (_b = this._chart) === null || _b === void 0 ? void 0 : _b.release();
65742
66869
  (_c = this._eventDispatcher) === null || _c === void 0 ? void 0 : _c.release();
65743
66870
  (_d = this._compiler) === null || _d === void 0 ? void 0 : _d.release();
@@ -65760,6 +66887,25 @@ class VChart {
65760
66887
  this._isReleased = true;
65761
66888
  InstanceManager.unregisterInstance(this);
65762
66889
  }
66890
+ _registerExitingVRenderComponent(component) {
66891
+ var _a;
66892
+ this._exitingVRenderComponents = (_a = this._exitingVRenderComponents) !== null && _a !== void 0 ? _a : new Set();
66893
+ this._exitingVRenderComponents.add(component);
66894
+ }
66895
+ _unregisterExitingVRenderComponent(component) {
66896
+ var _a;
66897
+ (_a = this._exitingVRenderComponents) === null || _a === void 0 ? void 0 : _a.delete(component);
66898
+ }
66899
+ _forceReleaseExitingVRenderComponents() {
66900
+ var _a;
66901
+ if (!((_a = this._exitingVRenderComponents) === null || _a === void 0 ? void 0 : _a.size)) {
66902
+ return;
66903
+ }
66904
+ this._exitingVRenderComponents.forEach(component => {
66905
+ releaseVRenderComponentSync(component);
66906
+ });
66907
+ this._exitingVRenderComponents.clear();
66908
+ }
65763
66909
  updateData(id, data, parserOptions, userUpdateOptions) {
65764
66910
  return __awaiter$b(this, void 0, void 0, function* () {
65765
66911
  return this.updateDataSync(id, data, parserOptions, userUpdateOptions);
@@ -65923,9 +67069,13 @@ class VChart {
65923
67069
  spec = mergeSpec({}, model.getSpec(), spec);
65924
67070
  }
65925
67071
  const result = model.updateSpec(spec);
65926
- model.reInit(spec);
65927
- if (result.change || result.reCompile || result.reMake || result.reSize || result.reRender) {
65928
- this._chart.reDataFlow();
67072
+ const localOnly = isUpdateSpecResultLocalOnly(result);
67073
+ const componentOnly = isUpdateSpecResultComponentOnly(result);
67074
+ if (!localOnly) {
67075
+ model.reInit(spec);
67076
+ if (!componentOnly && (result.change || result.reCompile || result.reMake || result.reSize || result.reRender)) {
67077
+ this._chart.reDataFlow();
67078
+ }
65929
67079
  }
65930
67080
  return this.updateCustomConfigAndRerender(result, sync, {
65931
67081
  morphConfig,
@@ -66106,7 +67256,7 @@ class VChart {
66106
67256
  resize = true;
66107
67257
  }
66108
67258
  const lasAutoSize = this._autoSize;
66109
- this._autoSize = isTrueBrowser(this._option.mode) ? ((_b = (_a = this._spec.autoFit) !== null && _a !== void 0 ? _a : this._option.autoFit) !== null && _b !== void 0 ? _b : true) : false;
67259
+ this._autoSize = isTrueBrowser(this._option.mode) ? (_b = (_a = this._spec.autoFit) !== null && _a !== void 0 ? _a : this._option.autoFit) !== null && _b !== void 0 ? _b : true : false;
66110
67260
  if (this._autoSize !== lasAutoSize) {
66111
67261
  resize = true;
66112
67262
  }
@@ -67259,6 +68409,8 @@ const defaultSeriesIgnoreCheckKeys = {
67259
68409
  data: true
67260
68410
  };
67261
68411
  const defaultSeriesCompileCheckKeys = {
68412
+ xField: true,
68413
+ yField: true,
67262
68414
  invalidType: true,
67263
68415
  animation: true,
67264
68416
  animationAppear: true,
@@ -67267,6 +68419,13 @@ const defaultSeriesCompileCheckKeys = {
67267
68419
  animationExit: true,
67268
68420
  animationNormal: true
67269
68421
  };
68422
+ const defaultSeriesCompileOnlyCheckKeys = {
68423
+ animationAppear: true,
68424
+ animationEnter: true,
68425
+ animationUpdate: true,
68426
+ animationExit: true,
68427
+ animationNormal: true
68428
+ };
67270
68429
 
67271
68430
  const AnimationStates = [...Object.keys(DEFAULT_ANIMATION_CONFIG), 'normal'];
67272
68431
  function animationConfig(defaultConfig = {}, userConfig, params) {
@@ -67622,6 +68781,40 @@ function getDefaultInteractionConfigByMode(mode) {
67622
68781
  return null;
67623
68782
  }
67624
68783
 
68784
+ const defaultSeriesDataRelatedCheckKeys = Object.keys(defaultSeriesCompileCheckKeys).reduce((keys, key) => {
68785
+ if (!defaultSeriesCompileOnlyCheckKeys[key]) {
68786
+ keys[key] = true;
68787
+ }
68788
+ return keys;
68789
+ }, {});
68790
+ const defaultSeriesSpecUpdatePolicy = {
68791
+ compileOnlyKeys: defaultSeriesCompileOnlyCheckKeys,
68792
+ dataRelatedKeys: defaultSeriesDataRelatedCheckKeys
68793
+ };
68794
+ const isSpecObject = (value) => isObject$2(value) && !isArray$1(value) && !isFunction$1(value);
68795
+ const hasOnlyAllowedSubKeyChanges = (specValue, prevSpecValue, allowedSubKeys) => {
68796
+ if (!isSpecObject(specValue) || !isSpecObject(prevSpecValue)) {
68797
+ return false;
68798
+ }
68799
+ let changed = false;
68800
+ const subKeys = Array.from(new Set([...Object.keys(prevSpecValue), ...Object.keys(specValue)]));
68801
+ for (const subKey of subKeys) {
68802
+ if (!isEqual(specValue[subKey], prevSpecValue[subKey])) {
68803
+ if (!allowedSubKeys[subKey]) {
68804
+ return false;
68805
+ }
68806
+ changed = true;
68807
+ }
68808
+ }
68809
+ return changed;
68810
+ };
68811
+ function markSeriesCompileEffect(compareResult, dataRelated = false) {
68812
+ compareResult.effects = Object.assign(Object.assign({}, compareResult.effects), { series: true, compile: true, layout: true, render: true });
68813
+ if (dataRelated) {
68814
+ compareResult.effects.data = true;
68815
+ compareResult.effects.scaleDomain = true;
68816
+ }
68817
+ }
67625
68818
  class BaseSeries extends BaseModel {
67626
68819
  getRegion() {
67627
68820
  return this._region;
@@ -68320,9 +69513,14 @@ class BaseSeries extends BaseModel {
68320
69513
  return !isEqual(prev, newLabels[index]);
68321
69514
  })) {
68322
69515
  compareResult.reCompile = true;
69516
+ markSeriesCompileEffect(compareResult);
68323
69517
  }
68324
69518
  }
69519
+ _getSpecUpdatePolicy() {
69520
+ return defaultSeriesSpecUpdatePolicy;
69521
+ }
68325
69522
  _compareSpec(spec, prevSpec, ignoreCheckKeys) {
69523
+ var _a, _b, _c, _d;
68326
69524
  const result = super._compareSpec(spec, prevSpec);
68327
69525
  const currentKeys = Object.keys(prevSpec || {}).sort();
68328
69526
  const nextKeys = Object.keys(spec || {}).sort();
@@ -68330,7 +69528,12 @@ class BaseSeries extends BaseModel {
68330
69528
  result.reMake = true;
68331
69529
  return result;
68332
69530
  }
68333
- const ignores = Object.assign(Object.assign(Object.assign(Object.assign({}, defaultSeriesIgnoreCheckKeys), defaultSeriesCompileCheckKeys), ignoreCheckKeys), { extensionMark: true, label: true, totalLabel: true });
69531
+ const specUpdatePolicy = this._getSpecUpdatePolicy();
69532
+ const compileOnlyKeys = (_a = specUpdatePolicy.compileOnlyKeys) !== null && _a !== void 0 ? _a : {};
69533
+ const dataRelatedKeys = (_b = specUpdatePolicy.dataRelatedKeys) !== null && _b !== void 0 ? _b : {};
69534
+ const compileOnlySubKeys = (_c = specUpdatePolicy.compileOnlySubKeys) !== null && _c !== void 0 ? _c : {};
69535
+ const compileCheckKeys = Object.assign(Object.assign({}, compileOnlyKeys), dataRelatedKeys);
69536
+ const ignores = Object.assign(Object.assign(Object.assign(Object.assign({}, defaultSeriesIgnoreCheckKeys), compileCheckKeys), ignoreCheckKeys), { extensionMark: true, label: true, totalLabel: true });
68334
69537
  this._compareExtensionMarksSpec(array(spec.extensionMark), array(prevSpec.extensionMark), result);
68335
69538
  !result.reMake && this._compareLabelSpec(array(spec.label), array(prevSpec.label), result);
68336
69539
  !result.reMake &&
@@ -68346,12 +69549,27 @@ class BaseSeries extends BaseModel {
68346
69549
  })) {
68347
69550
  result.reCompile = true;
68348
69551
  }
68349
- if (!result.reCompile &&
68350
- currentKeys.some((k) => {
68351
- return defaultSeriesCompileCheckKeys[k] && !isEqual(spec[k], prevSpec[k]);
68352
- })) {
69552
+ const changedCompileKeys = currentKeys.filter((k) => {
69553
+ return compileCheckKeys[k] && !isEqual(spec[k], prevSpec[k]);
69554
+ });
69555
+ const changedCompileOnlySubKeys = currentKeys.filter((k) => {
69556
+ return (compileOnlySubKeys[k] &&
69557
+ hasOnlyAllowedSubKeyChanges(spec[k], prevSpec[k], compileOnlySubKeys[k]));
69558
+ });
69559
+ changedCompileOnlySubKeys.forEach(k => {
69560
+ ignores[k] = true;
69561
+ });
69562
+ if (!result.reCompile && (changedCompileKeys.length || changedCompileOnlySubKeys.length)) {
68353
69563
  result.reCompile = true;
68354
69564
  }
69565
+ if (changedCompileKeys.some(k => dataRelatedKeys[k])) {
69566
+ markSeriesCompileEffect(result, true);
69567
+ }
69568
+ else if (result.reCompile &&
69569
+ !((_d = result.effects) === null || _d === void 0 ? void 0 : _d.series) &&
69570
+ (changedCompileKeys.length || changedCompileOnlySubKeys.length)) {
69571
+ markSeriesCompileEffect(result);
69572
+ }
68355
69573
  if (currentKeys.some((k) => {
68356
69574
  return !ignores[k] && !isEqual(spec[k], prevSpec[k]);
68357
69575
  })) {
@@ -68500,7 +69718,7 @@ class BaseSeries extends BaseModel {
68500
69718
  attributeContext: this._markAttributeContext,
68501
69719
  componentType: option.componentType,
68502
69720
  noSeparateStyle,
68503
- parent: parent !== false ? (parent !== null && parent !== void 0 ? parent : this._rootMark) : null
69721
+ parent: parent !== false ? parent !== null && parent !== void 0 ? parent : this._rootMark : null
68504
69722
  });
68505
69723
  if (isValid$1(m)) {
68506
69724
  const spec = this.getSpec() || {};
@@ -68533,11 +69751,22 @@ class BaseSeries extends BaseModel {
68533
69751
  if (!datum) {
68534
69752
  return key;
68535
69753
  }
68536
- const dimensionFields = this.getDimensionField();
68537
- key = dimensionFields.map(field => datum[field]).join('_');
68538
69754
  const seriesField = this.getSeriesField();
68539
- if (seriesField && !dimensionFields.includes(seriesField)) {
68540
- key += `_${datum[seriesField]}`;
69755
+ const dimensionFields = this.getDimensionField();
69756
+ const seriesFieldValue = seriesField ? datum[seriesField] : undefined;
69757
+ let hasSeriesFieldInDimension = false;
69758
+ let lastDimensionValue;
69759
+ for (let i = 0; i < dimensionFields.length; i++) {
69760
+ const field = dimensionFields[i];
69761
+ const dimensionValue = datum[field];
69762
+ key += `${i > 0 ? '_' : ''}${isNil$1(dimensionValue) ? '' : dimensionValue}`;
69763
+ hasSeriesFieldInDimension || (hasSeriesFieldInDimension = field === seriesField);
69764
+ lastDimensionValue = dimensionValue;
69765
+ }
69766
+ if (seriesField &&
69767
+ !hasSeriesFieldInDimension &&
69768
+ !(dimensionFields.length > 1 && lastDimensionValue === seriesFieldValue)) {
69769
+ key += `_${seriesFieldValue}`;
68541
69770
  }
68542
69771
  return key;
68543
69772
  }
@@ -69462,6 +70691,10 @@ const lineLikeSeriesMark = {
69462
70691
  ["line"]: { name: "line", type: "line" }
69463
70692
  };
69464
70693
 
70694
+ const LINE_LIKE_SERIES_DATA_RELATED_KEYS = {
70695
+ sampling: true,
70696
+ samplingFactor: true
70697
+ };
69465
70698
  class LineLikeSeriesMixin {
69466
70699
  addSamplingCompile() {
69467
70700
  if (this._spec.sampling) {
@@ -70735,6 +71968,7 @@ class BaseComponent extends LayoutModel {
70735
71968
  this.name = 'component';
70736
71969
  this.modelType = 'component';
70737
71970
  this.transformerConstructor = BaseComponentSpecTransformer;
71971
+ this._forceReleaseVRenderComponents = false;
70738
71972
  this._delegateEvent = (component, event, type, item = null, datum = null) => {
70739
71973
  var _a, _b;
70740
71974
  if (!(event instanceof CustomEvent)) {
@@ -70798,23 +72032,72 @@ class BaseComponent extends LayoutModel {
70798
72032
  }
70799
72033
  return result;
70800
72034
  }
72035
+ beforeRelease() {
72036
+ super.beforeRelease();
72037
+ this._forceReleaseVRenderComponents = true;
72038
+ this._forceReleaseExitingVRenderComponents();
72039
+ }
70801
72040
  release() {
70802
72041
  var _a;
70803
- super.release();
72042
+ if (this._shouldReleaseVRenderComponentsImmediately()) {
72043
+ this._forceReleaseExitingVRenderComponents();
72044
+ }
70804
72045
  this.clear();
72046
+ super.release();
70805
72047
  (_a = this.pluginService) === null || _a === void 0 ? void 0 : _a.releaseAll();
70806
72048
  this.pluginService = null;
70807
72049
  }
72050
+ _shouldReleaseVRenderComponentsImmediately() {
72051
+ return this._forceReleaseVRenderComponents;
72052
+ }
72053
+ _forceReleaseExitingVRenderComponents() {
72054
+ var _a;
72055
+ if (!((_a = this._exitingVRenderComponents) === null || _a === void 0 ? void 0 : _a.size)) {
72056
+ return;
72057
+ }
72058
+ this._exitingVRenderComponents.forEach(component => {
72059
+ var _a, _b, _c;
72060
+ releaseVRenderComponentSync(component);
72061
+ (_c = (_b = (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance) === null || _b === void 0 ? void 0 : _b._unregisterExitingVRenderComponent) === null || _c === void 0 ? void 0 : _c.call(_b, component);
72062
+ });
72063
+ this._exitingVRenderComponents.clear();
72064
+ }
72065
+ _releaseVRenderComponent(component) {
72066
+ var _a;
72067
+ const forceRelease = this._shouldReleaseVRenderComponentsImmediately();
72068
+ if (!forceRelease) {
72069
+ const exitingComponents = collectVRenderComponents(component);
72070
+ const releasedWithExit = releaseVRenderComponent(component, {
72071
+ enableExitAnimation: true,
72072
+ removeFromParent: true,
72073
+ onComplete: () => {
72074
+ exitingComponents.forEach(exitingComponent => {
72075
+ var _a, _b, _c, _d;
72076
+ (_a = this._exitingVRenderComponents) === null || _a === void 0 ? void 0 : _a.delete(exitingComponent);
72077
+ (_d = (_c = (_b = this._option) === null || _b === void 0 ? void 0 : _b.globalInstance) === null || _c === void 0 ? void 0 : _c._unregisterExitingVRenderComponent) === null || _d === void 0 ? void 0 : _d.call(_c, exitingComponent);
72078
+ });
72079
+ }
72080
+ });
72081
+ if (releasedWithExit) {
72082
+ this._exitingVRenderComponents = (_a = this._exitingVRenderComponents) !== null && _a !== void 0 ? _a : new Set();
72083
+ exitingComponents.forEach(exitingComponent => {
72084
+ var _a, _b, _c;
72085
+ this._exitingVRenderComponents.add(exitingComponent);
72086
+ (_c = (_b = (_a = this._option) === null || _a === void 0 ? void 0 : _a.globalInstance) === null || _b === void 0 ? void 0 : _b._registerExitingVRenderComponent) === null || _c === void 0 ? void 0 : _c.call(_b, exitingComponent);
72087
+ });
72088
+ return;
72089
+ }
72090
+ return;
72091
+ }
72092
+ releaseVRenderComponentSync(component);
72093
+ }
70808
72094
  clear() {
70809
72095
  var _a;
70810
72096
  const components = this._getNeedClearVRenderComponents();
70811
72097
  if (components && components.length) {
70812
72098
  components.forEach(c => {
70813
- var _a;
70814
72099
  if (c) {
70815
- c.release(true);
70816
- (_a = this.getContainer()) === null || _a === void 0 ? void 0 : _a.removeChild(c);
70817
- c = null;
72100
+ this._releaseVRenderComponent(c);
70818
72101
  }
70819
72102
  });
70820
72103
  }
@@ -70874,13 +72157,91 @@ class ComponentMark extends BaseMark {
70874
72157
  getComponent() {
70875
72158
  return this._component;
70876
72159
  }
70877
- clearComponent() {
70878
- if (this._component) {
70879
- if (this._component.parent) {
70880
- this._component.parent.removeChild(this._component);
72160
+ _clearExitingComponent(component) {
72161
+ if (this._exitingComponent === component) {
72162
+ this._unregisterExitingComponent(component);
72163
+ this._exitingComponent = undefined;
72164
+ this._exitingProduct = undefined;
72165
+ }
72166
+ }
72167
+ _removeProductAfterExit(component, product) {
72168
+ if (product.parent) {
72169
+ product.parent.removeChild(product, true);
72170
+ }
72171
+ if (this._product === product) {
72172
+ this._product = null;
72173
+ this._compiledProductId = null;
72174
+ }
72175
+ this._clearExitingComponent(component);
72176
+ }
72177
+ _registerExitingComponent(component) {
72178
+ var _a, _b, _c, _d, _e;
72179
+ (_e = (_d = (_c = (_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.getOption) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c.globalInstance) === null || _d === void 0 ? void 0 : _d._registerExitingVRenderComponent) === null || _e === void 0 ? void 0 : _e.call(_d, component);
72180
+ }
72181
+ _unregisterExitingComponent(component) {
72182
+ var _a, _b, _c, _d, _e;
72183
+ (_e = (_d = (_c = (_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.getOption) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c.globalInstance) === null || _d === void 0 ? void 0 : _d._unregisterExitingVRenderComponent) === null || _e === void 0 ? void 0 : _e.call(_d, component);
72184
+ }
72185
+ _releaseComponentWithExitAnimation(component, releaseProduct) {
72186
+ var _a, _b;
72187
+ const product = this._product;
72188
+ if (!component || ((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a._shouldReleaseVRenderComponentsImmediately) === null || _b === void 0 ? void 0 : _b.call(_a))) {
72189
+ return false;
72190
+ }
72191
+ const releasedWithExit = releaseVRenderComponent(component, {
72192
+ enableExitAnimation: true,
72193
+ removeFromParent: true,
72194
+ onComplete: () => {
72195
+ if (releaseProduct && product) {
72196
+ this._removeProductAfterExit(component, product);
72197
+ }
72198
+ else {
72199
+ this._clearExitingComponent(component);
72200
+ }
70881
72201
  }
70882
- this._component = null;
72202
+ });
72203
+ if (releasedWithExit) {
72204
+ this._exitingComponent = component;
72205
+ this._exitingProduct = releaseProduct ? product : undefined;
72206
+ this._registerExitingComponent(component);
72207
+ }
72208
+ return releasedWithExit;
72209
+ }
72210
+ clearComponent() {
72211
+ var _a, _b;
72212
+ const component = this._component;
72213
+ if (!component) {
72214
+ return;
70883
72215
  }
72216
+ if ((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a._shouldReleaseVRenderComponentsImmediately) === null || _b === void 0 ? void 0 : _b.call(_a)) {
72217
+ releaseVRenderComponentSync(component);
72218
+ }
72219
+ else {
72220
+ this._releaseComponentWithExitAnimation(component, false);
72221
+ }
72222
+ this._component = null;
72223
+ }
72224
+ releaseWithExitAnimation() {
72225
+ const component = this._component;
72226
+ if (!this._releaseComponentWithExitAnimation(component, true)) {
72227
+ return false;
72228
+ }
72229
+ this._component = null;
72230
+ this._exitingComponent = component;
72231
+ return true;
72232
+ }
72233
+ forceReleaseExitAnimation() {
72234
+ var _a;
72235
+ if (!this._exitingComponent) {
72236
+ return;
72237
+ }
72238
+ releaseVRenderComponentSync(this._exitingComponent);
72239
+ this._unregisterExitingComponent(this._exitingComponent);
72240
+ if ((_a = this._exitingProduct) === null || _a === void 0 ? void 0 : _a.parent) {
72241
+ this._exitingProduct.parent.removeChild(this._exitingProduct, true);
72242
+ }
72243
+ this._exitingComponent = undefined;
72244
+ this._exitingProduct = undefined;
70884
72245
  }
70885
72246
  _getAttrsFromConfig(attrs = {}) {
70886
72247
  const configAttrs = super._getAttrsFromConfig(attrs);
@@ -70941,8 +72302,26 @@ class ComponentMark extends BaseMark {
70941
72302
  this.needClear = true;
70942
72303
  }
70943
72304
  release() {
72305
+ var _a, _b;
72306
+ if ((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a._shouldReleaseVRenderComponentsImmediately) === null || _b === void 0 ? void 0 : _b.call(_a)) {
72307
+ this.forceReleaseExitAnimation();
72308
+ super.release();
72309
+ this.removeProduct(true);
72310
+ return;
72311
+ }
72312
+ if (this._exitingComponent) {
72313
+ if (!this._releaseComponentWithExitAnimation(this._exitingComponent, true)) {
72314
+ this.removeProduct(true);
72315
+ }
72316
+ super.release();
72317
+ return;
72318
+ }
72319
+ if (this.releaseWithExitAnimation()) {
72320
+ super.release();
72321
+ return;
72322
+ }
70944
72323
  super.release();
70945
- this.removeProduct();
72324
+ this.removeProduct(true);
70946
72325
  }
70947
72326
  }
70948
72327
  ComponentMark.type = "component";
@@ -70954,6 +72333,19 @@ const scaleParser = (scale) => {
70954
72333
  return scale;
70955
72334
  };
70956
72335
 
72336
+ const AXIS_COMPONENT_ONLY_CHANGE_KEYS = {
72337
+ grid: true,
72338
+ subGrid: true,
72339
+ tick: true,
72340
+ subTick: true,
72341
+ label: true,
72342
+ domainLine: true,
72343
+ title: true,
72344
+ maxWidth: true,
72345
+ minWidth: true,
72346
+ maxHeight: true,
72347
+ minHeight: true
72348
+ };
70957
72349
  class AxisComponent extends BaseComponent {
70958
72350
  getOrient() {
70959
72351
  return this._orient;
@@ -71259,6 +72651,7 @@ class AxisComponent extends BaseComponent {
71259
72651
  if (result.reMake) {
71260
72652
  return result;
71261
72653
  }
72654
+ const specChanged = !isEqual(prevSpec, spec);
71262
72655
  result.reRender = true;
71263
72656
  if ((prevSpec === null || prevSpec === void 0 ? void 0 : prevSpec.type) !== (spec === null || spec === void 0 ? void 0 : spec.type) || (prevSpec === null || prevSpec === void 0 ? void 0 : prevSpec.visible) !== (spec === null || spec === void 0 ? void 0 : spec.visible)) {
71264
72657
  result.reMake = true;
@@ -71268,8 +72661,17 @@ class AxisComponent extends BaseComponent {
71268
72661
  var _a, _b;
71269
72662
  return ((_a = prevSpec === null || prevSpec === void 0 ? void 0 : prevSpec[k]) === null || _a === void 0 ? void 0 : _a.visible) !== ((_b = spec === null || spec === void 0 ? void 0 : spec[k]) === null || _b === void 0 ? void 0 : _b.visible);
71270
72663
  });
72664
+ if (specChanged && !result.reMake && this._isComponentOnlySpecChange(spec, prevSpec)) {
72665
+ result.effects = Object.assign(Object.assign({}, result.effects), { component: true, layout: true, render: true });
72666
+ }
71271
72667
  return result;
71272
72668
  }
72669
+ _isComponentOnlySpecChange(spec, prevSpec) {
72670
+ const keys = Object.keys(Object.assign(Object.assign({}, prevSpec), spec));
72671
+ return keys.every(key => {
72672
+ return isEqual(prevSpec === null || prevSpec === void 0 ? void 0 : prevSpec[key], spec === null || spec === void 0 ? void 0 : spec[key]) || AXIS_COMPONENT_ONLY_CHANGE_KEYS[key];
72673
+ });
72674
+ }
71273
72675
  _getAxisAttributes() {
71274
72676
  const spec = this._spec;
71275
72677
  const axisAttrs = {
@@ -73863,6 +75265,10 @@ class LineSeries extends CartesianSeries {
73863
75265
  this.transformerConstructor = LineLikeSeriesSpecTransformer;
73864
75266
  this._sortDataByAxis = false;
73865
75267
  }
75268
+ _getSpecUpdatePolicy() {
75269
+ const policy = super._getSpecUpdatePolicy();
75270
+ return Object.assign(Object.assign({}, policy), { dataRelatedKeys: Object.assign(Object.assign({}, policy.dataRelatedKeys), LINE_LIKE_SERIES_DATA_RELATED_KEYS) });
75271
+ }
73866
75272
  compile() {
73867
75273
  super.compile();
73868
75274
  this.addSamplingCompile();
@@ -74539,6 +75945,11 @@ class Interaction {
74539
75945
  }
74540
75946
  }
74541
75947
 
75948
+ const MARKER_COMPONENT_SPEC_KEYS = {
75949
+ [ComponentTypeEnum.markPoint]: true,
75950
+ [ComponentTypeEnum.markLine]: true,
75951
+ [ComponentTypeEnum.markArea]: true
75952
+ };
74542
75953
  class BaseChart extends CompilableBase {
74543
75954
  getSpec() {
74544
75955
  return this._spec;
@@ -74592,6 +76003,7 @@ class BaseChart extends CompilableBase {
74592
76003
  this._regions = [];
74593
76004
  this._series = [];
74594
76005
  this._components = [];
76006
+ this._specTransformer = null;
74595
76007
  this._layoutRect = {
74596
76008
  x: 0,
74597
76009
  y: 0,
@@ -74723,6 +76135,7 @@ class BaseChart extends CompilableBase {
74723
76135
  this._spec = spec;
74724
76136
  }
74725
76137
  created(transformer) {
76138
+ this._specTransformer = transformer;
74726
76139
  this._chartData.parseData(this._spec.data);
74727
76140
  this._createGlobalScale();
74728
76141
  this._createBackground();
@@ -75099,12 +76512,18 @@ class BaseChart extends CompilableBase {
75099
76512
  }
75100
76513
  }
75101
76514
  _getSpecKeys(spec) {
75102
- const ignoreKeys = { width: true, height: true };
76515
+ const ignoreKeys = {
76516
+ width: true,
76517
+ height: true,
76518
+ xField: true,
76519
+ yField: true
76520
+ };
75103
76521
  return Object.keys(spec)
75104
76522
  .filter(key => !ignoreKeys[key])
75105
76523
  .sort();
75106
76524
  }
75107
76525
  updateSpec(spec) {
76526
+ var _a;
75108
76527
  const result = {
75109
76528
  change: false,
75110
76529
  reMake: false,
@@ -75112,49 +76531,83 @@ class BaseChart extends CompilableBase {
75112
76531
  reSize: false,
75113
76532
  reCompile: false
75114
76533
  };
75115
- this.setLayoutTag(true, null, false);
75116
76534
  if (spec.type !== this.type) {
75117
76535
  result.reMake = true;
76536
+ this.setLayoutTag(true, null, false);
75118
76537
  return result;
75119
76538
  }
75120
76539
  const currentKeys = this._getSpecKeys(this._spec);
75121
76540
  const nextKeys = this._getSpecKeys(spec);
75122
76541
  if (!isEqual(currentKeys, nextKeys)) {
75123
76542
  result.reMake = true;
76543
+ this.setLayoutTag(true, null, false);
75124
76544
  return result;
75125
76545
  }
75126
76546
  for (let i = 0; i < currentKeys.length; i++) {
75127
76547
  const key = currentKeys[i];
75128
- if (isArray$1(this._spec[key]) && this._spec[key].length !== array(spec[key]).length) {
76548
+ const currentSpec = this._spec[key];
76549
+ const nextSpec = spec[key];
76550
+ if (isArray$1(currentSpec) &&
76551
+ currentSpec.length !== array(nextSpec).length &&
76552
+ !this._canRemoveMarkerComponentsWithoutRemake(key, currentSpec, nextSpec)) {
75129
76553
  result.reMake = true;
76554
+ this.setLayoutTag(true, null, false);
75130
76555
  return result;
75131
76556
  }
75132
76557
  }
75133
76558
  const oldSpec = this._spec;
76559
+ const onlyMarkerComponentsRemoved = this._isOnlyMarkerComponentsRemoved(this._spec, spec, currentKeys);
76560
+ const onlyComponentSpecsChanged = this._isOnlyComponentSpecsChanged(this._spec, spec, currentKeys);
76561
+ const onlySeriesSpecsChanged = this._isOnlySeriesSpecsChanged(this._spec, spec, currentKeys);
75134
76562
  this._spec = spec;
76563
+ if (onlyMarkerComponentsRemoved) {
76564
+ this._removeMarkerComponentsForEmptySpecs(result);
76565
+ return result;
76566
+ }
75135
76567
  this.updateChartConfig(result, oldSpec);
75136
76568
  if (result.reMake) {
76569
+ this.setLayoutTag(true, null, false);
75137
76570
  return result;
75138
76571
  }
75139
76572
  this.updateGlobalScale(result);
75140
76573
  if (result.reMake) {
76574
+ this.setLayoutTag(true, null, false);
75141
76575
  return result;
75142
76576
  }
75143
76577
  this.updateRegionSpec(result);
75144
76578
  if (result.reMake) {
76579
+ this.setLayoutTag(true, null, false);
75145
76580
  return result;
75146
76581
  }
75147
- this.updateComponentSpec(result);
76582
+ const componentUpdateResult = this.updateComponentSpec(result);
75148
76583
  if (result.reMake) {
76584
+ this.setLayoutTag(true, null, false);
76585
+ return result;
76586
+ }
76587
+ if (isUpdateSpecResultLocalOnly(result)) {
75149
76588
  return result;
75150
76589
  }
76590
+ if (onlyComponentSpecsChanged &&
76591
+ !componentUpdateResult.hasNonComponentOnlyUpdate &&
76592
+ isUpdateSpecResultComponentOnly(result)) {
76593
+ componentUpdateResult.componentOnlyUpdatedComponents.forEach(component => {
76594
+ component.reInit(component.getSpec());
76595
+ });
76596
+ if ((_a = result.effects) === null || _a === void 0 ? void 0 : _a.layout) {
76597
+ this.setLayoutTag(true, null, false);
76598
+ }
76599
+ return result;
76600
+ }
76601
+ this.setLayoutTag(true, null, false);
75151
76602
  this.updateSeriesSpec(result);
75152
76603
  if (result.reMake) {
75153
76604
  return result;
75154
76605
  }
75155
76606
  this.reInit();
75156
- this.updateDataSpec();
75157
- this.updateGlobalScaleDomain();
76607
+ if (!onlySeriesSpecsChanged || !this._canSkipChartDataStages(result)) {
76608
+ this.updateDataSpec();
76609
+ this.updateGlobalScaleDomain();
76610
+ }
75158
76611
  return result;
75159
76612
  }
75160
76613
  updateChartConfig(result, oldSpec) {
@@ -75182,12 +76635,15 @@ class BaseChart extends CompilableBase {
75182
76635
  });
75183
76636
  }
75184
76637
  updateComponentSpec(result) {
76638
+ const componentOnlyUpdatedComponents = [];
76639
+ let hasNonComponentOnlyUpdate = false;
75185
76640
  const componentCache = {};
75186
76641
  const checkVisibleComponents = {
75187
76642
  [ComponentTypeEnum.title]: true,
75188
76643
  [ComponentTypeEnum.brush]: true,
75189
76644
  [ComponentTypeEnum.indicator]: true
75190
76645
  };
76646
+ const removedComponents = [];
75191
76647
  this._components.forEach(c => {
75192
76648
  var _a, _b;
75193
76649
  if (c.type === ComponentTypeEnum.label || c.type === ComponentTypeEnum.totalLabel) {
@@ -75203,11 +76659,32 @@ class BaseChart extends CompilableBase {
75203
76659
  specCount: cmpSpec.length,
75204
76660
  componentCount: 0
75205
76661
  };
76662
+ if (this._canRemoveMarkerComponentsWithoutRemake(compSpecKey, [c.getSpec()], cmpSpec)) {
76663
+ removedComponents.push(c);
76664
+ return;
76665
+ }
75206
76666
  componentCache[compSpecKey].componentCount++;
75207
- mergeUpdateResult(result, c.updateSpec((_b = cmpSpec[c.getSpecIndex()]) !== null && _b !== void 0 ? _b : {}, cmpSpec));
76667
+ const componentSpec = (_b = cmpSpec[c.getSpecIndex()]) !== null && _b !== void 0 ? _b : {};
76668
+ const previousComponentSpec = c.getSpec();
76669
+ const componentResult = c.updateSpec(componentSpec, cmpSpec);
76670
+ if (isUpdateSpecResultComponentOnly(componentResult)) {
76671
+ componentOnlyUpdatedComponents.push(c);
76672
+ }
76673
+ else if (!isEqual(previousComponentSpec, componentSpec)) {
76674
+ hasNonComponentOnlyUpdate = true;
76675
+ }
76676
+ mergeUpdateResult(result, componentResult);
75208
76677
  }
75209
76678
  else {
75210
- mergeUpdateResult(result, c.updateSpec(cmpSpec));
76679
+ const previousComponentSpec = c.getSpec();
76680
+ const componentResult = c.updateSpec(cmpSpec);
76681
+ if (isUpdateSpecResultComponentOnly(componentResult)) {
76682
+ componentOnlyUpdatedComponents.push(c);
76683
+ }
76684
+ else if (!isEqual(previousComponentSpec, cmpSpec)) {
76685
+ hasNonComponentOnlyUpdate = true;
76686
+ }
76687
+ mergeUpdateResult(result, componentResult);
75211
76688
  }
75212
76689
  });
75213
76690
  for (const key in componentCache) {
@@ -75218,6 +76695,13 @@ class BaseChart extends CompilableBase {
75218
76695
  }
75219
76696
  }
75220
76697
  }
76698
+ if (removedComponents.length) {
76699
+ removedComponents.forEach(component => {
76700
+ this._removeComponent(component);
76701
+ });
76702
+ result.change = true;
76703
+ result.effects = Object.assign(Object.assign({}, result.effects), { component: true, localOnly: true });
76704
+ }
75221
76705
  const isVisible = (compSpec) => compSpec && compSpec.visible !== false;
75222
76706
  Object.keys(checkVisibleComponents).forEach(type => {
75223
76707
  if (checkVisibleComponents[type]) {
@@ -75228,6 +76712,92 @@ class BaseChart extends CompilableBase {
75228
76712
  }
75229
76713
  }
75230
76714
  });
76715
+ return {
76716
+ componentOnlyUpdatedComponents,
76717
+ hasNonComponentOnlyUpdate
76718
+ };
76719
+ }
76720
+ _canRemoveMarkerComponentsWithoutRemake(key, currentSpec, nextSpec) {
76721
+ return (MARKER_COMPONENT_SPEC_KEYS[key] &&
76722
+ isArray$1(currentSpec) &&
76723
+ currentSpec.length > 0 &&
76724
+ isArray$1(nextSpec) &&
76725
+ nextSpec.length === 0);
76726
+ }
76727
+ _isOnlyMarkerComponentsRemoved(currentSpec, nextSpec, specKeys) {
76728
+ let hasMarkerRemoval = false;
76729
+ const onlyMarkerRemoval = specKeys.every(key => {
76730
+ if (this._canRemoveMarkerComponentsWithoutRemake(key, currentSpec[key], nextSpec[key])) {
76731
+ hasMarkerRemoval = true;
76732
+ return true;
76733
+ }
76734
+ return isEqual(currentSpec[key], nextSpec[key]);
76735
+ });
76736
+ return hasMarkerRemoval && onlyMarkerRemoval;
76737
+ }
76738
+ _isComponentSpecKey(key) {
76739
+ return this._components.some(component => {
76740
+ return (component.specKey || component.type) === key;
76741
+ });
76742
+ }
76743
+ _isOnlyComponentSpecsChanged(currentSpec, nextSpec, specKeys) {
76744
+ let hasComponentSpecChange = false;
76745
+ const currentSpecRecord = currentSpec;
76746
+ const nextSpecRecord = nextSpec;
76747
+ const onlyComponentSpecChange = specKeys.every(key => {
76748
+ if (isEqual(currentSpecRecord[key], nextSpecRecord[key])) {
76749
+ return true;
76750
+ }
76751
+ if (this._isComponentSpecKey(key)) {
76752
+ hasComponentSpecChange = true;
76753
+ return true;
76754
+ }
76755
+ return false;
76756
+ });
76757
+ return hasComponentSpecChange && onlyComponentSpecChange;
76758
+ }
76759
+ _isOnlySeriesSpecsChanged(currentSpec, nextSpec, specKeys) {
76760
+ var _a, _b;
76761
+ let hasSeriesSpecChange = false;
76762
+ const currentSpecRecord = currentSpec;
76763
+ const nextSpecRecord = nextSpec;
76764
+ const seriesRelatedSpecKeys = (_b = (_a = this._specTransformer) === null || _a === void 0 ? void 0 : _a.getSeriesRelatedSpecKeys()) !== null && _b !== void 0 ? _b : {};
76765
+ const onlySeriesSpecChange = specKeys.every(key => {
76766
+ if (isEqual(currentSpecRecord[key], nextSpecRecord[key])) {
76767
+ return true;
76768
+ }
76769
+ if (seriesRelatedSpecKeys[key]) {
76770
+ hasSeriesSpecChange = true;
76771
+ return true;
76772
+ }
76773
+ return false;
76774
+ });
76775
+ return hasSeriesSpecChange && onlySeriesSpecChange;
76776
+ }
76777
+ _canSkipChartDataStages(result) {
76778
+ const effects = result.effects;
76779
+ return !!(effects === null || effects === void 0 ? void 0 : effects.series) && !effects.remake && !effects.data && !effects.scaleDomain && !result.reMake;
76780
+ }
76781
+ _removeMarkerComponentsForEmptySpecs(result) {
76782
+ const removedComponents = this._components.filter(component => {
76783
+ var _a;
76784
+ const compSpecKey = component.specKey || component.type;
76785
+ const cmpSpec = (_a = this._spec[compSpecKey]) !== null && _a !== void 0 ? _a : {};
76786
+ return this._canRemoveMarkerComponentsWithoutRemake(compSpecKey, [component.getSpec()], cmpSpec);
76787
+ });
76788
+ if (!removedComponents.length) {
76789
+ return;
76790
+ }
76791
+ removedComponents.forEach(component => {
76792
+ this._removeComponent(component);
76793
+ });
76794
+ result.change = true;
76795
+ result.effects = Object.assign(Object.assign({}, result.effects), { component: true, localOnly: true });
76796
+ }
76797
+ _removeComponent(component) {
76798
+ this._components = this._components.filter(c => c !== component);
76799
+ this._idMap.delete(component.id);
76800
+ component.release();
75231
76801
  }
75232
76802
  updateSeriesSpec(result) {
75233
76803
  if (this._spec.series.length !== this._series.length) {
@@ -75338,10 +76908,12 @@ class BaseChart extends CompilableBase {
75338
76908
  });
75339
76909
  (_d = (_c = this._option.performanceHook) === null || _c === void 0 ? void 0 : _c.afterComponentCompile) === null || _d === void 0 ? void 0 : _d.call(_c, this._option.globalInstance);
75340
76910
  }
75341
- release() {
75342
- [...this._components, ...this._regions, ...this._series].forEach(m => {
75343
- m.beforeRelease();
75344
- });
76911
+ release(forceReleaseVRenderComponents = true) {
76912
+ if (forceReleaseVRenderComponents) {
76913
+ [...this._components, ...this._regions, ...this._series].forEach(m => {
76914
+ m.beforeRelease();
76915
+ });
76916
+ }
75345
76917
  super.release();
75346
76918
  this.clear();
75347
76919
  [...this._components, ...this._regions, ...this._series].forEach(m => {
@@ -75600,8 +77172,18 @@ const getRelatedSeriesInfo = (modelInfo, currentChartSpecInfo) => {
75600
77172
  return undefined;
75601
77173
  };
75602
77174
 
77175
+ const DEFAULT_SERIES_RELATED_CHART_SPEC_KEYS = {
77176
+ series: true,
77177
+ label: true,
77178
+ animationAppear: true,
77179
+ animationEnter: true,
77180
+ animationUpdate: true,
77181
+ animationExit: true,
77182
+ animationNormal: true
77183
+ };
75603
77184
  class BaseChartSpecTransformer {
75604
77185
  constructor(option) {
77186
+ this._seriesRelatedSpecKeys = Object.assign({}, DEFAULT_SERIES_RELATED_CHART_SPEC_KEYS);
75605
77187
  this._option = option;
75606
77188
  this.type = option.type;
75607
77189
  this.seriesType = option.seriesType;
@@ -75697,8 +77279,19 @@ class BaseChartSpecTransformer {
75697
77279
  _isValidSeries(seriesType) {
75698
77280
  return true;
75699
77281
  }
77282
+ getSeriesRelatedSpecKeys() {
77283
+ return this._seriesRelatedSpecKeys;
77284
+ }
77285
+ _addSeriesRelatedSpecKeys(...keysList) {
77286
+ keysList.forEach(keys => {
77287
+ keys === null || keys === void 0 ? void 0 : keys.forEach(key => {
77288
+ this._seriesRelatedSpecKeys[key] = true;
77289
+ });
77290
+ });
77291
+ }
75700
77292
  _getDefaultSeriesSpec(chartSpec, pickKeys, pickKeys2) {
75701
77293
  var _a, _b, _c, _d, _e;
77294
+ this._addSeriesRelatedSpecKeys(pickKeys, pickKeys2);
75702
77295
  const series = {
75703
77296
  dataKey: chartSpec.dataKey,
75704
77297
  hover: chartSpec.hover,
@@ -77184,6 +78777,10 @@ class AreaSeries extends CartesianSeries {
77184
78777
  this.transformerConstructor = AreaSeriesSpecTransformer;
77185
78778
  this._sortDataByAxis = false;
77186
78779
  }
78780
+ _getSpecUpdatePolicy() {
78781
+ const policy = super._getSpecUpdatePolicy();
78782
+ return Object.assign(Object.assign({}, policy), { dataRelatedKeys: Object.assign(Object.assign({}, policy.dataRelatedKeys), LINE_LIKE_SERIES_DATA_RELATED_KEYS) });
78783
+ }
77187
78784
  initMark() {
77188
78785
  var _a;
77189
78786
  const seriesMark = (_a = this._spec.seriesMark) !== null && _a !== void 0 ? _a : 'area';
@@ -77574,6 +79171,14 @@ const bar = {
77574
79171
  };
77575
79172
 
77576
79173
  const DefaultBandWidth$2 = 6;
79174
+ const BAR_SERIES_COMPILE_ONLY_KEYS = {
79175
+ barWidth: true,
79176
+ barMinWidth: true,
79177
+ barMaxWidth: true,
79178
+ barGapInGroup: true,
79179
+ barMinHeight: true,
79180
+ stackCornerRadius: true
79181
+ };
77577
79182
  class BarSeries extends CartesianSeries {
77578
79183
  constructor() {
77579
79184
  super(...arguments);
@@ -77675,6 +79280,10 @@ class BarSeries extends CartesianSeries {
77675
79280
  this._barBackgroundPositionYEncoder = encoder.bind(this);
77676
79281
  };
77677
79282
  }
79283
+ _getSpecUpdatePolicy() {
79284
+ const policy = super._getSpecUpdatePolicy();
79285
+ return Object.assign(Object.assign({}, policy), { compileOnlyKeys: Object.assign(Object.assign({}, policy.compileOnlyKeys), BAR_SERIES_COMPILE_ONLY_KEYS) });
79286
+ }
77678
79287
  initMark() {
77679
79288
  this._initBarBackgroundMark();
77680
79289
  this._barMark = this._createMark(Object.assign(Object.assign({}, BarSeries.mark.bar), { name: this._barMarkName, type: this._barMarkType }), {
@@ -77699,6 +79308,19 @@ class BarSeries extends CartesianSeries {
77699
79308
  fill: this.getColorAttribute()
77700
79309
  }, 'normal', AttributeLevel.Series);
77701
79310
  }
79311
+ this.initRectMarkStyle();
79312
+ }
79313
+ initRectMarkStyle() {
79314
+ var _a;
79315
+ if (!this._barMark) {
79316
+ return;
79317
+ }
79318
+ const bandAxisHelper = this.direction === "vertical" ? this._xAxisHelper : this._yAxisHelper;
79319
+ const scale = (_a = bandAxisHelper === null || bandAxisHelper === void 0 ? void 0 : bandAxisHelper.getScale) === null || _a === void 0 ? void 0 : _a.call(bandAxisHelper, 0);
79320
+ if (!scale) {
79321
+ return;
79322
+ }
79323
+ scale.type === 'band' ? this.initBandRectMarkStyle() : this.initLinearRectMarkStyle();
77702
79324
  }
77703
79325
  initLabelMarkStyle(textMark) {
77704
79326
  if (!textMark) {
@@ -77811,14 +79433,8 @@ class BarSeries extends CartesianSeries {
77811
79433
  this._barBackgroundViewData = new CompilableData(this._option, barBackgroundData);
77812
79434
  }
77813
79435
  init(option) {
77814
- var _a, _b;
77815
79436
  super.init(option);
77816
- if (this.direction === 'vertical') {
77817
- ((_a = this._xAxisHelper) === null || _a === void 0 ? void 0 : _a.getScale(0).type) === 'band' ? this.initBandRectMarkStyle() : this.initLinearRectMarkStyle();
77818
- }
77819
- else {
77820
- ((_b = this._yAxisHelper) === null || _b === void 0 ? void 0 : _b.getScale(0).type) === 'band' ? this.initBandRectMarkStyle() : this.initLinearRectMarkStyle();
77821
- }
79437
+ this.initRectMarkStyle();
77822
79438
  }
77823
79439
  _shouldDoPreCalculate() {
77824
79440
  const region = this.getRegion();
@@ -77941,6 +79557,13 @@ class BarSeries extends CartesianSeries {
77941
79557
  _initStackBarMarkStyle() {
77942
79558
  var _a, _b, _c, _d;
77943
79559
  if (!this._spec.stackCornerRadius) {
79560
+ const markConfig = this._barMark.getMarkConfig();
79561
+ if (markConfig.clip || !isNil$1(markConfig.clipPath)) {
79562
+ this._barMark.setMarkConfig({
79563
+ clip: false,
79564
+ clipPath: []
79565
+ });
79566
+ }
77944
79567
  return;
77945
79568
  }
77946
79569
  const xScale = (_b = (_a = this._xAxisHelper) === null || _a === void 0 ? void 0 : _a.getScale) === null || _b === void 0 ? void 0 : _b.call(_a, 0);
@@ -78370,6 +79993,9 @@ const scatter = {
78370
79993
  }
78371
79994
  };
78372
79995
 
79996
+ const SCATTER_SERIES_DATA_RELATED_KEYS = {
79997
+ sizeField: true
79998
+ };
78373
79999
  class ScatterSeries extends CartesianSeries {
78374
80000
  constructor() {
78375
80001
  super(...arguments);
@@ -78377,6 +80003,10 @@ class ScatterSeries extends CartesianSeries {
78377
80003
  this.transformerConstructor = ScatterSeriesSpecTransformer;
78378
80004
  this._invalidType = 'zero';
78379
80005
  }
80006
+ _getSpecUpdatePolicy() {
80007
+ const policy = super._getSpecUpdatePolicy();
80008
+ return Object.assign(Object.assign({}, policy), { dataRelatedKeys: Object.assign(Object.assign({}, policy.dataRelatedKeys), SCATTER_SERIES_DATA_RELATED_KEYS) });
80009
+ }
78380
80010
  setAttrFromSpec() {
78381
80011
  super.setAttrFromSpec();
78382
80012
  this._size = this._spec.size;
@@ -80831,6 +82461,9 @@ const waterfall = {
80831
82461
  }
80832
82462
  };
80833
82463
 
82464
+ const WATERFALL_SERIES_DATA_RELATED_KEYS = {
82465
+ calculationMode: true
82466
+ };
80834
82467
  class WaterfallSeries extends BarSeries {
80835
82468
  constructor() {
80836
82469
  super(...arguments);
@@ -80851,6 +82484,10 @@ class WaterfallSeries extends BarSeries {
80851
82484
  var _a;
80852
82485
  return (_a = this._totalData) === null || _a === void 0 ? void 0 : _a.getLatestData();
80853
82486
  }
82487
+ _getSpecUpdatePolicy() {
82488
+ const policy = super._getSpecUpdatePolicy();
82489
+ return Object.assign(Object.assign({}, policy), { dataRelatedKeys: Object.assign(Object.assign({}, policy.dataRelatedKeys), WATERFALL_SERIES_DATA_RELATED_KEYS) });
82490
+ }
80854
82491
  initGroups() {
80855
82492
  const groupFields = this.getGroupFields();
80856
82493
  if (groupFields && groupFields.length) {
@@ -81906,6 +83543,12 @@ const DEFAULT_SHAFT_SHAPE = 'line';
81906
83543
  const DEFAULT_FILL_COLOR = '#FFF';
81907
83544
  const DEFAULT_STROKE_COLOR = '#000';
81908
83545
  const DEFAULT_OUTLIER_SIZE = 10;
83546
+ const BOX_PLOT_SERIES_COMPILE_ONLY_KEYS = {
83547
+ boxWidth: true,
83548
+ boxMinWidth: true,
83549
+ boxMaxWidth: true,
83550
+ boxGapInGroup: true
83551
+ };
81909
83552
  class BoxPlotSeries extends CartesianSeries {
81910
83553
  constructor() {
81911
83554
  super(...arguments);
@@ -81943,6 +83586,10 @@ class BoxPlotSeries extends CartesianSeries {
81943
83586
  getOutliersStyle() {
81944
83587
  return this._outliersStyle;
81945
83588
  }
83589
+ _getSpecUpdatePolicy() {
83590
+ const policy = super._getSpecUpdatePolicy();
83591
+ return Object.assign(Object.assign({}, policy), { compileOnlyKeys: Object.assign(Object.assign({}, policy.compileOnlyKeys), BOX_PLOT_SERIES_COMPILE_ONLY_KEYS) });
83592
+ }
81946
83593
  setAttrFromSpec() {
81947
83594
  var _a, _b, _c, _d, _e, _f, _g;
81948
83595
  super.setAttrFromSpec();
@@ -82016,6 +83663,7 @@ class BoxPlotSeries extends CartesianSeries {
82016
83663
  size: isNumber$2((_f = this._outliersStyle) === null || _f === void 0 ? void 0 : _f.size) ? this._outliersStyle.size : DEFAULT_OUTLIER_SIZE
82017
83664
  }, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series);
82018
83665
  }
83666
+ this.initBoxPlotMarkStyle();
82019
83667
  }
82020
83668
  initBoxPlotMarkStyle() {
82021
83669
  var _a, _b;
@@ -83346,6 +84994,16 @@ const pie = {
83346
84994
  }
83347
84995
  };
83348
84996
 
84997
+ const PIE_SERIES_DATA_RELATED_KEYS = {
84998
+ valueField: true,
84999
+ angleField: true,
85000
+ startAngle: true,
85001
+ endAngle: true,
85002
+ minAngle: true
85003
+ };
85004
+ const PIE_SERIES_COMPILE_ONLY_KEYS = {
85005
+ outerRadius: true
85006
+ };
83349
85007
  class BasePieSeries extends PolarSeries {
83350
85008
  constructor() {
83351
85009
  super(...arguments);
@@ -83596,6 +85254,10 @@ class BasePieSeries extends PolarSeries {
83596
85254
  computeDatumRadius(datum, state) {
83597
85255
  return this._computeLayoutRadius() * this.getRadius(state) + this._centerOffset;
83598
85256
  }
85257
+ _getSpecUpdatePolicy() {
85258
+ const policy = super._getSpecUpdatePolicy();
85259
+ return Object.assign(Object.assign({}, policy), { compileOnlyKeys: Object.assign(Object.assign({}, policy.compileOnlyKeys), PIE_SERIES_COMPILE_ONLY_KEYS), dataRelatedKeys: Object.assign(Object.assign({}, policy.dataRelatedKeys), PIE_SERIES_DATA_RELATED_KEYS) });
85260
+ }
83599
85261
  _compareSpec(spec, prevSpec, ignoreCheckKeys) {
83600
85262
  ignoreCheckKeys = ignoreCheckKeys !== null && ignoreCheckKeys !== void 0 ? ignoreCheckKeys : { data: true };
83601
85263
  const defaultIgnoreKeys = [
@@ -85918,6 +87580,9 @@ const circularProgress = {
85918
87580
  }
85919
87581
  };
85920
87582
 
87583
+ const CIRCULAR_PROGRESS_SERIES_COMPILE_ONLY_KEYS = {
87584
+ cornerRadius: true
87585
+ };
85921
87586
  class CircularProgressSeries extends ProgressLikeSeries {
85922
87587
  constructor() {
85923
87588
  super(...arguments);
@@ -85947,6 +87612,10 @@ class CircularProgressSeries extends ProgressLikeSeries {
85947
87612
  this.radiusAxisHelper.getScale(0).step());
85948
87613
  };
85949
87614
  }
87615
+ _getSpecUpdatePolicy() {
87616
+ const policy = super._getSpecUpdatePolicy();
87617
+ return Object.assign(Object.assign({}, policy), { compileOnlyKeys: Object.assign(Object.assign({}, policy.compileOnlyKeys), CIRCULAR_PROGRESS_SERIES_COMPILE_ONLY_KEYS) });
87618
+ }
85950
87619
  getStackGroupFields() {
85951
87620
  return this.getGroupFields();
85952
87621
  }
@@ -86138,6 +87807,17 @@ const linearProgress = {
86138
87807
  }
86139
87808
  };
86140
87809
 
87810
+ const LINEAR_PROGRESS_SERIES_COMPILE_ONLY_KEYS = {
87811
+ bandWidth: true
87812
+ };
87813
+ const LINEAR_PROGRESS_SERIES_COMPILE_ONLY_SUB_KEYS = {
87814
+ progress: {
87815
+ topPadding: true,
87816
+ bottomPadding: true,
87817
+ leftPadding: true,
87818
+ rightPadding: true
87819
+ }
87820
+ };
86141
87821
  class LinearProgressSeries extends CartesianSeries {
86142
87822
  constructor() {
86143
87823
  super(...arguments);
@@ -86204,6 +87884,10 @@ class LinearProgressSeries extends CartesianSeries {
86204
87884
  return path;
86205
87885
  };
86206
87886
  }
87887
+ _getSpecUpdatePolicy() {
87888
+ const policy = super._getSpecUpdatePolicy();
87889
+ return Object.assign(Object.assign({}, policy), { compileOnlyKeys: Object.assign(Object.assign({}, policy.compileOnlyKeys), LINEAR_PROGRESS_SERIES_COMPILE_ONLY_KEYS), compileOnlySubKeys: Object.assign(Object.assign({}, policy.compileOnlySubKeys), LINEAR_PROGRESS_SERIES_COMPILE_ONLY_SUB_KEYS) });
87890
+ }
86207
87891
  initMark() {
86208
87892
  this._initTrackMark();
86209
87893
  this._initProgressMark();
@@ -96267,6 +97951,9 @@ const heatmap = {
96267
97951
  };
96268
97952
 
96269
97953
  const DefaultBandWidth = 6;
97954
+ const HEATMAP_SERIES_DATA_RELATED_KEYS = {
97955
+ valueField: true
97956
+ };
96270
97957
  class HeatmapSeries extends CartesianSeries {
96271
97958
  constructor() {
96272
97959
  super(...arguments);
@@ -96279,6 +97966,10 @@ class HeatmapSeries extends CartesianSeries {
96279
97966
  setFieldValue(f) {
96280
97967
  this._fieldValue = array(f);
96281
97968
  }
97969
+ _getSpecUpdatePolicy() {
97970
+ const policy = super._getSpecUpdatePolicy();
97971
+ return Object.assign(Object.assign({}, policy), { dataRelatedKeys: Object.assign(Object.assign({}, policy.dataRelatedKeys), HEATMAP_SERIES_DATA_RELATED_KEYS) });
97972
+ }
96282
97973
  setAttrFromSpec() {
96283
97974
  super.setAttrFromSpec();
96284
97975
  this.setFieldValue(this._spec.valueField);
@@ -98162,6 +99853,7 @@ class BasePieChartSpecTransformer extends PolarChartSpecTransformer {
98162
99853
  'useSequentialAnimation',
98163
99854
  'layoutRadius'
98164
99855
  ]);
99856
+ this._addSeriesRelatedSpecKeys(['valueField', 'angleField']);
98165
99857
  seriesSpec.categoryField = spec.categoryField || spec.seriesField;
98166
99858
  seriesSpec.valueField = spec.valueField || spec.angleField;
98167
99859
  seriesSpec.emptyCircle = (_a = spec.emptyPlaceholder) === null || _a === void 0 ? void 0 : _a.emptyCircle;
@@ -98866,6 +100558,7 @@ class CircularProgressChartSpecTransformer extends ProgressLikeChartSpecTransfor
98866
100558
  _getDefaultSeriesSpec(spec) {
98867
100559
  var _a, _b;
98868
100560
  const series = super._getDefaultSeriesSpec(spec);
100561
+ this._addSeriesRelatedSpecKeys(['cornerRadius']);
98869
100562
  series.progress = spec.progress;
98870
100563
  series.track = spec.track;
98871
100564
  series.tickMask = spec.tickMask;
@@ -99467,6 +101160,7 @@ class WaterfallChartSpecTransformer extends BarChartSpecTransformer {
99467
101160
  }
99468
101161
  _getDefaultSeriesSpec(spec) {
99469
101162
  const series = super._getDefaultSeriesSpec(spec);
101163
+ this._addSeriesRelatedSpecKeys(['bar', 'stackLabel', 'leaderLine', 'total', 'calculationMode']);
99470
101164
  series.bar = spec.bar;
99471
101165
  series.stackLabel = spec.stackLabel;
99472
101166
  series.leaderLine = spec.leaderLine;
@@ -99918,6 +101612,13 @@ const discreteLegendFilter = (data, op) => {
99918
101612
  return data;
99919
101613
  };
99920
101614
 
101615
+ const LEGEND_COMPONENT_ONLY_CHANGE_KEYS = {
101616
+ position: true,
101617
+ item: true,
101618
+ title: true,
101619
+ pager: true,
101620
+ background: true
101621
+ };
99921
101622
  class BaseLegend extends BaseComponent {
99922
101623
  constructor() {
99923
101624
  super(...arguments);
@@ -99983,15 +101684,31 @@ class BaseLegend extends BaseComponent {
99983
101684
  _compareSpec(spec, prevSpec) {
99984
101685
  const result = super._compareSpec(spec, prevSpec);
99985
101686
  result.reRender = true;
101687
+ const specChanged = !isEqual(prevSpec, spec);
101688
+ if (result.reMake) {
101689
+ return result;
101690
+ }
99986
101691
  if ((spec === null || spec === void 0 ? void 0 : spec.orient) !== (prevSpec === null || prevSpec === void 0 ? void 0 : prevSpec.orient)) {
99987
101692
  result.reMake = true;
99988
101693
  return result;
99989
101694
  }
99990
- if (!isEqual(prevSpec, spec)) {
101695
+ if (specChanged && !result.reCompile && this._isComponentOnlySpecChange(spec, prevSpec)) {
101696
+ result.effects = Object.assign(Object.assign({}, result.effects), { component: true, layout: true, render: true });
101697
+ return result;
101698
+ }
101699
+ if (specChanged) {
99991
101700
  result.reCompile = true;
99992
101701
  }
99993
101702
  return result;
99994
101703
  }
101704
+ _isComponentOnlySpecChange(spec, prevSpec) {
101705
+ const prevSpecRecord = prevSpec;
101706
+ const specRecord = spec;
101707
+ const keys = Object.keys(Object.assign(Object.assign({}, prevSpec), spec));
101708
+ return keys.every(key => {
101709
+ return isEqual(prevSpecRecord === null || prevSpecRecord === void 0 ? void 0 : prevSpecRecord[key], specRecord === null || specRecord === void 0 ? void 0 : specRecord[key]) || LEGEND_COMPONENT_ONLY_CHANGE_KEYS[key];
101710
+ });
101711
+ }
99995
101712
  _bindLegendDataChange() {
99996
101713
  this._preSelectedData = this._selectedData.slice();
99997
101714
  this._initSelectedData();
@@ -105733,10 +107450,72 @@ function markerFilter(data, options) {
105733
107450
  return data;
105734
107451
  }
105735
107452
 
107453
+ const getDataViewsInDataSet = (dataView) => {
107454
+ var _a;
107455
+ const dataViewMap = (_a = dataView === null || dataView === void 0 ? void 0 : dataView.dataSet) === null || _a === void 0 ? void 0 : _a.dataViewMap;
107456
+ return dataViewMap ? Object.values(dataViewMap).filter(Boolean) : [];
107457
+ };
107458
+ const detachDataViewListener = (source, target) => {
107459
+ var _a, _b;
107460
+ (_a = source === null || source === void 0 ? void 0 : source.target) === null || _a === void 0 ? void 0 : _a.removeListener('change', target.reRunAllTransform);
107461
+ (_b = source === null || source === void 0 ? void 0 : source.target) === null || _b === void 0 ? void 0 : _b.removeListener('markRunning', target.markRunning);
107462
+ };
107463
+ const detachDataViewDependencies = (dataView) => {
107464
+ if (!dataView) {
107465
+ return;
107466
+ }
107467
+ const dataViews = getDataViewsInDataSet(dataView);
107468
+ dataViews.forEach(source => {
107469
+ detachDataViewListener(source, dataView);
107470
+ });
107471
+ const dependencies = dataView === null || dataView === void 0 ? void 0 : dataView.rawData;
107472
+ if (Array.isArray(dependencies)) {
107473
+ dependencies.forEach(dependency => {
107474
+ detachDataViewListener(dependency, dataView);
107475
+ });
107476
+ }
107477
+ };
107478
+ const releaseDataViews = (dataViews) => {
107479
+ const releaseDataViews = Array.from(new Set(dataViews.filter(Boolean)));
107480
+ if (!releaseDataViews.length) {
107481
+ return;
107482
+ }
107483
+ releaseDataViews.forEach(detachDataViewDependencies);
107484
+ releaseDataViews.forEach(dataView => {
107485
+ var _a;
107486
+ (_a = dataView.destroy) === null || _a === void 0 ? void 0 : _a.call(dataView);
107487
+ });
107488
+ };
107489
+ const releaseDataViewWithDependencies = (dataView, shouldReleaseDependency) => {
107490
+ if (!dataView) {
107491
+ return;
107492
+ }
107493
+ const dataViewsInDataSet = new Set(getDataViewsInDataSet(dataView));
107494
+ const releaseDependencies = [];
107495
+ const collectReleaseDependencies = (currentDataView) => {
107496
+ const dependencies = currentDataView === null || currentDataView === void 0 ? void 0 : currentDataView.rawData;
107497
+ if (!Array.isArray(dependencies)) {
107498
+ return;
107499
+ }
107500
+ dependencies.forEach(dependency => {
107501
+ if (dataViewsInDataSet.has(dependency) &&
107502
+ shouldReleaseDependency(dependency) &&
107503
+ !releaseDependencies.includes(dependency)) {
107504
+ releaseDependencies.push(dependency);
107505
+ collectReleaseDependencies(dependency);
107506
+ }
107507
+ });
107508
+ };
107509
+ collectReleaseDependencies(dataView);
107510
+ releaseDataViews([dataView, ...releaseDependencies]);
107511
+ };
107512
+
105736
107513
  class BaseMarker extends BaseComponent {
105737
107514
  constructor() {
105738
107515
  super(...arguments);
105739
107516
  this.layoutType = 'none';
107517
+ this._markerDataChangeHandler = null;
107518
+ this._markerDataOwned = false;
105740
107519
  this._layoutOffsetX = 0;
105741
107520
  this._layoutOffsetY = 0;
105742
107521
  }
@@ -105816,6 +107595,33 @@ class BaseMarker extends BaseComponent {
105816
107595
  }
105817
107596
  return this._relativeSeries.getViewData();
105818
107597
  }
107598
+ _setMarkerData(data, owned = false) {
107599
+ this._releaseMarkerData();
107600
+ this._markerData = data;
107601
+ this._markerDataOwned = owned;
107602
+ }
107603
+ _bindMarkerDataChange() {
107604
+ var _a;
107605
+ if (!((_a = this._markerData) === null || _a === void 0 ? void 0 : _a.target)) {
107606
+ return;
107607
+ }
107608
+ this._markerDataChangeHandler = () => {
107609
+ this._markerLayout();
107610
+ };
107611
+ this._markerData.target.on('change', this._markerDataChangeHandler);
107612
+ }
107613
+ _releaseMarkerData() {
107614
+ const markerData = this._markerData;
107615
+ if ((markerData === null || markerData === void 0 ? void 0 : markerData.target) && this._markerDataChangeHandler) {
107616
+ markerData.target.removeListener('change', this._markerDataChangeHandler);
107617
+ }
107618
+ this._markerDataChangeHandler = null;
107619
+ if (this._markerDataOwned) {
107620
+ releaseDataViewWithDependencies(markerData, dataView => dataView.name === `${this.type}_${this.id}_data`);
107621
+ }
107622
+ this._markerData = null;
107623
+ this._markerDataOwned = false;
107624
+ }
105819
107625
  updateLayoutAttribute() {
105820
107626
  var _a, _b, _c;
105821
107627
  const markerVisible = (_a = this._spec.visible) !== null && _a !== void 0 ? _a : true;
@@ -105867,8 +107673,13 @@ class BaseMarker extends BaseComponent {
105867
107673
  }
105868
107674
  clear() {
105869
107675
  super.clear();
107676
+ this._markerComponent = null;
105870
107677
  this._firstSeries = null;
105871
107678
  }
107679
+ release() {
107680
+ this._releaseMarkerData();
107681
+ super.release();
107682
+ }
105872
107683
  _getFirstSeries() {
105873
107684
  var _a;
105874
107685
  if (this._firstSeries) {
@@ -105920,10 +107731,8 @@ class BaseMarker extends BaseComponent {
105920
107731
  type: 'markerFilter',
105921
107732
  options: this._getAllRelativeSeries()
105922
107733
  });
105923
- data.target.on('change', () => {
105924
- this._markerLayout();
105925
- });
105926
- this._markerData = data;
107734
+ this._setMarkerData(data, true);
107735
+ this._bindMarkerDataChange();
105927
107736
  }
105928
107737
  }
105929
107738
 
@@ -106054,7 +107863,7 @@ class BaseMarkLine extends BaseMarker {
106054
107863
  const spec = this._spec;
106055
107864
  const isCoordinateProcess = 'coordinates' in spec;
106056
107865
  const { doXProcess, doYProcess, doXYY1Process, doYXX1Process, doXYProcess, doAngleProcess, doRadiusProcess, doAngRadRad1Process, doRadAngAng1Process, doRadAngProcess } = getMarkLineProcessInfo(spec);
106057
- this._markerData = this._getRelativeDataView();
107866
+ this._setMarkerData(this._getRelativeDataView());
106058
107867
  if (!doXProcess &&
106059
107868
  !doYProcess &&
106060
107869
  !doXYY1Process &&
@@ -106092,10 +107901,8 @@ class BaseMarkLine extends BaseMarker {
106092
107901
  type: 'markerFilter',
106093
107902
  options: this._getAllRelativeSeries()
106094
107903
  });
106095
- data.target.on('change', () => {
106096
- this._markerLayout();
106097
- });
106098
- this._markerData = data;
107904
+ this._setMarkerData(data, true);
107905
+ this._bindMarkerDataChange();
106099
107906
  }
106100
107907
  }
106101
107908
  BaseMarkLine.specKey = 'markLine';
@@ -106545,11 +108352,15 @@ class Title extends BaseComponent {
106545
108352
  }
106546
108353
  _compareSpec(spec, prevSpec) {
106547
108354
  const result = super._compareSpec(spec, prevSpec);
108355
+ const specChanged = !isEqual(prevSpec, spec);
106548
108356
  if ((prevSpec === null || prevSpec === void 0 ? void 0 : prevSpec.orient) !== (spec === null || spec === void 0 ? void 0 : spec.orient) || (prevSpec === null || prevSpec === void 0 ? void 0 : prevSpec.visible) !== spec.visible) {
106549
108357
  result.reMake = true;
106550
108358
  }
106551
108359
  result.change = true;
106552
108360
  result.reRender = true;
108361
+ if (specChanged && !result.reMake) {
108362
+ result.effects = Object.assign(Object.assign({}, result.effects), { component: true, layout: true, render: true });
108363
+ }
106553
108364
  return result;
106554
108365
  }
106555
108366
  afterSetLayoutStartPoint(pos) {
@@ -107714,7 +109525,9 @@ class Label extends BaseLabelComponent {
107714
109525
  Object.keys(removedComponents).forEach(name => {
107715
109526
  const comp = removedComponents[name];
107716
109527
  if (comp) {
107717
- comp.release();
109528
+ if (!comp.releaseWithExitAnimation()) {
109529
+ comp.release();
109530
+ }
107718
109531
  this._labelComponentMap.delete(comp);
107719
109532
  }
107720
109533
  });
@@ -108399,6 +110212,10 @@ class Brush extends BaseComponent {
108399
110212
  });
108400
110213
  });
108401
110214
  }
110215
+ reInit(spec) {
110216
+ super.reInit(spec);
110217
+ this.init();
110218
+ }
108402
110219
  _initNeedOperatedItem() {
108403
110220
  const seriesUserId = this._spec.seriesId;
108404
110221
  const seriesIndex = this._spec.seriesIndex;