@visactor/vchart 2.1.0-alpha.1 → 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 (268) hide show
  1. package/build/es5/index.js +3 -3
  2. package/build/index.es.js +2232 -487
  3. package/build/index.js +2232 -487
  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/index.js +1 -1
  13. package/cjs/chart/interface/chart.d.ts +1 -0
  14. package/cjs/chart/interface/chart.js.map +1 -1
  15. package/cjs/chart/pie/base/pie-transformer.js +2 -2
  16. package/cjs/chart/pie/base/pie-transformer.js.map +1 -1
  17. package/cjs/chart/progress/circular/circular-progress-transformer.js +2 -2
  18. package/cjs/chart/progress/circular/circular-progress-transformer.js.map +1 -1
  19. package/cjs/chart/stack.js +1 -1
  20. package/cjs/chart/util.d.ts +4 -1
  21. package/cjs/chart/util.js +41 -5
  22. package/cjs/chart/util.js.map +1 -1
  23. package/cjs/chart/waterfall/waterfall-transformer.js +2 -1
  24. package/cjs/chart/waterfall/waterfall-transformer.js.map +1 -1
  25. package/cjs/compile/compiler.js +2 -2
  26. package/cjs/compile/compiler.js.map +1 -1
  27. package/cjs/compile/data/compilable-data.d.ts +1 -1
  28. package/cjs/compile/data/compilable-data.js +1 -1
  29. package/cjs/compile/data/compilable-data.js.map +1 -1
  30. package/cjs/compile/grammar-item.d.ts +1 -1
  31. package/cjs/compile/grammar-item.js.map +1 -1
  32. package/cjs/compile/interface/compilable-item.d.ts +1 -1
  33. package/cjs/compile/interface/compilable-item.js.map +1 -1
  34. package/cjs/component/axis/base-axis.d.ts +2 -7
  35. package/cjs/component/axis/base-axis.js +25 -3
  36. package/cjs/component/axis/base-axis.js.map +1 -1
  37. package/cjs/component/axis/cartesian/band-axis.d.ts +1 -7
  38. package/cjs/component/base/base-component.d.ts +7 -7
  39. package/cjs/component/base/base-component.js +41 -6
  40. package/cjs/component/base/base-component.js.map +1 -1
  41. package/cjs/component/base/release-vrender-component.d.ts +10 -0
  42. package/cjs/component/base/release-vrender-component.js +37 -0
  43. package/cjs/component/base/release-vrender-component.js.map +1 -0
  44. package/cjs/component/brush/brush.d.ts +2 -7
  45. package/cjs/component/brush/brush.js +3 -0
  46. package/cjs/component/brush/brush.js.map +1 -1
  47. package/cjs/component/crosshair/base.d.ts +1 -7
  48. package/cjs/component/custom-mark/custom-mark.d.ts +1 -7
  49. package/cjs/component/data-zoom/data-filter-base-component.d.ts +1 -7
  50. package/cjs/component/geo/geo-coordinate.d.ts +1 -7
  51. package/cjs/component/index.js +1 -2
  52. package/cjs/component/label/base-label.d.ts +1 -7
  53. package/cjs/component/label/label.js +1 -1
  54. package/cjs/component/label/label.js.map +1 -1
  55. package/cjs/component/legend/base-legend.d.ts +2 -7
  56. package/cjs/component/legend/base-legend.js +20 -3
  57. package/cjs/component/legend/base-legend.js.map +1 -1
  58. package/cjs/component/marker/base-marker.d.ts +7 -7
  59. package/cjs/component/marker/base-marker.js +23 -6
  60. package/cjs/component/marker/base-marker.js.map +1 -1
  61. package/cjs/component/marker/mark-line/base-mark-line.js +2 -4
  62. package/cjs/component/marker/mark-line/base-mark-line.js.map +1 -1
  63. package/cjs/component/title/title.d.ts +1 -7
  64. package/cjs/component/title/title.js +6 -2
  65. package/cjs/component/title/title.js.map +1 -1
  66. package/cjs/component/util.js +1 -1
  67. package/cjs/constant/box-plot.js +2 -1
  68. package/cjs/constant/scatter.js +1 -2
  69. package/cjs/core/expression-function.js +2 -1
  70. package/cjs/core/instance-manager.js +1 -1
  71. package/cjs/core/interface.js +1 -1
  72. package/cjs/core/util.js +1 -1
  73. package/cjs/core/vchart.d.ts +5 -1
  74. package/cjs/core/vchart.js +29 -13
  75. package/cjs/core/vchart.js.map +1 -1
  76. package/cjs/data/data-view-utils.d.ts +5 -0
  77. package/cjs/data/data-view-utils.js +58 -0
  78. package/cjs/data/data-view-utils.js.map +1 -0
  79. package/cjs/data/initialize.js +1 -1
  80. package/cjs/mark/base/base-mark.d.ts +12 -2
  81. package/cjs/mark/base/base-mark.js +85 -21
  82. package/cjs/mark/base/base-mark.js.map +1 -1
  83. package/cjs/mark/component.d.ts +9 -0
  84. package/cjs/mark/component.js +51 -3
  85. package/cjs/mark/component.js.map +1 -1
  86. package/cjs/mark/group.js +1 -1
  87. package/cjs/mark/group.js.map +1 -1
  88. package/cjs/mark/interface/mark.d.ts +2 -0
  89. package/cjs/mark/interface/mark.js.map +1 -1
  90. package/cjs/model/base-model.d.ts +3 -15
  91. package/cjs/model/base-model.js.map +1 -1
  92. package/cjs/model/interface.d.ts +13 -0
  93. package/cjs/model/interface.js.map +1 -1
  94. package/cjs/region/region.d.ts +1 -7
  95. package/cjs/series/area/area.d.ts +2 -0
  96. package/cjs/series/area/area.js +6 -0
  97. package/cjs/series/area/area.js.map +1 -1
  98. package/cjs/series/bar/bar.d.ts +3 -0
  99. package/cjs/series/bar/bar.js +30 -4
  100. package/cjs/series/bar/bar.js.map +1 -1
  101. package/cjs/series/base/base-series.d.ts +8 -7
  102. package/cjs/series/base/base-series.js +54 -13
  103. package/cjs/series/base/base-series.js.map +1 -1
  104. package/cjs/series/base/constant.d.ts +3 -0
  105. package/cjs/series/base/constant.js +9 -1
  106. package/cjs/series/base/constant.js.map +1 -1
  107. package/cjs/series/box-plot/box-plot.d.ts +2 -0
  108. package/cjs/series/box-plot/box-plot.js +14 -2
  109. package/cjs/series/box-plot/box-plot.js.map +1 -1
  110. package/cjs/series/heatmap/heatmap.d.ts +2 -0
  111. package/cjs/series/heatmap/heatmap.js +10 -0
  112. package/cjs/series/heatmap/heatmap.js.map +1 -1
  113. package/cjs/series/line/line.d.ts +2 -0
  114. package/cjs/series/line/line.js +6 -0
  115. package/cjs/series/line/line.js.map +1 -1
  116. package/cjs/series/mixin/line-mixin.d.ts +1 -0
  117. package/cjs/series/mixin/line-mixin.js +6 -1
  118. package/cjs/series/mixin/line-mixin.js.map +1 -1
  119. package/cjs/series/pie/pie.d.ts +3 -7
  120. package/cjs/series/pie/pie.js +16 -1
  121. package/cjs/series/pie/pie.js.map +1 -1
  122. package/cjs/series/progress/circular/circular.d.ts +2 -0
  123. package/cjs/series/progress/circular/circular.js +9 -1
  124. package/cjs/series/progress/circular/circular.js.map +1 -1
  125. package/cjs/series/progress/linear/linear.d.ts +2 -0
  126. package/cjs/series/progress/linear/linear.js +17 -1
  127. package/cjs/series/progress/linear/linear.js.map +1 -1
  128. package/cjs/series/scatter/scatter.d.ts +2 -0
  129. package/cjs/series/scatter/scatter.js +9 -1
  130. package/cjs/series/scatter/scatter.js.map +1 -1
  131. package/cjs/series/waterfall/waterfall.d.ts +2 -0
  132. package/cjs/series/waterfall/waterfall.js +10 -0
  133. package/cjs/series/waterfall/waterfall.js.map +1 -1
  134. package/cjs/util/graphic-state.d.ts +1 -0
  135. package/cjs/util/graphic-state.js +19 -4
  136. package/cjs/util/graphic-state.js.map +1 -1
  137. package/esm/chart/base/base-chart-transformer.d.ts +3 -0
  138. package/esm/chart/base/base-chart-transformer.js +22 -0
  139. package/esm/chart/base/base-chart-transformer.js.map +1 -1
  140. package/esm/chart/base/base-chart.d.ts +15 -9
  141. package/esm/chart/base/base-chart.js +111 -23
  142. package/esm/chart/base/base-chart.js.map +1 -1
  143. package/esm/chart/index.js +1 -1
  144. package/esm/chart/interface/chart.d.ts +1 -0
  145. package/esm/chart/interface/chart.js.map +1 -1
  146. package/esm/chart/pie/base/pie-transformer.js +2 -2
  147. package/esm/chart/pie/base/pie-transformer.js.map +1 -1
  148. package/esm/chart/progress/circular/circular-progress-transformer.js +2 -2
  149. package/esm/chart/progress/circular/circular-progress-transformer.js.map +1 -1
  150. package/esm/chart/stack.js +1 -1
  151. package/esm/chart/util.d.ts +4 -1
  152. package/esm/chart/util.js +35 -2
  153. package/esm/chart/util.js.map +1 -1
  154. package/esm/chart/waterfall/waterfall-transformer.js +2 -1
  155. package/esm/chart/waterfall/waterfall-transformer.js.map +1 -1
  156. package/esm/compile/compiler.js +2 -2
  157. package/esm/compile/compiler.js.map +1 -1
  158. package/esm/compile/data/compilable-data.d.ts +1 -1
  159. package/esm/compile/data/compilable-data.js +1 -1
  160. package/esm/compile/data/compilable-data.js.map +1 -1
  161. package/esm/compile/grammar-item.d.ts +1 -1
  162. package/esm/compile/grammar-item.js.map +1 -1
  163. package/esm/compile/interface/compilable-item.d.ts +1 -1
  164. package/esm/compile/interface/compilable-item.js.map +1 -1
  165. package/esm/component/axis/base-axis.d.ts +2 -7
  166. package/esm/component/axis/base-axis.js +25 -2
  167. package/esm/component/axis/base-axis.js.map +1 -1
  168. package/esm/component/axis/cartesian/band-axis.d.ts +1 -7
  169. package/esm/component/base/base-component.d.ts +7 -7
  170. package/esm/component/base/base-component.js +41 -5
  171. package/esm/component/base/base-component.js.map +1 -1
  172. package/esm/component/base/release-vrender-component.d.ts +10 -0
  173. package/esm/component/base/release-vrender-component.js +24 -0
  174. package/esm/component/base/release-vrender-component.js.map +1 -0
  175. package/esm/component/brush/brush.d.ts +2 -7
  176. package/esm/component/brush/brush.js +3 -0
  177. package/esm/component/brush/brush.js.map +1 -1
  178. package/esm/component/crosshair/base.d.ts +1 -7
  179. package/esm/component/custom-mark/custom-mark.d.ts +1 -7
  180. package/esm/component/data-zoom/data-filter-base-component.d.ts +1 -7
  181. package/esm/component/geo/geo-coordinate.d.ts +1 -7
  182. package/esm/component/index.js +1 -2
  183. package/esm/component/label/base-label.d.ts +1 -7
  184. package/esm/component/label/label.js +1 -1
  185. package/esm/component/label/label.js.map +1 -1
  186. package/esm/component/legend/base-legend.d.ts +2 -7
  187. package/esm/component/legend/base-legend.js +20 -2
  188. package/esm/component/legend/base-legend.js.map +1 -1
  189. package/esm/component/marker/base-marker.d.ts +7 -7
  190. package/esm/component/marker/base-marker.js +24 -5
  191. package/esm/component/marker/base-marker.js.map +1 -1
  192. package/esm/component/marker/mark-line/base-mark-line.js +2 -4
  193. package/esm/component/marker/mark-line/base-mark-line.js.map +1 -1
  194. package/esm/component/title/title.d.ts +1 -7
  195. package/esm/component/title/title.js +6 -2
  196. package/esm/component/title/title.js.map +1 -1
  197. package/esm/component/util.js +1 -1
  198. package/esm/constant/box-plot.js +2 -1
  199. package/esm/constant/scatter.js +1 -2
  200. package/esm/core/expression-function.js +2 -1
  201. package/esm/core/instance-manager.js +1 -1
  202. package/esm/core/interface.js +1 -1
  203. package/esm/core/util.js +1 -1
  204. package/esm/core/vchart.d.ts +5 -1
  205. package/esm/core/vchart.js +30 -13
  206. package/esm/core/vchart.js.map +1 -1
  207. package/esm/data/data-view-utils.d.ts +5 -0
  208. package/esm/data/data-view-utils.js +46 -0
  209. package/esm/data/data-view-utils.js.map +1 -0
  210. package/esm/data/initialize.js +1 -1
  211. package/esm/mark/base/base-mark.d.ts +12 -2
  212. package/esm/mark/base/base-mark.js +85 -20
  213. package/esm/mark/base/base-mark.js.map +1 -1
  214. package/esm/mark/component.d.ts +9 -0
  215. package/esm/mark/component.js +51 -2
  216. package/esm/mark/component.js.map +1 -1
  217. package/esm/mark/group.js +1 -1
  218. package/esm/mark/group.js.map +1 -1
  219. package/esm/mark/interface/mark.d.ts +2 -0
  220. package/esm/mark/interface/mark.js.map +1 -1
  221. package/esm/model/base-model.d.ts +3 -15
  222. package/esm/model/base-model.js.map +1 -1
  223. package/esm/model/interface.d.ts +13 -0
  224. package/esm/model/interface.js.map +1 -1
  225. package/esm/region/region.d.ts +1 -7
  226. package/esm/series/area/area.d.ts +2 -0
  227. package/esm/series/area/area.js +7 -1
  228. package/esm/series/area/area.js.map +1 -1
  229. package/esm/series/bar/bar.d.ts +3 -0
  230. package/esm/series/bar/bar.js +30 -4
  231. package/esm/series/bar/bar.js.map +1 -1
  232. package/esm/series/base/base-series.d.ts +8 -7
  233. package/esm/series/base/base-series.js +50 -11
  234. package/esm/series/base/base-series.js.map +1 -1
  235. package/esm/series/base/constant.d.ts +3 -0
  236. package/esm/series/base/constant.js +10 -0
  237. package/esm/series/base/constant.js.map +1 -1
  238. package/esm/series/box-plot/box-plot.d.ts +2 -0
  239. package/esm/series/box-plot/box-plot.js +13 -2
  240. package/esm/series/box-plot/box-plot.js.map +1 -1
  241. package/esm/series/heatmap/heatmap.d.ts +2 -0
  242. package/esm/series/heatmap/heatmap.js +10 -0
  243. package/esm/series/heatmap/heatmap.js.map +1 -1
  244. package/esm/series/line/line.d.ts +2 -0
  245. package/esm/series/line/line.js +7 -1
  246. package/esm/series/line/line.js.map +1 -1
  247. package/esm/series/mixin/line-mixin.d.ts +1 -0
  248. package/esm/series/mixin/line-mixin.js +5 -0
  249. package/esm/series/mixin/line-mixin.js.map +1 -1
  250. package/esm/series/pie/pie.d.ts +3 -7
  251. package/esm/series/pie/pie.js +17 -0
  252. package/esm/series/pie/pie.js.map +1 -1
  253. package/esm/series/progress/circular/circular.d.ts +2 -0
  254. package/esm/series/progress/circular/circular.js +10 -0
  255. package/esm/series/progress/circular/circular.js.map +1 -1
  256. package/esm/series/progress/linear/linear.d.ts +2 -0
  257. package/esm/series/progress/linear/linear.js +18 -0
  258. package/esm/series/progress/linear/linear.js.map +1 -1
  259. package/esm/series/scatter/scatter.d.ts +2 -0
  260. package/esm/series/scatter/scatter.js +10 -0
  261. package/esm/series/scatter/scatter.js.map +1 -1
  262. package/esm/series/waterfall/waterfall.d.ts +2 -0
  263. package/esm/series/waterfall/waterfall.js +10 -0
  264. package/esm/series/waterfall/waterfall.js.map +1 -1
  265. package/esm/util/graphic-state.d.ts +1 -0
  266. package/esm/util/graphic-state.js +16 -3
  267. package/esm/util/graphic-state.js.map +1 -1
  268. package/package.json +9 -8
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
41025
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
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,20 +43943,20 @@ 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);
@@ -43355,52 +43971,51 @@ const clipPathGeometryAttrs = {
43355
43971
  width: !0,
43356
43972
  height: !0
43357
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
+ }
43358
43984
  class Update extends ACustomAnimate {
43359
43985
  constructor(from, to, duration, easing, params) {
43360
- super(from, to, duration, easing, params), this.clipPathSyncKeys = null, this.clipPathSyncParent = null, this.clipPathSyncChildIndex = -1, this.clipPathSyncDisabled = !1;
43986
+ super(from, to, duration, easing, params), this.updateFromAttrs = null, this.clipPathSyncKeys = null, this.clipPathSyncParent = null, this.clipPathSyncChildIndex = -1, this.clipPathSyncDisabled = !1;
43361
43987
  }
43362
43988
  onBind() {
43363
- var _a, _b;
43989
+ var _a;
43364
43990
  super.onBind();
43991
+ const targetContext = null !== (_a = this.target.context) && void 0 !== _a ? _a : {};
43365
43992
  let {
43366
43993
  diffAttrs = {}
43367
- } = null !== (_a = this.target.context) && void 0 !== _a ? _a : {};
43994
+ } = targetContext;
43368
43995
  const {
43369
43996
  options: options
43370
43997
  } = this.params;
43371
- diffAttrs = Object.assign({}, diffAttrs), (null === (_b = null == options ? void 0 : options.excludeChannels) || void 0 === _b ? void 0 : _b.length) && options.excludeChannels.forEach(channel => {
43372
- delete diffAttrs[channel];
43373
- }), this.props = diffAttrs, this.clipPathSyncKeys = Object.keys(diffAttrs).filter(key => clipPathGeometryAttrs[key]), this.clipPathSyncDisabled = !this.clipPathSyncKeys.length, this.syncParentClipPathToTarget();
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();
43374
44001
  }
43375
- getStaticCommitAttrs() {
43376
- var _a;
43377
- if (!this.props) return null;
43378
- const target = this.target,
43379
- contextFinalAttrs = null === (_a = target.context) || void 0 === _a ? void 0 : _a.finalAttrs,
43380
- finalAttribute = "function" == typeof target.getFinalAttribute ? target.getFinalAttribute() : target.finalAttribute,
43381
- commitAttrs = {};
43382
- return Object.keys(this.props).forEach(key => {
43383
- contextFinalAttrs && Object.prototype.hasOwnProperty.call(contextFinalAttrs, key) ? commitAttrs[key] = contextFinalAttrs[key] : finalAttribute && Object.prototype.hasOwnProperty.call(finalAttribute, key) ? commitAttrs[key] = finalAttribute[key] : this.animate.validAttr(key) && (commitAttrs[key] = this.props[key]);
43384
- }), Object.keys(commitAttrs).length ? commitAttrs : null;
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
+ });
43385
44007
  }
43386
44008
  onEnd(cb) {
43387
- if (cb) return void super.onEnd(cb);
43388
- const commitAttrs = this.getStaticCommitAttrs();
43389
- commitAttrs && this.target.setAttributes(commitAttrs, !1, {
43390
- type: AttributeUpdateType.ANIMATE_END
43391
- }), this.syncParentClipPathToTarget(), 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());
43392
44011
  }
43393
44012
  update(end, ratio, out) {
43394
44013
  if (this.onStart(), !this.props || !this.propKeys) return;
43395
44014
  const easedRatio = this.easing(ratio);
43396
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
43397
- if (!this.animate.validAttr(this.propKeys[index])) return;
43398
- const key = this.propKeys[index];
43399
- func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
43400
- }), this.syncParentClipPathToTarget(), this.onUpdate(end, easedRatio, out);
44015
+ this.runInterpolateUpdate(this.fromProps, this.props, easedRatio), this.syncParentClipPathToTarget(), this.onUpdate(end, easedRatio, out);
43401
44016
  }
43402
44017
  syncParentClipPathToTarget() {
43403
- var _a, _b;
44018
+ var _a, _b, _c, _d;
43404
44019
  if (this.clipPathSyncDisabled) return;
43405
44020
  const target = this.target,
43406
44021
  parent = target.parent,
@@ -43411,7 +44026,7 @@ class Update extends ACustomAnimate {
43411
44026
  const clipGraphic = path[childIndex];
43412
44027
  if (!(null == clipGraphic ? void 0 : clipGraphic.attribute) || clipGraphic.type !== target.type || !this.isClipPathStaticTarget(clipGraphic)) return;
43413
44028
  const syncAttrs = this.buildClipPathTransientAttrs(clipGraphic);
43414
- syncAttrs && applyAnimationTransientAttributes(clipGraphic, syncAttrs, AttributeUpdateType.ANIMATE_UPDATE);
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));
43415
44030
  }
43416
44031
  getClipPathSyncChildIndex(parent) {
43417
44032
  var _a;
@@ -43555,10 +44170,10 @@ class MoveBase extends ACustomAnimate {
43555
44170
  super(from, to, duration, easing, params);
43556
44171
  }
43557
44172
  onUpdate(end, ratio, out) {
43558
- const attribute = this.target.attribute;
44173
+ const attrs = {};
43559
44174
  this.propKeys.forEach(key => {
43560
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
43561
- }), 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();
43562
44177
  }
43563
44178
  }
43564
44179
  class MoveIn extends MoveBase {
@@ -43614,10 +44229,10 @@ class RotateBase extends ACustomAnimate {
43614
44229
  super(from, to, duration, easing, params);
43615
44230
  }
43616
44231
  onUpdate(end, ratio, out) {
43617
- const attribute = this.target.attribute;
44232
+ const attrs = {};
43618
44233
  this.propKeys.forEach(key => {
43619
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
43620
- }), 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();
43621
44236
  }
43622
44237
  }
43623
44238
  class RotateIn extends RotateBase {
@@ -43660,7 +44275,7 @@ class MotionPath extends ACustomAnimate {
43660
44275
  pos: pos,
43661
44276
  angle: angle
43662
44277
  } = this.path.getAttrAt(at);
43663
- 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());
43664
44279
  }
43665
44280
  }
43666
44281
 
@@ -45179,7 +45794,10 @@ class AxisUpdate extends AComponentAnimate {
45179
45794
  }), this.completeBind(animator);
45180
45795
  }
45181
45796
  deleteSelfAttr(key) {
45182
- super.deleteSelfAttr(key), this._animator.deleteSelfAttr(key);
45797
+ this.deleteSelfAttrs([key]);
45798
+ }
45799
+ deleteSelfAttrs(keys) {
45800
+ super.deleteSelfAttrs(keys), this._animator.deleteSelfAttrs(keys);
45183
45801
  }
45184
45802
  tryPreventConflict() {}
45185
45803
  }
@@ -45725,8 +46343,8 @@ class LineAxis extends AxisBase {
45725
46343
  const orient = this.attribute.orient;
45726
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;
45727
46345
  }
45728
- release() {
45729
- super.release(), this._breaks = null;
46346
+ release(all) {
46347
+ super.release(all), this._breaks = null;
45730
46348
  }
45731
46349
  }
45732
46350
  LineAxis.defaultAttributes = DEFAULT_AXIS_THEME, mixin(LineAxis, LineAxisMixin);
@@ -48099,6 +48717,14 @@ var __rest$8 = undefined && undefined.__rest || function (s, e) {
48099
48717
  }
48100
48718
  return t;
48101
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
+ }
48102
48728
  loadLabelComponent();
48103
48729
  class LabelBase extends AnimateComponent {
48104
48730
  setBitmap(bitmap) {
@@ -48163,11 +48789,56 @@ class LabelBase extends AnimateComponent {
48163
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;
48164
48790
  }
48165
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
+ }
48166
48836
  render() {
48837
+ if (this._exitReleaseState) return;
48167
48838
  if (this._prepare(), isNil$1(this._idToGraphic) || this._isCollectionBase && isNil$1(this._idToPoint)) return;
48168
48839
  const markAttributeList = [];
48169
48840
  !1 !== this._enableAnimation && this._baseMarks.forEach(mark => {
48170
- markAttributeList.push(mark.attribute), mark.initAttributes(mark.getAttributes(!0));
48841
+ markAttributeList.push(cloneAttributeSnapshot(mark.attribute)), mark.initAttributes(mark.getAttributes(!0));
48171
48842
  });
48172
48843
  const {
48173
48844
  overlap: overlap,
@@ -48733,6 +49404,10 @@ class LabelBase extends AnimateComponent {
48733
49404
  _canPlaceInside(textBound, shapeBound) {
48734
49405
  return !(!textBound || !shapeBound) && shapeBound.encloses(textBound);
48735
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
+ }
48736
49411
  setLocation(point) {
48737
49412
  this.translateTo(point.x, point.y);
48738
49413
  }
@@ -49502,6 +50177,7 @@ class DataLabel extends AbstractComponent {
49502
50177
  }
49503
50178
  render() {
49504
50179
  var _a;
50180
+ if (this._exitReleaseState) return;
49505
50181
  const {
49506
50182
  dataLabels: dataLabels,
49507
50183
  size: size
@@ -49536,6 +50212,47 @@ class DataLabel extends AbstractComponent {
49536
50212
  currentComponentMap.get(key) || this.removeChild(cp);
49537
50213
  }), this._componentMap = currentComponentMap;
49538
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
+ }
49539
50256
  setLocation(point) {
49540
50257
  this.translateTo(point.x, point.y);
49541
50258
  }
@@ -51169,14 +51886,51 @@ class Marker extends AbstractComponent {
51169
51886
  y: clipInRange ? -(null !== (_b = limitRect.y) && void 0 !== _b ? _b : 0) : 0
51170
51887
  });
51171
51888
  }
51172
- 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 = {}) {
51173
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;
51174
51928
  this.transAnimationConfig(), this.setAttribute("pickable", !1);
51175
- const markerVisible = null === (_a = this.attribute.visible) || void 0 === _a || _a;
51176
- !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();
51177
51931
  }
51178
- release() {
51179
- 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);
51180
51934
  }
51181
51935
  }
51182
51936
 
@@ -53439,7 +54193,10 @@ let DiscreteLegend$1 = class DiscreteLegend extends LegendBase {
53439
54193
  const innerGroupHeight = innerGroupBounds.height(),
53440
54194
  itemGroupWidth = isValid$1(this.attribute.item.width) ? this.attribute.item.width : innerGroupWidth + parsedPadding[1] + parsedPadding[3],
53441
54195
  itemGroupHeight = this._itemHeightByUser || innerGroupHeight + parsedPadding[0] + parsedPadding[2];
53442
- 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;
53443
54200
  }
53444
54201
  _createPager(compStyle) {
53445
54202
  var _a, _b;
@@ -55076,7 +55833,11 @@ let Title$1 = class Title extends AbstractComponent {
55076
55833
  subTextBoundsWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;
55077
55834
  let totalWidth = Math.max(mainTextBoundsWidth, subTextBoundsWidth),
55078
55835
  totalHeight = mainTextBoundsHeight + (null !== (_q = subtextStyle.height) && void 0 !== _q ? _q : subTextBoundsHeight);
55079
- 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) {
55080
55841
  if (isValid$1(align) || isValid$1(textStyle.align)) {
55081
55842
  const mainTitleAlign = textStyle.align ? textStyle.align : align,
55082
55843
  mainTitleWidth = null !== (_r = textStyle.width) && void 0 !== _r ? _r : totalWidth;
@@ -60309,7 +61070,7 @@ class Compiler {
60309
61070
  stage.release();
60310
61071
  }
60311
61072
  else if (rootGroup) {
60312
- stage.defaultLayer.removeChild(rootGroup);
61073
+ stage.defaultLayer.removeChild(rootGroup, true);
60313
61074
  rootGroup.release();
60314
61075
  }
60315
61076
  }
@@ -60327,7 +61088,7 @@ class Compiler {
60327
61088
  if (removeGraphicItems) {
60328
61089
  this._rootMarks.forEach(g => {
60329
61090
  traverseGroupMark(g, m => {
60330
- m.removeProduct();
61091
+ m.removeProduct(true);
60331
61092
  }, null, true);
60332
61093
  });
60333
61094
  }
@@ -60502,6 +61263,71 @@ function calculateChartSize(spec, option, defaultSize) {
60502
61263
  height
60503
61264
  };
60504
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
+ }
60505
61331
  function mergeUpdateResult(target, ...sources) {
60506
61332
  const merge = (key) => sources.reduce((value, cur) => value || (cur === null || cur === void 0 ? void 0 : cur[key]), target[key]);
60507
61333
  Object.assign(target, {
@@ -60514,6 +61340,7 @@ function mergeUpdateResult(target, ...sources) {
60514
61340
  changeTheme: merge('changeTheme'),
60515
61341
  changeBackground: merge('changeBackground')
60516
61342
  });
61343
+ mergeUpdateSpecEffects(target, ...sources);
60517
61344
  return target;
60518
61345
  }
60519
61346
  function getTrimPaddingConfig(chartType, spec) {
@@ -62728,7 +63555,7 @@ class CompilableData extends GrammarItem {
62728
63555
  this._data = null;
62729
63556
  this._data = dataView;
62730
63557
  }
62731
- removeProduct() {
63558
+ removeProduct(_releaseDetach) {
62732
63559
  this._product = null;
62733
63560
  this._prevProduct = null;
62734
63561
  this._compiledProductId = null;
@@ -62902,6 +63729,34 @@ const morph = (prevMarks, nextMarks, morphConfig = {}) => {
62902
63729
  };
62903
63730
 
62904
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
+ };
62905
63760
  const addGraphicState = (graphic, state, keepCurrentStates = true, hasAnimation) => {
62906
63761
  var _a;
62907
63762
  if (!state) {
@@ -62909,7 +63764,7 @@ const addGraphicState = (graphic, state, keepCurrentStates = true, hasAnimation)
62909
63764
  }
62910
63765
  const currentStates = keepCurrentStates ? (_a = graphic.currentStates) !== null && _a !== void 0 ? _a : [] : [];
62911
63766
  const nextStates = keepCurrentStates ? Array.from(new Set([...currentStates, state])) : [state];
62912
- graphic.useStates(nextStates, hasAnimation);
63767
+ setGraphicStates(graphic, nextStates, hasAnimation);
62913
63768
  };
62914
63769
  const removeGraphicState = (graphic, state, hasAnimation) => {
62915
63770
  var _a;
@@ -62919,9 +63774,10 @@ const removeGraphicState = (graphic, state, hasAnimation) => {
62919
63774
  }
62920
63775
  const currentStates = ((_a = graphic.currentStates) !== null && _a !== void 0 ? _a : []);
62921
63776
  const nextStates = currentStates.filter((stateName) => !states.includes(stateName));
62922
- graphic.useStates(nextStates, hasAnimation);
63777
+ setGraphicStates(graphic, nextStates, hasAnimation);
62923
63778
  };
62924
63779
 
63780
+ const statesClearedBeforeReInitKey = Symbol('statesClearedBeforeReInit');
62925
63781
  class BaseMark extends GrammarItem {
62926
63782
  commit(render, recursion) {
62927
63783
  if (recursion && this.getMarks().length > 0) {
@@ -63127,9 +63983,9 @@ class BaseMark extends GrammarItem {
63127
63983
  }
63128
63984
  resumeAnimationByState(state) {
63129
63985
  }
63130
- removeProduct() {
63986
+ removeProduct(releaseDetach) {
63131
63987
  if (this._product && this._product.parent) {
63132
- this._product.parent.removeChild(this._product);
63988
+ this._product.parent.removeChild(this._product, releaseDetach);
63133
63989
  }
63134
63990
  this._product = null;
63135
63991
  this._compiledProductId = null;
@@ -63159,6 +64015,9 @@ class BaseMark extends GrammarItem {
63159
64015
  this._unCompileChannel = {};
63160
64016
  this._disabledAnimationStates = [];
63161
64017
  this._skipBeforeLayouted = false;
64018
+ this._sharedStateDefinitionRefIds = new WeakMap();
64019
+ this._sharedStateDefinitionRefId = 0;
64020
+ this._dynamicSharedStateNames = new Set();
63162
64021
  this._extensionChannel = {};
63163
64022
  this._computeExChannel = {};
63164
64023
  this._graphicMap = new Map();
@@ -63193,11 +64052,19 @@ class BaseMark extends GrammarItem {
63193
64052
  }
63194
64053
  };
63195
64054
  this._setStateOfGraphic = (g, hasAnimation) => {
63196
- g.clearStates();
64055
+ var _a, _b, _c;
63197
64056
  g.stateProxy = null;
63198
- if (g.context.diffState === DiffState.enter || g.context.diffState === DiffState.update) {
63199
- 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;
63200
64066
  }
64067
+ setGraphicStates(g, targetStates, hasAnimation);
63201
64068
  };
63202
64069
  this.name = name;
63203
64070
  this.model = option.model;
@@ -63731,6 +64598,9 @@ class BaseMark extends GrammarItem {
63731
64598
  if (state === 'appear') {
63732
64599
  return;
63733
64600
  }
64601
+ if (state === 'update' && !this._hasDiffAttrs(g)) {
64602
+ return;
64603
+ }
63734
64604
  const config = animationConfig[state];
63735
64605
  if (config && config.length > 0) {
63736
64606
  const configList = config.map((item, index) => ({
@@ -63896,6 +64766,48 @@ class BaseMark extends GrammarItem {
63896
64766
  });
63897
64767
  return { updateStyles, groupStyles };
63898
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
+ }
63899
64811
  _applySharedStateDefinitions() {
63900
64812
  var _a;
63901
64813
  if (!this._product) {
@@ -63903,7 +64815,10 @@ class BaseMark extends GrammarItem {
63903
64815
  }
63904
64816
  const stateNames = Object.keys((_a = this._encoderOfState) !== null && _a !== void 0 ? _a : {}).filter(stateName => stateName !== 'group' && stateName !== 'update');
63905
64817
  if (!stateNames.length) {
63906
- this._product.sharedStateDefinitions = undefined;
64818
+ this._dynamicSharedStateNames.clear();
64819
+ if (this._product.sharedStateDefinitions !== undefined) {
64820
+ this._product.sharedStateDefinitions = undefined;
64821
+ }
63907
64822
  return;
63908
64823
  }
63909
64824
  const sortedStateNames = this._stateSort ? stateNames.slice().sort(this._stateSort) : stateNames;
@@ -63912,15 +64827,71 @@ class BaseMark extends GrammarItem {
63912
64827
  statePriority.set(stateName, index);
63913
64828
  });
63914
64829
  const sharedStateDefinitions = {};
64830
+ const cacheKeys = [];
64831
+ const dynamicSharedStateNames = new Set();
63915
64832
  stateNames.forEach(stateName => {
63916
64833
  var _a;
63917
64834
  const encoder = this._encoderOfState[stateName];
63918
- sharedStateDefinitions[stateName] = {
63919
- priority: (_a = statePriority.get(stateName)) !== null && _a !== void 0 ? _a : 0,
63920
- declaredAffectedKeys: Object.keys(encoder !== null && encoder !== void 0 ? encoder : {}),
63921
- 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
63922
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('|'));
63923
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;
63924
64895
  this._product.sharedStateDefinitions = sharedStateDefinitions;
63925
64896
  }
63926
64897
  _addProgressiveGraphic(parent, g) {
@@ -63939,6 +64910,36 @@ class BaseMark extends GrammarItem {
63939
64910
  g.context.finalAttrs = finalAttrs;
63940
64911
  });
63941
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
+ }
63942
64943
  _runApplyGraphic(graphics) {
63943
64944
  const hasAnimation = this.hasAnimation();
63944
64945
  graphics.forEach((g, index) => {
@@ -63971,11 +64972,11 @@ class BaseMark extends GrammarItem {
63971
64972
  }
63972
64973
  }
63973
64974
  else {
63974
- const diffAttrs = getDiffAttributesOfGraphic(g, finalAttrs);
64975
+ const diffAttrs = this._excludeStateControlledDiffAttrs(g, getDiffAttributesOfGraphic(g, finalAttrs));
63975
64976
  g.context.diffAttrs = diffAttrs;
63976
64977
  if (g.context.reusing) {
63977
64978
  g.context.lastAttrs = g.attribute;
63978
- g.initAttributes({});
64979
+ g.initAttributes(finalAttrs);
63979
64980
  g.context.reusing = false;
63980
64981
  }
63981
64982
  else if (!hasStateAnimation) {
@@ -64127,11 +65128,24 @@ class BaseMark extends GrammarItem {
64127
65128
  }
64128
65129
  const stateInfo = this.state.getStateInfo(key);
64129
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');
64130
65135
  if (this.state.checkOneState(g, g.context.data, stateInfo) === 'in') {
64131
- addGraphicState(g, key, true, this.hasAnimationByState('state'));
65136
+ addGraphicState(g, key, true, hasStateAnimation);
64132
65137
  }
64133
65138
  else {
64134
- 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
+ }
64135
65149
  }
64136
65150
  });
64137
65151
  }
@@ -64159,7 +65173,9 @@ class BaseMark extends GrammarItem {
64159
65173
  animation: Object.assign(Object.assign({}, item), { customParameters: g.context })
64160
65174
  }));
64161
65175
  g.applyAnimationState(['exit'], [exitConfigList.length === 1 ? exitConfigList[0] : exitConfigList], () => {
64162
- doRemove(g, key);
65176
+ if (g.context.diffState === DiffState.exit && g.isExiting && this._graphicMap.get(key) === g) {
65177
+ doRemove(g, key);
65178
+ }
64163
65179
  });
64164
65180
  }
64165
65181
  }
@@ -64334,7 +65350,10 @@ class BaseMark extends GrammarItem {
64334
65350
  this.uncommit();
64335
65351
  this.stateStyle = {};
64336
65352
  this.getGraphics().forEach(g => {
64337
- 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
+ }
64338
65357
  });
64339
65358
  }
64340
65359
  }
@@ -64465,7 +65484,7 @@ class GroupMark extends BaseMark {
64465
65484
  }
64466
65485
  release() {
64467
65486
  super.release();
64468
- this.removeProduct();
65487
+ this.removeProduct(true);
64469
65488
  }
64470
65489
  }
64471
65490
  GroupMark.type = "group";
@@ -65279,6 +66298,38 @@ class VChartPluginService extends BasePluginService {
65279
66298
  }
65280
66299
  }
65281
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
+
65282
66333
  class VChart {
65283
66334
  static useRegisters(comps) {
65284
66335
  comps.forEach((fn) => {
@@ -65528,7 +66579,7 @@ class VChart {
65528
66579
  this._compiler.updateLayoutTag();
65529
66580
  this._setFontFamilyTheme(this.getTheme('fontFamily'));
65530
66581
  this._initDataSet(this._option.dataSet);
65531
- 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;
65532
66583
  this._bindResizeEvent();
65533
66584
  this._bindViewEvent();
65534
66585
  this._initChartPlugin();
@@ -65682,6 +66733,9 @@ class VChart {
65682
66733
  this._updateAnimateState(true);
65683
66734
  }
65684
66735
  this._reCompile(updateSpecResult);
66736
+ if (isUpdateSpecResultLocalOnly(updateSpecResult)) {
66737
+ return this;
66738
+ }
65685
66739
  if (sync) {
65686
66740
  return this._renderSync(option);
65687
66741
  }
@@ -65699,7 +66753,7 @@ class VChart {
65699
66753
  if (updateResult.reMake) {
65700
66754
  this._releaseData();
65701
66755
  this._initDataSet();
65702
- (_a = this._chart) === null || _a === void 0 ? void 0 : _a.release();
66756
+ (_a = this._chart) === null || _a === void 0 ? void 0 : _a.release(false);
65703
66757
  this._chart = null;
65704
66758
  }
65705
66759
  if (updateResult.reTransformSpec) {
@@ -65810,6 +66864,7 @@ class VChart {
65810
66864
  this._chartPluginApply('releaseAll');
65811
66865
  this._chartPlugin = null;
65812
66866
  this._chartSpecTransformer = null;
66867
+ this._forceReleaseExitingVRenderComponents();
65813
66868
  (_b = this._chart) === null || _b === void 0 ? void 0 : _b.release();
65814
66869
  (_c = this._eventDispatcher) === null || _c === void 0 ? void 0 : _c.release();
65815
66870
  (_d = this._compiler) === null || _d === void 0 ? void 0 : _d.release();
@@ -65832,6 +66887,25 @@ class VChart {
65832
66887
  this._isReleased = true;
65833
66888
  InstanceManager.unregisterInstance(this);
65834
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
+ }
65835
66909
  updateData(id, data, parserOptions, userUpdateOptions) {
65836
66910
  return __awaiter$b(this, void 0, void 0, function* () {
65837
66911
  return this.updateDataSync(id, data, parserOptions, userUpdateOptions);
@@ -65995,9 +67069,13 @@ class VChart {
65995
67069
  spec = mergeSpec({}, model.getSpec(), spec);
65996
67070
  }
65997
67071
  const result = model.updateSpec(spec);
65998
- model.reInit(spec);
65999
- if (result.change || result.reCompile || result.reMake || result.reSize || result.reRender) {
66000
- 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
+ }
66001
67079
  }
66002
67080
  return this.updateCustomConfigAndRerender(result, sync, {
66003
67081
  morphConfig,
@@ -66178,7 +67256,7 @@ class VChart {
66178
67256
  resize = true;
66179
67257
  }
66180
67258
  const lasAutoSize = this._autoSize;
66181
- 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;
66182
67260
  if (this._autoSize !== lasAutoSize) {
66183
67261
  resize = true;
66184
67262
  }
@@ -67331,6 +68409,8 @@ const defaultSeriesIgnoreCheckKeys = {
67331
68409
  data: true
67332
68410
  };
67333
68411
  const defaultSeriesCompileCheckKeys = {
68412
+ xField: true,
68413
+ yField: true,
67334
68414
  invalidType: true,
67335
68415
  animation: true,
67336
68416
  animationAppear: true,
@@ -67339,6 +68419,13 @@ const defaultSeriesCompileCheckKeys = {
67339
68419
  animationExit: true,
67340
68420
  animationNormal: true
67341
68421
  };
68422
+ const defaultSeriesCompileOnlyCheckKeys = {
68423
+ animationAppear: true,
68424
+ animationEnter: true,
68425
+ animationUpdate: true,
68426
+ animationExit: true,
68427
+ animationNormal: true
68428
+ };
67342
68429
 
67343
68430
  const AnimationStates = [...Object.keys(DEFAULT_ANIMATION_CONFIG), 'normal'];
67344
68431
  function animationConfig(defaultConfig = {}, userConfig, params) {
@@ -67694,6 +68781,40 @@ function getDefaultInteractionConfigByMode(mode) {
67694
68781
  return null;
67695
68782
  }
67696
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
+ }
67697
68818
  class BaseSeries extends BaseModel {
67698
68819
  getRegion() {
67699
68820
  return this._region;
@@ -68392,9 +69513,14 @@ class BaseSeries extends BaseModel {
68392
69513
  return !isEqual(prev, newLabels[index]);
68393
69514
  })) {
68394
69515
  compareResult.reCompile = true;
69516
+ markSeriesCompileEffect(compareResult);
68395
69517
  }
68396
69518
  }
69519
+ _getSpecUpdatePolicy() {
69520
+ return defaultSeriesSpecUpdatePolicy;
69521
+ }
68397
69522
  _compareSpec(spec, prevSpec, ignoreCheckKeys) {
69523
+ var _a, _b, _c, _d;
68398
69524
  const result = super._compareSpec(spec, prevSpec);
68399
69525
  const currentKeys = Object.keys(prevSpec || {}).sort();
68400
69526
  const nextKeys = Object.keys(spec || {}).sort();
@@ -68402,7 +69528,12 @@ class BaseSeries extends BaseModel {
68402
69528
  result.reMake = true;
68403
69529
  return result;
68404
69530
  }
68405
- 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 });
68406
69537
  this._compareExtensionMarksSpec(array(spec.extensionMark), array(prevSpec.extensionMark), result);
68407
69538
  !result.reMake && this._compareLabelSpec(array(spec.label), array(prevSpec.label), result);
68408
69539
  !result.reMake &&
@@ -68418,12 +69549,27 @@ class BaseSeries extends BaseModel {
68418
69549
  })) {
68419
69550
  result.reCompile = true;
68420
69551
  }
68421
- if (!result.reCompile &&
68422
- currentKeys.some((k) => {
68423
- return defaultSeriesCompileCheckKeys[k] && !isEqual(spec[k], prevSpec[k]);
68424
- })) {
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)) {
68425
69563
  result.reCompile = true;
68426
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
+ }
68427
69573
  if (currentKeys.some((k) => {
68428
69574
  return !ignores[k] && !isEqual(spec[k], prevSpec[k]);
68429
69575
  })) {
@@ -68572,7 +69718,7 @@ class BaseSeries extends BaseModel {
68572
69718
  attributeContext: this._markAttributeContext,
68573
69719
  componentType: option.componentType,
68574
69720
  noSeparateStyle,
68575
- 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
68576
69722
  });
68577
69723
  if (isValid$1(m)) {
68578
69724
  const spec = this.getSpec() || {};
@@ -68605,11 +69751,22 @@ class BaseSeries extends BaseModel {
68605
69751
  if (!datum) {
68606
69752
  return key;
68607
69753
  }
68608
- const dimensionFields = this.getDimensionField();
68609
- key = dimensionFields.map(field => datum[field]).join('_');
68610
69754
  const seriesField = this.getSeriesField();
68611
- if (seriesField && !dimensionFields.includes(seriesField)) {
68612
- 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}`;
68613
69770
  }
68614
69771
  return key;
68615
69772
  }
@@ -69534,6 +70691,10 @@ const lineLikeSeriesMark = {
69534
70691
  ["line"]: { name: "line", type: "line" }
69535
70692
  };
69536
70693
 
70694
+ const LINE_LIKE_SERIES_DATA_RELATED_KEYS = {
70695
+ sampling: true,
70696
+ samplingFactor: true
70697
+ };
69537
70698
  class LineLikeSeriesMixin {
69538
70699
  addSamplingCompile() {
69539
70700
  if (this._spec.sampling) {
@@ -70807,6 +71968,7 @@ class BaseComponent extends LayoutModel {
70807
71968
  this.name = 'component';
70808
71969
  this.modelType = 'component';
70809
71970
  this.transformerConstructor = BaseComponentSpecTransformer;
71971
+ this._forceReleaseVRenderComponents = false;
70810
71972
  this._delegateEvent = (component, event, type, item = null, datum = null) => {
70811
71973
  var _a, _b;
70812
71974
  if (!(event instanceof CustomEvent)) {
@@ -70870,23 +72032,72 @@ class BaseComponent extends LayoutModel {
70870
72032
  }
70871
72033
  return result;
70872
72034
  }
72035
+ beforeRelease() {
72036
+ super.beforeRelease();
72037
+ this._forceReleaseVRenderComponents = true;
72038
+ this._forceReleaseExitingVRenderComponents();
72039
+ }
70873
72040
  release() {
70874
72041
  var _a;
70875
- super.release();
72042
+ if (this._shouldReleaseVRenderComponentsImmediately()) {
72043
+ this._forceReleaseExitingVRenderComponents();
72044
+ }
70876
72045
  this.clear();
72046
+ super.release();
70877
72047
  (_a = this.pluginService) === null || _a === void 0 ? void 0 : _a.releaseAll();
70878
72048
  this.pluginService = null;
70879
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
+ }
70880
72094
  clear() {
70881
72095
  var _a;
70882
72096
  const components = this._getNeedClearVRenderComponents();
70883
72097
  if (components && components.length) {
70884
72098
  components.forEach(c => {
70885
- var _a;
70886
72099
  if (c) {
70887
- c.release(true);
70888
- (_a = this.getContainer()) === null || _a === void 0 ? void 0 : _a.removeChild(c);
70889
- c = null;
72100
+ this._releaseVRenderComponent(c);
70890
72101
  }
70891
72102
  });
70892
72103
  }
@@ -70946,13 +72157,91 @@ class ComponentMark extends BaseMark {
70946
72157
  getComponent() {
70947
72158
  return this._component;
70948
72159
  }
70949
- clearComponent() {
70950
- if (this._component) {
70951
- if (this._component.parent) {
70952
- 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
+ }
70953
72201
  }
70954
- 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;
70955
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;
70956
72245
  }
70957
72246
  _getAttrsFromConfig(attrs = {}) {
70958
72247
  const configAttrs = super._getAttrsFromConfig(attrs);
@@ -71013,8 +72302,26 @@ class ComponentMark extends BaseMark {
71013
72302
  this.needClear = true;
71014
72303
  }
71015
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
+ }
71016
72323
  super.release();
71017
- this.removeProduct();
72324
+ this.removeProduct(true);
71018
72325
  }
71019
72326
  }
71020
72327
  ComponentMark.type = "component";
@@ -71026,6 +72333,19 @@ const scaleParser = (scale) => {
71026
72333
  return scale;
71027
72334
  };
71028
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
+ };
71029
72349
  class AxisComponent extends BaseComponent {
71030
72350
  getOrient() {
71031
72351
  return this._orient;
@@ -71331,6 +72651,7 @@ class AxisComponent extends BaseComponent {
71331
72651
  if (result.reMake) {
71332
72652
  return result;
71333
72653
  }
72654
+ const specChanged = !isEqual(prevSpec, spec);
71334
72655
  result.reRender = true;
71335
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)) {
71336
72657
  result.reMake = true;
@@ -71340,8 +72661,17 @@ class AxisComponent extends BaseComponent {
71340
72661
  var _a, _b;
71341
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);
71342
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
+ }
71343
72667
  return result;
71344
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
+ }
71345
72675
  _getAxisAttributes() {
71346
72676
  const spec = this._spec;
71347
72677
  const axisAttrs = {
@@ -73935,6 +75265,10 @@ class LineSeries extends CartesianSeries {
73935
75265
  this.transformerConstructor = LineLikeSeriesSpecTransformer;
73936
75266
  this._sortDataByAxis = false;
73937
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
+ }
73938
75272
  compile() {
73939
75273
  super.compile();
73940
75274
  this.addSamplingCompile();
@@ -74611,6 +75945,11 @@ class Interaction {
74611
75945
  }
74612
75946
  }
74613
75947
 
75948
+ const MARKER_COMPONENT_SPEC_KEYS = {
75949
+ [ComponentTypeEnum.markPoint]: true,
75950
+ [ComponentTypeEnum.markLine]: true,
75951
+ [ComponentTypeEnum.markArea]: true
75952
+ };
74614
75953
  class BaseChart extends CompilableBase {
74615
75954
  getSpec() {
74616
75955
  return this._spec;
@@ -74664,6 +76003,7 @@ class BaseChart extends CompilableBase {
74664
76003
  this._regions = [];
74665
76004
  this._series = [];
74666
76005
  this._components = [];
76006
+ this._specTransformer = null;
74667
76007
  this._layoutRect = {
74668
76008
  x: 0,
74669
76009
  y: 0,
@@ -74795,6 +76135,7 @@ class BaseChart extends CompilableBase {
74795
76135
  this._spec = spec;
74796
76136
  }
74797
76137
  created(transformer) {
76138
+ this._specTransformer = transformer;
74798
76139
  this._chartData.parseData(this._spec.data);
74799
76140
  this._createGlobalScale();
74800
76141
  this._createBackground();
@@ -75171,12 +76512,18 @@ class BaseChart extends CompilableBase {
75171
76512
  }
75172
76513
  }
75173
76514
  _getSpecKeys(spec) {
75174
- const ignoreKeys = { width: true, height: true };
76515
+ const ignoreKeys = {
76516
+ width: true,
76517
+ height: true,
76518
+ xField: true,
76519
+ yField: true
76520
+ };
75175
76521
  return Object.keys(spec)
75176
76522
  .filter(key => !ignoreKeys[key])
75177
76523
  .sort();
75178
76524
  }
75179
76525
  updateSpec(spec) {
76526
+ var _a;
75180
76527
  const result = {
75181
76528
  change: false,
75182
76529
  reMake: false,
@@ -75184,49 +76531,83 @@ class BaseChart extends CompilableBase {
75184
76531
  reSize: false,
75185
76532
  reCompile: false
75186
76533
  };
75187
- this.setLayoutTag(true, null, false);
75188
76534
  if (spec.type !== this.type) {
75189
76535
  result.reMake = true;
76536
+ this.setLayoutTag(true, null, false);
75190
76537
  return result;
75191
76538
  }
75192
76539
  const currentKeys = this._getSpecKeys(this._spec);
75193
76540
  const nextKeys = this._getSpecKeys(spec);
75194
76541
  if (!isEqual(currentKeys, nextKeys)) {
75195
76542
  result.reMake = true;
76543
+ this.setLayoutTag(true, null, false);
75196
76544
  return result;
75197
76545
  }
75198
76546
  for (let i = 0; i < currentKeys.length; i++) {
75199
76547
  const key = currentKeys[i];
75200
- 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)) {
75201
76553
  result.reMake = true;
76554
+ this.setLayoutTag(true, null, false);
75202
76555
  return result;
75203
76556
  }
75204
76557
  }
75205
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);
75206
76562
  this._spec = spec;
76563
+ if (onlyMarkerComponentsRemoved) {
76564
+ this._removeMarkerComponentsForEmptySpecs(result);
76565
+ return result;
76566
+ }
75207
76567
  this.updateChartConfig(result, oldSpec);
75208
76568
  if (result.reMake) {
76569
+ this.setLayoutTag(true, null, false);
75209
76570
  return result;
75210
76571
  }
75211
76572
  this.updateGlobalScale(result);
75212
76573
  if (result.reMake) {
76574
+ this.setLayoutTag(true, null, false);
75213
76575
  return result;
75214
76576
  }
75215
76577
  this.updateRegionSpec(result);
75216
76578
  if (result.reMake) {
76579
+ this.setLayoutTag(true, null, false);
75217
76580
  return result;
75218
76581
  }
75219
- this.updateComponentSpec(result);
76582
+ const componentUpdateResult = this.updateComponentSpec(result);
75220
76583
  if (result.reMake) {
76584
+ this.setLayoutTag(true, null, false);
76585
+ return result;
76586
+ }
76587
+ if (isUpdateSpecResultLocalOnly(result)) {
75221
76588
  return result;
75222
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);
75223
76602
  this.updateSeriesSpec(result);
75224
76603
  if (result.reMake) {
75225
76604
  return result;
75226
76605
  }
75227
76606
  this.reInit();
75228
- this.updateDataSpec();
75229
- this.updateGlobalScaleDomain();
76607
+ if (!onlySeriesSpecsChanged || !this._canSkipChartDataStages(result)) {
76608
+ this.updateDataSpec();
76609
+ this.updateGlobalScaleDomain();
76610
+ }
75230
76611
  return result;
75231
76612
  }
75232
76613
  updateChartConfig(result, oldSpec) {
@@ -75254,12 +76635,15 @@ class BaseChart extends CompilableBase {
75254
76635
  });
75255
76636
  }
75256
76637
  updateComponentSpec(result) {
76638
+ const componentOnlyUpdatedComponents = [];
76639
+ let hasNonComponentOnlyUpdate = false;
75257
76640
  const componentCache = {};
75258
76641
  const checkVisibleComponents = {
75259
76642
  [ComponentTypeEnum.title]: true,
75260
76643
  [ComponentTypeEnum.brush]: true,
75261
76644
  [ComponentTypeEnum.indicator]: true
75262
76645
  };
76646
+ const removedComponents = [];
75263
76647
  this._components.forEach(c => {
75264
76648
  var _a, _b;
75265
76649
  if (c.type === ComponentTypeEnum.label || c.type === ComponentTypeEnum.totalLabel) {
@@ -75275,11 +76659,32 @@ class BaseChart extends CompilableBase {
75275
76659
  specCount: cmpSpec.length,
75276
76660
  componentCount: 0
75277
76661
  };
76662
+ if (this._canRemoveMarkerComponentsWithoutRemake(compSpecKey, [c.getSpec()], cmpSpec)) {
76663
+ removedComponents.push(c);
76664
+ return;
76665
+ }
75278
76666
  componentCache[compSpecKey].componentCount++;
75279
- 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);
75280
76677
  }
75281
76678
  else {
75282
- 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);
75283
76688
  }
75284
76689
  });
75285
76690
  for (const key in componentCache) {
@@ -75290,6 +76695,13 @@ class BaseChart extends CompilableBase {
75290
76695
  }
75291
76696
  }
75292
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
+ }
75293
76705
  const isVisible = (compSpec) => compSpec && compSpec.visible !== false;
75294
76706
  Object.keys(checkVisibleComponents).forEach(type => {
75295
76707
  if (checkVisibleComponents[type]) {
@@ -75300,6 +76712,92 @@ class BaseChart extends CompilableBase {
75300
76712
  }
75301
76713
  }
75302
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();
75303
76801
  }
75304
76802
  updateSeriesSpec(result) {
75305
76803
  if (this._spec.series.length !== this._series.length) {
@@ -75410,10 +76908,12 @@ class BaseChart extends CompilableBase {
75410
76908
  });
75411
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);
75412
76910
  }
75413
- release() {
75414
- [...this._components, ...this._regions, ...this._series].forEach(m => {
75415
- m.beforeRelease();
75416
- });
76911
+ release(forceReleaseVRenderComponents = true) {
76912
+ if (forceReleaseVRenderComponents) {
76913
+ [...this._components, ...this._regions, ...this._series].forEach(m => {
76914
+ m.beforeRelease();
76915
+ });
76916
+ }
75417
76917
  super.release();
75418
76918
  this.clear();
75419
76919
  [...this._components, ...this._regions, ...this._series].forEach(m => {
@@ -75672,8 +77172,18 @@ const getRelatedSeriesInfo = (modelInfo, currentChartSpecInfo) => {
75672
77172
  return undefined;
75673
77173
  };
75674
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
+ };
75675
77184
  class BaseChartSpecTransformer {
75676
77185
  constructor(option) {
77186
+ this._seriesRelatedSpecKeys = Object.assign({}, DEFAULT_SERIES_RELATED_CHART_SPEC_KEYS);
75677
77187
  this._option = option;
75678
77188
  this.type = option.type;
75679
77189
  this.seriesType = option.seriesType;
@@ -75769,8 +77279,19 @@ class BaseChartSpecTransformer {
75769
77279
  _isValidSeries(seriesType) {
75770
77280
  return true;
75771
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
+ }
75772
77292
  _getDefaultSeriesSpec(chartSpec, pickKeys, pickKeys2) {
75773
77293
  var _a, _b, _c, _d, _e;
77294
+ this._addSeriesRelatedSpecKeys(pickKeys, pickKeys2);
75774
77295
  const series = {
75775
77296
  dataKey: chartSpec.dataKey,
75776
77297
  hover: chartSpec.hover,
@@ -77256,6 +78777,10 @@ class AreaSeries extends CartesianSeries {
77256
78777
  this.transformerConstructor = AreaSeriesSpecTransformer;
77257
78778
  this._sortDataByAxis = false;
77258
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
+ }
77259
78784
  initMark() {
77260
78785
  var _a;
77261
78786
  const seriesMark = (_a = this._spec.seriesMark) !== null && _a !== void 0 ? _a : 'area';
@@ -77646,6 +79171,14 @@ const bar = {
77646
79171
  };
77647
79172
 
77648
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
+ };
77649
79182
  class BarSeries extends CartesianSeries {
77650
79183
  constructor() {
77651
79184
  super(...arguments);
@@ -77747,6 +79280,10 @@ class BarSeries extends CartesianSeries {
77747
79280
  this._barBackgroundPositionYEncoder = encoder.bind(this);
77748
79281
  };
77749
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
+ }
77750
79287
  initMark() {
77751
79288
  this._initBarBackgroundMark();
77752
79289
  this._barMark = this._createMark(Object.assign(Object.assign({}, BarSeries.mark.bar), { name: this._barMarkName, type: this._barMarkType }), {
@@ -77771,6 +79308,19 @@ class BarSeries extends CartesianSeries {
77771
79308
  fill: this.getColorAttribute()
77772
79309
  }, 'normal', AttributeLevel.Series);
77773
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();
77774
79324
  }
77775
79325
  initLabelMarkStyle(textMark) {
77776
79326
  if (!textMark) {
@@ -77883,14 +79433,8 @@ class BarSeries extends CartesianSeries {
77883
79433
  this._barBackgroundViewData = new CompilableData(this._option, barBackgroundData);
77884
79434
  }
77885
79435
  init(option) {
77886
- var _a, _b;
77887
79436
  super.init(option);
77888
- if (this.direction === 'vertical') {
77889
- ((_a = this._xAxisHelper) === null || _a === void 0 ? void 0 : _a.getScale(0).type) === 'band' ? this.initBandRectMarkStyle() : this.initLinearRectMarkStyle();
77890
- }
77891
- else {
77892
- ((_b = this._yAxisHelper) === null || _b === void 0 ? void 0 : _b.getScale(0).type) === 'band' ? this.initBandRectMarkStyle() : this.initLinearRectMarkStyle();
77893
- }
79437
+ this.initRectMarkStyle();
77894
79438
  }
77895
79439
  _shouldDoPreCalculate() {
77896
79440
  const region = this.getRegion();
@@ -78013,6 +79557,13 @@ class BarSeries extends CartesianSeries {
78013
79557
  _initStackBarMarkStyle() {
78014
79558
  var _a, _b, _c, _d;
78015
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
+ }
78016
79567
  return;
78017
79568
  }
78018
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);
@@ -78442,6 +79993,9 @@ const scatter = {
78442
79993
  }
78443
79994
  };
78444
79995
 
79996
+ const SCATTER_SERIES_DATA_RELATED_KEYS = {
79997
+ sizeField: true
79998
+ };
78445
79999
  class ScatterSeries extends CartesianSeries {
78446
80000
  constructor() {
78447
80001
  super(...arguments);
@@ -78449,6 +80003,10 @@ class ScatterSeries extends CartesianSeries {
78449
80003
  this.transformerConstructor = ScatterSeriesSpecTransformer;
78450
80004
  this._invalidType = 'zero';
78451
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
+ }
78452
80010
  setAttrFromSpec() {
78453
80011
  super.setAttrFromSpec();
78454
80012
  this._size = this._spec.size;
@@ -80903,6 +82461,9 @@ const waterfall = {
80903
82461
  }
80904
82462
  };
80905
82463
 
82464
+ const WATERFALL_SERIES_DATA_RELATED_KEYS = {
82465
+ calculationMode: true
82466
+ };
80906
82467
  class WaterfallSeries extends BarSeries {
80907
82468
  constructor() {
80908
82469
  super(...arguments);
@@ -80923,6 +82484,10 @@ class WaterfallSeries extends BarSeries {
80923
82484
  var _a;
80924
82485
  return (_a = this._totalData) === null || _a === void 0 ? void 0 : _a.getLatestData();
80925
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
+ }
80926
82491
  initGroups() {
80927
82492
  const groupFields = this.getGroupFields();
80928
82493
  if (groupFields && groupFields.length) {
@@ -81978,6 +83543,12 @@ const DEFAULT_SHAFT_SHAPE = 'line';
81978
83543
  const DEFAULT_FILL_COLOR = '#FFF';
81979
83544
  const DEFAULT_STROKE_COLOR = '#000';
81980
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
+ };
81981
83552
  class BoxPlotSeries extends CartesianSeries {
81982
83553
  constructor() {
81983
83554
  super(...arguments);
@@ -82015,6 +83586,10 @@ class BoxPlotSeries extends CartesianSeries {
82015
83586
  getOutliersStyle() {
82016
83587
  return this._outliersStyle;
82017
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
+ }
82018
83593
  setAttrFromSpec() {
82019
83594
  var _a, _b, _c, _d, _e, _f, _g;
82020
83595
  super.setAttrFromSpec();
@@ -82088,6 +83663,7 @@ class BoxPlotSeries extends CartesianSeries {
82088
83663
  size: isNumber$2((_f = this._outliersStyle) === null || _f === void 0 ? void 0 : _f.size) ? this._outliersStyle.size : DEFAULT_OUTLIER_SIZE
82089
83664
  }, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series);
82090
83665
  }
83666
+ this.initBoxPlotMarkStyle();
82091
83667
  }
82092
83668
  initBoxPlotMarkStyle() {
82093
83669
  var _a, _b;
@@ -83418,6 +84994,16 @@ const pie = {
83418
84994
  }
83419
84995
  };
83420
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
+ };
83421
85007
  class BasePieSeries extends PolarSeries {
83422
85008
  constructor() {
83423
85009
  super(...arguments);
@@ -83668,6 +85254,10 @@ class BasePieSeries extends PolarSeries {
83668
85254
  computeDatumRadius(datum, state) {
83669
85255
  return this._computeLayoutRadius() * this.getRadius(state) + this._centerOffset;
83670
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
+ }
83671
85261
  _compareSpec(spec, prevSpec, ignoreCheckKeys) {
83672
85262
  ignoreCheckKeys = ignoreCheckKeys !== null && ignoreCheckKeys !== void 0 ? ignoreCheckKeys : { data: true };
83673
85263
  const defaultIgnoreKeys = [
@@ -85990,6 +87580,9 @@ const circularProgress = {
85990
87580
  }
85991
87581
  };
85992
87582
 
87583
+ const CIRCULAR_PROGRESS_SERIES_COMPILE_ONLY_KEYS = {
87584
+ cornerRadius: true
87585
+ };
85993
87586
  class CircularProgressSeries extends ProgressLikeSeries {
85994
87587
  constructor() {
85995
87588
  super(...arguments);
@@ -86019,6 +87612,10 @@ class CircularProgressSeries extends ProgressLikeSeries {
86019
87612
  this.radiusAxisHelper.getScale(0).step());
86020
87613
  };
86021
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
+ }
86022
87619
  getStackGroupFields() {
86023
87620
  return this.getGroupFields();
86024
87621
  }
@@ -86210,6 +87807,17 @@ const linearProgress = {
86210
87807
  }
86211
87808
  };
86212
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
+ };
86213
87821
  class LinearProgressSeries extends CartesianSeries {
86214
87822
  constructor() {
86215
87823
  super(...arguments);
@@ -86276,6 +87884,10 @@ class LinearProgressSeries extends CartesianSeries {
86276
87884
  return path;
86277
87885
  };
86278
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
+ }
86279
87891
  initMark() {
86280
87892
  this._initTrackMark();
86281
87893
  this._initProgressMark();
@@ -96339,6 +97951,9 @@ const heatmap = {
96339
97951
  };
96340
97952
 
96341
97953
  const DefaultBandWidth = 6;
97954
+ const HEATMAP_SERIES_DATA_RELATED_KEYS = {
97955
+ valueField: true
97956
+ };
96342
97957
  class HeatmapSeries extends CartesianSeries {
96343
97958
  constructor() {
96344
97959
  super(...arguments);
@@ -96351,6 +97966,10 @@ class HeatmapSeries extends CartesianSeries {
96351
97966
  setFieldValue(f) {
96352
97967
  this._fieldValue = array(f);
96353
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
+ }
96354
97973
  setAttrFromSpec() {
96355
97974
  super.setAttrFromSpec();
96356
97975
  this.setFieldValue(this._spec.valueField);
@@ -98234,6 +99853,7 @@ class BasePieChartSpecTransformer extends PolarChartSpecTransformer {
98234
99853
  'useSequentialAnimation',
98235
99854
  'layoutRadius'
98236
99855
  ]);
99856
+ this._addSeriesRelatedSpecKeys(['valueField', 'angleField']);
98237
99857
  seriesSpec.categoryField = spec.categoryField || spec.seriesField;
98238
99858
  seriesSpec.valueField = spec.valueField || spec.angleField;
98239
99859
  seriesSpec.emptyCircle = (_a = spec.emptyPlaceholder) === null || _a === void 0 ? void 0 : _a.emptyCircle;
@@ -98938,6 +100558,7 @@ class CircularProgressChartSpecTransformer extends ProgressLikeChartSpecTransfor
98938
100558
  _getDefaultSeriesSpec(spec) {
98939
100559
  var _a, _b;
98940
100560
  const series = super._getDefaultSeriesSpec(spec);
100561
+ this._addSeriesRelatedSpecKeys(['cornerRadius']);
98941
100562
  series.progress = spec.progress;
98942
100563
  series.track = spec.track;
98943
100564
  series.tickMask = spec.tickMask;
@@ -99539,6 +101160,7 @@ class WaterfallChartSpecTransformer extends BarChartSpecTransformer {
99539
101160
  }
99540
101161
  _getDefaultSeriesSpec(spec) {
99541
101162
  const series = super._getDefaultSeriesSpec(spec);
101163
+ this._addSeriesRelatedSpecKeys(['bar', 'stackLabel', 'leaderLine', 'total', 'calculationMode']);
99542
101164
  series.bar = spec.bar;
99543
101165
  series.stackLabel = spec.stackLabel;
99544
101166
  series.leaderLine = spec.leaderLine;
@@ -99990,6 +101612,13 @@ const discreteLegendFilter = (data, op) => {
99990
101612
  return data;
99991
101613
  };
99992
101614
 
101615
+ const LEGEND_COMPONENT_ONLY_CHANGE_KEYS = {
101616
+ position: true,
101617
+ item: true,
101618
+ title: true,
101619
+ pager: true,
101620
+ background: true
101621
+ };
99993
101622
  class BaseLegend extends BaseComponent {
99994
101623
  constructor() {
99995
101624
  super(...arguments);
@@ -100055,15 +101684,31 @@ class BaseLegend extends BaseComponent {
100055
101684
  _compareSpec(spec, prevSpec) {
100056
101685
  const result = super._compareSpec(spec, prevSpec);
100057
101686
  result.reRender = true;
101687
+ const specChanged = !isEqual(prevSpec, spec);
101688
+ if (result.reMake) {
101689
+ return result;
101690
+ }
100058
101691
  if ((spec === null || spec === void 0 ? void 0 : spec.orient) !== (prevSpec === null || prevSpec === void 0 ? void 0 : prevSpec.orient)) {
100059
101692
  result.reMake = true;
100060
101693
  return result;
100061
101694
  }
100062
- 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) {
100063
101700
  result.reCompile = true;
100064
101701
  }
100065
101702
  return result;
100066
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
+ }
100067
101712
  _bindLegendDataChange() {
100068
101713
  this._preSelectedData = this._selectedData.slice();
100069
101714
  this._initSelectedData();
@@ -105805,10 +107450,72 @@ function markerFilter(data, options) {
105805
107450
  return data;
105806
107451
  }
105807
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
+
105808
107513
  class BaseMarker extends BaseComponent {
105809
107514
  constructor() {
105810
107515
  super(...arguments);
105811
107516
  this.layoutType = 'none';
107517
+ this._markerDataChangeHandler = null;
107518
+ this._markerDataOwned = false;
105812
107519
  this._layoutOffsetX = 0;
105813
107520
  this._layoutOffsetY = 0;
105814
107521
  }
@@ -105888,6 +107595,33 @@ class BaseMarker extends BaseComponent {
105888
107595
  }
105889
107596
  return this._relativeSeries.getViewData();
105890
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
+ }
105891
107625
  updateLayoutAttribute() {
105892
107626
  var _a, _b, _c;
105893
107627
  const markerVisible = (_a = this._spec.visible) !== null && _a !== void 0 ? _a : true;
@@ -105939,8 +107673,13 @@ class BaseMarker extends BaseComponent {
105939
107673
  }
105940
107674
  clear() {
105941
107675
  super.clear();
107676
+ this._markerComponent = null;
105942
107677
  this._firstSeries = null;
105943
107678
  }
107679
+ release() {
107680
+ this._releaseMarkerData();
107681
+ super.release();
107682
+ }
105944
107683
  _getFirstSeries() {
105945
107684
  var _a;
105946
107685
  if (this._firstSeries) {
@@ -105992,10 +107731,8 @@ class BaseMarker extends BaseComponent {
105992
107731
  type: 'markerFilter',
105993
107732
  options: this._getAllRelativeSeries()
105994
107733
  });
105995
- data.target.on('change', () => {
105996
- this._markerLayout();
105997
- });
105998
- this._markerData = data;
107734
+ this._setMarkerData(data, true);
107735
+ this._bindMarkerDataChange();
105999
107736
  }
106000
107737
  }
106001
107738
 
@@ -106126,7 +107863,7 @@ class BaseMarkLine extends BaseMarker {
106126
107863
  const spec = this._spec;
106127
107864
  const isCoordinateProcess = 'coordinates' in spec;
106128
107865
  const { doXProcess, doYProcess, doXYY1Process, doYXX1Process, doXYProcess, doAngleProcess, doRadiusProcess, doAngRadRad1Process, doRadAngAng1Process, doRadAngProcess } = getMarkLineProcessInfo(spec);
106129
- this._markerData = this._getRelativeDataView();
107866
+ this._setMarkerData(this._getRelativeDataView());
106130
107867
  if (!doXProcess &&
106131
107868
  !doYProcess &&
106132
107869
  !doXYY1Process &&
@@ -106164,10 +107901,8 @@ class BaseMarkLine extends BaseMarker {
106164
107901
  type: 'markerFilter',
106165
107902
  options: this._getAllRelativeSeries()
106166
107903
  });
106167
- data.target.on('change', () => {
106168
- this._markerLayout();
106169
- });
106170
- this._markerData = data;
107904
+ this._setMarkerData(data, true);
107905
+ this._bindMarkerDataChange();
106171
107906
  }
106172
107907
  }
106173
107908
  BaseMarkLine.specKey = 'markLine';
@@ -106617,11 +108352,15 @@ class Title extends BaseComponent {
106617
108352
  }
106618
108353
  _compareSpec(spec, prevSpec) {
106619
108354
  const result = super._compareSpec(spec, prevSpec);
108355
+ const specChanged = !isEqual(prevSpec, spec);
106620
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) {
106621
108357
  result.reMake = true;
106622
108358
  }
106623
108359
  result.change = true;
106624
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
+ }
106625
108364
  return result;
106626
108365
  }
106627
108366
  afterSetLayoutStartPoint(pos) {
@@ -107786,7 +109525,9 @@ class Label extends BaseLabelComponent {
107786
109525
  Object.keys(removedComponents).forEach(name => {
107787
109526
  const comp = removedComponents[name];
107788
109527
  if (comp) {
107789
- comp.release();
109528
+ if (!comp.releaseWithExitAnimation()) {
109529
+ comp.release();
109530
+ }
107790
109531
  this._labelComponentMap.delete(comp);
107791
109532
  }
107792
109533
  });
@@ -108471,6 +110212,10 @@ class Brush extends BaseComponent {
108471
110212
  });
108472
110213
  });
108473
110214
  }
110215
+ reInit(spec) {
110216
+ super.reInit(spec);
110217
+ this.init();
110218
+ }
108474
110219
  _initNeedOperatedItem() {
108475
110220
  const seriesUserId = this._spec.seriesId;
108476
110221
  const seriesIndex = this._spec.seriesIndex;