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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/build/es5/index.js +3 -3
  2. package/build/index.es.js +2290 -473
  3. package/build/index.js +2290 -473
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/chart/base/base-chart-transformer.d.ts +3 -0
  7. package/cjs/chart/base/base-chart-transformer.js +21 -1
  8. package/cjs/chart/base/base-chart-transformer.js.map +1 -1
  9. package/cjs/chart/base/base-chart.d.ts +15 -9
  10. package/cjs/chart/base/base-chart.js +115 -24
  11. package/cjs/chart/base/base-chart.js.map +1 -1
  12. package/cjs/chart/interface/chart.d.ts +1 -0
  13. package/cjs/chart/interface/chart.js.map +1 -1
  14. package/cjs/chart/pie/base/pie-transformer.js +2 -2
  15. package/cjs/chart/pie/base/pie-transformer.js.map +1 -1
  16. package/cjs/chart/progress/circular/circular-progress-transformer.js +2 -2
  17. package/cjs/chart/progress/circular/circular-progress-transformer.js.map +1 -1
  18. package/cjs/chart/util.d.ts +4 -1
  19. package/cjs/chart/util.js +40 -4
  20. package/cjs/chart/util.js.map +1 -1
  21. package/cjs/chart/waterfall/waterfall-transformer.js +2 -1
  22. package/cjs/chart/waterfall/waterfall-transformer.js.map +1 -1
  23. package/cjs/compile/compiler.js +2 -2
  24. package/cjs/compile/compiler.js.map +1 -1
  25. package/cjs/compile/data/compilable-data.d.ts +1 -1
  26. package/cjs/compile/data/compilable-data.js +1 -1
  27. package/cjs/compile/data/compilable-data.js.map +1 -1
  28. package/cjs/compile/grammar-item.d.ts +1 -1
  29. package/cjs/compile/grammar-item.js.map +1 -1
  30. package/cjs/compile/interface/compilable-item.d.ts +1 -1
  31. package/cjs/compile/interface/compilable-item.js.map +1 -1
  32. package/cjs/component/axis/base-axis.d.ts +2 -7
  33. package/cjs/component/axis/base-axis.js +25 -3
  34. package/cjs/component/axis/base-axis.js.map +1 -1
  35. package/cjs/component/axis/cartesian/band-axis.d.ts +1 -7
  36. package/cjs/component/base/base-component.d.ts +7 -7
  37. package/cjs/component/base/base-component.js +41 -6
  38. package/cjs/component/base/base-component.js.map +1 -1
  39. package/cjs/component/base/release-vrender-component.d.ts +10 -0
  40. package/cjs/component/base/release-vrender-component.js +37 -0
  41. package/cjs/component/base/release-vrender-component.js.map +1 -0
  42. package/cjs/component/brush/brush.d.ts +2 -7
  43. package/cjs/component/brush/brush.js +3 -0
  44. package/cjs/component/brush/brush.js.map +1 -1
  45. package/cjs/component/crosshair/base.d.ts +1 -7
  46. package/cjs/component/custom-mark/custom-mark.d.ts +1 -7
  47. package/cjs/component/data-zoom/data-filter-base-component.d.ts +1 -7
  48. package/cjs/component/geo/geo-coordinate.d.ts +1 -7
  49. package/cjs/component/index.js +1 -2
  50. package/cjs/component/label/base-label.d.ts +1 -7
  51. package/cjs/component/label/label.js +1 -1
  52. package/cjs/component/label/label.js.map +1 -1
  53. package/cjs/component/legend/base-legend.d.ts +2 -7
  54. package/cjs/component/legend/base-legend.js +20 -3
  55. package/cjs/component/legend/base-legend.js.map +1 -1
  56. package/cjs/component/marker/base-marker.d.ts +7 -7
  57. package/cjs/component/marker/base-marker.js +23 -6
  58. package/cjs/component/marker/base-marker.js.map +1 -1
  59. package/cjs/component/marker/mark-line/base-mark-line.js +2 -4
  60. package/cjs/component/marker/mark-line/base-mark-line.js.map +1 -1
  61. package/cjs/component/title/title.d.ts +1 -7
  62. package/cjs/component/title/title.js +6 -2
  63. package/cjs/component/title/title.js.map +1 -1
  64. package/cjs/constant/attribute.js +2 -1
  65. package/cjs/constant/scatter.js +1 -2
  66. package/cjs/constant/waterfall.js +2 -1
  67. package/cjs/core/factory.js +1 -1
  68. package/cjs/core/index.js +1 -1
  69. package/cjs/core/vchart.d.ts +5 -1
  70. package/cjs/core/vchart.js +28 -12
  71. package/cjs/core/vchart.js.map +1 -1
  72. package/cjs/data/data-view-utils.d.ts +5 -0
  73. package/cjs/data/data-view-utils.js +58 -0
  74. package/cjs/data/data-view-utils.js.map +1 -0
  75. package/cjs/env/env.js +1 -1
  76. package/cjs/env/index.js +1 -1
  77. package/cjs/mark/base/base-mark.d.ts +12 -2
  78. package/cjs/mark/base/base-mark.js +85 -21
  79. package/cjs/mark/base/base-mark.js.map +1 -1
  80. package/cjs/mark/component.d.ts +9 -0
  81. package/cjs/mark/component.js +51 -3
  82. package/cjs/mark/component.js.map +1 -1
  83. package/cjs/mark/group.js +1 -1
  84. package/cjs/mark/group.js.map +1 -1
  85. package/cjs/mark/interface/mark.d.ts +2 -0
  86. package/cjs/mark/interface/mark.js.map +1 -1
  87. package/cjs/model/base-model.d.ts +3 -15
  88. package/cjs/model/base-model.js.map +1 -1
  89. package/cjs/model/interface.d.ts +13 -0
  90. package/cjs/model/interface.js.map +1 -1
  91. package/cjs/region/region.d.ts +1 -7
  92. package/cjs/series/area/area.d.ts +2 -0
  93. package/cjs/series/area/area.js +6 -0
  94. package/cjs/series/area/area.js.map +1 -1
  95. package/cjs/series/bar/bar.d.ts +3 -0
  96. package/cjs/series/bar/bar.js +30 -4
  97. package/cjs/series/bar/bar.js.map +1 -1
  98. package/cjs/series/base/base-series.d.ts +8 -7
  99. package/cjs/series/base/base-series.js +54 -13
  100. package/cjs/series/base/base-series.js.map +1 -1
  101. package/cjs/series/base/constant.d.ts +3 -0
  102. package/cjs/series/base/constant.js +9 -1
  103. package/cjs/series/base/constant.js.map +1 -1
  104. package/cjs/series/box-plot/box-plot.d.ts +2 -0
  105. package/cjs/series/box-plot/box-plot.js +14 -2
  106. package/cjs/series/box-plot/box-plot.js.map +1 -1
  107. package/cjs/series/heatmap/heatmap.d.ts +2 -0
  108. package/cjs/series/heatmap/heatmap.js +10 -0
  109. package/cjs/series/heatmap/heatmap.js.map +1 -1
  110. package/cjs/series/line/line.d.ts +2 -0
  111. package/cjs/series/line/line.js +6 -0
  112. package/cjs/series/line/line.js.map +1 -1
  113. package/cjs/series/mixin/line-mixin.d.ts +1 -0
  114. package/cjs/series/mixin/line-mixin.js +6 -1
  115. package/cjs/series/mixin/line-mixin.js.map +1 -1
  116. package/cjs/series/pie/pie.d.ts +3 -7
  117. package/cjs/series/pie/pie.js +16 -1
  118. package/cjs/series/pie/pie.js.map +1 -1
  119. package/cjs/series/progress/circular/circular.d.ts +2 -0
  120. package/cjs/series/progress/circular/circular.js +9 -1
  121. package/cjs/series/progress/circular/circular.js.map +1 -1
  122. package/cjs/series/progress/linear/linear.d.ts +2 -0
  123. package/cjs/series/progress/linear/linear.js +17 -1
  124. package/cjs/series/progress/linear/linear.js.map +1 -1
  125. package/cjs/series/scatter/scatter.d.ts +2 -0
  126. package/cjs/series/scatter/scatter.js +9 -1
  127. package/cjs/series/scatter/scatter.js.map +1 -1
  128. package/cjs/series/waterfall/waterfall.d.ts +2 -0
  129. package/cjs/series/waterfall/waterfall.js +10 -0
  130. package/cjs/series/waterfall/waterfall.js.map +1 -1
  131. package/cjs/util/graphic-state.d.ts +1 -0
  132. package/cjs/util/graphic-state.js +19 -4
  133. package/cjs/util/graphic-state.js.map +1 -1
  134. package/esm/chart/base/base-chart-transformer.d.ts +3 -0
  135. package/esm/chart/base/base-chart-transformer.js +22 -0
  136. package/esm/chart/base/base-chart-transformer.js.map +1 -1
  137. package/esm/chart/base/base-chart.d.ts +15 -9
  138. package/esm/chart/base/base-chart.js +111 -23
  139. package/esm/chart/base/base-chart.js.map +1 -1
  140. package/esm/chart/interface/chart.d.ts +1 -0
  141. package/esm/chart/interface/chart.js.map +1 -1
  142. package/esm/chart/pie/base/pie-transformer.js +2 -2
  143. package/esm/chart/pie/base/pie-transformer.js.map +1 -1
  144. package/esm/chart/progress/circular/circular-progress-transformer.js +2 -2
  145. package/esm/chart/progress/circular/circular-progress-transformer.js.map +1 -1
  146. package/esm/chart/util.d.ts +4 -1
  147. package/esm/chart/util.js +34 -1
  148. package/esm/chart/util.js.map +1 -1
  149. package/esm/chart/waterfall/waterfall-transformer.js +2 -1
  150. package/esm/chart/waterfall/waterfall-transformer.js.map +1 -1
  151. package/esm/compile/compiler.js +2 -2
  152. package/esm/compile/compiler.js.map +1 -1
  153. package/esm/compile/data/compilable-data.d.ts +1 -1
  154. package/esm/compile/data/compilable-data.js +1 -1
  155. package/esm/compile/data/compilable-data.js.map +1 -1
  156. package/esm/compile/grammar-item.d.ts +1 -1
  157. package/esm/compile/grammar-item.js.map +1 -1
  158. package/esm/compile/interface/compilable-item.d.ts +1 -1
  159. package/esm/compile/interface/compilable-item.js.map +1 -1
  160. package/esm/component/axis/base-axis.d.ts +2 -7
  161. package/esm/component/axis/base-axis.js +25 -2
  162. package/esm/component/axis/base-axis.js.map +1 -1
  163. package/esm/component/axis/cartesian/band-axis.d.ts +1 -7
  164. package/esm/component/base/base-component.d.ts +7 -7
  165. package/esm/component/base/base-component.js +41 -5
  166. package/esm/component/base/base-component.js.map +1 -1
  167. package/esm/component/base/release-vrender-component.d.ts +10 -0
  168. package/esm/component/base/release-vrender-component.js +24 -0
  169. package/esm/component/base/release-vrender-component.js.map +1 -0
  170. package/esm/component/brush/brush.d.ts +2 -7
  171. package/esm/component/brush/brush.js +3 -0
  172. package/esm/component/brush/brush.js.map +1 -1
  173. package/esm/component/crosshair/base.d.ts +1 -7
  174. package/esm/component/custom-mark/custom-mark.d.ts +1 -7
  175. package/esm/component/data-zoom/data-filter-base-component.d.ts +1 -7
  176. package/esm/component/geo/geo-coordinate.d.ts +1 -7
  177. package/esm/component/index.js +1 -2
  178. package/esm/component/label/base-label.d.ts +1 -7
  179. package/esm/component/label/label.js +1 -1
  180. package/esm/component/label/label.js.map +1 -1
  181. package/esm/component/legend/base-legend.d.ts +2 -7
  182. package/esm/component/legend/base-legend.js +20 -2
  183. package/esm/component/legend/base-legend.js.map +1 -1
  184. package/esm/component/marker/base-marker.d.ts +7 -7
  185. package/esm/component/marker/base-marker.js +24 -5
  186. package/esm/component/marker/base-marker.js.map +1 -1
  187. package/esm/component/marker/mark-line/base-mark-line.js +2 -4
  188. package/esm/component/marker/mark-line/base-mark-line.js.map +1 -1
  189. package/esm/component/title/title.d.ts +1 -7
  190. package/esm/component/title/title.js +6 -2
  191. package/esm/component/title/title.js.map +1 -1
  192. package/esm/constant/attribute.js +2 -1
  193. package/esm/constant/scatter.js +1 -2
  194. package/esm/constant/waterfall.js +2 -1
  195. package/esm/core/factory.js +1 -1
  196. package/esm/core/index.js +1 -1
  197. package/esm/core/vchart.d.ts +5 -1
  198. package/esm/core/vchart.js +29 -12
  199. package/esm/core/vchart.js.map +1 -1
  200. package/esm/data/data-view-utils.d.ts +5 -0
  201. package/esm/data/data-view-utils.js +46 -0
  202. package/esm/data/data-view-utils.js.map +1 -0
  203. package/esm/env/env.js +1 -1
  204. package/esm/env/index.js +1 -1
  205. package/esm/mark/base/base-mark.d.ts +12 -2
  206. package/esm/mark/base/base-mark.js +85 -20
  207. package/esm/mark/base/base-mark.js.map +1 -1
  208. package/esm/mark/component.d.ts +9 -0
  209. package/esm/mark/component.js +51 -2
  210. package/esm/mark/component.js.map +1 -1
  211. package/esm/mark/group.js +1 -1
  212. package/esm/mark/group.js.map +1 -1
  213. package/esm/mark/interface/mark.d.ts +2 -0
  214. package/esm/mark/interface/mark.js.map +1 -1
  215. package/esm/model/base-model.d.ts +3 -15
  216. package/esm/model/base-model.js.map +1 -1
  217. package/esm/model/interface.d.ts +13 -0
  218. package/esm/model/interface.js.map +1 -1
  219. package/esm/region/region.d.ts +1 -7
  220. package/esm/series/area/area.d.ts +2 -0
  221. package/esm/series/area/area.js +7 -1
  222. package/esm/series/area/area.js.map +1 -1
  223. package/esm/series/bar/bar.d.ts +3 -0
  224. package/esm/series/bar/bar.js +30 -4
  225. package/esm/series/bar/bar.js.map +1 -1
  226. package/esm/series/base/base-series.d.ts +8 -7
  227. package/esm/series/base/base-series.js +50 -11
  228. package/esm/series/base/base-series.js.map +1 -1
  229. package/esm/series/base/constant.d.ts +3 -0
  230. package/esm/series/base/constant.js +10 -0
  231. package/esm/series/base/constant.js.map +1 -1
  232. package/esm/series/box-plot/box-plot.d.ts +2 -0
  233. package/esm/series/box-plot/box-plot.js +13 -2
  234. package/esm/series/box-plot/box-plot.js.map +1 -1
  235. package/esm/series/heatmap/heatmap.d.ts +2 -0
  236. package/esm/series/heatmap/heatmap.js +10 -0
  237. package/esm/series/heatmap/heatmap.js.map +1 -1
  238. package/esm/series/line/line.d.ts +2 -0
  239. package/esm/series/line/line.js +7 -1
  240. package/esm/series/line/line.js.map +1 -1
  241. package/esm/series/mixin/line-mixin.d.ts +1 -0
  242. package/esm/series/mixin/line-mixin.js +5 -0
  243. package/esm/series/mixin/line-mixin.js.map +1 -1
  244. package/esm/series/pie/pie.d.ts +3 -7
  245. package/esm/series/pie/pie.js +17 -0
  246. package/esm/series/pie/pie.js.map +1 -1
  247. package/esm/series/progress/circular/circular.d.ts +2 -0
  248. package/esm/series/progress/circular/circular.js +10 -0
  249. package/esm/series/progress/circular/circular.js.map +1 -1
  250. package/esm/series/progress/linear/linear.d.ts +2 -0
  251. package/esm/series/progress/linear/linear.js +18 -0
  252. package/esm/series/progress/linear/linear.js.map +1 -1
  253. package/esm/series/scatter/scatter.d.ts +2 -0
  254. package/esm/series/scatter/scatter.js +10 -0
  255. package/esm/series/scatter/scatter.js.map +1 -1
  256. package/esm/series/waterfall/waterfall.d.ts +2 -0
  257. package/esm/series/waterfall/waterfall.js +10 -0
  258. package/esm/series/waterfall/waterfall.js.map +1 -1
  259. package/esm/util/graphic-state.d.ts +1 -0
  260. package/esm/util/graphic-state.js +16 -3
  261. package/esm/util/graphic-state.js.map +1 -1
  262. package/package.json +11 -10
package/build/index.js CHANGED
@@ -14967,6 +14967,12 @@
14967
14967
  function getStageStatePerfMonitor(stage) {
14968
14968
  if (stage) return stage[STAGE_PERF_MONITOR];
14969
14969
  }
14970
+ function getActiveStageStatePerfMonitor(stage) {
14971
+ var _a;
14972
+ if (!stage) return;
14973
+ const current = getStageStatePerfMonitor(stage);
14974
+ return current || (!0 === (null === (_a = stage.statePerfConfig) || void 0 === _a ? void 0 : _a.enabled) ? ensureStageStatePerfMonitor(stage) : void 0);
14975
+ }
14970
14976
 
14971
14977
  function isPlainObject$1(value) {
14972
14978
  return null != value && "object" == typeof value && !Array.isArray(value);
@@ -15062,7 +15068,7 @@
15062
15068
  }
15063
15069
  invalidateResolverCache() {
15064
15070
  var _a, _b;
15065
- 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");
15071
+ 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");
15066
15072
  }
15067
15073
  hasState(stateName) {
15068
15074
  return !!this._activeStates.length && (null == stateName || this._activeStates.includes(stateName));
@@ -15109,7 +15115,7 @@
15109
15115
  }
15110
15116
  recomputePatch(effectiveStates) {
15111
15117
  var _a;
15112
- const perfMonitor = getStageStatePerfMonitor(null === (_a = this.graphic) || void 0 === _a ? void 0 : _a.stage),
15118
+ const perfMonitor = getActiveStageStatePerfMonitor(null === (_a = this.graphic) || void 0 === _a ? void 0 : _a.stage),
15113
15119
  patchStart = perfMonitor ? performance.now() : 0;
15114
15120
  let resolverCost = 0;
15115
15121
  const cacheKey = effectiveStates.join(","),
@@ -15357,32 +15363,6 @@
15357
15363
  }
15358
15364
  }), resolvedAttrs;
15359
15365
  }
15360
- resolveWithCompiled(normalAttrs, compiledDefinitions, stateProxy, effectiveStates, resolvedPatch) {
15361
- var _a, _b;
15362
- const mergeMode = null !== (_a = this.options.mergeMode) && void 0 !== _a ? _a : "shallow",
15363
- resolvedAttrs = null !== (_b = cloneValue(resolvedPatch)) && void 0 !== _b ? _b : {};
15364
- return effectiveStates.forEach(stateName => {
15365
- const proxyPatch = null == stateProxy ? void 0 : stateProxy(stateName, effectiveStates);
15366
- null != proxyPatch && Object.keys(proxyPatch).forEach(key => {
15367
- const nextValue = proxyPatch[key],
15368
- hasCompiledDefinition = compiledDefinitions.has(stateName);
15369
- if ("deep" === mergeMode && isPlainObject(nextValue) && (isPlainObject(resolvedAttrs[key]) || !hasCompiledDefinition && isPlainObject(normalAttrs[key]))) {
15370
- const baseValue = isPlainObject(resolvedAttrs[key]) ? resolvedAttrs[key] : isPlainObject(normalAttrs[key]) ? normalAttrs[key] : {};
15371
- resolvedAttrs[key] = deepMerge(baseValue, nextValue);
15372
- } else resolvedAttrs[key] = cloneValue(nextValue);
15373
- });
15374
- }), resolvedAttrs;
15375
- }
15376
- computeNormalAttrsBackup(normalAttrs, targetAttrs, finalAttribute) {
15377
- const nextNormalAttrs = {},
15378
- nextTargetAttrs = Object.assign({}, targetAttrs);
15379
- for (const key in targetAttrs) Object.prototype.hasOwnProperty.call(targetAttrs, key) && (nextNormalAttrs[key] = cloneValue(normalAttrs && key in normalAttrs ? normalAttrs[key] : finalAttribute[key]));
15380
- if (normalAttrs) for (const key in normalAttrs) Object.prototype.hasOwnProperty.call(normalAttrs, key) && !(key in targetAttrs) && (nextTargetAttrs[key] = cloneValue(normalAttrs[key]));
15381
- return {
15382
- attrs: nextTargetAttrs,
15383
- normalAttrs: nextNormalAttrs
15384
- };
15385
- }
15386
15366
  }
15387
15367
 
15388
15368
  function hasOwnKeys(value) {
@@ -15517,7 +15497,7 @@
15517
15497
  }
15518
15498
  function ensureSharedStateScopeFresh(scope) {
15519
15499
  var _a;
15520
- 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;
15500
+ 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;
15521
15501
  }
15522
15502
  function collectSharedStateScopeChain(scope) {
15523
15503
  const chain = [];
@@ -15528,7 +15508,7 @@
15528
15508
 
15529
15509
  function scheduleStageSharedStateRefresh(stage) {
15530
15510
  var _a;
15531
- stage && "released" !== stage.releaseStatus && (null === (_a = getStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordRefresh("renderScheduled"), stage.renderNextFrame());
15511
+ stage && "released" !== stage.releaseStatus && (null === (_a = getActiveStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordRefresh("renderScheduled"), stage.renderNextFrame());
15532
15512
  }
15533
15513
  function enqueueGraphicSharedStateRefresh(stage, graphic) {
15534
15514
  var _a;
@@ -15536,7 +15516,7 @@
15536
15516
  const pending = null !== (_a = stage._pendingSharedStateRefreshGraphics) && void 0 !== _a ? _a : stage._pendingSharedStateRefreshGraphics = new Set();
15537
15517
  if (!pending.has(graphic)) {
15538
15518
  pending.add(graphic);
15539
- const perfMonitor = getStageStatePerfMonitor(stage);
15519
+ const perfMonitor = getActiveStageStatePerfMonitor(stage);
15540
15520
  null == perfMonitor || perfMonitor.recordRefresh("queuedGraphics"), null == perfMonitor || perfMonitor.recordAllocation("refreshQueuePushes");
15541
15521
  }
15542
15522
  }
@@ -15551,12 +15531,13 @@
15551
15531
  function flushStageSharedStateRefresh(stage) {
15552
15532
  const pending = stage._pendingSharedStateRefreshGraphics;
15553
15533
  if (!pending || !pending.size) return;
15554
- const perfMonitor = getStageStatePerfMonitor(stage),
15534
+ const perfMonitor = getActiveStageStatePerfMonitor(stage),
15555
15535
  start = perfMonitor ? performance.now() : 0,
15556
15536
  graphics = Array.from(pending.values());
15557
15537
  pending.clear(), null == perfMonitor || perfMonitor.recordRefresh("flushedGraphics", graphics.length), graphics.forEach(graphic => {
15558
15538
  if ("released" === graphic.releaseStatus) return;
15559
15539
  if (graphic.stage !== stage) return;
15540
+ if (!graphic.sharedStateDirty) return;
15560
15541
  const refresh = graphic.refreshSharedStateBeforeRender;
15561
15542
  "function" == typeof refresh && (refresh.call(graphic), null == perfMonitor || perfMonitor.incrementCounter("sharedRefreshCommits"));
15562
15543
  }), perfMonitor && (perfMonitor.recordCost("sharedRefresh", performance.now() - start), perfMonitor.recordEvent("shared-refresh-flush", {
@@ -15573,9 +15554,12 @@
15573
15554
  tempConstantScaleXYKey = ["scaleX", "scaleY"],
15574
15555
  tempConstantAngleKey = ["angle"],
15575
15556
  builtinTextureTypes = new Set(["circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave"]),
15576
- point = new Point();
15557
+ FULL_STATE_DEFINITION_KEYS = new Set(["name", "patch", "priority", "exclude", "suppress", "resolver", "declaredAffectedKeys"]),
15558
+ point = new Point(),
15559
+ EMPTY_STATE_NAMES = [],
15560
+ BROAD_UPDATE_CATEGORY = UpdateCategory.PAINT | UpdateCategory.SHAPE | UpdateCategory.BOUNDS | UpdateCategory.TRANSFORM | UpdateCategory.LAYOUT;
15577
15561
  function isPlainObjectValue(value) {
15578
- return "object" == typeof value && null != value && !isArray$1(value);
15562
+ return "object" == typeof value && null != value && !Array.isArray(value);
15579
15563
  }
15580
15564
  function cloneAttributeValue(value) {
15581
15565
  if (!isPlainObjectValue(value)) return value;
@@ -15586,12 +15570,6 @@
15586
15570
  clone[key] = isPlainObjectValue(nextValue) ? cloneAttributeValue(nextValue) : nextValue;
15587
15571
  }), clone;
15588
15572
  }
15589
- function cloneSimpleAttributeRecord(value) {
15590
- return isPlainObjectValue(value) ? Object.assign({}, value) : value;
15591
- }
15592
- function shouldUseSimpleAttributeFastPath(value) {
15593
- return !!isPlainObjectValue(value) && !Object.keys(value).some(key => isPlainObjectValue(value[key]));
15594
- }
15595
15573
  function cloneAttributeSurface(value) {
15596
15574
  if (!isPlainObjectValue(value)) return value;
15597
15575
  const source = value,
@@ -15601,6 +15579,9 @@
15601
15579
  clone[key] = isPlainObjectValue(nextValue) ? Object.assign({}, nextValue) : nextValue;
15602
15580
  }), clone;
15603
15581
  }
15582
+ function areAttributeValuesEqual(left, right) {
15583
+ return left === right || !!(isPlainObjectValue(left) || isPlainObjectValue(right) || Array.isArray(left) || Array.isArray(right)) && isEqual(left, right);
15584
+ }
15604
15585
  function deepMergeAttributeValue(base, value) {
15605
15586
  var _a;
15606
15587
  const result = null !== (_a = cloneAttributeValue(base)) && void 0 !== _a ? _a : {};
@@ -15663,18 +15644,24 @@
15663
15644
  get globalTransMatrix() {
15664
15645
  return this.tryUpdateGlobalTransMatrix(!0);
15665
15646
  }
15647
+ get baseAttributes() {
15648
+ var _a;
15649
+ return null !== (_a = this._baseAttributes) && void 0 !== _a ? _a : this.attribute;
15650
+ }
15651
+ set baseAttributes(value) {
15652
+ value !== this.attribute ? this._baseAttributes = value : this._baseAttributes = void 0;
15653
+ }
15666
15654
  constructor(params = {}) {
15667
15655
  var _a;
15668
- super(), this.resolverEpoch = 0, this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT;
15669
- const useSimpleAttributeFastPath = shouldUseSimpleAttributeFastPath(params),
15670
- initialBaseAttributes = useSimpleAttributeFastPath ? cloneSimpleAttributeRecord(params) : cloneAttributeValue(params);
15671
- 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);
15656
+ 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);
15672
15657
  }
15673
15658
  get normalAttrs() {
15674
15659
  return this.baseAttributes;
15675
15660
  }
15676
- set normalAttrs(value) {
15677
- this._deprecatedNormalAttrsView = null != value ? value : void 0;
15661
+ set normalAttrs(_value) {}
15662
+ getBaseAttributesStorage() {
15663
+ var _a;
15664
+ return null !== (_a = this._baseAttributes) && void 0 !== _a ? _a : this.attribute;
15678
15665
  }
15679
15666
  getGraphicService() {
15680
15667
  var _a, _b;
@@ -15705,10 +15692,18 @@
15705
15692
  const nextScope = this.resolveBoundSharedStateScope();
15706
15693
  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);
15707
15694
  }
15708
- syncSharedStateActiveRegistrations() {
15695
+ syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
15709
15696
  var _a, _b;
15710
- const nextScopes = (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && this.boundSharedStateScope ? new Set(collectSharedStateScopeChain(this.boundSharedStateScope)) : new Set();
15711
- (null !== (_b = this.registeredActiveScopes) && void 0 !== _b ? _b : new Set()).forEach(scope => {
15697
+ 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);
15698
+ }
15699
+ syncSharedStateActiveRegistrations() {
15700
+ var _a;
15701
+ const previousScopes = this.registeredActiveScopes;
15702
+ if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach(scope => {
15703
+ scope.subtreeActiveDescendants.delete(this);
15704
+ }), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
15705
+ const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
15706
+ null == previousScopes || previousScopes.forEach(scope => {
15712
15707
  nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
15713
15708
  }), nextScopes.forEach(scope => {
15714
15709
  scope.subtreeActiveDescendants.add(this);
@@ -15724,15 +15719,13 @@
15724
15719
  this.sharedStateDirty = !0, enqueueGraphicSharedStateRefresh(this.stage, this), scheduleStageSharedStateRefresh(this.stage);
15725
15720
  }
15726
15721
  onParentSharedStateTreeChanged(stage, layer) {
15727
- this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingFromTree() : this.setStage(stage, layer);
15722
+ this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
15728
15723
  }
15729
15724
  refreshSharedStateBeforeRender() {
15730
15725
  var _a;
15731
15726
  (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({
15732
15727
  type: AttributeUpdateType.STATE
15733
- }), this._emitCustomEvent("afterStateUpdate", {
15734
- type: AttributeUpdateType.STATE
15735
- }), this.sharedStateDirty = !1) : this.sharedStateDirty = !1;
15728
+ }), this.emitStateUpdateEvent(), this.sharedStateDirty = !1) : this.sharedStateDirty = !1;
15736
15729
  }
15737
15730
  getLocalStatesVersion() {
15738
15731
  var _a, _b;
@@ -15790,7 +15783,7 @@
15790
15783
  const transition = stateModel.useStates(this.currentStates),
15791
15784
  effectiveStates = null !== (_d = transition.effectiveStates) && void 0 !== _d ? _d : transition.states,
15792
15785
  resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
15793
- this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs), this.syncSharedStateActiveRegistrations();
15786
+ this.currentStates = transition.states, this.effectiveStates = [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.syncSharedStateActiveRegistrations();
15794
15787
  }
15795
15788
  buildStaticAttributeSnapshot() {
15796
15789
  var _a;
@@ -15829,16 +15822,17 @@
15829
15822
  next: void 0
15830
15823
  }), delete target[key]));
15831
15824
  const nextValue = snapshot[key];
15832
- isEqual(previousValue, nextValue) || (delta.set(key, {
15825
+ areAttributeValuesEqual(previousValue, nextValue) || (delta.set(key, {
15833
15826
  prev: previousValue,
15834
15827
  next: nextValue
15835
15828
  }), target[key] = cloneAttributeValue(nextValue));
15836
15829
  }), delta;
15837
15830
  }
15838
15831
  _syncAttribute() {
15832
+ this.attribute === this.baseAttributes && this.resolvedStatePatch && this.detachAttributeFromBaseAttributes();
15839
15833
  const snapshot = this.buildStaticAttributeSnapshot(),
15840
15834
  delta = this.syncObjectToSnapshot(this.attribute, snapshot);
15841
- return this.valid = this.isValid(), delta;
15835
+ return this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, delta;
15842
15836
  }
15843
15837
  _syncFinalAttributeFromStaticTruth() {
15844
15838
  const target = this.finalAttribute;
@@ -15846,47 +15840,146 @@
15846
15840
  const snapshot = this.buildStaticAttributeSnapshot();
15847
15841
  this.syncObjectToSnapshot(target, snapshot);
15848
15842
  }
15849
- submitUpdateByDelta(delta, forceUpdateTag = !1) {
15843
+ mergeAttributeDeltaCategory(category, key, prev, next) {
15844
+ var _a;
15845
+ let nextCategory = "stroke" === key || "shadowBlur" === key ? classifyAttributeDelta(key, prev, next) : null !== (_a = ATTRIBUTE_CATEGORY[key]) && void 0 !== _a ? _a : UpdateCategory.PAINT;
15846
+ return nextCategory & UpdateCategory.PICK && (nextCategory |= UpdateCategory.BOUNDS), nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key) && (nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS), category | nextCategory;
15847
+ }
15848
+ submitUpdateByCategory(category, forceUpdateTag = !1) {
15850
15849
  var _a;
15851
15850
  if (forceUpdateTag) return this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), void this.addUpdateLayoutTag();
15851
+ if (category !== UpdateCategory.NONE) {
15852
+ const stage = this.stage;
15853
+ stage && (null === (_a = getActiveStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordCategory(category));
15854
+ }
15855
+ (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();
15856
+ }
15857
+ submitUpdateByDelta(delta, forceUpdateTag = !1) {
15852
15858
  let category = UpdateCategory.NONE;
15853
15859
  delta.forEach((entry, key) => {
15854
- let nextCategory = classifyAttributeDelta(key, entry.prev, entry.next);
15855
- nextCategory & UpdateCategory.PICK && (nextCategory |= UpdateCategory.BOUNDS), nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key) && (nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS), category |= nextCategory;
15856
- }), 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();
15860
+ category = this.mergeAttributeDeltaCategory(category, key, entry.prev, entry.next);
15861
+ }), this.submitUpdateByCategory(category, forceUpdateTag);
15862
+ }
15863
+ submitTouchedKeyUpdate(keys, forceUpdateTag = !1) {
15864
+ this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTags(keys));
15865
+ }
15866
+ submitTouchedUpdate(needsShapeAndBounds) {
15867
+ !this.updateShapeAndBoundsTagSetted() && needsShapeAndBounds ? this.addUpdateShapeAndBoundsTag() : this.addUpdateBoundTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag();
15857
15868
  }
15858
15869
  commitBaseAttributeMutation(forceUpdateTag = !1, context) {
15859
- var _a, _b;
15860
- (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());
15870
+ var _a, _b, _c;
15871
+ (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());
15861
15872
  const delta = this._syncAttribute();
15862
15873
  this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
15863
15874
  }
15875
+ canCommitBaseAttributesByTouchedKeys() {
15876
+ var _a, _b;
15877
+ 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());
15878
+ }
15879
+ detachAttributeFromBaseAttributes() {
15880
+ this.attribute === this.baseAttributes && (this._baseAttributes = this.attribute, this.attribute = cloneAttributeSurface(this.attribute));
15881
+ }
15882
+ commitInternalBaseAttributes(params, context) {
15883
+ params && Object.keys(params).length && (this.canCommitBaseAttributesByTouchedKeys() ? this.commitBaseAttributesByTouchedKeys(params, !1, context) : (this.detachAttributeFromBaseAttributes(), this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context)));
15884
+ }
15885
+ commitBaseAttributesByTouchedKeys(params, forceUpdateTag = !1, context) {
15886
+ const source = params,
15887
+ baseAttributes = this.getBaseAttributesStorage();
15888
+ let hasKeys = !1,
15889
+ needsShapeAndBounds = forceUpdateTag;
15890
+ for (const key in source) Object.prototype.hasOwnProperty.call(source, key) && (hasKeys = !0, baseAttributes[key] = source[key], !needsShapeAndBounds && this.needUpdateTag(key) && (needsShapeAndBounds = !0));
15891
+ hasKeys && (this.attribute = baseAttributes, this._baseAttributes = void 0, this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, this.submitTouchedUpdate(needsShapeAndBounds), this.onAttributeUpdate(context));
15892
+ }
15893
+ commitBaseAttributeBySingleKey(key, value, forceUpdateTag = !1, context) {
15894
+ 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);
15895
+ }
15864
15896
  applyBaseAttributes(params) {
15865
15897
  const keys = Object.keys(params);
15866
15898
  for (let i = 0; i < keys.length; i++) {
15867
15899
  const key = keys[i];
15868
- this.baseAttributes[key] = cloneAttributeValue(params[key]);
15900
+ this.getBaseAttributesStorage()[key] = params[key];
15869
15901
  }
15870
15902
  }
15903
+ applyAnimationTransientAttributes(params, forceUpdateTag = !1, context) {
15904
+ const source = params;
15905
+ let target,
15906
+ needsShapeAndBounds = forceUpdateTag;
15907
+ 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));
15908
+ target && (this.attributeMayContainTransientAttrs = !0, this.valid = this.isValid(), this.submitTouchedUpdate(needsShapeAndBounds), this.onAttributeUpdate(context));
15909
+ }
15871
15910
  applyTransientAttributes(params, forceUpdateTag = !1, context) {
15911
+ this.detachAttributeFromBaseAttributes();
15872
15912
  const delta = new Map(),
15873
15913
  keys = Object.keys(params);
15874
15914
  for (let i = 0; i < keys.length; i++) {
15875
15915
  const key = keys[i],
15876
15916
  previousValue = this.attribute[key],
15877
15917
  nextValue = params[key];
15878
- isEqual(previousValue, nextValue) || (delta.set(key, {
15918
+ areAttributeValuesEqual(previousValue, nextValue) || (delta.set(key, {
15879
15919
  prev: previousValue,
15880
15920
  next: nextValue
15881
- }), this.attribute[key] = cloneAttributeValue(nextValue));
15921
+ }), this.attribute[key] = nextValue);
15882
15922
  }
15883
- this.valid = this.isValid(), this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
15923
+ delta.size && (this.attributeMayContainTransientAttrs = !0), this.valid = this.isValid(), this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
15884
15924
  }
15885
15925
  _restoreAttributeFromStaticTruth(context) {
15886
15926
  this._syncFinalAttributeFromStaticTruth();
15887
15927
  const delta = this._syncAttribute();
15888
15928
  this.submitUpdateByDelta(delta), this.onAttributeUpdate(context);
15889
15929
  }
15930
+ collectStatePatchDeltaKeys(previousPatch, nextPatch) {
15931
+ const keys = previousPatch ? Object.keys(previousPatch) : [];
15932
+ if (!nextPatch) return keys;
15933
+ for (const key in nextPatch) Object.prototype.hasOwnProperty.call(nextPatch, key) && !Object.prototype.hasOwnProperty.call(null != previousPatch ? previousPatch : {}, key) && keys.push(key);
15934
+ return keys;
15935
+ }
15936
+ getStaticTruthValueForStateKey(key, nextPatch) {
15937
+ var _a;
15938
+ const baseAttributes = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : {},
15939
+ patch = nextPatch;
15940
+ if (patch && Object.prototype.hasOwnProperty.call(patch, key)) {
15941
+ const patchValue = patch[key],
15942
+ baseValue = baseAttributes[key];
15943
+ return "deep" === this.stateMergeMode && isPlainObjectValue(baseValue) && isPlainObjectValue(patchValue) ? {
15944
+ hasValue: !0,
15945
+ value: deepMergeAttributeValue(baseValue, patchValue)
15946
+ } : {
15947
+ hasValue: !0,
15948
+ value: patchValue
15949
+ };
15950
+ }
15951
+ return Object.prototype.hasOwnProperty.call(baseAttributes, key) ? {
15952
+ hasValue: !0,
15953
+ value: baseAttributes[key]
15954
+ } : {
15955
+ hasValue: !1,
15956
+ value: void 0
15957
+ };
15958
+ }
15959
+ syncStatePatchDeltaToTarget(target, keys, nextPatch, collectCategory = !1) {
15960
+ let category = UpdateCategory.NONE;
15961
+ for (let i = 0; i < keys.length; i++) {
15962
+ const key = keys[i],
15963
+ previousValue = target[key],
15964
+ next = this.getStaticTruthValueForStateKey(key, nextPatch);
15965
+ if (!next.hasValue) {
15966
+ Object.prototype.hasOwnProperty.call(target, key) && (delete target[key], collectCategory && (category = this.mergeAttributeDeltaCategory(category, key, previousValue, void 0)));
15967
+ continue;
15968
+ }
15969
+ if (areAttributeValuesEqual(previousValue, next.value)) continue;
15970
+ const nextValue = cloneAttributeValue(next.value);
15971
+ target[key] = nextValue, collectCategory && (category = this.mergeAttributeDeltaCategory(category, key, previousValue, nextValue));
15972
+ }
15973
+ return category;
15974
+ }
15975
+ restoreAttributeFromStatePatchDelta(previousPatch, nextPatch, context) {
15976
+ this.detachAttributeFromBaseAttributes();
15977
+ const keys = this.collectStatePatchDeltaKeys(previousPatch, nextPatch),
15978
+ finalAttribute = this.finalAttribute;
15979
+ finalAttribute && this.syncStatePatchDeltaToTarget(finalAttribute, keys, nextPatch, !1);
15980
+ const category = this.syncStatePatchDeltaToTarget(this.attribute, keys, nextPatch, !0);
15981
+ this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, this.submitUpdateByCategory(category), this.onAttributeUpdate(context);
15982
+ }
15890
15983
  setMode(mode) {
15891
15984
  "3d" === mode ? this.set3dMode() : this.set2dMode();
15892
15985
  }
@@ -15909,7 +16002,7 @@
15909
16002
  return point;
15910
16003
  }
15911
16004
  onAnimateBind(animate) {
15912
- this._emitCustomEvent("animate-bind", animate);
16005
+ this.detachAttributeFromBaseAttributes(), this._emitCustomEvent("animate-bind", animate);
15913
16006
  }
15914
16007
  visitTrackedAnimates(cb) {
15915
16008
  const hook = this.forEachTrackedAnimate;
@@ -15922,8 +16015,22 @@
15922
16015
  const getTrackedAnimates = this.getTrackedAnimates;
15923
16016
  return "function" == typeof getTrackedAnimates ? getTrackedAnimates.call(this).size > 0 : !!(null === (_a = this.animates) || void 0 === _a ? void 0 : _a.size);
15924
16017
  }
16018
+ mayHaveTrackedAnimates() {
16019
+ var _a;
16020
+ return !!(null === (_a = this.animates) || void 0 === _a ? void 0 : _a.size) || !!this._animationStateManager;
16021
+ }
15925
16022
  tryUpdateAABBBounds() {
16023
+ if (!(this.shadowRoot || this._updateTag & UpdateTag.UPDATE_BOUNDS)) return this._AABBBounds;
15926
16024
  const full = "imprecise" === this.attribute.boundsMode;
16025
+ if (!this.shadowRoot) {
16026
+ const graphicService = this.getGraphicService(),
16027
+ graphicTheme = this.getGraphicTheme();
16028
+ if (!graphicService.validCheck(this.attribute, graphicTheme, this._AABBBounds, this)) return this._AABBBounds;
16029
+ if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
16030
+ graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
16031
+ const bounds = this.doUpdateAABBBounds(full, graphicTheme);
16032
+ return graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
16033
+ }
15927
16034
  if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
15928
16035
  if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
15929
16036
  this.getGraphicService().beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
@@ -15996,14 +16103,14 @@
15996
16103
  const _parsedPath = new CustomSymbolClass(symbolType, cache);
15997
16104
  return Graphic.userSymbolMap[symbolType] = _parsedPath, _parsedPath;
15998
16105
  }
15999
- doUpdateAABBBounds(full) {
16106
+ doUpdateAABBBounds(full, graphicTheme) {
16000
16107
  this.updateAABBBoundsStamp++;
16001
- const graphicTheme = this.getGraphicTheme();
16108
+ const resolvedGraphicTheme = null != graphicTheme ? graphicTheme : this.getGraphicTheme();
16002
16109
  this._AABBBounds.clear();
16003
16110
  const attribute = this.attribute,
16004
- bounds = this.updateAABBBounds(attribute, graphicTheme, this._AABBBounds, full),
16111
+ bounds = this.updateAABBBounds(attribute, resolvedGraphicTheme, this._AABBBounds, full),
16005
16112
  {
16006
- boundsPadding = graphicTheme.boundsPadding
16113
+ boundsPadding = resolvedGraphicTheme.boundsPadding
16007
16114
  } = attribute,
16008
16115
  paddingArray = parsePadding(boundsPadding);
16009
16116
  return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(), bounds;
@@ -16071,25 +16178,63 @@
16071
16178
  this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
16072
16179
  }
16073
16180
  setAttributesAndPreventAnimate(params, forceUpdateTag = !1, context, ignorePriority) {
16074
- this.visitTrackedAnimates(animate => {
16075
- (animate.priority !== 1 / 0 || ignorePriority) && Object.keys(params).forEach(key => {
16076
- animate.preventAttr(key);
16077
- });
16181
+ if (!params) return;
16182
+ const keys = Object.keys(params);
16183
+ this.captureTransientFromAttrsBeforePreventAnimate(params, keys, context), this.visitTrackedAnimates(animate => {
16184
+ (animate.priority !== 1 / 0 || ignorePriority) && animate.preventAttrs(keys);
16078
16185
  }), this.applyTransientAttributes(params, forceUpdateTag, context);
16079
16186
  }
16187
+ captureTransientFromAttrsBeforePreventAnimate(params, keys, context) {
16188
+ var _a, _b;
16189
+ const graphicContext = this.context,
16190
+ diffAttrs = null !== (_a = null == graphicContext ? void 0 : graphicContext.diffAttrs) && void 0 !== _a ? _a : params,
16191
+ updateType = null == context ? void 0 : context.type;
16192
+ if (!keys.length || !diffAttrs || updateType === AttributeUpdateType.STATE || null != updateType && updateType >= AttributeUpdateType.ANIMATE_BIND && updateType <= AttributeUpdateType.ANIMATE_END) return;
16193
+ const sameDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs === diffAttrs;
16194
+ let fromAttrs = sameDiffAttrs && null !== (_b = this.transientFromAttrsBeforePreventAnimate) && void 0 !== _b ? _b : null;
16195
+ sameDiffAttrs || (this.transientFromAttrsBeforePreventAnimate = null, this.transientFromAttrsBeforePreventAnimateDiffAttrs = null);
16196
+ let captured = !1;
16197
+ for (let i = 0; i < keys.length; i++) {
16198
+ const key = keys[i];
16199
+ if (!Object.prototype.hasOwnProperty.call(diffAttrs, key)) continue;
16200
+ const previousValue = this.attribute[key],
16201
+ nextValue = params[key];
16202
+ isEqual(previousValue, nextValue) || (null != fromAttrs || (fromAttrs = {}), fromAttrs[key] = cloneAttributeValue(previousValue), captured = !0);
16203
+ }
16204
+ captured && (this.transientFromAttrsBeforePreventAnimate = fromAttrs, this.transientFromAttrsBeforePreventAnimateDiffAttrs = diffAttrs);
16205
+ }
16206
+ consumeTransientFromAttrsBeforePreventAnimate(diffAttrs) {
16207
+ const transientFromAttrs = this.transientFromAttrsBeforePreventAnimate,
16208
+ sourceDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs;
16209
+ if (!transientFromAttrs || !sourceDiffAttrs) return null;
16210
+ 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;
16211
+ let fromAttrs = null,
16212
+ remaining = !1;
16213
+ 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);
16214
+ if (remaining) {
16215
+ const nextTransientFromAttrs = {};
16216
+ for (const key in transientFromAttrs) Object.prototype.hasOwnProperty.call(transientFromAttrs, key) && !Object.prototype.hasOwnProperty.call(diffAttrs, key) && (nextTransientFromAttrs[key] = transientFromAttrs[key]);
16217
+ this.transientFromAttrsBeforePreventAnimate = nextTransientFromAttrs;
16218
+ } else this.transientFromAttrsBeforePreventAnimate = null, this.transientFromAttrsBeforePreventAnimateDiffAttrs = null;
16219
+ return fromAttrs;
16220
+ }
16080
16221
  setAttributes(params, forceUpdateTag = !1, context) {
16081
- 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));
16222
+ 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));
16082
16223
  }
16083
16224
  _setAttributes(params, forceUpdateTag = !1, context) {
16084
- this.applyBaseAttributes(params), this.commitBaseAttributeMutation(forceUpdateTag, context);
16225
+ this.canCommitBaseAttributesByTouchedKeys() ? this.commitBaseAttributesByTouchedKeys(params, forceUpdateTag, context) : (this.detachAttributeFromBaseAttributes(), this.applyBaseAttributes(params), this.commitBaseAttributeMutation(forceUpdateTag, context));
16085
16226
  }
16086
16227
  setAttribute(key, value, forceUpdateTag, context) {
16087
16228
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
16088
16229
  [key]: value
16089
16230
  }, this.attribute, key, context);
16090
- params ? this._setAttributes(params, forceUpdateTag, context) : (this.applyBaseAttributes({
16091
- [key]: value
16092
- }), this.commitBaseAttributeMutation(!!forceUpdateTag, context)), "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
16231
+ if (params) this._setAttributes(params, forceUpdateTag, context);else if (this.canCommitBaseAttributesByTouchedKeys()) this.commitBaseAttributeBySingleKey(key, value, !!forceUpdateTag, context);else {
16232
+ const nextAttrs = {
16233
+ [key]: value
16234
+ };
16235
+ this.applyBaseAttributes(nextAttrs), this.commitBaseAttributeMutation(!!forceUpdateTag, context);
16236
+ }
16237
+ "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
16093
16238
  }
16094
16239
  needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
16095
16240
  for (let i = 0; i < k.length; i++) {
@@ -16108,7 +16253,7 @@
16108
16253
  const context = {
16109
16254
  type: AttributeUpdateType.INIT
16110
16255
  };
16111
- 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);
16256
+ 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);
16112
16257
  }
16113
16258
  translate(x, y) {
16114
16259
  var _a, _b;
@@ -16120,10 +16265,15 @@
16120
16265
  x: x,
16121
16266
  y: y
16122
16267
  }, this.attribute, tempConstantXYKey, context);
16123
- params && (x = params.x, y = params.y, delete params.x, delete params.y, this.applyBaseAttributes(params));
16268
+ params && (x = params.x, y = params.y, delete params.x, delete params.y);
16124
16269
  const attribute = this.baseAttributes,
16125
- postMatrix = attribute.postMatrix;
16126
- 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;
16270
+ postMatrix = attribute.postMatrix,
16271
+ nextAttrs = params || {};
16272
+ if (postMatrix) {
16273
+ const nextPostMatrix = postMatrix.clone();
16274
+ application.transformUtil.fromMatrix(nextPostMatrix, nextPostMatrix).translate(x, y), nextAttrs.postMatrix = nextPostMatrix;
16275
+ } 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;
16276
+ return this.commitInternalBaseAttributes(nextAttrs, context), this;
16127
16277
  }
16128
16278
  translateTo(x, y) {
16129
16279
  const attribute = this.baseAttributes;
@@ -16135,7 +16285,10 @@
16135
16285
  x: x,
16136
16286
  y: y
16137
16287
  }, this.attribute, tempConstantXYKey, context);
16138
- return params ? (this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context), this) : (attribute.x = x, attribute.y = y, this.commitBaseAttributeMutation(!1, context), this);
16288
+ return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
16289
+ x: x,
16290
+ y: y
16291
+ }, context), this);
16139
16292
  }
16140
16293
  scale(scaleX, scaleY, scaleCenter) {
16141
16294
  var _a, _b;
@@ -16148,15 +16301,16 @@
16148
16301
  scaleY: scaleY,
16149
16302
  scaleCenter: scaleCenter
16150
16303
  }, this.attribute, tempConstantScaleXYKey, context);
16151
- params && (scaleX = params.scaleX, scaleY = params.scaleY, delete params.scaleX, delete params.scaleY, this.applyBaseAttributes(params));
16152
- const attribute = this.baseAttributes;
16304
+ params && (scaleX = params.scaleX, scaleY = params.scaleY, delete params.scaleX, delete params.scaleY);
16305
+ const attribute = this.baseAttributes,
16306
+ nextAttrs = params || {};
16153
16307
  if (scaleCenter) {
16154
16308
  let {
16155
16309
  postMatrix: postMatrix
16156
- } = this.attribute;
16157
- postMatrix || (postMatrix = new Matrix(), attribute.postMatrix = postMatrix), application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter);
16158
- } 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;
16159
- return this.commitBaseAttributeMutation(!1, context), this;
16310
+ } = this.baseAttributes;
16311
+ postMatrix = postMatrix ? postMatrix.clone() : new Matrix(), application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter), nextAttrs.postMatrix = postMatrix;
16312
+ } 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;
16313
+ return this.commitInternalBaseAttributes(nextAttrs, context), this;
16160
16314
  }
16161
16315
  scaleTo(scaleX, scaleY) {
16162
16316
  const attribute = this.baseAttributes;
@@ -16168,7 +16322,10 @@
16168
16322
  scaleX: scaleX,
16169
16323
  scaleY: scaleY
16170
16324
  }, this.attribute, tempConstantScaleXYKey, context);
16171
- return params ? (this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context), this) : (attribute.scaleX = scaleX, attribute.scaleY = scaleY, this.commitBaseAttributeMutation(!1, context), this);
16325
+ return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
16326
+ scaleX: scaleX,
16327
+ scaleY: scaleY
16328
+ }, context), this);
16172
16329
  }
16173
16330
  rotate(angle, rotateCenter) {
16174
16331
  var _a;
@@ -16180,24 +16337,26 @@
16180
16337
  angle: angle,
16181
16338
  rotateCenter: rotateCenter
16182
16339
  }, this.attribute, tempConstantAngleKey, context);
16183
- params && (delete params.angle, this.applyBaseAttributes(params));
16184
- const attribute = this.baseAttributes;
16340
+ params && delete params.angle;
16341
+ const attribute = this.baseAttributes,
16342
+ nextAttrs = params || {};
16185
16343
  if (rotateCenter) {
16186
16344
  let {
16187
16345
  postMatrix: postMatrix
16188
16346
  } = this.baseAttributes;
16189
- postMatrix || (postMatrix = new Matrix(), this.baseAttributes.postMatrix = postMatrix), application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter);
16190
- } else attribute.angle = (null !== (_a = attribute.angle) && void 0 !== _a ? _a : DefaultTransform.angle) + angle;
16191
- return this.commitBaseAttributeMutation(!1, context), this;
16347
+ postMatrix = postMatrix ? postMatrix.clone() : new Matrix(), application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter), nextAttrs.postMatrix = postMatrix;
16348
+ } else nextAttrs.angle = (null !== (_a = attribute.angle) && void 0 !== _a ? _a : DefaultTransform.angle) + angle;
16349
+ return this.commitInternalBaseAttributes(nextAttrs, context), this;
16192
16350
  }
16193
16351
  rotateTo(angle) {
16194
- const attribute = this.baseAttributes;
16195
- if (attribute.angle === angle) return this;
16352
+ if (this.baseAttributes.angle === angle) return this;
16196
16353
  const context = {
16197
16354
  type: AttributeUpdateType.ROTATE_TO
16198
16355
  },
16199
16356
  params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(angle, this.attribute, tempConstantAngleKey, context);
16200
- return params ? (this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context), this) : (attribute.angle = angle, this.commitBaseAttributeMutation(!1, context), this);
16357
+ return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
16358
+ angle: angle
16359
+ }, context), this);
16201
16360
  }
16202
16361
  skewTo(b, c) {
16203
16362
  return this;
@@ -16236,6 +16395,131 @@
16236
16395
  stateEngine: this.stateEngine
16237
16396
  });
16238
16397
  }
16398
+ resolveSimpleLocalStateTransition(states, previousStates) {
16399
+ var _a;
16400
+ 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;
16401
+ if (1 === states.length) {
16402
+ const stateName = states[0],
16403
+ hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName),
16404
+ nextStates = [stateName],
16405
+ changed = !this.sameStateNames(previousStates, nextStates),
16406
+ resolvedStateAttrs = {};
16407
+ if (hasDefinition) {
16408
+ const attrs = this.states[stateName];
16409
+ if (null != attrs) {
16410
+ if (!isPlainObjectValue(attrs)) return null;
16411
+ const keys = Object.keys(attrs);
16412
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
16413
+ const key = keys[keyIndex];
16414
+ if (FULL_STATE_DEFINITION_KEYS.has(key)) return null;
16415
+ const attrValue = attrs[key];
16416
+ resolvedStateAttrs[key] = isPlainObjectValue(attrValue) ? cloneAttributeValue(attrValue) : attrValue;
16417
+ }
16418
+ }
16419
+ }
16420
+ return {
16421
+ changed: changed,
16422
+ states: nextStates,
16423
+ effectiveStates: nextStates,
16424
+ resolvedStateAttrs: resolvedStateAttrs
16425
+ };
16426
+ }
16427
+ const uniqueStates = Array.from(new Set(states)),
16428
+ withDefinition = [],
16429
+ withoutDefinition = [];
16430
+ for (let i = 0; i < uniqueStates.length; i++) {
16431
+ const stateName = uniqueStates[i];
16432
+ Object.prototype.hasOwnProperty.call(this.states, stateName) ? withDefinition.push(stateName) : withoutDefinition.push(stateName);
16433
+ }
16434
+ withDefinition.sort((left, right) => left.localeCompare(right));
16435
+ const nextStates = withDefinition.concat(withoutDefinition),
16436
+ changed = !this.sameStateNames(previousStates, nextStates),
16437
+ resolvedStateAttrs = {};
16438
+ for (let i = 0; i < nextStates.length; i++) {
16439
+ const stateName = nextStates[i];
16440
+ if (!Object.prototype.hasOwnProperty.call(this.states, stateName)) continue;
16441
+ const attrs = this.states[stateName];
16442
+ if (null == attrs) continue;
16443
+ if (!isPlainObjectValue(attrs)) return null;
16444
+ const keys = Object.keys(attrs);
16445
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
16446
+ const key = keys[keyIndex];
16447
+ if (FULL_STATE_DEFINITION_KEYS.has(key)) return null;
16448
+ const attrValue = attrs[key];
16449
+ resolvedStateAttrs[key] = isPlainObjectValue(attrValue) ? cloneAttributeValue(attrValue) : attrValue;
16450
+ }
16451
+ }
16452
+ return {
16453
+ changed: changed,
16454
+ states: nextStates,
16455
+ effectiveStates: nextStates,
16456
+ resolvedStateAttrs: resolvedStateAttrs
16457
+ };
16458
+ }
16459
+ resolveGraphicStateTransition(states, previousStates, forceResolverRefresh = !1) {
16460
+ var _a, _b, _c, _d;
16461
+ let transition = this.resolveSimpleLocalStateTransition(states, previousStates);
16462
+ const isSimpleLocalTransition = !!transition;
16463
+ let resolvedStateAttrs;
16464
+ if (transition) resolvedStateAttrs = transition.resolvedStateAttrs;else {
16465
+ const stateResolveBaseAttrs = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute,
16466
+ stateModel = this.createStateModel();
16467
+ 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);
16468
+ }
16469
+ return {
16470
+ transition: transition,
16471
+ effectiveStates: null !== (_d = transition.effectiveStates) && void 0 !== _d ? _d : transition.states,
16472
+ resolvedStateAttrs: resolvedStateAttrs,
16473
+ isSimpleLocalTransition: isSimpleLocalTransition
16474
+ };
16475
+ }
16476
+ normalizeSetStatesOptions(options) {
16477
+ return options && "object" == typeof options ? {
16478
+ hasAnimation: options.animate,
16479
+ animateSameStatePatchChange: !0 === options.animateSameStatePatchChange,
16480
+ shouldRefreshSameStatePatch: !0
16481
+ } : {
16482
+ hasAnimation: "boolean" == typeof options ? options : void 0,
16483
+ animateSameStatePatchChange: !1,
16484
+ shouldRefreshSameStatePatch: !1
16485
+ };
16486
+ }
16487
+ sameStatePatches(left, right) {
16488
+ const leftRecord = null != left ? left : {},
16489
+ rightRecord = null != right ? right : {},
16490
+ keys = new Set([...Object.keys(leftRecord), ...Object.keys(rightRecord)]);
16491
+ for (const key of keys) {
16492
+ if (Object.prototype.hasOwnProperty.call(leftRecord, key) !== Object.prototype.hasOwnProperty.call(rightRecord, key)) return !1;
16493
+ if (!areAttributeValuesEqual(leftRecord[key], rightRecord[key])) return !1;
16494
+ }
16495
+ return !0;
16496
+ }
16497
+ commitSameStatePatchRefresh(states, hasAnimation, animateSameStatePatchChange = !1) {
16498
+ var _a;
16499
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
16500
+ previousResolvedStatePatch = this.resolvedStatePatch,
16501
+ {
16502
+ transition: transition,
16503
+ effectiveStates: effectiveStates,
16504
+ resolvedStateAttrs: resolvedStateAttrs,
16505
+ isSimpleLocalTransition: isSimpleLocalTransition
16506
+ } = this.resolveGraphicStateTransition(states, previousStates, !0),
16507
+ patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
16508
+ 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)) {
16509
+ if (this.stage) {
16510
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
16511
+ null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
16512
+ graphicId: this._uid,
16513
+ targetStates: [...transition.states]
16514
+ });
16515
+ }
16516
+ hasAnimation && animateSameStatePatchChange ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
16517
+ type: AttributeUpdateType.STATE
16518
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
16519
+ type: AttributeUpdateType.STATE
16520
+ }), this.emitStateUpdateEvent());
16521
+ }
16522
+ }
16239
16523
  resolveStateAnimateConfig(animateConfig) {
16240
16524
  var _a, _b, _c;
16241
16525
  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;
@@ -16256,9 +16540,7 @@
16256
16540
  });
16257
16541
  this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
16258
16542
  }
16259
- updateNormalAttrs(stateAttrs) {
16260
- this._deprecatedNormalAttrsView = cloneAttributeValue(this.baseAttributes);
16261
- }
16543
+ updateNormalAttrs(_stateAttrs) {}
16262
16544
  getStateTransitionDefaultAttribute(key, targetAttrs) {
16263
16545
  return this.getDefaultAttribute(key);
16264
16546
  }
@@ -16268,6 +16550,7 @@
16268
16550
  stopStateAnimates(type = "end") {
16269
16551
  const stopAnimationState = this.stopAnimationState;
16270
16552
  if ("function" == typeof stopAnimationState) return void stopAnimationState.call(this, "state", type);
16553
+ if (!this.mayHaveTrackedAnimates()) return;
16271
16554
  const stateAnimates = [];
16272
16555
  this.visitTrackedAnimates(animate => {
16273
16556
  animate.stateNames && stateAnimates.push(animate);
@@ -16280,19 +16563,25 @@
16280
16563
  }
16281
16564
  clearStates(hasAnimation) {
16282
16565
  var _a, _b, _c;
16283
- const previousStates = this.currentStates ? this.currentStates.slice() : [],
16284
- previousResolvedStatePatch = this.resolvedStatePatch ? cloneAttributeValue(this.resolvedStatePatch) : void 0,
16566
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
16567
+ previousResolvedStatePatch = this.resolvedStatePatch,
16285
16568
  transition = this.createStateModel().clearStates();
16286
16569
  if (!transition.changed && 0 === previousStates.length) return this.currentStates = [], this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, void this.clearSharedStateActiveRegistrations();
16287
- const resolvedStateAttrs = cloneAttributeValue(null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : {});
16288
- 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", {
16289
- graphicId: this._uid,
16290
- targetStates: []
16291
- }), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
16292
- type: AttributeUpdateType.STATE
16293
- }), this._emitCustomEvent("afterStateUpdate", {
16294
- type: AttributeUpdateType.STATE
16295
- })));
16570
+ const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
16571
+ if (!transition.changed || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0)) {
16572
+ if (this.currentStates = transition.states, this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1, this.clearSharedStateActiveRegistrations(), this.stage) {
16573
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
16574
+ null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
16575
+ graphicId: this._uid,
16576
+ targetStates: []
16577
+ });
16578
+ }
16579
+ hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
16580
+ type: AttributeUpdateType.STATE
16581
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
16582
+ type: AttributeUpdateType.STATE
16583
+ }), this.emitStateUpdateEvent());
16584
+ }
16296
16585
  }
16297
16586
  removeState(stateName, hasAnimation) {
16298
16587
  const transition = this.createStateModel().removeState(stateName);
@@ -16306,39 +16595,59 @@
16306
16595
  const transition = this.createStateModel().addState(stateName, keepCurrentStates);
16307
16596
  transition.changed && this.useStates(transition.states, hasAnimation);
16308
16597
  }
16598
+ setStates(states, options) {
16599
+ var _a, _b, _c;
16600
+ const {
16601
+ hasAnimation: hasAnimation,
16602
+ animateSameStatePatchChange: animateSameStatePatchChange,
16603
+ shouldRefreshSameStatePatch: shouldRefreshSameStatePatch
16604
+ } = this.normalizeSetStatesOptions(options),
16605
+ nextStates = (null == states ? void 0 : states.length) ? states : EMPTY_STATE_NAMES,
16606
+ 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));
16607
+ if (nextStates.length) {
16608
+ if (this.sameStateNames(this.currentStates, nextStates)) return shouldRefreshSameStatePatch ? void this.commitSameStatePatchRefresh(nextStates, hasAnimation, animateSameStatePatchChange) : void (this.sharedStateDirty && this.refreshSharedStateBeforeRender());
16609
+ this.useStates(nextStates, hasAnimation);
16610
+ } else {
16611
+ if (!hasCurrentState && !this.sharedStateDirty) return;
16612
+ this.clearStates(hasAnimation);
16613
+ }
16614
+ }
16309
16615
  useStates(states, hasAnimation) {
16310
- var _a, _b, _c, _d, _e;
16616
+ var _a;
16311
16617
  if (!states.length) return void this.clearStates(hasAnimation);
16312
- const previousStates = this.currentStates ? this.currentStates.slice() : [],
16313
- previousResolvedStatePatch = this.resolvedStatePatch ? cloneAttributeValue(this.resolvedStatePatch) : void 0,
16314
- stateResolveBaseAttrs = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute,
16315
- stateModel = this.createStateModel();
16316
- null === (_b = this.stateEngine) || void 0 === _b || _b.setResolveContext(this, stateResolveBaseAttrs);
16317
- const transition = stateModel.useStates(states);
16318
- if (!transition.changed && this.sameStateNames(previousStates, transition.states)) return;
16319
- const effectiveStates = null !== (_c = transition.effectiveStates) && void 0 !== _c ? _c : transition.states,
16320
- resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
16321
- 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", {
16322
- graphicId: this._uid,
16323
- targetStates: [...transition.states]
16324
- }), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
16325
- type: AttributeUpdateType.STATE
16326
- }), this._emitCustomEvent("afterStateUpdate", {
16327
- type: AttributeUpdateType.STATE
16328
- })));
16618
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES,
16619
+ previousResolvedStatePatch = this.resolvedStatePatch,
16620
+ {
16621
+ transition: transition,
16622
+ effectiveStates: effectiveStates,
16623
+ resolvedStateAttrs: resolvedStateAttrs,
16624
+ isSimpleLocalTransition: isSimpleLocalTransition
16625
+ } = this.resolveGraphicStateTransition(states, previousStates);
16626
+ if ((transition.changed || !this.sameStateNames(previousStates, transition.states)) && this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) {
16627
+ if (this.currentStates = transition.states, this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stage) {
16628
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
16629
+ null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
16630
+ graphicId: this._uid,
16631
+ targetStates: [...transition.states]
16632
+ });
16633
+ }
16634
+ hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(), this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
16635
+ type: AttributeUpdateType.STATE
16636
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
16637
+ type: AttributeUpdateType.STATE
16638
+ }), this.emitStateUpdateEvent());
16639
+ }
16329
16640
  }
16330
16641
  invalidateResolver() {
16331
- var _a, _b;
16642
+ var _a, _b, _c;
16332
16643
  if (!this.stateEngine || !(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.compiledStateDefinitions) return;
16333
16644
  const stateResolveBaseAttrs = null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : this.attribute;
16334
- this.stateEngine.setResolveContext(this, stateResolveBaseAttrs), this.resolverEpoch += 1, this.stateEngine.invalidateResolverCache();
16645
+ this.stateEngine.setResolveContext(this, stateResolveBaseAttrs), this.resolverEpoch = (null !== (_c = this.resolverEpoch) && void 0 !== _c ? _c : 0) + 1, this.stateEngine.invalidateResolverCache();
16335
16646
  const transition = this.stateEngine.applyStates(this.currentStates),
16336
16647
  resolvedStateAttrs = Object.assign({}, this.stateEngine.resolvedPatch);
16337
- this.effectiveStates = [...transition.effectiveStates], this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs), this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
16338
- type: AttributeUpdateType.STATE
16339
- }), this._emitCustomEvent("afterStateUpdate", {
16648
+ this.effectiveStates = [...transition.effectiveStates], this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
16340
16649
  type: AttributeUpdateType.STATE
16341
- });
16650
+ }), this.emitStateUpdateEvent();
16342
16651
  }
16343
16652
  sameStateNames(left, right) {
16344
16653
  const normalizedLeft = null != left ? left : [],
@@ -16359,6 +16668,9 @@
16359
16668
  addUpdateShapeAndBoundsTag() {
16360
16669
  this._updateTag |= UpdateTag.UPDATE_SHAPE_AND_BOUNDS, this.parent && this.parent.addChildUpdateBoundTag(), this.glyphHost && this.glyphHost.addUpdateBoundTag();
16361
16670
  }
16671
+ addBroadUpdateTag() {
16672
+ 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();
16673
+ }
16362
16674
  updateShapeAndBoundsTagSetted() {
16363
16675
  return (this._updateTag & UpdateTag.UPDATE_SHAPE_AND_BOUNDS) === UpdateTag.UPDATE_SHAPE_AND_BOUNDS;
16364
16676
  }
@@ -16446,13 +16758,13 @@
16446
16758
  }
16447
16759
  }
16448
16760
  setStage(stage, layer) {
16449
- var _a, _b, _c, _d, _e, _f, _g, _h;
16761
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
16450
16762
  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,
16451
16763
  previousStage = this.stage;
16452
16764
  if (this.stage !== stage || this.layer !== layer) {
16453
- 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()) {
16454
- const previousTimeline = null === (_e = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _e ? void 0 : _e.call(previousStage),
16455
- nextTimeline = null === (_f = null == stage ? void 0 : stage.getTimeline) || void 0 === _f ? void 0 : _f.call(stage),
16765
+ 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()) {
16766
+ const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage),
16767
+ nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage),
16456
16768
  detachedStageAnimates = [];
16457
16769
  this.visitTrackedAnimates(a => {
16458
16770
  (!!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)));
@@ -16465,9 +16777,13 @@
16465
16777
  type: AttributeUpdateType.ANIMATE_END
16466
16778
  }));
16467
16779
  }
16468
- 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));
16780
+ 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));
16469
16781
  }
16470
- this.syncSharedStateScopeBindingFromTree(!!(null === (_h = this.currentStates) || void 0 === _h ? void 0 : _h.length));
16782
+ ((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);
16783
+ }
16784
+ detachStageForRelease() {
16785
+ var _a, _b, _c;
16786
+ (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));
16471
16787
  }
16472
16788
  setStageToShadowRoot(stage, layer) {
16473
16789
  this.shadowRoot && this.shadowRoot.setStage(stage, layer);
@@ -16534,6 +16850,7 @@
16534
16850
  res && (res.state = "fail", cb && cb());
16535
16851
  }
16536
16852
  _stopAnimates() {
16853
+ if (!this.mayHaveTrackedAnimates()) return;
16537
16854
  const animates = [];
16538
16855
  this.visitTrackedAnimates(animate => {
16539
16856
  animates.push(animate);
@@ -16547,14 +16864,17 @@
16547
16864
  });
16548
16865
  }
16549
16866
  release() {
16550
- var _a, _b, _c;
16551
- this.releaseStatus = "released", this.clearSharedStateActiveRegistrations(), this.stopAnimates();
16552
- const graphicService = null !== (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.graphicService) && void 0 !== _b ? _b : application.graphicService;
16553
- null === (_c = null == graphicService ? void 0 : graphicService.onRelease) || void 0 === _c || _c.call(graphicService, this), super.release();
16867
+ var _a, _b, _c, _d;
16868
+ this.releaseStatus = "released", (null === (_a = this.registeredActiveScopes) || void 0 === _a ? void 0 : _a.size) && this.clearSharedStateActiveRegistrations(), (this.mayHaveTrackedAnimates() || this.shadowRoot) && this.stopAnimates();
16869
+ const graphicService = null !== (_c = null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application.graphicService;
16870
+ null === (_d = null == graphicService ? void 0 : graphicService.onRelease) || void 0 === _d || _d.call(graphicService, this), super.release();
16871
+ }
16872
+ hasCustomEvent(type) {
16873
+ return !!this._events && type in this._events;
16554
16874
  }
16555
16875
  _dispatchCustomEvent(type, context) {
16556
16876
  var _a, _b;
16557
- if (this._events && type in this._events) {
16877
+ if (this.hasCustomEvent(type)) {
16558
16878
  const changeEvent = new CustomEvent(type, context);
16559
16879
  changeEvent.bubbles = !1;
16560
16880
  const manager = null === (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventSystem) || void 0 === _b ? void 0 : _b.manager;
@@ -16563,7 +16883,7 @@
16563
16883
  return !0;
16564
16884
  }
16565
16885
  beforeStateUpdate(attrs, prevStates, nextStates, hasAnimation, isClear) {
16566
- return this._dispatchCustomEvent("beforeStateUpdate", {
16886
+ return !this.hasCustomEvent("beforeStateUpdate") || this._dispatchCustomEvent("beforeStateUpdate", {
16567
16887
  type: AttributeUpdateType.STATE,
16568
16888
  attrs: Object.assign({}, attrs),
16569
16889
  prevStates: prevStates.slice(),
@@ -16572,6 +16892,11 @@
16572
16892
  isClear: !!isClear
16573
16893
  });
16574
16894
  }
16895
+ emitStateUpdateEvent() {
16896
+ this.hasCustomEvent("afterStateUpdate") && this._emitCustomEvent("afterStateUpdate", {
16897
+ type: AttributeUpdateType.STATE
16898
+ });
16899
+ }
16575
16900
  _emitCustomEvent(type, context) {
16576
16901
  this._dispatchCustomEvent(type, context);
16577
16902
  }
@@ -19578,13 +19903,15 @@
19578
19903
  }(GroupUpdateAABBBoundsMode || (GroupUpdateAABBBoundsMode = {}));
19579
19904
  let Group$1 = class Group extends Graphic {
19580
19905
  constructor(params) {
19581
- super(params), this.type = "group", this.parent = null, this.isContainer = !0, this.numberType = GROUP_NUMBER_TYPE, this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
19906
+ super(params), this.type = "group", this.parent = null, this.isContainer = !0, this._hasSharedStateDefinitions = !1, this.numberType = GROUP_NUMBER_TYPE, this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
19582
19907
  }
19583
19908
  get sharedStateDefinitions() {
19584
19909
  return this._sharedStateDefinitions;
19585
19910
  }
19586
19911
  set sharedStateDefinitions(value) {
19587
- this._sharedStateDefinitions !== value && (this._sharedStateDefinitions = value, this.ensureSharedStateScopeBound(), this.sharedStateScope && (setSharedStateScopeLocalDefinitions(this.sharedStateScope, value), markScopeActiveDescendantsDirty(this.sharedStateScope, this.stage)));
19912
+ if (this._sharedStateDefinitions === value) return;
19913
+ const previousScope = this.sharedStateScope;
19914
+ 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();
19588
19915
  }
19589
19916
  setMode(mode) {
19590
19917
  "3d" === mode ? this.set3dMode() : this.set2dMode();
@@ -19709,9 +20036,10 @@
19709
20036
  insertInto(newNode, idx) {
19710
20037
  return this._updateChildToStage(super.insertInto(newNode, idx));
19711
20038
  }
19712
- removeChild(child) {
20039
+ removeChild(child, highPerformance = !1) {
20040
+ var _a;
19713
20041
  const data = super.removeChild(child);
19714
- return this.getGraphicService().onRemove(child), child.setStage(null, null), this.addUpdateBoundTag(), data;
20042
+ 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;
19715
20043
  }
19716
20044
  removeAllChild(deep = !1) {
19717
20045
  const children = this.children.slice();
@@ -19723,11 +20051,13 @@
19723
20051
  }
19724
20052
  setStage(stage, layer) {
19725
20053
  var _a, _b, _c, _d, _e, _f;
19726
- 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;
19727
- 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 => {
20054
+ 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,
20055
+ 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;
20056
+ 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 => {
19728
20057
  item.setStage(stage, this.layer);
19729
20058
  });
19730
- this.layer !== layer && (this.layer = layer), this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingFromTree(!!(null === (_f = this.currentStates) || void 0 === _f ? void 0 : _f.length)), this.forEachChildren(item => {
20059
+ const layerChanged = this.layer !== layer;
20060
+ layerChanged && (this.layer = layer), needsSharedStateTreeSync ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingOnTreeChange(!0), this.notifyChildrenSharedStateTreeChanged()) : layerChanged && this.forEachChildren(item => {
19731
20061
  item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(stage, this.layer);
19732
20062
  });
19733
20063
  }
@@ -19774,15 +20104,29 @@
19774
20104
  g.release(all);
19775
20105
  }), super.release();
19776
20106
  }
20107
+ detachStageForRelease() {
20108
+ super.detachStageForRelease(), this.sharedStateScope = void 0, this.forEachChildren(item => {
20109
+ var _a;
20110
+ null === (_a = item.detachStageForRelease) || void 0 === _a || _a.call(item);
20111
+ });
20112
+ }
19777
20113
  ensureSharedStateScopeBound() {
19778
20114
  var _a, _b, _c;
20115
+ if (!this.hasSharedStateDefinitions()) return void (this.sharedStateScope = void 0);
19779
20116
  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;
19780
20117
  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);
19781
20118
  }
20119
+ hasSharedStateDefinitions() {
20120
+ return this._hasSharedStateDefinitions;
20121
+ }
20122
+ notifyChildrenSharedStateTreeChanged() {
20123
+ this.forEachChildren(item => {
20124
+ item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(this.stage, this.layer);
20125
+ });
20126
+ }
19782
20127
  onParentSharedStateTreeChanged(stage, layer) {
19783
- this.stage === stage && this.layer === layer ? (this.ensureSharedStateScopeBound(), this.syncSharedStateScopeBindingFromTree(), this.forEachChildren(item => {
19784
- item.onParentSharedStateTreeChanged && item.onParentSharedStateTreeChanged(stage, this.layer);
19785
- })) : this.setStage(stage, layer);
20128
+ var _a;
20129
+ 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);
19786
20130
  }
19787
20131
  };
19788
20132
  Group$1.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
@@ -20130,7 +20474,10 @@
20130
20474
  beforeUpdateAABBBounds: new SyncHook(["graphic", "stage", "willUpdate", "aabbBounds"]),
20131
20475
  afterUpdateAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds", "globalAABBBounds", "selfChange"]),
20132
20476
  clearAABBBounds: new SyncHook(["graphic", "stage", "aabbBounds"])
20133
- }, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds();
20477
+ }, this.tempAABBBounds1 = new AABBBounds(), this.tempAABBBounds2 = new AABBBounds(), this.tempAABBBoundsResult = {
20478
+ tb1: this.tempAABBBounds1,
20479
+ tb2: this.tempAABBBounds2
20480
+ };
20134
20481
  }
20135
20482
  onAttributeUpdate(graphic) {
20136
20483
  this.hooks.onAttributeUpdate.taps.length && this.hooks.onAttributeUpdate.call(graphic);
@@ -20230,10 +20577,7 @@
20230
20577
  updateTempAABBBounds(aabbBounds) {
20231
20578
  const tb1 = this.tempAABBBounds1,
20232
20579
  tb2 = this.tempAABBBounds2;
20233
- return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), {
20234
- tb1: tb1,
20235
- tb2: tb2
20236
- };
20580
+ return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), this.tempAABBBoundsResult;
20237
20581
  }
20238
20582
  }
20239
20583
 
@@ -21575,7 +21919,7 @@
21575
21919
  const globalBounds = new AABBBounds();
21576
21920
  class DirtyBoundsPlugin {
21577
21921
  constructor() {
21578
- this.name = "DirtyBoundsPlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.handlePaintOnlyUpdate = graphic => {
21922
+ this.name = "DirtyBoundsPlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.dirtyBoundsHooksRegistered = !1, this.handlePaintOnlyUpdate = graphic => {
21579
21923
  var _a, _b, _c, _d;
21580
21924
  const stage = this.pluginService.stage;
21581
21925
  if (!stage || stage !== graphic.stage || !stage.renderCount) return;
@@ -21595,12 +21939,13 @@
21595
21939
  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));
21596
21940
  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;
21597
21941
  }
21598
- activate(context) {
21599
- this.pluginService = context, context.stage.hooks.afterRender.tap(this.key, stage => {
21600
- stage && stage === this.pluginService.stage && stage.dirtyBounds.clear();
21601
- });
21602
- const stage = this.pluginService.stage;
21603
- stage && (stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handlePaintOnlyUpdate), stage.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, (graphic, stage, willUpdate, bounds) => {
21942
+ getRemoveDirtyBounds(graphic) {
21943
+ var _a;
21944
+ const cachedBounds = (null !== (_a = graphic.glyphHost) && void 0 !== _a ? _a : graphic)._globalAABBBounds;
21945
+ if (cachedBounds && "function" == typeof cachedBounds.empty && !cachedBounds.empty()) return cachedBounds;
21946
+ }
21947
+ registerDirtyBoundsHooks(stage) {
21948
+ this.dirtyBoundsHooksRegistered || (stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handlePaintOnlyUpdate), stage.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, (graphic, stage, willUpdate, bounds) => {
21604
21949
  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)));
21605
21950
  }), stage.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, (graphic, stage, bounds, params, selfChange) => {
21606
21951
  stage && stage === this.pluginService.stage && stage.renderCount && (graphic.isContainer && !selfChange || stage.dirty(params.globalAABBBounds));
@@ -21608,12 +21953,21 @@
21608
21953
  stage && stage === this.pluginService.stage && stage.renderCount && stage && stage.dirty(bounds);
21609
21954
  }), stage.graphicService.hooks.onRemove.tap(this.key, graphic => {
21610
21955
  const stage = graphic.stage;
21611
- stage && stage === this.pluginService.stage && stage.renderCount && stage && stage.dirty(graphic.globalAABBBounds);
21612
- }));
21956
+ if (!stage || stage !== this.pluginService.stage || !stage.renderCount) return;
21957
+ const bounds = this.getRemoveDirtyBounds(graphic);
21958
+ bounds && !bounds.empty() && stage.dirty(bounds);
21959
+ }), this.dirtyBoundsHooksRegistered = !0);
21960
+ }
21961
+ activate(context) {
21962
+ this.pluginService = context, context.stage.hooks.afterRender.tap(this.key, stage => {
21963
+ stage && stage === this.pluginService.stage && (stage.dirtyBounds.clear(), this.registerDirtyBoundsHooks(stage));
21964
+ });
21965
+ const stage = this.pluginService.stage;
21966
+ stage && stage.renderCount && this.registerDirtyBoundsHooks(stage);
21613
21967
  }
21614
21968
  deactivate(context) {
21615
21969
  const stage = this.pluginService.stage;
21616
- 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));
21970
+ 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));
21617
21971
  }
21618
21972
  }
21619
21973
 
@@ -21969,7 +22323,7 @@
21969
22323
  ticker.bindStage(this), this._ticker && this._ticker.removeListener("tick", this.afterTickCb), ticker.addTimeline(this.timeline), this._ticker = ticker, this._ticker.on("tick", this.afterTickCb);
21970
22324
  }
21971
22325
  constructor(params = {}, deps = {}) {
21972
- var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
22326
+ var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
21973
22327
  super({}), this.tickedBeforeRender = !0, this._onVisibleChange = visible => {
21974
22328
  if (!(this._skipRender < 0)) if (visible) {
21975
22329
  if (this.dirtyBounds) {
@@ -21979,7 +22333,8 @@
21979
22333
  this._skipRender > 1 && this.renderNextFrame(), this._skipRender = 0;
21980
22334
  } else this._skipRender = 1;
21981
22335
  }, this.beforeRender = stage => {
21982
- flushStageSharedStateRefresh(this), this._beforeRenderList.forEach(cb => cb(stage));
22336
+ const pendingSharedRefresh = this._pendingSharedStateRefreshGraphics;
22337
+ (null == pendingSharedRefresh ? void 0 : pendingSharedRefresh.size) && flushStageSharedStateRefresh(this), this._beforeRenderList.forEach(cb => cb(stage));
21983
22338
  }, this.afterClearScreen = drawParams => {
21984
22339
  this._afterClearScreen && this._afterClearScreen(drawParams);
21985
22340
  }, this.afterClearRect = drawParams => {
@@ -22004,14 +22359,17 @@
22004
22359
  canvas: params.canvas
22005
22360
  }), 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, {
22006
22361
  main: !0
22007
- })), 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 = () => {
22362
+ })), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.theme.onStateDefinitionsChange = () => {
22008
22363
  var _a;
22009
- this.rootSharedStateScope && (setRootSharedStateScopeThemeDefinitions(this.rootSharedStateScope, null === (_a = this.theme) || void 0 === _a ? void 0 : _a.stateDefinitions), markScopeActiveDescendantsDirty(this.rootSharedStateScope, this));
22364
+ const definitions = null === (_a = this.theme) || void 0 === _a ? void 0 : _a.stateDefinitions;
22365
+ if (!definitions || !Object.keys(definitions).length) return void (this.rootSharedStateScope && (setRootSharedStateScopeThemeDefinitions(this.rootSharedStateScope, definitions), markScopeActiveDescendantsDirty(this.rootSharedStateScope, this)));
22366
+ const rootScope = this.ensureRootSharedStateScope(definitions);
22367
+ setRootSharedStateScopeThemeDefinitions(rootScope, definitions), markScopeActiveDescendantsDirty(rootScope, this);
22010
22368
  }, 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 = {
22011
22369
  tickRenderMode: "effect"
22012
22370
  }), this.optmize(params.optimize), params.background && isString$1(this._background) && this._background.includes("/") && this.setAttributes({
22013
22371
  background: this._background
22014
- }), this.initAnimate(params), this.rafId = null !== (_y = params.rafId) && void 0 !== _y ? _y : Math.floor(6 * Math.random());
22372
+ }), this.initAnimate(params), this.rafId = null !== (_x = params.rafId) && void 0 !== _x ? _x : Math.floor(6 * Math.random());
22015
22373
  }
22016
22374
  initAnimate(params) {
22017
22375
  var _a;
@@ -22271,8 +22629,14 @@
22271
22629
  this._doRenderInThisFrame(), this.willNextFrameRender = !1;
22272
22630
  }));
22273
22631
  }
22632
+ ensureRootSharedStateScope(themeStateDefinitions) {
22633
+ return this.rootSharedStateScope ? (this.rootSharedStateScope.ownerStage = this, this.rootSharedStateScope) : (this.rootSharedStateScope = createRootSharedStateScope(this, themeStateDefinitions), this.rootSharedStateScope);
22634
+ }
22635
+ getStateBatchScheduler() {
22636
+ return this._stateBatchScheduler || (this._stateBatchScheduler = new StateBatchScheduler(this, ensureStageStatePerfMonitor(this))), this._stateBatchScheduler;
22637
+ }
22274
22638
  scheduleStateBatch(graphics, targetStates) {
22275
- this._stateBatchScheduler.schedule(graphics, targetStates);
22639
+ this.getStateBatchScheduler().schedule(graphics, targetStates);
22276
22640
  }
22277
22641
  getStatePerfSnapshot() {
22278
22642
  return ensureStageStatePerfMonitor(this).getSnapshot();
@@ -24773,7 +25137,11 @@
24773
25137
  };
24774
25138
  class BaseRender {
24775
25139
  init(contributions) {
24776
- 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));
25140
+ this.builtinContributions || (this.builtinContributions = []), this._renderContribitions = contributions ? contributions.getContributions().slice() : [];
25141
+ const addContribution = item => {
25142
+ this._renderContribitions.includes(item) || this._renderContribitions.push(item);
25143
+ };
25144
+ 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 = []);
24777
25145
  }
24778
25146
  reInit() {
24779
25147
  this.init(this.graphicRenderContributions);
@@ -29822,8 +30190,8 @@
29822
30190
  graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === this.pluginService.stage && graphic.isContainer && !this.skipBoundsTrigger && _tempBounds.copy(bounds);
29823
30191
  }), stage.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, (graphic, stage, bounds, params, selfChange) => {
29824
30192
  stage && stage === this.pluginService.stage && graphic.isContainer && !this.skipBoundsTrigger && (_tempBounds.equals(bounds) || this.tryLayout(graphic, !1));
29825
- }), stage.graphicService.hooks.onSetStage.tap(this.key, graphic => {
29826
- graphic.glyphHost && (graphic = graphic.glyphHost), this.tryLayout(graphic, !1);
30193
+ }), stage.graphicService.hooks.onSetStage.tap(this.key, (graphic, nextStage) => {
30194
+ nextStage && nextStage === this.pluginService.stage && (graphic.glyphHost && (graphic = graphic.glyphHost), this.tryLayout(graphic, !1));
29827
30195
  }));
29828
30196
  }
29829
30197
  deactivate(context) {
@@ -30386,7 +30754,6 @@
30386
30754
  segments: segments,
30387
30755
  shouldClipImageByLayout: shouldClipImageByLayout,
30388
30756
  shouldUseMat4: shouldUseMat4,
30389
- shouldUseSimpleAttributeFastPath: shouldUseSimpleAttributeFastPath,
30390
30757
  snapLength: snapLength,
30391
30758
  splitArc: splitArc,
30392
30759
  splitArea: splitArea,
@@ -38068,15 +38435,38 @@
38068
38435
  if (!graphic || !targetAttrs) return;
38069
38436
  const committedTargetAttrs = cloneDeep(targetAttrs),
38070
38437
  transientStartAttrs = cloneDeep(null != startAttrs ? startAttrs : graphic.attribute);
38071
- graphic.setAttributes(committedTargetAttrs);
38072
- const baseAttributes = graphic.baseAttributes;
38073
- baseAttributes && "object" == typeof baseAttributes && Object.keys(committedTargetAttrs).forEach(key => {
38074
- baseAttributes[key] = cloneDeep(committedTargetAttrs[key]);
38075
- }), 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, {
38438
+ 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, {
38076
38439
  type: AttributeUpdateType.ANIMATE_BIND
38077
38440
  });
38078
38441
  }
38079
38442
 
38443
+ function collectTrackedAnimates(graphic, animates = [], visited = new Set()) {
38444
+ var _a, _b, _c, _d, _e;
38445
+ const trackedAnimates = null !== (_c = null === (_b = (_a = graphic).getTrackedAnimates) || void 0 === _b ? void 0 : _b.call(_a)) && void 0 !== _c ? _c : graphic.animates;
38446
+ return null == trackedAnimates || trackedAnimates.forEach(animate => {
38447
+ animate && !visited.has(animate) && (visited.add(animate), animates.push(animate));
38448
+ }), null === (_e = (_d = graphic).forEachChildren) || void 0 === _e || _e.call(_d, child => {
38449
+ collectTrackedAnimates(child, animates, visited);
38450
+ }), animates;
38451
+ }
38452
+ function appendExitReleaseCallback(state, callback) {
38453
+ callback && (null == state || state.onComplete.push(callback));
38454
+ }
38455
+ function runExitReleaseCallbacks(callbacks) {
38456
+ callbacks.forEach(callback => {
38457
+ callback();
38458
+ });
38459
+ }
38460
+ function bindExitReleaseAnimates(exitAnimates, getState, finalize) {
38461
+ const finish = animate => {
38462
+ const state = getState();
38463
+ state && !state.finalized && state.pendingAnimates.has(animate) && (state.pendingAnimates.delete(animate), state.pendingAnimates.size || finalize());
38464
+ };
38465
+ exitAnimates.forEach(animate => {
38466
+ animate.onEnd(() => finish(animate)), animate.onRemove(() => finish(animate));
38467
+ });
38468
+ }
38469
+
38080
38470
  const DefaultAxisAnimation = {
38081
38471
  type: "default",
38082
38472
  duration: 300,
@@ -38108,12 +38498,65 @@
38108
38498
  });
38109
38499
  return this.add(offscreenGroup), this._renderInner(offscreenGroup), this.removeChild(offscreenGroup), this.attribute = currentAttribute, offscreenGroup.AABBBounds;
38110
38500
  }
38501
+ _finalizeExitRelease() {
38502
+ var _a, _b;
38503
+ const state = this._exitReleaseState;
38504
+ if (null == state ? void 0 : state.finalized) return;
38505
+ state && (state.finalized = !0);
38506
+ const parent = this.parent,
38507
+ removeFromParent = !!(null == state ? void 0 : state.removeFromParent),
38508
+ callbacks = null !== (_a = null == state ? void 0 : state.onComplete) && void 0 !== _a ? _a : [];
38509
+ 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);
38510
+ }
38511
+ _runExitAnimationBeforeRelease(options = {}) {
38512
+ var _a, _b, _c;
38513
+ if (this._exitReleaseState && !this._exitReleaseState.finalized) return this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent, appendExitReleaseCallback(this._exitReleaseState, options.onComplete), !0;
38514
+ if (!this.stage || !1 === this.attribute.animation || !1 === this.attribute.animationExit || !this._innerView) return !1;
38515
+ if (this._prepare(), !(null === (_a = this._animationConfig) || void 0 === _a ? void 0 : _a.exit)) return !1;
38516
+ const exitTargets = new Set();
38517
+ if (traverseGroup(this._innerView, el => {
38518
+ "group" !== el.type && exitTargets.add(el);
38519
+ }), !exitTargets.size) return !1;
38520
+ const existingAnimates = collectTrackedAnimates(this),
38521
+ {
38522
+ delay = 0,
38523
+ duration = DefaultAxisAnimation.duration,
38524
+ easing = DefaultAxisAnimation.easing
38525
+ } = this._animationConfig.exit;
38526
+ exitTargets.forEach(target => {
38527
+ var _a, _b, _c;
38528
+ const startAttrs = {
38529
+ opacity: null !== (_a = target.attribute.opacity) && void 0 !== _a ? _a : 1,
38530
+ fillOpacity: null !== (_b = target.attribute.fillOpacity) && void 0 !== _b ? _b : 1,
38531
+ strokeOpacity: null !== (_c = target.attribute.strokeOpacity) && void 0 !== _c ? _c : 1
38532
+ },
38533
+ endAttrs = {
38534
+ opacity: 0,
38535
+ fillOpacity: 0,
38536
+ strokeOpacity: 0
38537
+ };
38538
+ commitUpdateAnimationTarget(target, endAttrs, startAttrs), target.animate().wait(delay).to(endAttrs, duration, easing);
38539
+ });
38540
+ const exitAnimates = collectTrackedAnimates(this).filter(animate => !existingAnimates.includes(animate));
38541
+ if (!exitAnimates.length) return !1;
38542
+ this.setAttribute("childrenPickable", !1), null === (_c = (_b = this._innerView).removeAllEventListeners) || void 0 === _c || _c.call(_b), this.releaseStatus = "willRelease";
38543
+ const pendingAnimates = new Set(exitAnimates);
38544
+ return this._exitReleaseState = {
38545
+ pendingAnimates: pendingAnimates,
38546
+ finalized: !1,
38547
+ removeFromParent: !!options.removeFromParent,
38548
+ onComplete: options.onComplete ? [options.onComplete] : []
38549
+ }, bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease()), !0;
38550
+ }
38551
+ releaseWithExitAnimation(options = {}) {
38552
+ return "released" !== this.releaseStatus && this._runExitAnimationBeforeRelease(options);
38553
+ }
38111
38554
  render() {
38112
- this._prepare(), this._prevInnerView = this._innerView && getElMap(this._innerView), this.removeAllChild(!0), this._innerView = graphicCreator.group({
38555
+ this._exitReleaseState || (this._prepare(), this._prevInnerView = this._innerView && getElMap(this._innerView), this.removeAllChild(!0), this._innerView = graphicCreator.group({
38113
38556
  x: 0,
38114
38557
  y: 0,
38115
38558
  pickable: !1
38116
- }), this.add(this._innerView), this._renderInner(this._innerView), this._bindEvent(), this.runAnimation();
38559
+ }), this.add(this._innerView), this._renderInner(this._innerView), this._bindEvent(), this.runAnimation());
38117
38560
  }
38118
38561
  _prepare() {
38119
38562
  this._prepareAnimate(DefaultAxisAnimation);
@@ -38445,8 +38888,8 @@
38445
38888
  });
38446
38889
  }
38447
38890
  }
38448
- release() {
38449
- super.release(), this._prevInnerView = null, this._innerView = null;
38891
+ release(all) {
38892
+ this._exitReleaseState ? this._finalizeExitRelease() : (all && this.removeAllChild(!0), super.release(all), all && this.removeAllChild(!0), this._prevInnerView = null, this._innerView = null);
38450
38893
  }
38451
38894
  }
38452
38895
 
@@ -38958,20 +39401,67 @@
38958
39401
  return !1;
38959
39402
  }
38960
39403
 
39404
+ const animateUpdateContext = {
39405
+ type: AttributeUpdateType.ANIMATE_UPDATE
39406
+ },
39407
+ animateBindContext = {
39408
+ type: AttributeUpdateType.ANIMATE_BIND
39409
+ },
39410
+ animateStartContext = {
39411
+ type: AttributeUpdateType.ANIMATE_START
39412
+ };
39413
+ function getAnimationContext(type) {
39414
+ switch (type) {
39415
+ case AttributeUpdateType.ANIMATE_UPDATE:
39416
+ return animateUpdateContext;
39417
+ case AttributeUpdateType.ANIMATE_BIND:
39418
+ return animateBindContext;
39419
+ case AttributeUpdateType.ANIMATE_START:
39420
+ return animateStartContext;
39421
+ default:
39422
+ return {
39423
+ type: type
39424
+ };
39425
+ }
39426
+ }
39427
+ function prepareAnimationFrameAttribute(target) {
39428
+ const transientTarget = target;
39429
+ return transientTarget.attribute || (transientTarget.attribute = {}), transientTarget.attribute === transientTarget.baseAttributes && "function" == typeof transientTarget.detachAttributeFromBaseAttributes && transientTarget.detachAttributeFromBaseAttributes(), transientTarget.attributeMayContainTransientAttrs = !0, transientTarget.attribute;
39430
+ }
39431
+ function commitAnimationFrameAttribute(target) {
39432
+ var _a, _b;
39433
+ null === (_b = (_a = target).onAttributeUpdate) || void 0 === _b || _b.call(_a, animateUpdateContext);
39434
+ }
39435
+ function applyAnimationFrameAttributes(target, attributes) {
39436
+ if (!attributes) return;
39437
+ const targetAttribute = prepareAnimationFrameAttribute(target);
39438
+ for (const key in attributes) Object.prototype.hasOwnProperty.call(attributes, key) && (targetAttribute[key] = attributes[key]);
39439
+ commitAnimationFrameAttribute(target);
39440
+ }
39441
+ function applyAnimationFrameNumberAttributes(target, keys, from, to, ratio) {
39442
+ const targetAttribute = prepareAnimationFrameAttribute(target);
39443
+ for (let i = 0; i < keys.length; i++) {
39444
+ const key = keys[i];
39445
+ targetAttribute[key] = from[key] + (to[key] - from[key]) * ratio;
39446
+ }
39447
+ commitAnimationFrameAttribute(target);
39448
+ }
38961
39449
  function applyAnimationTransientAttributes(target, attributes, type = AttributeUpdateType.ANIMATE_UPDATE) {
38962
39450
  var _a;
38963
39451
  if (!attributes) return;
38964
- const context = {
38965
- type: type
38966
- },
39452
+ const context = getAnimationContext(type),
38967
39453
  transientTarget = target;
38968
- "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);
39454
+ "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);
38969
39455
  }
38970
39456
  function applyAppearStartAttributes(target, attributes) {
38971
39457
  applyAnimationTransientAttributes(target, attributes, AttributeUpdateType.ANIMATE_BIND);
38972
39458
  }
38973
39459
 
38974
39460
  function noop() {}
39461
+ function includesKey$1(keys, key) {
39462
+ for (let i = 0; i < keys.length; i++) if (keys[i] === key) return !0;
39463
+ return !1;
39464
+ }
38975
39465
  class Step {
38976
39466
  constructor(type, props, duration, easing) {
38977
39467
  var _a;
@@ -39027,6 +39517,17 @@
39027
39517
  onBind() {
39028
39518
  "glyph" === this.target.type && (this.syncAttributeUpdate = this._syncAttributeUpdate);
39029
39519
  }
39520
+ runInterpolateUpdate(fromProps, toProps, ratio) {
39521
+ if (this.animate.interpolateUpdateFunction) return void this.animate.interpolateUpdateFunction(fromProps, toProps, ratio, this, this.target);
39522
+ const funcs = this.interpolateUpdateFunctions,
39523
+ propKeys = this.propKeys;
39524
+ if (funcs && propKeys) for (let index = 0; index < funcs.length; index++) {
39525
+ const key = propKeys[index],
39526
+ fromValue = fromProps[key],
39527
+ toValue = toProps[key];
39528
+ funcs[index](key, fromValue, toValue, ratio, this, this.target);
39529
+ }
39530
+ }
39030
39531
  onFirstRun() {}
39031
39532
  onStart() {
39032
39533
  if (!this._hasFirstRun) {
@@ -39041,23 +39542,49 @@
39041
39542
  tryPreventConflict() {
39042
39543
  var _a, _b;
39043
39544
  const animate = this.animate,
39044
- target = this.target;
39045
- (null !== (_b = null === (_a = target.forEachTrackedAnimate) || void 0 === _a ? void 0 : _a.bind(target)) && void 0 !== _b ? _b : cb => {
39046
- var _a;
39047
- null === (_a = target.animates) || void 0 === _a || _a.forEach(cb);
39048
- })(a => {
39545
+ target = this.target,
39546
+ forEachTrackedAnimate = null !== (_b = null === (_a = target.forEachTrackedAnimate) || void 0 === _a ? void 0 : _a.bind(target)) && void 0 !== _b ? _b : cb => {
39547
+ var _a;
39548
+ null === (_a = target.animates) || void 0 === _a || _a.forEach(cb);
39549
+ },
39550
+ propKeys = this.propKeys;
39551
+ forEachTrackedAnimate(a => {
39049
39552
  if (a === animate || a.priority > animate.priority || a.priority === 1 / 0) return;
39050
39553
  const fromProps = a.getStartProps();
39051
- this.propKeys.forEach(key => {
39052
- null != fromProps[key] && a.preventAttr(key);
39053
- });
39554
+ let conflictKeys = null;
39555
+ for (let i = 0; i < propKeys.length; i++) {
39556
+ const key = propKeys[i];
39557
+ null != fromProps[key] && (null != conflictKeys ? conflictKeys : conflictKeys = []).push(key);
39558
+ }
39559
+ conflictKeys && a.preventAttrs(conflictKeys);
39054
39560
  });
39055
39561
  }
39562
+ removeKeysFromRecord(record, keys) {
39563
+ if (!record) return record;
39564
+ let hasBlockedKey = !1;
39565
+ for (const key in record) if (Object.prototype.hasOwnProperty.call(record, key) && includesKey$1(keys, key)) {
39566
+ hasBlockedKey = !0;
39567
+ break;
39568
+ }
39569
+ if (!hasBlockedKey) return record;
39570
+ const nextRecord = {};
39571
+ for (const key in record) Object.prototype.hasOwnProperty.call(record, key) && !includesKey$1(keys, key) && (nextRecord[key] = record[key]);
39572
+ return nextRecord;
39573
+ }
39056
39574
  deleteSelfAttr(key) {
39575
+ this.deleteSelfAttrs([key]);
39576
+ }
39577
+ deleteSelfAttrs(keys) {
39057
39578
  var _a;
39058
- delete this.props[key], this.fromProps && delete this.fromProps[key];
39059
- const index = this.propKeys.indexOf(key);
39060
- -1 !== index && (this.propKeys.splice(index, 1), null === (_a = this.interpolateUpdateFunctions) || void 0 === _a || _a.splice(index, 1));
39579
+ 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)) {
39580
+ const funcs = this.interpolateUpdateFunctions;
39581
+ let writeIndex = 0;
39582
+ for (let readIndex = 0; readIndex < this.propKeys.length; readIndex++) {
39583
+ const propKey = this.propKeys[readIndex];
39584
+ includesKey$1(keys, propKey) || (writeIndex !== readIndex && (this.propKeys[writeIndex] = propKey, funcs && (funcs[writeIndex] = funcs[readIndex])), writeIndex++);
39585
+ }
39586
+ this.propKeys.length = writeIndex, funcs && (funcs.length = writeIndex);
39587
+ }
39061
39588
  }
39062
39589
  trySyncStartProps() {
39063
39590
  this.propKeys.forEach(key => {
@@ -39067,11 +39594,7 @@
39067
39594
  update(end, ratio, out) {
39068
39595
  if (this.onStart(), !this.props || !this.propKeys) return;
39069
39596
  const easedRatio = this.easing(ratio);
39070
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
39071
- if (!this.animate.validAttr(this.propKeys[index])) return;
39072
- const key = this.propKeys[index];
39073
- func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
39074
- }), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
39597
+ this.runInterpolateUpdate(this.fromProps, this.props, easedRatio), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
39075
39598
  }
39076
39599
  onUpdate(end, ratio, out) {}
39077
39600
  onEnd(cb) {
@@ -39275,19 +39798,34 @@
39275
39798
  }), this.applyTransientFromAttributes();
39276
39799
  }
39277
39800
  deleteSelfAttr(key) {
39278
- super.deleteSelfAttr(key), delete this.from[key];
39801
+ this.deleteSelfAttrs([key]);
39802
+ }
39803
+ deleteSelfAttrs(keys) {
39804
+ super.deleteSelfAttrs(keys), this.from = this.removeKeysFromRecord(this.from, keys);
39279
39805
  }
39280
39806
  update(end, ratio, out) {
39281
39807
  if (this.onStart(), !this.props || !this.propKeys) return;
39282
39808
  const easedRatio = this.easing(ratio);
39283
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.from, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
39284
- if (!this.animate.validAttr(this.propKeys[index])) return;
39285
- const key = this.propKeys[index];
39286
- func(key, this.from[key], this.props[key], easedRatio, this, this.target);
39287
- }), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
39809
+ this.runInterpolateUpdate(this.from, this.props, easedRatio), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
39288
39810
  }
39289
39811
  }
39290
39812
 
39813
+ function includesKey(keys, key) {
39814
+ for (let i = 0; i < keys.length; i++) if (keys[i] === key) return !0;
39815
+ return !1;
39816
+ }
39817
+ function removeKeysFromRecord(record, keys) {
39818
+ if (!record) return record;
39819
+ let hasBlockedKey = !1;
39820
+ for (const key in record) if (Object.prototype.hasOwnProperty.call(record, key) && includesKey(keys, key)) {
39821
+ hasBlockedKey = !0;
39822
+ break;
39823
+ }
39824
+ if (!hasBlockedKey) return record;
39825
+ const nextRecord = {};
39826
+ for (const key in record) Object.prototype.hasOwnProperty.call(record, key) && !includesKey(keys, key) && (nextRecord[key] = record[key]);
39827
+ return nextRecord;
39828
+ }
39291
39829
  class Animate {
39292
39830
  constructor(id = Generator.GenAutoIncrementId(), timeline = defaultTimeline, slience) {
39293
39831
  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;
@@ -39310,7 +39848,7 @@
39310
39848
  bind(target) {
39311
39849
  this.target = target;
39312
39850
  const trackerTarget = this.target;
39313
- 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(() => {
39851
+ 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(() => {
39314
39852
  this.stop(), this.__skipRestoreStaticAttributeOnRemove || "function" != typeof trackerTarget.restoreStaticAttribute || trackerTarget.restoreStaticAttribute(), "function" == typeof trackerTarget.untrackAnimate ? trackerTarget.untrackAnimate(this.id) : this.target.animates.delete(this.id);
39315
39853
  }), this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.target.animationAttribute || (this.target.animationAttribute = {}), this;
39316
39854
  }
@@ -39375,12 +39913,14 @@
39375
39913
  cb ? (this._onRemove || (this._onRemove = []), this._onRemove.push(cb)) : null === (_a = this._onRemove) || void 0 === _a || _a.forEach(cb => cb());
39376
39914
  }
39377
39915
  preventAttr(key) {
39378
- this._preventAttrs.add(key), delete this._startProps[key], delete this._endProps[key];
39379
- let step = this._firstStep;
39380
- for (; step;) step.deleteSelfAttr(key), step = step.next;
39916
+ this.preventAttrs([key]);
39381
39917
  }
39382
39918
  preventAttrs(keys) {
39383
- keys.forEach(key => this._preventAttrs.add(key));
39919
+ if (!(null == keys ? void 0 : keys.length)) return;
39920
+ for (let i = 0; i < keys.length; i++) this._preventAttrs.add(keys[i]);
39921
+ this._startProps = removeKeysFromRecord(this._startProps, keys), this._endProps = removeKeysFromRecord(this._endProps, keys);
39922
+ let step = this._firstStep;
39923
+ for (; step;) step.deleteSelfAttrs(keys), step = step.next;
39384
39924
  }
39385
39925
  validAttr(key) {
39386
39926
  return !this._preventAttrs.has(key);
@@ -39799,6 +40339,33 @@
39799
40339
  cb();
39800
40340
  });
39801
40341
  }
40342
+ getActiveAttrKeys() {
40343
+ const keys = [];
40344
+ for (let i = 0; i < this._animates.length; i++) {
40345
+ const animate = this._animates[i];
40346
+ if (animate.status === AnimateStatus.END) continue;
40347
+ const endProps = animate.getEndProps();
40348
+ if (endProps) for (const key in endProps) Object.prototype.hasOwnProperty.call(endProps, key) && keys.indexOf(key) < 0 && keys.push(key);
40349
+ }
40350
+ return keys;
40351
+ }
40352
+ hasActiveAttrs() {
40353
+ for (let i = 0; i < this._animates.length; i++) {
40354
+ const animate = this._animates[i];
40355
+ if (animate.status === AnimateStatus.END) continue;
40356
+ const endProps = animate.getEndProps();
40357
+ if (endProps) for (const key in endProps) if (Object.prototype.hasOwnProperty.call(endProps, key)) return !0;
40358
+ }
40359
+ return !1;
40360
+ }
40361
+ preventAttrs(keys) {
40362
+ if (!(null == keys ? void 0 : keys.length)) return this.hasActiveAttrs();
40363
+ for (let i = 0; i < this._animates.length; i++) {
40364
+ const animate = this._animates[i];
40365
+ animate.status !== AnimateStatus.END && animate.preventAttrs(keys);
40366
+ }
40367
+ return this.hasActiveAttrs();
40368
+ }
39802
40369
  _trackAnimation(animate) {
39803
40370
  this._animates.push(animate), this._activeCount++, 1 !== this._activeCount || this._started || (this._started = !0, this.onStart()), animate.onEnd(() => {
39804
40371
  this._activeCount--;
@@ -39921,7 +40488,8 @@
39921
40488
  let parsedFromProps = null,
39922
40489
  props = params.to,
39923
40490
  from = params.from;
39924
- 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);
40491
+ const commitAttrOutChannel = this.shouldCommitAttrOutChannel(type);
40492
+ 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);
39925
40493
  let totalDelay = 0;
39926
40494
  oneByOneDelay && (totalDelay = oneByOneDelay * (count - index - 1));
39927
40495
  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;
@@ -39984,7 +40552,8 @@
39984
40552
  let parsedFromProps = null,
39985
40553
  props = effect.to,
39986
40554
  from = effect.from;
39987
- 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);
40555
+ const commitAttrOutChannel = this.shouldCommitAttrOutChannel(type);
40556
+ 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);
39988
40557
  const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
39989
40558
  customType = effect.custom ? effect.customType : getCustomType(custom);
39990
40559
  this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
@@ -39998,11 +40567,14 @@
39998
40567
  interpolator(ratio, from, to, step, target, animate.target, customParams);
39999
40568
  }, animate.to(props, duration, easing);
40000
40569
  }
40570
+ shouldCommitAttrOutChannel(type) {
40571
+ return "update" !== type;
40572
+ }
40001
40573
  createCustomAnimation(animate, CustomAnimateConstructor, from, props, duration, easing, customParams) {
40002
40574
  const customAnimate = new CustomAnimateConstructor(from, props, duration, easing, customParams);
40003
40575
  animate.play(customAnimate);
40004
40576
  }
40005
- createPropsFromChannel(channel, graphic) {
40577
+ createPropsFromChannel(channel, graphic, includeAttrOutChannel = !0) {
40006
40578
  var _a;
40007
40579
  const props = {};
40008
40580
  let from = null;
@@ -40011,7 +40583,7 @@
40011
40583
  props: props,
40012
40584
  attrOutChannel: null
40013
40585
  };
40014
- const attrOutChannel = {};
40586
+ const attrOutChannel = includeAttrOutChannel ? {} : null;
40015
40587
  let hasAttrs = !1;
40016
40588
  const diffAttrs = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs;
40017
40589
  if (Array.isArray(channel) && (channel = channel.reduce((res, key) => (void 0 === diffAttrs[key] || (res[key] = {
@@ -40020,7 +40592,7 @@
40020
40592
  var _a, _b, _c, _d;
40021
40593
  const config = channel[key];
40022
40594
  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);
40023
- }), diffAttrs) for (const key in diffAttrs) {
40595
+ }), diffAttrs && attrOutChannel) for (const key in diffAttrs) {
40024
40596
  const value = diffAttrs[key];
40025
40597
  if (void 0 === value) continue;
40026
40598
  props.hasOwnProperty(key) || !!(null == from ? void 0 : from.hasOwnProperty(key)) || (attrOutChannel[key] = value, hasAttrs = !0);
@@ -40099,8 +40671,22 @@
40099
40671
  hasTrackedAnimate() {
40100
40672
  return this.trackedAnimates.size > 0;
40101
40673
  }
40674
+ hasStateInfo(list, target) {
40675
+ for (let i = 0; i < list.length; i++) if (list[i] === target) return !0;
40676
+ return !1;
40677
+ }
40678
+ takeOverUpdateAttrs(nextState, currentStates, shouldStopState) {
40679
+ if (nextState.state !== AnimationStates$1.UPDATE || !currentStates.length) return;
40680
+ const nextKeys = nextState.executor.getActiveAttrKeys();
40681
+ if (nextKeys.length) for (let i = 0; i < currentStates.length; i++) {
40682
+ const currentState = currentStates[i];
40683
+ currentState.state !== AnimationStates$1.UPDATE || currentState === nextState || this.hasStateInfo(shouldStopState, currentState) || currentState.executor.preventAttrs(nextKeys) || (currentState.executor.stop(null, !1), shouldStopState.push(currentState));
40684
+ }
40685
+ }
40102
40686
  applyState(nextState, animationConfig, callback) {
40687
+ var _a;
40103
40688
  const registry = AnimationTransitionRegistry.getInstance(),
40689
+ currentStateList = null !== (_a = this.stateList) && void 0 !== _a ? _a : [],
40104
40690
  shouldStopState = [],
40105
40691
  shouldApplyState = [];
40106
40692
  if (this.stateList && this.stateList.length ? nextState.forEach((state, index) => {
@@ -40108,14 +40694,14 @@
40108
40694
  allowTransition: !0,
40109
40695
  stopOriginalTransition: !0
40110
40696
  };
40111
- this.stateList.forEach(currState => {
40697
+ currentStateList.forEach(currState => {
40112
40698
  const _result = registry.isTransitionAllowed(currState.state, state, this.graphic);
40113
40699
  result.allowTransition = result.allowTransition && _result.allowTransition;
40114
40700
  }), result.allowTransition && (shouldApplyState.push({
40115
40701
  state: state,
40116
40702
  animationConfig: isArray$1(animationConfig[index]) ? animationConfig[index].map(item => item.animation) : animationConfig[index].animation,
40117
40703
  executor: new AnimateExecutor(this.graphic)
40118
- }), this.stateList.forEach(currState => {
40704
+ }), currentStateList.forEach(currState => {
40119
40705
  registry.isTransitionAllowed(currState.state, state, this.graphic).stopOriginalTransition && shouldStopState.push(currState);
40120
40706
  }));
40121
40707
  }) : nextState.forEach((state, index) => {
@@ -40127,12 +40713,18 @@
40127
40713
  }), shouldStopState.forEach(state => {
40128
40714
  state.executor.stop(null, !1);
40129
40715
  }), shouldApplyState.length) {
40130
- shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig);
40716
+ shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig), this.takeOverUpdateAttrs(shouldApplyState[0], currentStateList, shouldStopState);
40131
40717
  for (let i = 0; i < shouldApplyState.length; i++) {
40132
40718
  const nextState = shouldApplyState[i + 1],
40133
40719
  currentState = shouldApplyState[i];
40134
40720
  currentState.executor.onEnd(() => {
40135
- nextState && nextState.executor.execute(nextState.animationConfig), this.stateList = this.stateList.filter(state => state !== currentState), i === shouldApplyState.length - 1 && callback && callback(!1);
40721
+ var _a;
40722
+ if (nextState) {
40723
+ nextState.executor.execute(nextState.animationConfig);
40724
+ const stoppedStates = [];
40725
+ 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)));
40726
+ }
40727
+ this.stateList = this.stateList.filter(state => state !== currentState), i === shouldApplyState.length - 1 && callback && callback(!1);
40136
40728
  });
40137
40729
  }
40138
40730
  } else callback && callback(!0);
@@ -40375,8 +40967,11 @@
40375
40967
  }), this));
40376
40968
  }
40377
40969
  deleteSelfAttr(key) {
40970
+ this.deleteSelfAttrs([key]);
40971
+ }
40972
+ deleteSelfAttrs(keys) {
40378
40973
  this.tasks.forEach(task => {
40379
- task.animate && task.animate.forEach(animate => animate.preventAttr(key));
40974
+ task.animate && task.animate.forEach(animate => animate.preventAttrs(keys));
40380
40975
  });
40381
40976
  }
40382
40977
  stop(type) {
@@ -40940,6 +41535,25 @@
40940
41535
  }
40941
41536
  }
40942
41537
 
41538
+ function buildAnimationStaticCommitAttrs(target, keys, animate, fallbackAttrs) {
41539
+ var _a;
41540
+ const commitTarget = target,
41541
+ contextFinalAttrs = null === (_a = commitTarget.context) || void 0 === _a ? void 0 : _a.finalAttrs,
41542
+ finalAttribute = "function" == typeof commitTarget.getFinalAttribute ? commitTarget.getFinalAttribute() : commitTarget.finalAttribute;
41543
+ let commitAttrs = null;
41544
+ for (let i = 0; i < keys.length; i++) {
41545
+ const key = keys[i];
41546
+ 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]));
41547
+ }
41548
+ return commitAttrs;
41549
+ }
41550
+ function commitAnimationStaticAttrs(target, keys, animate, fallbackAttrs) {
41551
+ const commitAttrs = buildAnimationStaticCommitAttrs(target, keys, animate, fallbackAttrs);
41552
+ return !!commitAttrs && (target.setAttributes(commitAttrs, !1, {
41553
+ type: AttributeUpdateType.ANIMATE_END
41554
+ }), !0);
41555
+ }
41556
+
40943
41557
  class TagPointsUpdate extends ACustomAnimate {
40944
41558
  constructor(from, to, duration, easing, params) {
40945
41559
  var _a, _b;
@@ -40958,21 +41572,9 @@
40958
41572
  }
40959
41573
  onBind() {
40960
41574
  super.onBind();
40961
- const {
40962
- points: points,
40963
- segments: segments
40964
- } = this.target.attribute,
40965
- {
40966
- points: pointsTo,
40967
- segments: segmentsTo
40968
- } = this.target.getFinalAttribute();
40969
- this.from = {
40970
- points: points,
40971
- segments: segments
40972
- }, this.to = {
40973
- points: pointsTo,
40974
- segments: segmentsTo
40975
- }, this.props = this.to;
41575
+ const currentAttribute = this.target.attribute,
41576
+ finalAttribute = this.target.getFinalAttribute();
41577
+ 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;
40976
41578
  const originFromPoints = this.getPoints(this.from),
40977
41579
  originToPoints = this.getPoints(this.to, !0);
40978
41580
  this.fromPoints = originFromPoints ? Array.isArray(originFromPoints) ? originFromPoints : [originFromPoints] : [], this.toPoints = originToPoints ? Array.isArray(originToPoints) ? originToPoints : [originToPoints] : [];
@@ -41008,31 +41610,42 @@
41008
41610
  const lastClipRange = this.target.attribute.clipRange;
41009
41611
  isValidNumber$1(lastClipRange * this.clipRange) && (this.clipRange *= lastClipRange);
41010
41612
  }
41613
+ onEnd(cb) {
41614
+ cb ? super.onEnd(cb) : (this.to && commitAnimationStaticAttrs(this.target, Object.keys(this.to), this.animate, this.to), super.onEnd());
41615
+ }
41616
+ applyPointTransientAttributes(attributes) {
41617
+ const validAttrs = {};
41618
+ Object.keys(attributes).forEach(key => {
41619
+ this.animate.validAttr(key) && (validAttrs[key] = attributes[key]);
41620
+ }), Object.keys(validAttrs).length && (applyAnimationFrameAttributes(this.target, validAttrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag());
41621
+ }
41011
41622
  onUpdate(end, ratio, out) {
41012
- if (end) return Object.keys(this.to).forEach(k => {
41013
- this.target.attribute[k] = this.to[k];
41014
- }), this.target.addUpdatePositionTag(), void this.target.addUpdateShapeAndBoundsTag();
41015
- if (this.points = this.points.map((point, index) => {
41016
- const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
41017
- return newPoint.context = point.context, newPoint;
41018
- }), this.clipRange) {
41019
- 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));
41020
- applyAnimationTransientAttributes(this.target, {
41021
- clipRange: this.clipRange + (1 - this.clipRange) * ratio
41022
- });
41023
- }
41024
- if (this.segmentsCache && this.to.segments) {
41025
- let start = 0;
41026
- const segments = this.to.segments.map((segment, index) => {
41027
- const end = start + this.segmentsCache[index],
41028
- points = this.points.slice(start, end);
41029
- return start = end, Object.assign(Object.assign({}, segment), {
41030
- points: points
41623
+ if (end) this.applyPointTransientAttributes(this.to);else {
41624
+ if (this.points = this.points.map((point, index) => {
41625
+ const newPoint = pointInterpolation(this.interpolatePoints[index][0], this.interpolatePoints[index][1], ratio);
41626
+ return newPoint.context = point.context, newPoint;
41627
+ }), this.clipRange) {
41628
+ 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));
41629
+ applyAnimationTransientAttributes(this.target, {
41630
+ clipRange: this.clipRange + (1 - this.clipRange) * ratio
41631
+ });
41632
+ }
41633
+ if (this.segmentsCache && this.to.segments) {
41634
+ let start = 0;
41635
+ const segments = this.to.segments.map((segment, index) => {
41636
+ const end = start + this.segmentsCache[index],
41637
+ points = this.points.slice(start, end);
41638
+ return start = end, Object.assign(Object.assign({}, segment), {
41639
+ points: points
41640
+ });
41641
+ });
41642
+ this.applyPointTransientAttributes({
41643
+ segments: segments
41031
41644
  });
41645
+ } else this.applyPointTransientAttributes({
41646
+ points: this.points
41032
41647
  });
41033
- this.target.attribute.segments = segments;
41034
- } else this.target.attribute.points = this.points;
41035
- this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41648
+ }
41036
41649
  }
41037
41650
  }
41038
41651
 
@@ -41053,10 +41666,10 @@
41053
41666
  }), 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);
41054
41667
  }
41055
41668
  onUpdate(end, ratio, out) {
41056
- const attribute = this.target.attribute;
41669
+ const attrs = {};
41057
41670
  this.propKeys.forEach(key => {
41058
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
41059
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41671
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
41672
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41060
41673
  }
41061
41674
  }
41062
41675
  class CommonOut extends ACustomAnimate {
@@ -41071,16 +41684,16 @@
41071
41684
  this.keys.forEach(key => {
41072
41685
  var _a;
41073
41686
  to[key] = 0, from[key] = null !== (_a = attrs[key]) && void 0 !== _a ? _a : 1;
41074
- }), 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();
41687
+ }), 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();
41075
41688
  }
41076
41689
  onEnd(cb) {
41077
41690
  super.onEnd(cb);
41078
41691
  }
41079
41692
  onUpdate(end, ratio, out) {
41080
- const attribute = this.target.attribute;
41693
+ const attrs = {};
41081
41694
  this.propKeys.forEach(key => {
41082
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
41083
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41695
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
41696
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41084
41697
  }
41085
41698
  }
41086
41699
 
@@ -41110,8 +41723,7 @@
41110
41723
  onEnd() {}
41111
41724
  onUpdate(end, ratio, out) {
41112
41725
  if (null == this.phi || null == this.theta) return;
41113
- const target = this.target,
41114
- {
41726
+ const {
41115
41727
  center: center,
41116
41728
  r: r,
41117
41729
  cb: cb
@@ -41122,8 +41734,15 @@
41122
41734
  x = r * Math.sin(phi) * Math.cos(theta) + center.x,
41123
41735
  y = r * Math.cos(phi) + center.y,
41124
41736
  z = r * Math.sin(phi) * Math.sin(theta) + center.z;
41125
- 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;
41126
- target.attribute.alpha = pi2 - target.attribute.alpha, target.attribute.zIndex = -1e4 * target.attribute.z, cb && cb(out);
41737
+ let alpha = theta + pi$1 / 2;
41738
+ for (; alpha > pi2;) alpha -= pi2;
41739
+ alpha = pi2 - alpha, applyAnimationFrameAttributes(this.target, {
41740
+ x: x,
41741
+ y: y,
41742
+ z: z,
41743
+ alpha: alpha,
41744
+ zIndex: -1e4 * z
41745
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag(), cb && cb(out);
41127
41746
  }
41128
41747
  }
41129
41748
 
@@ -41265,15 +41884,23 @@
41265
41884
  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;
41266
41885
  }
41267
41886
  deleteSelfAttr(key) {
41268
- delete this.props[key], this.fromProps && delete this.fromProps[key];
41269
- const index = this.propKeys.indexOf(key);
41270
- -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;
41887
+ this.deleteSelfAttrs([key]);
41888
+ }
41889
+ deleteSelfAttrs(keys) {
41890
+ var _a;
41891
+ super.deleteSelfAttrs(keys);
41892
+ const firstKey = null === (_a = this.propKeys) || void 0 === _a ? void 0 : _a[0];
41893
+ this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateAngle : this._updateFunction = "startAngle" === firstKey ? this.updateStartAngle : "endAngle" === firstKey ? this.updateEndAngle : null;
41271
41894
  }
41272
41895
  updateStartAngle(ratio) {
41273
- this.target.attribute.startAngle = this.from.startAngle + (this.to.startAngle - this.from.startAngle) * ratio;
41896
+ applyAnimationFrameAttributes(this.target, {
41897
+ startAngle: this.from.startAngle + (this.to.startAngle - this.from.startAngle) * ratio
41898
+ });
41274
41899
  }
41275
41900
  updateEndAngle(ratio) {
41276
- this.target.attribute.endAngle = this.from.endAngle + (this.to.endAngle - this.from.endAngle) * ratio;
41901
+ applyAnimationFrameAttributes(this.target, {
41902
+ endAngle: this.from.endAngle + (this.to.endAngle - this.from.endAngle) * ratio
41903
+ });
41277
41904
  }
41278
41905
  updateAngle(ratio) {
41279
41906
  this.updateStartAngle(ratio), this.updateEndAngle(ratio);
@@ -41447,10 +42074,10 @@
41447
42074
  super.onEnd(cb);
41448
42075
  }
41449
42076
  onUpdate(end, ratio, out) {
41450
- const attribute = this.target.attribute;
42077
+ const attrs = {};
41451
42078
  this.propKeys.forEach(key => {
41452
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
41453
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
42079
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
42080
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41454
42081
  }
41455
42082
  }
41456
42083
  class GrowCenterOut extends ACustomAnimate {
@@ -41469,10 +42096,10 @@
41469
42096
  super.onEnd(cb);
41470
42097
  }
41471
42098
  onUpdate(end, ratio, out) {
41472
- const attribute = this.target.attribute;
42099
+ const attrs = {};
41473
42100
  this.propKeys.forEach(key => {
41474
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
41475
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
42101
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
42102
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41476
42103
  }
41477
42104
  }
41478
42105
 
@@ -41552,10 +42179,7 @@
41552
42179
  super.onEnd(cb);
41553
42180
  }
41554
42181
  onUpdate(end, ratio, out) {
41555
- const attribute = this.target.attribute;
41556
- this.propKeys.forEach(key => {
41557
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
41558
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
42182
+ applyAnimationFrameNumberAttributes(this.target, this.propKeys, this.from, this.to, ratio), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41559
42183
  }
41560
42184
  }
41561
42185
  function growHeightOutIndividual(graphic, options, animationParameters) {
@@ -41613,10 +42237,7 @@
41613
42237
  super.onEnd(cb);
41614
42238
  }
41615
42239
  onUpdate(end, ratio, out) {
41616
- const attribute = this.target.attribute;
41617
- this.propKeys.forEach(key => {
41618
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
41619
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
42240
+ applyAnimationFrameNumberAttributes(this.target, this.propKeys, this.from, this.to, ratio), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41620
42241
  }
41621
42242
  }
41622
42243
 
@@ -41649,7 +42270,9 @@
41649
42270
  var _a, _b;
41650
42271
  const fromPoints = null === (_a = this.from) || void 0 === _a ? void 0 : _a.points,
41651
42272
  toPoints = null === (_b = this.to) || void 0 === _b ? void 0 : _b.points;
41652
- fromPoints && toPoints && (this.target.attribute.points = fromPoints.map((point, index) => pointInterpolation(fromPoints[index], toPoints[index], ratio)), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag());
42273
+ fromPoints && toPoints && (applyAnimationFrameAttributes(this.target, {
42274
+ points: fromPoints.map((point, index) => pointInterpolation(fromPoints[index], toPoints[index], ratio))
42275
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag());
41653
42276
  }
41654
42277
  }
41655
42278
  class GrowPointsIn extends GworPointsBase {
@@ -41881,10 +42504,10 @@
41881
42504
  super(from, to, duration, easing, params);
41882
42505
  }
41883
42506
  onUpdate(end, ratio, out) {
41884
- const attribute = this.target.attribute;
42507
+ const attrs = {};
41885
42508
  this.propKeys.forEach(key => {
41886
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
41887
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
42509
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
42510
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
41888
42511
  }
41889
42512
  }
41890
42513
  class GrowRadiusIn extends GrowPointsBase {
@@ -42024,10 +42647,7 @@
42024
42647
  super.onEnd(cb);
42025
42648
  }
42026
42649
  onUpdate(end, ratio, out) {
42027
- const attribute = this.target.attribute;
42028
- this.propKeys.forEach(key => {
42029
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
42030
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
42650
+ applyAnimationFrameNumberAttributes(this.target, this.propKeys, this.from, this.to, ratio), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
42031
42651
  }
42032
42652
  }
42033
42653
  class GrowWidthOut extends ACustomAnimate {
@@ -42047,10 +42667,7 @@
42047
42667
  super.onEnd(cb);
42048
42668
  }
42049
42669
  onUpdate(end, ratio, out) {
42050
- const attribute = this.target.attribute;
42051
- this.propKeys.forEach(key => {
42052
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
42053
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
42670
+ applyAnimationFrameNumberAttributes(this.target, this.propKeys, this.from, this.to, ratio), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
42054
42671
  }
42055
42672
  }
42056
42673
 
@@ -42823,18 +43440,26 @@
42823
43440
  super.onEnd(cb);
42824
43441
  }
42825
43442
  updateX(ratio) {
42826
- this.target.attribute.scaleX = this.from.scaleX + (this.to.scaleX - this.from.scaleX) * ratio;
43443
+ this.applyScaleTransientAttrs(ratio, !0, !1);
42827
43444
  }
42828
43445
  updateY(ratio) {
42829
- this.target.attribute.scaleY = this.from.scaleY + (this.to.scaleY - this.from.scaleY) * ratio;
43446
+ this.applyScaleTransientAttrs(ratio, !1, !0);
42830
43447
  }
42831
43448
  updateXY(ratio) {
42832
- this.updateX(ratio), this.updateY(ratio);
43449
+ this.applyScaleTransientAttrs(ratio, !0, !0);
43450
+ }
43451
+ applyScaleTransientAttrs(ratio, scaleX, scaleY) {
43452
+ const attrs = {};
43453
+ 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);
42833
43454
  }
42834
43455
  deleteSelfAttr(key) {
42835
- delete this.props[key], this.fromProps && delete this.fromProps[key];
42836
- const index = this.propKeys.indexOf(key);
42837
- -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;
43456
+ this.deleteSelfAttrs([key]);
43457
+ }
43458
+ deleteSelfAttrs(keys) {
43459
+ var _a;
43460
+ super.deleteSelfAttrs(keys);
43461
+ const firstKey = null === (_a = this.propKeys) || void 0 === _a ? void 0 : _a[0];
43462
+ this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateXY : this._updateFunction = "scaleX" === firstKey ? this.updateX : "scaleY" === firstKey ? this.updateY : null;
42838
43463
  }
42839
43464
  onUpdate(end, ratio, out) {
42840
43465
  this._updateFunction && (this._updateFunction(ratio), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag());
@@ -42879,10 +43504,10 @@
42879
43504
  super.onEnd(cb);
42880
43505
  }
42881
43506
  onUpdate(end, ratio, out) {
42882
- const attribute = this.target.attribute;
43507
+ const attrs = {};
42883
43508
  this.propKeys.forEach(key => {
42884
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
42885
- }), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
43509
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
43510
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
42886
43511
  }
42887
43512
  }
42888
43513
 
@@ -42893,14 +43518,19 @@
42893
43518
  update(end, ratio, out) {
42894
43519
  if (this.onStart(), !this.props || !this.propKeys) return;
42895
43520
  const easedRatio = this.easing(ratio);
42896
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
42897
- if (!this.animate.validAttr(this.propKeys[index])) return;
42898
- const key = this.propKeys[index];
42899
- func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
42900
- }), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
43521
+ this.runInterpolateUpdate(this.fromProps, this.props, easedRatio), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
42901
43522
  }
42902
43523
  }
42903
43524
 
43525
+ function buildInterpolatedAttrs(keys, from, to, ratio) {
43526
+ const attrs = {};
43527
+ return keys.forEach(key => {
43528
+ attrs[key] = from[key] + (to[key] - from[key]) * ratio;
43529
+ }), attrs;
43530
+ }
43531
+ function applyStoryFrame(target, attrs) {
43532
+ applyAnimationFrameAttributes(target, attrs), target.addUpdatePositionTag(), target.addUpdateShapeAndBoundsTag();
43533
+ }
42904
43534
  class SlideIn extends ACustomAnimate {
42905
43535
  constructor(from, to, duration, easing, params) {
42906
43536
  super(from, to, duration, easing, params);
@@ -42923,10 +43553,7 @@
42923
43553
  "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);
42924
43554
  }
42925
43555
  onUpdate(end, ratio, out) {
42926
- const attribute = this.target.attribute;
42927
- this.propKeys.forEach(key => {
42928
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
42929
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
43556
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
42930
43557
  }
42931
43558
  }
42932
43559
  class GrowIn extends ACustomAnimate {
@@ -42951,10 +43578,7 @@
42951
43578
  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);
42952
43579
  }
42953
43580
  onUpdate(end, ratio, out) {
42954
- const attribute = this.target.attribute;
42955
- this.propKeys.forEach(key => {
42956
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
42957
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
43581
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
42958
43582
  }
42959
43583
  }
42960
43584
  class SpinIn extends ACustomAnimate {
@@ -42985,10 +43609,7 @@
42985
43609
  this.propKeys = ["opacity", "baseOpacity", "angle", "scaleX", "scaleY"], this.from = from, this.to = to, this.props = to, applyAppearStartAttributes(this.target, from);
42986
43610
  }
42987
43611
  onUpdate(end, ratio, out) {
42988
- const attribute = this.target.attribute;
42989
- this.propKeys.forEach(key => {
42990
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
42991
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
43612
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
42992
43613
  }
42993
43614
  }
42994
43615
  class StrokeIn extends ACustomAnimate {
@@ -43033,8 +43654,10 @@
43033
43654
  }
43034
43655
  onUpdate(end, ratio, out) {
43035
43656
  var _a;
43036
- const attribute = this.target.attribute;
43037
- 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);
43657
+ const attrs = {
43658
+ lineDashOffset: this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio
43659
+ };
43660
+ (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);
43038
43661
  }
43039
43662
  onEnd() {
43040
43663
  var _a;
@@ -43085,8 +43708,10 @@
43085
43708
  }
43086
43709
  onUpdate(end, ratio, out) {
43087
43710
  var _a;
43088
- const attribute = this.target.attribute;
43089
- 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);
43711
+ const attrs = {
43712
+ lineDashOffset: this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio
43713
+ };
43714
+ (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);
43090
43715
  }
43091
43716
  }
43092
43717
  class MoveScaleIn extends ACustomAnimate {
@@ -43183,10 +43808,7 @@
43183
43808
  "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;
43184
43809
  }
43185
43810
  onUpdate(end, ratio, out) {
43186
- const attribute = this.target.attribute;
43187
- this.propKeys.forEach(key => {
43188
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
43189
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
43811
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
43190
43812
  }
43191
43813
  }
43192
43814
  class GrowOut extends ACustomAnimate {
@@ -43211,10 +43833,7 @@
43211
43833
  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;
43212
43834
  }
43213
43835
  onUpdate(end, ratio, out) {
43214
- const attribute = this.target.attribute;
43215
- this.propKeys.forEach(key => {
43216
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
43217
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
43836
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
43218
43837
  }
43219
43838
  }
43220
43839
  class SpinOut extends ACustomAnimate {
@@ -43245,10 +43864,7 @@
43245
43864
  this.propKeys = ["opacity", "baseOpacity", "angle", "scaleX", "scaleY"], this.from = from, this.to = to, this.props = to;
43246
43865
  }
43247
43866
  onUpdate(end, ratio, out) {
43248
- const attribute = this.target.attribute;
43249
- this.propKeys.forEach(key => {
43250
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
43251
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
43867
+ applyStoryFrame(this.target, buildInterpolatedAttrs(this.propKeys, this.from, this.to, ratio));
43252
43868
  }
43253
43869
  }
43254
43870
  class MoveScaleOut extends ACustomAnimate {
@@ -43333,56 +43949,127 @@
43333
43949
  onUpdate(end, ratio, out) {
43334
43950
  const angle = ratio * Math.PI * this.pulseCount,
43335
43951
  pulseValue = Math.abs(Math.sin(angle)),
43336
- attribute = this.target.attribute;
43952
+ attrs = {};
43337
43953
  if (this.useOpacity) {
43338
43954
  const opacity = 1 + (this.pulseOpacity - 1) * pulseValue;
43339
- this.useStroke && (attribute.strokeOpacity = (this.originalAttributes.strokeOpacity || 1) * opacity), this.useFill && (attribute.fillOpacity = (this.originalAttributes.fillOpacity || 1) * opacity);
43955
+ this.useStroke && (attrs.strokeOpacity = (this.originalAttributes.strokeOpacity || 1) * opacity), this.useFill && (attrs.fillOpacity = (this.originalAttributes.fillOpacity || 1) * opacity);
43340
43956
  }
43341
43957
  if (this.useScale) {
43342
43958
  const scale = 1 + (this.pulseScale - 1) * pulseValue;
43343
- attribute.scaleX = (this.originalAttributes.scaleX || 1) * scale, attribute.scaleY = (this.originalAttributes.scaleY || 1) * scale;
43959
+ attrs.scaleX = (this.originalAttributes.scaleX || 1) * scale, attrs.scaleY = (this.originalAttributes.scaleY || 1) * scale;
43344
43960
  }
43345
- this.useColor && this.pulseColor && this.applyColorPulse(attribute, pulseValue), this.target.addUpdateShapeAndBoundsTag(), this.target.addUpdatePositionTag();
43961
+ this.useColor && this.pulseColor && this.applyColorPulse(attrs, pulseValue), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdateShapeAndBoundsTag(), this.target.addUpdatePositionTag();
43346
43962
  }
43347
- applyColorPulse(attribute, pulseValue) {
43963
+ applyColorPulse(attrs, pulseValue) {
43348
43964
  const colorRatio = this.pulseColorIntensity * pulseValue;
43349
- 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));
43965
+ 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));
43350
43966
  }
43351
43967
  onEnd() {
43352
43968
  super.onEnd(), this.target.setAttributes(this.originalAttributes);
43353
43969
  }
43354
43970
  }
43355
43971
 
43972
+ const clipPathGeometryAttrs = {
43973
+ x: !0,
43974
+ y: !0,
43975
+ x1: !0,
43976
+ y1: !0,
43977
+ width: !0,
43978
+ height: !0
43979
+ };
43980
+ function includesChannel(channels, key) {
43981
+ for (let i = 0; i < channels.length; i++) if (channels[i] === key) return !0;
43982
+ return !1;
43983
+ }
43984
+ function filterExcludedChannels(diffAttrs, excludeChannels) {
43985
+ if (!(null == excludeChannels ? void 0 : excludeChannels.length)) return diffAttrs;
43986
+ const nextAttrs = {};
43987
+ for (const key in diffAttrs) Object.prototype.hasOwnProperty.call(diffAttrs, key) && !includesChannel(excludeChannels, key) && (nextAttrs[key] = diffAttrs[key]);
43988
+ return nextAttrs;
43989
+ }
43356
43990
  class Update extends ACustomAnimate {
43357
43991
  constructor(from, to, duration, easing, params) {
43358
- super(from, to, duration, easing, params);
43992
+ super(from, to, duration, easing, params), this.updateFromAttrs = null, this.clipPathSyncKeys = null, this.clipPathSyncParent = null, this.clipPathSyncChildIndex = -1, this.clipPathSyncDisabled = !1;
43359
43993
  }
43360
43994
  onBind() {
43361
- var _a, _b;
43995
+ var _a;
43362
43996
  super.onBind();
43997
+ const targetContext = null !== (_a = this.target.context) && void 0 !== _a ? _a : {};
43363
43998
  let {
43364
43999
  diffAttrs = {}
43365
- } = null !== (_a = this.target.context) && void 0 !== _a ? _a : {};
44000
+ } = targetContext;
43366
44001
  const {
43367
44002
  options: options
43368
44003
  } = this.params;
43369
- diffAttrs = Object.assign({}, diffAttrs), (null === (_b = null == options ? void 0 : options.excludeChannels) || void 0 === _b ? void 0 : _b.length) && options.excludeChannels.forEach(channel => {
43370
- delete diffAttrs[channel];
43371
- }), this.props = diffAttrs;
44004
+ diffAttrs = filterExcludedChannels(diffAttrs, null == options ? void 0 : options.excludeChannels), this.props = diffAttrs;
44005
+ const consumeTransientFromAttrs = this.target.consumeTransientFromAttrsBeforePreventAnimate;
44006
+ 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();
44007
+ }
44008
+ trySyncStartProps() {
44009
+ const updateFromAttrs = this.updateFromAttrs;
44010
+ this.propKeys.forEach(key => {
44011
+ this.fromProps[key] = updateFromAttrs && Object.prototype.hasOwnProperty.call(updateFromAttrs, key) ? updateFromAttrs[key] : this.animate.target.getComputedAttribute(key);
44012
+ });
43372
44013
  }
43373
44014
  onEnd(cb) {
43374
- cb ? super.onEnd(cb) : (this.props && Object.keys(this.props).length && this.target.setAttributes(this.props, !1, {
43375
- type: AttributeUpdateType.ANIMATE_END
43376
- }), super.onEnd());
44015
+ var _a;
44016
+ 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());
43377
44017
  }
43378
44018
  update(end, ratio, out) {
43379
44019
  if (this.onStart(), !this.props || !this.propKeys) return;
43380
44020
  const easedRatio = this.easing(ratio);
43381
- this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
43382
- if (!this.animate.validAttr(this.propKeys[index])) return;
43383
- const key = this.propKeys[index];
43384
- func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
43385
- }), this.onUpdate(end, easedRatio, out);
44021
+ this.runInterpolateUpdate(this.fromProps, this.props, easedRatio), this.syncParentClipPathToTarget(), this.onUpdate(end, easedRatio, out);
44022
+ }
44023
+ syncParentClipPathToTarget() {
44024
+ var _a, _b, _c, _d;
44025
+ if (this.clipPathSyncDisabled) return;
44026
+ const target = this.target,
44027
+ parent = target.parent,
44028
+ path = null === (_a = null == parent ? void 0 : parent.attribute) || void 0 === _a ? void 0 : _a.path;
44029
+ if (!(null === (_b = null == parent ? void 0 : parent.attribute) || void 0 === _b ? void 0 : _b.clip) || !Array.isArray(path) || !path.length) return;
44030
+ const childIndex = this.getClipPathSyncChildIndex(parent);
44031
+ if (childIndex < 0 || childIndex >= path.length) return;
44032
+ const clipGraphic = path[childIndex];
44033
+ if (!(null == clipGraphic ? void 0 : clipGraphic.attribute) || clipGraphic.type !== target.type || !this.isClipPathStaticTarget(clipGraphic)) return;
44034
+ const syncAttrs = this.buildClipPathTransientAttrs(clipGraphic);
44035
+ syncAttrs && (applyAnimationFrameAttributes(clipGraphic, syncAttrs), null === (_c = clipGraphic.addUpdatePositionTag) || void 0 === _c || _c.call(clipGraphic), null === (_d = clipGraphic.addUpdateShapeAndBoundsTag) || void 0 === _d || _d.call(clipGraphic));
44036
+ }
44037
+ getClipPathSyncChildIndex(parent) {
44038
+ var _a;
44039
+ if (this.clipPathSyncParent === parent && this.clipPathSyncChildIndex >= 0) return this.clipPathSyncChildIndex;
44040
+ const target = this.target;
44041
+ let childIndex = -1;
44042
+ return null === (_a = parent.forEachChildren) || void 0 === _a || _a.call(parent, (child, index) => child === target && (childIndex = index, !0)), this.clipPathSyncParent = parent, this.clipPathSyncChildIndex = childIndex, childIndex;
44043
+ }
44044
+ isClipPathStaticTarget(clipGraphic) {
44045
+ var _a, _b;
44046
+ const target = this.target,
44047
+ targetFinalAttrs = this.getTargetFinalAttrs(),
44048
+ clipGraphicFinalAttrs = "function" == typeof clipGraphic.getFinalAttribute ? clipGraphic.getFinalAttribute() : clipGraphic.finalAttribute,
44049
+ clipFinalAttrs = null !== (_a = null != clipGraphicFinalAttrs ? clipGraphicFinalAttrs : clipGraphic.baseAttributes) && void 0 !== _a ? _a : clipGraphic.attribute,
44050
+ keys = null !== (_b = this.clipPathSyncKeys) && void 0 !== _b ? _b : [];
44051
+ return !!(keys.length && targetFinalAttrs && clipFinalAttrs) && keys.every(key => {
44052
+ var _a, _b;
44053
+ return this.isSameClipPathValue(clipFinalAttrs[key], null !== (_a = targetFinalAttrs[key]) && void 0 !== _a ? _a : null === (_b = target.attribute) || void 0 === _b ? void 0 : _b[key]);
44054
+ });
44055
+ }
44056
+ getTargetFinalAttrs() {
44057
+ var _a, _b, _c;
44058
+ const target = this.target;
44059
+ return null !== (_c = null !== (_b = null === (_a = target.context) || void 0 === _a ? void 0 : _a.finalAttrs) && void 0 !== _b ? _b : "function" == typeof target.getFinalAttribute ? target.getFinalAttribute() : target.finalAttribute) && void 0 !== _c ? _c : null;
44060
+ }
44061
+ isSameClipPathValue(a, b) {
44062
+ return "number" == typeof a && "number" == typeof b ? Math.abs(a - b) < 1e-8 : a === b;
44063
+ }
44064
+ buildClipPathTransientAttrs(clipGraphic) {
44065
+ var _a;
44066
+ const target = this.target,
44067
+ attrs = {};
44068
+ return (null !== (_a = this.clipPathSyncKeys) && void 0 !== _a ? _a : []).forEach(key => {
44069
+ var _a;
44070
+ const nextValue = null === (_a = target.attribute) || void 0 === _a ? void 0 : _a[key];
44071
+ Object.prototype.hasOwnProperty.call(clipGraphic.attribute, key) && void 0 !== nextValue && !this.isSameClipPathValue(clipGraphic.attribute[key], nextValue) && (attrs[key] = nextValue);
44072
+ }), Object.keys(attrs).length ? attrs : null;
43386
44073
  }
43387
44074
  }
43388
44075
 
@@ -43489,10 +44176,10 @@
43489
44176
  super(from, to, duration, easing, params);
43490
44177
  }
43491
44178
  onUpdate(end, ratio, out) {
43492
- const attribute = this.target.attribute;
44179
+ const attrs = {};
43493
44180
  this.propKeys.forEach(key => {
43494
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
43495
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
44181
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
44182
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
43496
44183
  }
43497
44184
  }
43498
44185
  class MoveIn extends MoveBase {
@@ -43548,10 +44235,10 @@
43548
44235
  super(from, to, duration, easing, params);
43549
44236
  }
43550
44237
  onUpdate(end, ratio, out) {
43551
- const attribute = this.target.attribute;
44238
+ const attrs = {};
43552
44239
  this.propKeys.forEach(key => {
43553
- attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
43554
- }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
44240
+ attrs[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
44241
+ }), applyAnimationFrameAttributes(this.target, attrs), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
43555
44242
  }
43556
44243
  }
43557
44244
  class RotateIn extends RotateBase {
@@ -43594,7 +44281,7 @@
43594
44281
  pos: pos,
43595
44282
  angle: angle
43596
44283
  } = this.path.getAttrAt(at);
43597
- 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);
44284
+ 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());
43598
44285
  }
43599
44286
  }
43600
44287
 
@@ -45113,7 +45800,10 @@
45113
45800
  }), this.completeBind(animator);
45114
45801
  }
45115
45802
  deleteSelfAttr(key) {
45116
- super.deleteSelfAttr(key), this._animator.deleteSelfAttr(key);
45803
+ this.deleteSelfAttrs([key]);
45804
+ }
45805
+ deleteSelfAttrs(keys) {
45806
+ super.deleteSelfAttrs(keys), this._animator.deleteSelfAttrs(keys);
45117
45807
  }
45118
45808
  tryPreventConflict() {}
45119
45809
  }
@@ -45659,8 +46349,8 @@
45659
46349
  const orient = this.attribute.orient;
45660
46350
  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;
45661
46351
  }
45662
- release() {
45663
- super.release(), this._breaks = null;
46352
+ release(all) {
46353
+ super.release(all), this._breaks = null;
45664
46354
  }
45665
46355
  }
45666
46356
  LineAxis.defaultAttributes = DEFAULT_AXIS_THEME, mixin(LineAxis, LineAxisMixin);
@@ -48033,6 +48723,14 @@
48033
48723
  }
48034
48724
  return t;
48035
48725
  };
48726
+ function cloneAttributeSnapshot(value) {
48727
+ if (!isObject$2(value) || isArray$1(value)) return value;
48728
+ const snapshot = {};
48729
+ return Object.keys(value).forEach(key => {
48730
+ const nextValue = value[key];
48731
+ snapshot[key] = isObject$2(nextValue) && !isArray$1(nextValue) ? cloneAttributeSnapshot(nextValue) : nextValue;
48732
+ }), snapshot;
48733
+ }
48036
48734
  loadLabelComponent();
48037
48735
  class LabelBase extends AnimateComponent {
48038
48736
  setBitmap(bitmap) {
@@ -48097,11 +48795,56 @@
48097
48795
  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;
48098
48796
  }
48099
48797
  }
48798
+ _finalizeExitRelease() {
48799
+ var _a, _b, _c, _d;
48800
+ const state = this._exitReleaseState;
48801
+ if (null == state ? void 0 : state.finalized) return;
48802
+ state && (state.finalized = !0);
48803
+ const parent = this.parent,
48804
+ removeFromParent = !!(null == state ? void 0 : state.removeFromParent),
48805
+ callbacks = null !== (_a = null == state ? void 0 : state.onComplete) && void 0 !== _a ? _a : [];
48806
+ 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);
48807
+ }
48808
+ _runExitAnimationBeforeRelease(options = {}) {
48809
+ var _a, _b;
48810
+ if (this._exitReleaseState && !this._exitReleaseState.finalized) return this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent, appendExitReleaseCallback(this._exitReleaseState, options.onComplete), !0;
48811
+ if (!this.stage || !1 === this.attribute.animation || !1 === this.attribute.animationExit || !(null === (_a = this._graphicToText) || void 0 === _a ? void 0 : _a.size)) return !1;
48812
+ if (this._prepareAnimate(DefaultLabelAnimation), !(null === (_b = this._animationConfig) || void 0 === _b ? void 0 : _b.exit)) return !1;
48813
+ const exitTargets = new Set();
48814
+ if (this._graphicToText.forEach(label => {
48815
+ (null == label ? void 0 : label.text) && exitTargets.add(label.text), (null == label ? void 0 : label.labelLine) && exitTargets.add(label.labelLine);
48816
+ }), !exitTargets.size) return !1;
48817
+ const existingAnimates = collectTrackedAnimates(this);
48818
+ exitTargets.forEach(target => {
48819
+ var _a;
48820
+ target.applyAnimationState(["exit"], [{
48821
+ name: "exit",
48822
+ animation: Object.assign(Object.assign({}, this._animationConfig.exit), {
48823
+ type: null !== (_a = this._animationConfig.exit.type) && void 0 !== _a ? _a : "fadeOut",
48824
+ selfOnly: !0
48825
+ })
48826
+ }]);
48827
+ });
48828
+ const exitAnimates = collectTrackedAnimates(this).filter(animate => !existingAnimates.includes(animate));
48829
+ if (!exitAnimates.length) return !1;
48830
+ this.setAttribute("childrenPickable", !1), this.releaseStatus = "willRelease";
48831
+ const pendingAnimates = new Set(exitAnimates);
48832
+ return this._exitReleaseState = {
48833
+ pendingAnimates: pendingAnimates,
48834
+ finalized: !1,
48835
+ removeFromParent: !!options.removeFromParent,
48836
+ onComplete: options.onComplete ? [options.onComplete] : []
48837
+ }, bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease()), !0;
48838
+ }
48839
+ releaseWithExitAnimation(options = {}) {
48840
+ return "released" !== this.releaseStatus && this._runExitAnimationBeforeRelease(options);
48841
+ }
48100
48842
  render() {
48843
+ if (this._exitReleaseState) return;
48101
48844
  if (this._prepare(), isNil$1(this._idToGraphic) || this._isCollectionBase && isNil$1(this._idToPoint)) return;
48102
48845
  const markAttributeList = [];
48103
48846
  !1 !== this._enableAnimation && this._baseMarks.forEach(mark => {
48104
- markAttributeList.push(mark.attribute), mark.initAttributes(mark.getAttributes(!0));
48847
+ markAttributeList.push(cloneAttributeSnapshot(mark.attribute)), mark.initAttributes(mark.getAttributes(!0));
48105
48848
  });
48106
48849
  const {
48107
48850
  overlap: overlap,
@@ -48667,6 +49410,10 @@
48667
49410
  _canPlaceInside(textBound, shapeBound) {
48668
49411
  return !(!textBound || !shapeBound) && shapeBound.encloses(textBound);
48669
49412
  }
49413
+ release(all) {
49414
+ var _a, _b;
49415
+ 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);
49416
+ }
48670
49417
  setLocation(point) {
48671
49418
  this.translateTo(point.x, point.y);
48672
49419
  }
@@ -49436,6 +50183,7 @@
49436
50183
  }
49437
50184
  render() {
49438
50185
  var _a;
50186
+ if (this._exitReleaseState) return;
49439
50187
  const {
49440
50188
  dataLabels: dataLabels,
49441
50189
  size: size
@@ -49470,6 +50218,47 @@
49470
50218
  currentComponentMap.get(key) || this.removeChild(cp);
49471
50219
  }), this._componentMap = currentComponentMap;
49472
50220
  }
50221
+ _finalizeExitRelease() {
50222
+ var _a, _b, _c;
50223
+ const state = this._exitReleaseState;
50224
+ if (null == state ? void 0 : state.finalized) return;
50225
+ state && (state.finalized = !0);
50226
+ const parent = this.parent,
50227
+ removeFromParent = !!(null == state ? void 0 : state.removeFromParent),
50228
+ callbacks = null !== (_a = null == state ? void 0 : state.onComplete) && void 0 !== _a ? _a : [];
50229
+ 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);
50230
+ }
50231
+ releaseWithExitAnimation(options = {}) {
50232
+ var _a;
50233
+ if ("released" === this.releaseStatus) return !1;
50234
+ if (this._exitReleaseState && !this._exitReleaseState.finalized) return this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent, appendExitReleaseCallback(this._exitReleaseState, options.onComplete), !0;
50235
+ if (!this.stage || !(null === (_a = this._componentMap) || void 0 === _a ? void 0 : _a.size)) return !1;
50236
+ const state = {
50237
+ pendingCount: 0,
50238
+ finalized: !1,
50239
+ removeFromParent: !!options.removeFromParent,
50240
+ onComplete: options.onComplete ? [options.onComplete] : []
50241
+ },
50242
+ exitingComponents = [],
50243
+ fallbackComponents = [];
50244
+ let initializing = !0;
50245
+ const finish = () => {
50246
+ state.finalized || (state.pendingCount -= 1, state.pendingCount <= 0 && !initializing && this._finalizeExitRelease());
50247
+ };
50248
+ return this._exitReleaseState = state, this._componentMap.forEach(component => {
50249
+ state.pendingCount += 1;
50250
+ component.releaseWithExitAnimation({
50251
+ removeFromParent: !1,
50252
+ onComplete: finish
50253
+ }) ? exitingComponents.push(component) : (state.pendingCount -= 1, fallbackComponents.push(component));
50254
+ }), exitingComponents.length ? (fallbackComponents.forEach(component => {
50255
+ component.release(!0), this.removeChild(component);
50256
+ }), this.setAttribute("childrenPickable", !1), this.releaseStatus = "willRelease", initializing = !1, state.pendingCount <= 0 && this._finalizeExitRelease(), !0) : (this._exitReleaseState = void 0, !1);
50257
+ }
50258
+ release(all) {
50259
+ var _a;
50260
+ this._exitReleaseState ? this._finalizeExitRelease() : (all && this.removeAllChild(!0), super.release(all), null === (_a = this._componentMap) || void 0 === _a || _a.clear());
50261
+ }
49473
50262
  setLocation(point) {
49474
50263
  this.translateTo(point.x, point.y);
49475
50264
  }
@@ -51103,14 +51892,51 @@
51103
51892
  y: clipInRange ? -(null !== (_b = limitRect.y) && void 0 !== _b ? _b : 0) : 0
51104
51893
  });
51105
51894
  }
51106
- render() {
51895
+ _finalizeExitRelease() {
51896
+ var _a, _b;
51897
+ const state = this._exitReleaseState;
51898
+ if (null == state ? void 0 : state.finalized) return;
51899
+ state && (state.finalized = !0);
51900
+ const parent = this.parent,
51901
+ removeFromParent = !!(null == state ? void 0 : state.removeFromParent),
51902
+ releaseSelf = !!(null == state ? void 0 : state.releaseSelf),
51903
+ callbacks = null !== (_a = null == state ? void 0 : state.onComplete) && void 0 !== _a ? _a : [];
51904
+ 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);
51905
+ }
51906
+ _runExitAnimationBeforeCleanup(options = {}) {
51107
51907
  var _a;
51908
+ const releaseSelf = !!options.releaseSelf;
51909
+ 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;
51910
+ if (!this.stage || !1 === this.attribute.animation || !1 === this.attribute.animationExit || !this._container) return !1;
51911
+ if (this.transAnimationConfig(), !(null === (_a = this._animationConfig) || void 0 === _a ? void 0 : _a.exit)) return !1;
51912
+ const existingAnimates = collectTrackedAnimates(this);
51913
+ this.markerAnimate("exit");
51914
+ const exitAnimates = collectTrackedAnimates(this).filter(animate => !existingAnimates.includes(animate));
51915
+ if (!exitAnimates.length) return !1;
51916
+ this._releaseEvent(), this.setAttribute("childrenPickable", !1), releaseSelf && (this.releaseStatus = "willRelease");
51917
+ const pendingAnimates = new Set(exitAnimates);
51918
+ return this._exitReleaseState = {
51919
+ pendingAnimates: pendingAnimates,
51920
+ finalized: !1,
51921
+ releaseSelf: releaseSelf,
51922
+ removeFromParent: !!options.removeFromParent,
51923
+ onComplete: options.onComplete ? [options.onComplete] : []
51924
+ }, bindExitReleaseAnimates(exitAnimates, () => this._exitReleaseState, () => this._finalizeExitRelease()), !0;
51925
+ }
51926
+ releaseWithExitAnimation(options = {}) {
51927
+ return "released" !== this.releaseStatus && this._runExitAnimationBeforeCleanup(Object.assign(Object.assign({}, options), {
51928
+ releaseSelf: !0
51929
+ }));
51930
+ }
51931
+ render() {
51932
+ var _a, _b;
51933
+ if (null === (_a = this._exitReleaseState) || void 0 === _a ? void 0 : _a.releaseSelf) return;
51108
51934
  this.transAnimationConfig(), this.setAttribute("pickable", !1);
51109
- const markerVisible = null === (_a = this.attribute.visible) || void 0 === _a || _a;
51110
- !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();
51935
+ const markerVisible = null === (_b = this.attribute.visible) || void 0 === _b || _b;
51936
+ !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();
51111
51937
  }
51112
- release() {
51113
- this.markerAnimate("exit"), super.release(), this._releaseEvent(), this._container = null;
51938
+ release(all) {
51939
+ 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);
51114
51940
  }
51115
51941
  }
51116
51942
 
@@ -53373,7 +54199,10 @@
53373
54199
  const innerGroupHeight = innerGroupBounds.height(),
53374
54200
  itemGroupWidth = isValid$1(this.attribute.item.width) ? this.attribute.item.width : innerGroupWidth + parsedPadding[1] + parsedPadding[3],
53375
54201
  itemGroupHeight = this._itemHeightByUser || innerGroupHeight + parsedPadding[0] + parsedPadding[2];
53376
- 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;
54202
+ return itemGroup.setAttributes({
54203
+ width: itemGroupWidth,
54204
+ height: itemGroupHeight
54205
+ }), focusShape && focusShape.setAttribute("visible", !1), innerGroup.translateTo(-innerGroupBounds.x1 + parsedPadding[3], -innerGroupBounds.y1 + parsedPadding[0]), itemGroup;
53377
54206
  }
53378
54207
  _createPager(compStyle) {
53379
54208
  var _a, _b;
@@ -55010,7 +55839,11 @@
55010
55839
  subTextBoundsWidth = this._subTitle ? this._subTitle.AABBBounds.width() : 0;
55011
55840
  let totalWidth = Math.max(mainTextBoundsWidth, subTextBoundsWidth),
55012
55841
  totalHeight = mainTextBoundsHeight + (null !== (_q = subtextStyle.height) && void 0 !== _q ? _q : subTextBoundsHeight);
55013
- 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) {
55842
+ 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({
55843
+ width: totalWidth,
55844
+ height: totalHeight,
55845
+ boundsPadding: parsedPadding
55846
+ }), this._mainTitle) {
55014
55847
  if (isValid$1(align) || isValid$1(textStyle.align)) {
55015
55848
  const mainTitleAlign = textStyle.align ? textStyle.align : align,
55016
55849
  mainTitleWidth = null !== (_r = textStyle.width) && void 0 !== _r ? _r : totalWidth;
@@ -60243,7 +61076,7 @@
60243
61076
  stage.release();
60244
61077
  }
60245
61078
  else if (rootGroup) {
60246
- stage.defaultLayer.removeChild(rootGroup);
61079
+ stage.defaultLayer.removeChild(rootGroup, true);
60247
61080
  rootGroup.release();
60248
61081
  }
60249
61082
  }
@@ -60261,7 +61094,7 @@
60261
61094
  if (removeGraphicItems) {
60262
61095
  this._rootMarks.forEach(g => {
60263
61096
  traverseGroupMark(g, m => {
60264
- m.removeProduct();
61097
+ m.removeProduct(true);
60265
61098
  }, null, true);
60266
61099
  });
60267
61100
  }
@@ -60436,6 +61269,71 @@
60436
61269
  height
60437
61270
  };
60438
61271
  }
61272
+ const UPDATE_SPEC_EFFECT_KEYS = [
61273
+ 'remake',
61274
+ 'compile',
61275
+ 'render',
61276
+ 'layout',
61277
+ 'data',
61278
+ 'scaleDomain',
61279
+ 'series',
61280
+ 'component',
61281
+ 'animation',
61282
+ 'localOnly'
61283
+ ];
61284
+ function mergeUpdateSpecEffects(target, ...sources) {
61285
+ sources.forEach(source => {
61286
+ const sourceEffects = source === null || source === void 0 ? void 0 : source.effects;
61287
+ if (!sourceEffects) {
61288
+ return;
61289
+ }
61290
+ if (!target.effects) {
61291
+ target.effects = {};
61292
+ }
61293
+ const targetEffects = target.effects;
61294
+ UPDATE_SPEC_EFFECT_KEYS.forEach(key => {
61295
+ if (sourceEffects[key]) {
61296
+ targetEffects[key] = targetEffects[key] || sourceEffects[key];
61297
+ }
61298
+ });
61299
+ });
61300
+ }
61301
+ function isUpdateSpecResultLocalOnly(result) {
61302
+ const effects = result.effects;
61303
+ return (!!(effects === null || effects === void 0 ? void 0 : effects.localOnly) &&
61304
+ !result.reMake &&
61305
+ !result.reCompile &&
61306
+ !result.reRender &&
61307
+ !result.reSize &&
61308
+ !effects.remake &&
61309
+ !effects.compile &&
61310
+ !effects.render &&
61311
+ !effects.layout &&
61312
+ !effects.data &&
61313
+ !effects.scaleDomain &&
61314
+ !effects.series &&
61315
+ !result.reTransformSpec &&
61316
+ !result.reAnimate &&
61317
+ !result.changeTheme &&
61318
+ !result.changeBackground);
61319
+ }
61320
+ function isUpdateSpecResultComponentOnly(result) {
61321
+ const effects = result.effects;
61322
+ return (!!(effects === null || effects === void 0 ? void 0 : effects.component) &&
61323
+ !result.reMake &&
61324
+ !result.reCompile &&
61325
+ !result.reSize &&
61326
+ !effects.remake &&
61327
+ !effects.compile &&
61328
+ !effects.data &&
61329
+ !effects.scaleDomain &&
61330
+ !effects.series &&
61331
+ !effects.animation &&
61332
+ !result.reTransformSpec &&
61333
+ !result.reAnimate &&
61334
+ !result.changeTheme &&
61335
+ !result.changeBackground);
61336
+ }
60439
61337
  function mergeUpdateResult(target, ...sources) {
60440
61338
  const merge = (key) => sources.reduce((value, cur) => value || (cur === null || cur === void 0 ? void 0 : cur[key]), target[key]);
60441
61339
  Object.assign(target, {
@@ -60448,6 +61346,7 @@
60448
61346
  changeTheme: merge('changeTheme'),
60449
61347
  changeBackground: merge('changeBackground')
60450
61348
  });
61349
+ mergeUpdateSpecEffects(target, ...sources);
60451
61350
  return target;
60452
61351
  }
60453
61352
  function getTrimPaddingConfig(chartType, spec) {
@@ -62662,7 +63561,7 @@
62662
63561
  this._data = null;
62663
63562
  this._data = dataView;
62664
63563
  }
62665
- removeProduct() {
63564
+ removeProduct(_releaseDetach) {
62666
63565
  this._product = null;
62667
63566
  this._prevProduct = null;
62668
63567
  this._compiledProductId = null;
@@ -62836,6 +63735,34 @@
62836
63735
  };
62837
63736
 
62838
63737
  const normalizeStates = (states) => (Array.isArray(states) ? states : states ? [states] : []);
63738
+ const isSameStates = (currentStates, nextStates) => {
63739
+ const current = currentStates !== null && currentStates !== void 0 ? currentStates : [];
63740
+ if (current.length !== nextStates.length) {
63741
+ return false;
63742
+ }
63743
+ return current.every((stateName, index) => stateName === nextStates[index]);
63744
+ };
63745
+ const setGraphicStates = (graphic, nextStates, hasAnimation) => {
63746
+ var _a;
63747
+ if (graphic.setStates) {
63748
+ graphic.setStates(nextStates, {
63749
+ animate: hasAnimation,
63750
+ animateSameStatePatchChange: true
63751
+ });
63752
+ return;
63753
+ }
63754
+ const normalizedNextStates = nextStates !== null && nextStates !== void 0 ? nextStates : [];
63755
+ if (isSameStates(graphic.currentStates, normalizedNextStates)) {
63756
+ (_a = graphic.invalidateResolver) === null || _a === void 0 ? void 0 : _a.call(graphic);
63757
+ return;
63758
+ }
63759
+ if (normalizedNextStates.length) {
63760
+ graphic.useStates(normalizedNextStates, hasAnimation);
63761
+ }
63762
+ else {
63763
+ graphic.clearStates(hasAnimation);
63764
+ }
63765
+ };
62839
63766
  const addGraphicState = (graphic, state, keepCurrentStates = true, hasAnimation) => {
62840
63767
  var _a;
62841
63768
  if (!state) {
@@ -62843,7 +63770,7 @@
62843
63770
  }
62844
63771
  const currentStates = keepCurrentStates ? (_a = graphic.currentStates) !== null && _a !== void 0 ? _a : [] : [];
62845
63772
  const nextStates = keepCurrentStates ? Array.from(new Set([...currentStates, state])) : [state];
62846
- graphic.useStates(nextStates, hasAnimation);
63773
+ setGraphicStates(graphic, nextStates, hasAnimation);
62847
63774
  };
62848
63775
  const removeGraphicState = (graphic, state, hasAnimation) => {
62849
63776
  var _a;
@@ -62853,9 +63780,10 @@
62853
63780
  }
62854
63781
  const currentStates = ((_a = graphic.currentStates) !== null && _a !== void 0 ? _a : []);
62855
63782
  const nextStates = currentStates.filter((stateName) => !states.includes(stateName));
62856
- graphic.useStates(nextStates, hasAnimation);
63783
+ setGraphicStates(graphic, nextStates, hasAnimation);
62857
63784
  };
62858
63785
 
63786
+ const statesClearedBeforeReInitKey = Symbol('statesClearedBeforeReInit');
62859
63787
  class BaseMark extends GrammarItem {
62860
63788
  commit(render, recursion) {
62861
63789
  if (recursion && this.getMarks().length > 0) {
@@ -63061,9 +63989,9 @@
63061
63989
  }
63062
63990
  resumeAnimationByState(state) {
63063
63991
  }
63064
- removeProduct() {
63992
+ removeProduct(releaseDetach) {
63065
63993
  if (this._product && this._product.parent) {
63066
- this._product.parent.removeChild(this._product);
63994
+ this._product.parent.removeChild(this._product, releaseDetach);
63067
63995
  }
63068
63996
  this._product = null;
63069
63997
  this._compiledProductId = null;
@@ -63093,6 +64021,9 @@
63093
64021
  this._unCompileChannel = {};
63094
64022
  this._disabledAnimationStates = [];
63095
64023
  this._skipBeforeLayouted = false;
64024
+ this._sharedStateDefinitionRefIds = new WeakMap();
64025
+ this._sharedStateDefinitionRefId = 0;
64026
+ this._dynamicSharedStateNames = new Set();
63096
64027
  this._extensionChannel = {};
63097
64028
  this._computeExChannel = {};
63098
64029
  this._graphicMap = new Map();
@@ -63127,11 +64058,19 @@
63127
64058
  }
63128
64059
  };
63129
64060
  this._setStateOfGraphic = (g, hasAnimation) => {
63130
- g.clearStates();
64061
+ var _a, _b, _c;
63131
64062
  g.stateProxy = null;
63132
- if (g.context.diffState === DiffState.enter || g.context.diffState === DiffState.update) {
63133
- g.context.states && g.useStates(g.context.states, hasAnimation);
64063
+ const targetStates = g.context.diffState === DiffState.enter || g.context.diffState === DiffState.update
64064
+ ? g.context.states
64065
+ : undefined;
64066
+ const hasCurrentState = !!((_a = g.currentStates) === null || _a === void 0 ? void 0 : _a.length) ||
64067
+ !!((_b = g.effectiveStates) === null || _b === void 0 ? void 0 : _b.length) ||
64068
+ !!g.resolvedStatePatch ||
64069
+ !!((_c = g.registeredActiveScopes) === null || _c === void 0 ? void 0 : _c.size);
64070
+ if (!(targetStates === null || targetStates === void 0 ? void 0 : targetStates.length) && !hasCurrentState) {
64071
+ return;
63134
64072
  }
64073
+ setGraphicStates(g, targetStates, hasAnimation);
63135
64074
  };
63136
64075
  this.name = name;
63137
64076
  this.model = option.model;
@@ -63665,6 +64604,9 @@
63665
64604
  if (state === 'appear') {
63666
64605
  return;
63667
64606
  }
64607
+ if (state === 'update' && !this._hasDiffAttrs(g)) {
64608
+ return;
64609
+ }
63668
64610
  const config = animationConfig[state];
63669
64611
  if (config && config.length > 0) {
63670
64612
  const configList = config.map((item, index) => ({
@@ -63830,6 +64772,48 @@
63830
64772
  });
63831
64773
  return { updateStyles, groupStyles };
63832
64774
  }
64775
+ _getSharedStateDefinitionRefId(value) {
64776
+ if ((typeof value !== 'object' && typeof value !== 'function') || value === null) {
64777
+ return `${value}`;
64778
+ }
64779
+ const objectValue = value;
64780
+ let id = this._sharedStateDefinitionRefIds.get(objectValue);
64781
+ if (!id) {
64782
+ id = ++this._sharedStateDefinitionRefId;
64783
+ this._sharedStateDefinitionRefIds.set(objectValue, id);
64784
+ }
64785
+ return `ref:${id}`;
64786
+ }
64787
+ _getSharedStateDefinitionValueKey(value) {
64788
+ try {
64789
+ const jsonValue = JSON.stringify(value);
64790
+ return jsonValue !== null && jsonValue !== void 0 ? jsonValue : `${value}`;
64791
+ }
64792
+ catch (_error) {
64793
+ return this._getSharedStateDefinitionRefId(value);
64794
+ }
64795
+ }
64796
+ _isStaticSharedStateAttribute(stateName, key) {
64797
+ var _a, _b;
64798
+ const stateStyle = (_a = this.stateStyle[stateName]) === null || _a === void 0 ? void 0 : _a[key];
64799
+ if (!stateStyle || stateStyle.referer || isFunction$1(stateStyle.postProcess) || key in this._computeExChannel) {
64800
+ return false;
64801
+ }
64802
+ const style = stateStyle.style;
64803
+ if (isFunction$1(style)) {
64804
+ return false;
64805
+ }
64806
+ if (GradientType.includes(style === null || style === void 0 ? void 0 : style.gradient)) {
64807
+ return false;
64808
+ }
64809
+ if (['outerBorder', 'innerBorder'].includes(key)) {
64810
+ return false;
64811
+ }
64812
+ if (isValidScaleType((_b = style === null || style === void 0 ? void 0 : style.scale) === null || _b === void 0 ? void 0 : _b.type)) {
64813
+ return false;
64814
+ }
64815
+ return true;
64816
+ }
63833
64817
  _applySharedStateDefinitions() {
63834
64818
  var _a;
63835
64819
  if (!this._product) {
@@ -63837,7 +64821,10 @@
63837
64821
  }
63838
64822
  const stateNames = Object.keys((_a = this._encoderOfState) !== null && _a !== void 0 ? _a : {}).filter(stateName => stateName !== 'group' && stateName !== 'update');
63839
64823
  if (!stateNames.length) {
63840
- this._product.sharedStateDefinitions = undefined;
64824
+ this._dynamicSharedStateNames.clear();
64825
+ if (this._product.sharedStateDefinitions !== undefined) {
64826
+ this._product.sharedStateDefinitions = undefined;
64827
+ }
63841
64828
  return;
63842
64829
  }
63843
64830
  const sortedStateNames = this._stateSort ? stateNames.slice().sort(this._stateSort) : stateNames;
@@ -63846,15 +64833,71 @@
63846
64833
  statePriority.set(stateName, index);
63847
64834
  });
63848
64835
  const sharedStateDefinitions = {};
64836
+ const cacheKeys = [];
64837
+ const dynamicSharedStateNames = new Set();
63849
64838
  stateNames.forEach(stateName => {
63850
64839
  var _a;
63851
64840
  const encoder = this._encoderOfState[stateName];
63852
- sharedStateDefinitions[stateName] = {
63853
- priority: (_a = statePriority.get(stateName)) !== null && _a !== void 0 ? _a : 0,
63854
- declaredAffectedKeys: Object.keys(encoder !== null && encoder !== void 0 ? encoder : {}),
63855
- resolver: ({ graphic }) => this._runEncoderOfGraphic(encoder, graphic)
64841
+ const patch = {};
64842
+ const dynamicEncoder = {};
64843
+ const patchKeys = [];
64844
+ const dynamicKeys = [];
64845
+ Object.keys(encoder !== null && encoder !== void 0 ? encoder : {}).forEach(key => {
64846
+ if (this._isStaticSharedStateAttribute(stateName, key)) {
64847
+ patch[key] = this._computeAttribute(key, stateName)(undefined);
64848
+ patchKeys.push(key);
64849
+ }
64850
+ else {
64851
+ dynamicEncoder[key] = encoder[key];
64852
+ dynamicKeys.push(key);
64853
+ }
64854
+ });
64855
+ if (!patchKeys.length && !dynamicKeys.length) {
64856
+ return;
64857
+ }
64858
+ const definition = {
64859
+ priority: (_a = statePriority.get(stateName)) !== null && _a !== void 0 ? _a : 0
63856
64860
  };
64861
+ if (patchKeys.length) {
64862
+ definition.patch = patch;
64863
+ }
64864
+ if (dynamicKeys.length) {
64865
+ dynamicSharedStateNames.add(stateName);
64866
+ definition.declaredAffectedKeys = dynamicKeys;
64867
+ definition.resolver = ({ graphic }) => this._runEncoderOfGraphic(dynamicEncoder, graphic);
64868
+ }
64869
+ sharedStateDefinitions[stateName] = definition;
64870
+ cacheKeys.push([
64871
+ stateName,
64872
+ definition.priority,
64873
+ patchKeys.sort().map(key => `${key}:${this._getSharedStateDefinitionValueKey(patch[key])}`),
64874
+ dynamicKeys.sort().map(key => {
64875
+ var _a;
64876
+ const stateStyle = (_a = this.stateStyle[stateName]) === null || _a === void 0 ? void 0 : _a[key];
64877
+ const styleId = this._getSharedStateDefinitionRefId(stateStyle === null || stateStyle === void 0 ? void 0 : stateStyle.style);
64878
+ const postProcessId = this._getSharedStateDefinitionRefId(stateStyle === null || stateStyle === void 0 ? void 0 : stateStyle.postProcess);
64879
+ const refererId = this._getSharedStateDefinitionRefId(stateStyle === null || stateStyle === void 0 ? void 0 : stateStyle.referer);
64880
+ return `${key}:${styleId}:${postProcessId}:${refererId}`;
64881
+ })
64882
+ ].join('|'));
63857
64883
  });
64884
+ if (!cacheKeys.length) {
64885
+ this._dynamicSharedStateNames.clear();
64886
+ if (this._product.sharedStateDefinitions !== undefined) {
64887
+ this._product.sharedStateDefinitions = undefined;
64888
+ }
64889
+ return;
64890
+ }
64891
+ const cacheKey = cacheKeys.sort().join('||');
64892
+ this._dynamicSharedStateNames = dynamicSharedStateNames;
64893
+ if (cacheKey === this._sharedStateDefinitionsCacheKey && this._sharedStateDefinitionsCache) {
64894
+ if (this._product.sharedStateDefinitions !== this._sharedStateDefinitionsCache) {
64895
+ this._product.sharedStateDefinitions = this._sharedStateDefinitionsCache;
64896
+ }
64897
+ return;
64898
+ }
64899
+ this._sharedStateDefinitionsCacheKey = cacheKey;
64900
+ this._sharedStateDefinitionsCache = sharedStateDefinitions;
63858
64901
  this._product.sharedStateDefinitions = sharedStateDefinitions;
63859
64902
  }
63860
64903
  _addProgressiveGraphic(parent, g) {
@@ -63873,6 +64916,36 @@
63873
64916
  g.context.finalAttrs = finalAttrs;
63874
64917
  });
63875
64918
  }
64919
+ _excludeStateControlledDiffAttrs(g, diffAttrs) {
64920
+ var _a;
64921
+ if (!diffAttrs || !Object.keys(diffAttrs).length) {
64922
+ return diffAttrs;
64923
+ }
64924
+ let nextDiffAttrs;
64925
+ const excludeKey = (key) => {
64926
+ if (!(key in diffAttrs)) {
64927
+ return;
64928
+ }
64929
+ if (!nextDiffAttrs) {
64930
+ nextDiffAttrs = Object.assign({}, diffAttrs);
64931
+ }
64932
+ delete nextDiffAttrs[key];
64933
+ };
64934
+ if (g.resolvedStatePatch) {
64935
+ Object.keys(g.resolvedStatePatch).forEach(excludeKey);
64936
+ }
64937
+ (_a = g.context.states) === null || _a === void 0 ? void 0 : _a.forEach(stateName => {
64938
+ var _a;
64939
+ const encoder = (_a = this._encoderOfState) === null || _a === void 0 ? void 0 : _a[stateName];
64940
+ if (encoder) {
64941
+ Object.keys(encoder).forEach(excludeKey);
64942
+ }
64943
+ });
64944
+ return nextDiffAttrs !== null && nextDiffAttrs !== void 0 ? nextDiffAttrs : diffAttrs;
64945
+ }
64946
+ _hasDiffAttrs(g) {
64947
+ return !!g.context.diffAttrs && Object.keys(g.context.diffAttrs).length > 0;
64948
+ }
63876
64949
  _runApplyGraphic(graphics) {
63877
64950
  const hasAnimation = this.hasAnimation();
63878
64951
  graphics.forEach((g, index) => {
@@ -63905,11 +64978,11 @@
63905
64978
  }
63906
64979
  }
63907
64980
  else {
63908
- const diffAttrs = getDiffAttributesOfGraphic(g, finalAttrs);
64981
+ const diffAttrs = this._excludeStateControlledDiffAttrs(g, getDiffAttributesOfGraphic(g, finalAttrs));
63909
64982
  g.context.diffAttrs = diffAttrs;
63910
64983
  if (g.context.reusing) {
63911
64984
  g.context.lastAttrs = g.attribute;
63912
- g.initAttributes({});
64985
+ g.initAttributes(finalAttrs);
63913
64986
  g.context.reusing = false;
63914
64987
  }
63915
64988
  else if (!hasStateAnimation) {
@@ -64061,11 +65134,24 @@
64061
65134
  }
64062
65135
  const stateInfo = this.state.getStateInfo(key);
64063
65136
  this._graphics.forEach(g => {
65137
+ const reinitStateGraphic = g;
65138
+ const statesClearedBeforeReInit = reinitStateGraphic[statesClearedBeforeReInitKey];
65139
+ const wasStateClearedBeforeReInit = statesClearedBeforeReInit === null || statesClearedBeforeReInit === void 0 ? void 0 : statesClearedBeforeReInit.includes(key);
65140
+ const hasStateAnimation = wasStateClearedBeforeReInit ? false : this.hasAnimationByState('state');
64064
65141
  if (this.state.checkOneState(g, g.context.data, stateInfo) === 'in') {
64065
- addGraphicState(g, key, true, this.hasAnimationByState('state'));
65142
+ addGraphicState(g, key, true, hasStateAnimation);
64066
65143
  }
64067
65144
  else {
64068
- removeGraphicState(g, key, this.hasAnimationByState('state'));
65145
+ removeGraphicState(g, key, hasStateAnimation);
65146
+ }
65147
+ if (wasStateClearedBeforeReInit) {
65148
+ const nextStates = statesClearedBeforeReInit.filter(stateName => stateName !== key);
65149
+ if (nextStates.length) {
65150
+ reinitStateGraphic[statesClearedBeforeReInitKey] = nextStates;
65151
+ }
65152
+ else {
65153
+ delete reinitStateGraphic[statesClearedBeforeReInitKey];
65154
+ }
64069
65155
  }
64070
65156
  });
64071
65157
  }
@@ -64093,7 +65179,9 @@
64093
65179
  animation: Object.assign(Object.assign({}, item), { customParameters: g.context })
64094
65180
  }));
64095
65181
  g.applyAnimationState(['exit'], [exitConfigList.length === 1 ? exitConfigList[0] : exitConfigList], () => {
64096
- doRemove(g, key);
65182
+ if (g.context.diffState === DiffState.exit && g.isExiting && this._graphicMap.get(key) === g) {
65183
+ doRemove(g, key);
65184
+ }
64097
65185
  });
64098
65186
  }
64099
65187
  }
@@ -64268,7 +65356,10 @@
64268
65356
  this.uncommit();
64269
65357
  this.stateStyle = {};
64270
65358
  this.getGraphics().forEach(g => {
64271
- g.clearStates();
65359
+ var _a;
65360
+ if ((_a = g.currentStates) === null || _a === void 0 ? void 0 : _a.length) {
65361
+ g[statesClearedBeforeReInitKey] = g.currentStates.slice();
65362
+ }
64272
65363
  });
64273
65364
  }
64274
65365
  }
@@ -64399,7 +65490,7 @@
64399
65490
  }
64400
65491
  release() {
64401
65492
  super.release();
64402
- this.removeProduct();
65493
+ this.removeProduct(true);
64403
65494
  }
64404
65495
  }
64405
65496
  GroupMark.type = "group";
@@ -65213,6 +66304,38 @@
65213
66304
  }
65214
66305
  }
65215
66306
 
66307
+ const releaseVRenderComponentSync = (component, removeFromParent = true) => {
66308
+ var _a, _b, _c, _d, _e;
66309
+ const parent = component.parent;
66310
+ (_a = component.release) === null || _a === void 0 ? void 0 : _a.call(component, true);
66311
+ (_c = (_b = component).removeAllChild) === null || _c === void 0 ? void 0 : _c.call(_b, true);
66312
+ if (removeFromParent) {
66313
+ (_e = ((_d = component.parent) !== null && _d !== void 0 ? _d : parent)) === null || _e === void 0 ? void 0 : _e.removeChild(component, true);
66314
+ }
66315
+ };
66316
+ const collectVRenderComponents = (component) => {
66317
+ var _a, _b;
66318
+ const components = [component];
66319
+ (_b = (_a = component).forEachChildren) === null || _b === void 0 ? void 0 : _b.call(_a, child => {
66320
+ components.push(...collectVRenderComponents(child));
66321
+ });
66322
+ return components;
66323
+ };
66324
+ const releaseVRenderComponent = (component, options = {}) => {
66325
+ var _a, _b;
66326
+ const { enableExitAnimation = true, removeFromParent = true, onComplete } = options;
66327
+ const releasedWithExit = enableExitAnimation &&
66328
+ ((_b = (_a = component).releaseWithExitAnimation) === null || _b === void 0 ? void 0 : _b.call(_a, {
66329
+ removeFromParent,
66330
+ onComplete
66331
+ }));
66332
+ if (releasedWithExit) {
66333
+ return true;
66334
+ }
66335
+ releaseVRenderComponentSync(component, removeFromParent);
66336
+ return false;
66337
+ };
66338
+
65216
66339
  class VChart {
65217
66340
  static useRegisters(comps) {
65218
66341
  comps.forEach((fn) => {
@@ -65462,7 +66585,7 @@
65462
66585
  this._compiler.updateLayoutTag();
65463
66586
  this._setFontFamilyTheme(this.getTheme('fontFamily'));
65464
66587
  this._initDataSet(this._option.dataSet);
65465
- this._autoSize = isTrueBrowseEnv ? ((_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true) : false;
66588
+ this._autoSize = isTrueBrowseEnv ? (_g = (_f = spec.autoFit) !== null && _f !== void 0 ? _f : this._option.autoFit) !== null && _g !== void 0 ? _g : true : false;
65466
66589
  this._bindResizeEvent();
65467
66590
  this._bindViewEvent();
65468
66591
  this._initChartPlugin();
@@ -65616,6 +66739,9 @@
65616
66739
  this._updateAnimateState(true);
65617
66740
  }
65618
66741
  this._reCompile(updateSpecResult);
66742
+ if (isUpdateSpecResultLocalOnly(updateSpecResult)) {
66743
+ return this;
66744
+ }
65619
66745
  if (sync) {
65620
66746
  return this._renderSync(option);
65621
66747
  }
@@ -65633,7 +66759,7 @@
65633
66759
  if (updateResult.reMake) {
65634
66760
  this._releaseData();
65635
66761
  this._initDataSet();
65636
- (_a = this._chart) === null || _a === void 0 ? void 0 : _a.release();
66762
+ (_a = this._chart) === null || _a === void 0 ? void 0 : _a.release(false);
65637
66763
  this._chart = null;
65638
66764
  }
65639
66765
  if (updateResult.reTransformSpec) {
@@ -65744,6 +66870,7 @@
65744
66870
  this._chartPluginApply('releaseAll');
65745
66871
  this._chartPlugin = null;
65746
66872
  this._chartSpecTransformer = null;
66873
+ this._forceReleaseExitingVRenderComponents();
65747
66874
  (_b = this._chart) === null || _b === void 0 ? void 0 : _b.release();
65748
66875
  (_c = this._eventDispatcher) === null || _c === void 0 ? void 0 : _c.release();
65749
66876
  (_d = this._compiler) === null || _d === void 0 ? void 0 : _d.release();
@@ -65766,6 +66893,25 @@
65766
66893
  this._isReleased = true;
65767
66894
  InstanceManager.unregisterInstance(this);
65768
66895
  }
66896
+ _registerExitingVRenderComponent(component) {
66897
+ var _a;
66898
+ this._exitingVRenderComponents = (_a = this._exitingVRenderComponents) !== null && _a !== void 0 ? _a : new Set();
66899
+ this._exitingVRenderComponents.add(component);
66900
+ }
66901
+ _unregisterExitingVRenderComponent(component) {
66902
+ var _a;
66903
+ (_a = this._exitingVRenderComponents) === null || _a === void 0 ? void 0 : _a.delete(component);
66904
+ }
66905
+ _forceReleaseExitingVRenderComponents() {
66906
+ var _a;
66907
+ if (!((_a = this._exitingVRenderComponents) === null || _a === void 0 ? void 0 : _a.size)) {
66908
+ return;
66909
+ }
66910
+ this._exitingVRenderComponents.forEach(component => {
66911
+ releaseVRenderComponentSync(component);
66912
+ });
66913
+ this._exitingVRenderComponents.clear();
66914
+ }
65769
66915
  updateData(id, data, parserOptions, userUpdateOptions) {
65770
66916
  return __awaiter$b(this, void 0, void 0, function* () {
65771
66917
  return this.updateDataSync(id, data, parserOptions, userUpdateOptions);
@@ -65929,9 +67075,13 @@
65929
67075
  spec = mergeSpec({}, model.getSpec(), spec);
65930
67076
  }
65931
67077
  const result = model.updateSpec(spec);
65932
- model.reInit(spec);
65933
- if (result.change || result.reCompile || result.reMake || result.reSize || result.reRender) {
65934
- this._chart.reDataFlow();
67078
+ const localOnly = isUpdateSpecResultLocalOnly(result);
67079
+ const componentOnly = isUpdateSpecResultComponentOnly(result);
67080
+ if (!localOnly) {
67081
+ model.reInit(spec);
67082
+ if (!componentOnly && (result.change || result.reCompile || result.reMake || result.reSize || result.reRender)) {
67083
+ this._chart.reDataFlow();
67084
+ }
65935
67085
  }
65936
67086
  return this.updateCustomConfigAndRerender(result, sync, {
65937
67087
  morphConfig,
@@ -66112,7 +67262,7 @@
66112
67262
  resize = true;
66113
67263
  }
66114
67264
  const lasAutoSize = this._autoSize;
66115
- 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;
67265
+ 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;
66116
67266
  if (this._autoSize !== lasAutoSize) {
66117
67267
  resize = true;
66118
67268
  }
@@ -67265,6 +68415,8 @@
67265
68415
  data: true
67266
68416
  };
67267
68417
  const defaultSeriesCompileCheckKeys = {
68418
+ xField: true,
68419
+ yField: true,
67268
68420
  invalidType: true,
67269
68421
  animation: true,
67270
68422
  animationAppear: true,
@@ -67273,6 +68425,13 @@
67273
68425
  animationExit: true,
67274
68426
  animationNormal: true
67275
68427
  };
68428
+ const defaultSeriesCompileOnlyCheckKeys = {
68429
+ animationAppear: true,
68430
+ animationEnter: true,
68431
+ animationUpdate: true,
68432
+ animationExit: true,
68433
+ animationNormal: true
68434
+ };
67276
68435
 
67277
68436
  const AnimationStates = [...Object.keys(DEFAULT_ANIMATION_CONFIG), 'normal'];
67278
68437
  function animationConfig(defaultConfig = {}, userConfig, params) {
@@ -67628,6 +68787,40 @@
67628
68787
  return null;
67629
68788
  }
67630
68789
 
68790
+ const defaultSeriesDataRelatedCheckKeys = Object.keys(defaultSeriesCompileCheckKeys).reduce((keys, key) => {
68791
+ if (!defaultSeriesCompileOnlyCheckKeys[key]) {
68792
+ keys[key] = true;
68793
+ }
68794
+ return keys;
68795
+ }, {});
68796
+ const defaultSeriesSpecUpdatePolicy = {
68797
+ compileOnlyKeys: defaultSeriesCompileOnlyCheckKeys,
68798
+ dataRelatedKeys: defaultSeriesDataRelatedCheckKeys
68799
+ };
68800
+ const isSpecObject = (value) => isObject$2(value) && !isArray$1(value) && !isFunction$1(value);
68801
+ const hasOnlyAllowedSubKeyChanges = (specValue, prevSpecValue, allowedSubKeys) => {
68802
+ if (!isSpecObject(specValue) || !isSpecObject(prevSpecValue)) {
68803
+ return false;
68804
+ }
68805
+ let changed = false;
68806
+ const subKeys = Array.from(new Set([...Object.keys(prevSpecValue), ...Object.keys(specValue)]));
68807
+ for (const subKey of subKeys) {
68808
+ if (!isEqual(specValue[subKey], prevSpecValue[subKey])) {
68809
+ if (!allowedSubKeys[subKey]) {
68810
+ return false;
68811
+ }
68812
+ changed = true;
68813
+ }
68814
+ }
68815
+ return changed;
68816
+ };
68817
+ function markSeriesCompileEffect(compareResult, dataRelated = false) {
68818
+ compareResult.effects = Object.assign(Object.assign({}, compareResult.effects), { series: true, compile: true, layout: true, render: true });
68819
+ if (dataRelated) {
68820
+ compareResult.effects.data = true;
68821
+ compareResult.effects.scaleDomain = true;
68822
+ }
68823
+ }
67631
68824
  class BaseSeries extends BaseModel {
67632
68825
  getRegion() {
67633
68826
  return this._region;
@@ -68326,9 +69519,14 @@
68326
69519
  return !isEqual(prev, newLabels[index]);
68327
69520
  })) {
68328
69521
  compareResult.reCompile = true;
69522
+ markSeriesCompileEffect(compareResult);
68329
69523
  }
68330
69524
  }
69525
+ _getSpecUpdatePolicy() {
69526
+ return defaultSeriesSpecUpdatePolicy;
69527
+ }
68331
69528
  _compareSpec(spec, prevSpec, ignoreCheckKeys) {
69529
+ var _a, _b, _c, _d;
68332
69530
  const result = super._compareSpec(spec, prevSpec);
68333
69531
  const currentKeys = Object.keys(prevSpec || {}).sort();
68334
69532
  const nextKeys = Object.keys(spec || {}).sort();
@@ -68336,7 +69534,12 @@
68336
69534
  result.reMake = true;
68337
69535
  return result;
68338
69536
  }
68339
- const ignores = Object.assign(Object.assign(Object.assign(Object.assign({}, defaultSeriesIgnoreCheckKeys), defaultSeriesCompileCheckKeys), ignoreCheckKeys), { extensionMark: true, label: true, totalLabel: true });
69537
+ const specUpdatePolicy = this._getSpecUpdatePolicy();
69538
+ const compileOnlyKeys = (_a = specUpdatePolicy.compileOnlyKeys) !== null && _a !== void 0 ? _a : {};
69539
+ const dataRelatedKeys = (_b = specUpdatePolicy.dataRelatedKeys) !== null && _b !== void 0 ? _b : {};
69540
+ const compileOnlySubKeys = (_c = specUpdatePolicy.compileOnlySubKeys) !== null && _c !== void 0 ? _c : {};
69541
+ const compileCheckKeys = Object.assign(Object.assign({}, compileOnlyKeys), dataRelatedKeys);
69542
+ const ignores = Object.assign(Object.assign(Object.assign(Object.assign({}, defaultSeriesIgnoreCheckKeys), compileCheckKeys), ignoreCheckKeys), { extensionMark: true, label: true, totalLabel: true });
68340
69543
  this._compareExtensionMarksSpec(array(spec.extensionMark), array(prevSpec.extensionMark), result);
68341
69544
  !result.reMake && this._compareLabelSpec(array(spec.label), array(prevSpec.label), result);
68342
69545
  !result.reMake &&
@@ -68352,12 +69555,27 @@
68352
69555
  })) {
68353
69556
  result.reCompile = true;
68354
69557
  }
68355
- if (!result.reCompile &&
68356
- currentKeys.some((k) => {
68357
- return defaultSeriesCompileCheckKeys[k] && !isEqual(spec[k], prevSpec[k]);
68358
- })) {
69558
+ const changedCompileKeys = currentKeys.filter((k) => {
69559
+ return compileCheckKeys[k] && !isEqual(spec[k], prevSpec[k]);
69560
+ });
69561
+ const changedCompileOnlySubKeys = currentKeys.filter((k) => {
69562
+ return (compileOnlySubKeys[k] &&
69563
+ hasOnlyAllowedSubKeyChanges(spec[k], prevSpec[k], compileOnlySubKeys[k]));
69564
+ });
69565
+ changedCompileOnlySubKeys.forEach(k => {
69566
+ ignores[k] = true;
69567
+ });
69568
+ if (!result.reCompile && (changedCompileKeys.length || changedCompileOnlySubKeys.length)) {
68359
69569
  result.reCompile = true;
68360
69570
  }
69571
+ if (changedCompileKeys.some(k => dataRelatedKeys[k])) {
69572
+ markSeriesCompileEffect(result, true);
69573
+ }
69574
+ else if (result.reCompile &&
69575
+ !((_d = result.effects) === null || _d === void 0 ? void 0 : _d.series) &&
69576
+ (changedCompileKeys.length || changedCompileOnlySubKeys.length)) {
69577
+ markSeriesCompileEffect(result);
69578
+ }
68361
69579
  if (currentKeys.some((k) => {
68362
69580
  return !ignores[k] && !isEqual(spec[k], prevSpec[k]);
68363
69581
  })) {
@@ -68506,7 +69724,7 @@
68506
69724
  attributeContext: this._markAttributeContext,
68507
69725
  componentType: option.componentType,
68508
69726
  noSeparateStyle,
68509
- parent: parent !== false ? (parent !== null && parent !== void 0 ? parent : this._rootMark) : null
69727
+ parent: parent !== false ? parent !== null && parent !== void 0 ? parent : this._rootMark : null
68510
69728
  });
68511
69729
  if (isValid$1(m)) {
68512
69730
  const spec = this.getSpec() || {};
@@ -68539,11 +69757,22 @@
68539
69757
  if (!datum) {
68540
69758
  return key;
68541
69759
  }
68542
- const dimensionFields = this.getDimensionField();
68543
- key = dimensionFields.map(field => datum[field]).join('_');
68544
69760
  const seriesField = this.getSeriesField();
68545
- if (seriesField && !dimensionFields.includes(seriesField)) {
68546
- key += `_${datum[seriesField]}`;
69761
+ const dimensionFields = this.getDimensionField();
69762
+ const seriesFieldValue = seriesField ? datum[seriesField] : undefined;
69763
+ let hasSeriesFieldInDimension = false;
69764
+ let lastDimensionValue;
69765
+ for (let i = 0; i < dimensionFields.length; i++) {
69766
+ const field = dimensionFields[i];
69767
+ const dimensionValue = datum[field];
69768
+ key += `${i > 0 ? '_' : ''}${isNil$1(dimensionValue) ? '' : dimensionValue}`;
69769
+ hasSeriesFieldInDimension || (hasSeriesFieldInDimension = field === seriesField);
69770
+ lastDimensionValue = dimensionValue;
69771
+ }
69772
+ if (seriesField &&
69773
+ !hasSeriesFieldInDimension &&
69774
+ !(dimensionFields.length > 1 && lastDimensionValue === seriesFieldValue)) {
69775
+ key += `_${seriesFieldValue}`;
68547
69776
  }
68548
69777
  return key;
68549
69778
  }
@@ -69468,6 +70697,10 @@
69468
70697
  ["line"]: { name: "line", type: "line" }
69469
70698
  };
69470
70699
 
70700
+ const LINE_LIKE_SERIES_DATA_RELATED_KEYS = {
70701
+ sampling: true,
70702
+ samplingFactor: true
70703
+ };
69471
70704
  class LineLikeSeriesMixin {
69472
70705
  addSamplingCompile() {
69473
70706
  if (this._spec.sampling) {
@@ -70741,6 +71974,7 @@
70741
71974
  this.name = 'component';
70742
71975
  this.modelType = 'component';
70743
71976
  this.transformerConstructor = BaseComponentSpecTransformer;
71977
+ this._forceReleaseVRenderComponents = false;
70744
71978
  this._delegateEvent = (component, event, type, item = null, datum = null) => {
70745
71979
  var _a, _b;
70746
71980
  if (!(event instanceof CustomEvent)) {
@@ -70804,23 +72038,72 @@
70804
72038
  }
70805
72039
  return result;
70806
72040
  }
72041
+ beforeRelease() {
72042
+ super.beforeRelease();
72043
+ this._forceReleaseVRenderComponents = true;
72044
+ this._forceReleaseExitingVRenderComponents();
72045
+ }
70807
72046
  release() {
70808
72047
  var _a;
70809
- super.release();
72048
+ if (this._shouldReleaseVRenderComponentsImmediately()) {
72049
+ this._forceReleaseExitingVRenderComponents();
72050
+ }
70810
72051
  this.clear();
72052
+ super.release();
70811
72053
  (_a = this.pluginService) === null || _a === void 0 ? void 0 : _a.releaseAll();
70812
72054
  this.pluginService = null;
70813
72055
  }
72056
+ _shouldReleaseVRenderComponentsImmediately() {
72057
+ return this._forceReleaseVRenderComponents;
72058
+ }
72059
+ _forceReleaseExitingVRenderComponents() {
72060
+ var _a;
72061
+ if (!((_a = this._exitingVRenderComponents) === null || _a === void 0 ? void 0 : _a.size)) {
72062
+ return;
72063
+ }
72064
+ this._exitingVRenderComponents.forEach(component => {
72065
+ var _a, _b, _c;
72066
+ releaseVRenderComponentSync(component);
72067
+ (_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);
72068
+ });
72069
+ this._exitingVRenderComponents.clear();
72070
+ }
72071
+ _releaseVRenderComponent(component) {
72072
+ var _a;
72073
+ const forceRelease = this._shouldReleaseVRenderComponentsImmediately();
72074
+ if (!forceRelease) {
72075
+ const exitingComponents = collectVRenderComponents(component);
72076
+ const releasedWithExit = releaseVRenderComponent(component, {
72077
+ enableExitAnimation: true,
72078
+ removeFromParent: true,
72079
+ onComplete: () => {
72080
+ exitingComponents.forEach(exitingComponent => {
72081
+ var _a, _b, _c, _d;
72082
+ (_a = this._exitingVRenderComponents) === null || _a === void 0 ? void 0 : _a.delete(exitingComponent);
72083
+ (_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);
72084
+ });
72085
+ }
72086
+ });
72087
+ if (releasedWithExit) {
72088
+ this._exitingVRenderComponents = (_a = this._exitingVRenderComponents) !== null && _a !== void 0 ? _a : new Set();
72089
+ exitingComponents.forEach(exitingComponent => {
72090
+ var _a, _b, _c;
72091
+ this._exitingVRenderComponents.add(exitingComponent);
72092
+ (_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);
72093
+ });
72094
+ return;
72095
+ }
72096
+ return;
72097
+ }
72098
+ releaseVRenderComponentSync(component);
72099
+ }
70814
72100
  clear() {
70815
72101
  var _a;
70816
72102
  const components = this._getNeedClearVRenderComponents();
70817
72103
  if (components && components.length) {
70818
72104
  components.forEach(c => {
70819
- var _a;
70820
72105
  if (c) {
70821
- c.release(true);
70822
- (_a = this.getContainer()) === null || _a === void 0 ? void 0 : _a.removeChild(c);
70823
- c = null;
72106
+ this._releaseVRenderComponent(c);
70824
72107
  }
70825
72108
  });
70826
72109
  }
@@ -70880,13 +72163,91 @@
70880
72163
  getComponent() {
70881
72164
  return this._component;
70882
72165
  }
70883
- clearComponent() {
70884
- if (this._component) {
70885
- if (this._component.parent) {
70886
- this._component.parent.removeChild(this._component);
72166
+ _clearExitingComponent(component) {
72167
+ if (this._exitingComponent === component) {
72168
+ this._unregisterExitingComponent(component);
72169
+ this._exitingComponent = undefined;
72170
+ this._exitingProduct = undefined;
72171
+ }
72172
+ }
72173
+ _removeProductAfterExit(component, product) {
72174
+ if (product.parent) {
72175
+ product.parent.removeChild(product, true);
72176
+ }
72177
+ if (this._product === product) {
72178
+ this._product = null;
72179
+ this._compiledProductId = null;
72180
+ }
72181
+ this._clearExitingComponent(component);
72182
+ }
72183
+ _registerExitingComponent(component) {
72184
+ var _a, _b, _c, _d, _e;
72185
+ (_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);
72186
+ }
72187
+ _unregisterExitingComponent(component) {
72188
+ var _a, _b, _c, _d, _e;
72189
+ (_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);
72190
+ }
72191
+ _releaseComponentWithExitAnimation(component, releaseProduct) {
72192
+ var _a, _b;
72193
+ const product = this._product;
72194
+ if (!component || ((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a._shouldReleaseVRenderComponentsImmediately) === null || _b === void 0 ? void 0 : _b.call(_a))) {
72195
+ return false;
72196
+ }
72197
+ const releasedWithExit = releaseVRenderComponent(component, {
72198
+ enableExitAnimation: true,
72199
+ removeFromParent: true,
72200
+ onComplete: () => {
72201
+ if (releaseProduct && product) {
72202
+ this._removeProductAfterExit(component, product);
72203
+ }
72204
+ else {
72205
+ this._clearExitingComponent(component);
72206
+ }
70887
72207
  }
70888
- this._component = null;
72208
+ });
72209
+ if (releasedWithExit) {
72210
+ this._exitingComponent = component;
72211
+ this._exitingProduct = releaseProduct ? product : undefined;
72212
+ this._registerExitingComponent(component);
72213
+ }
72214
+ return releasedWithExit;
72215
+ }
72216
+ clearComponent() {
72217
+ var _a, _b;
72218
+ const component = this._component;
72219
+ if (!component) {
72220
+ return;
70889
72221
  }
72222
+ if ((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a._shouldReleaseVRenderComponentsImmediately) === null || _b === void 0 ? void 0 : _b.call(_a)) {
72223
+ releaseVRenderComponentSync(component);
72224
+ }
72225
+ else {
72226
+ this._releaseComponentWithExitAnimation(component, false);
72227
+ }
72228
+ this._component = null;
72229
+ }
72230
+ releaseWithExitAnimation() {
72231
+ const component = this._component;
72232
+ if (!this._releaseComponentWithExitAnimation(component, true)) {
72233
+ return false;
72234
+ }
72235
+ this._component = null;
72236
+ this._exitingComponent = component;
72237
+ return true;
72238
+ }
72239
+ forceReleaseExitAnimation() {
72240
+ var _a;
72241
+ if (!this._exitingComponent) {
72242
+ return;
72243
+ }
72244
+ releaseVRenderComponentSync(this._exitingComponent);
72245
+ this._unregisterExitingComponent(this._exitingComponent);
72246
+ if ((_a = this._exitingProduct) === null || _a === void 0 ? void 0 : _a.parent) {
72247
+ this._exitingProduct.parent.removeChild(this._exitingProduct, true);
72248
+ }
72249
+ this._exitingComponent = undefined;
72250
+ this._exitingProduct = undefined;
70890
72251
  }
70891
72252
  _getAttrsFromConfig(attrs = {}) {
70892
72253
  const configAttrs = super._getAttrsFromConfig(attrs);
@@ -70947,8 +72308,26 @@
70947
72308
  this.needClear = true;
70948
72309
  }
70949
72310
  release() {
72311
+ var _a, _b;
72312
+ if ((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a._shouldReleaseVRenderComponentsImmediately) === null || _b === void 0 ? void 0 : _b.call(_a)) {
72313
+ this.forceReleaseExitAnimation();
72314
+ super.release();
72315
+ this.removeProduct(true);
72316
+ return;
72317
+ }
72318
+ if (this._exitingComponent) {
72319
+ if (!this._releaseComponentWithExitAnimation(this._exitingComponent, true)) {
72320
+ this.removeProduct(true);
72321
+ }
72322
+ super.release();
72323
+ return;
72324
+ }
72325
+ if (this.releaseWithExitAnimation()) {
72326
+ super.release();
72327
+ return;
72328
+ }
70950
72329
  super.release();
70951
- this.removeProduct();
72330
+ this.removeProduct(true);
70952
72331
  }
70953
72332
  }
70954
72333
  ComponentMark.type = "component";
@@ -70960,6 +72339,19 @@
70960
72339
  return scale;
70961
72340
  };
70962
72341
 
72342
+ const AXIS_COMPONENT_ONLY_CHANGE_KEYS = {
72343
+ grid: true,
72344
+ subGrid: true,
72345
+ tick: true,
72346
+ subTick: true,
72347
+ label: true,
72348
+ domainLine: true,
72349
+ title: true,
72350
+ maxWidth: true,
72351
+ minWidth: true,
72352
+ maxHeight: true,
72353
+ minHeight: true
72354
+ };
70963
72355
  class AxisComponent extends BaseComponent {
70964
72356
  getOrient() {
70965
72357
  return this._orient;
@@ -71265,6 +72657,7 @@
71265
72657
  if (result.reMake) {
71266
72658
  return result;
71267
72659
  }
72660
+ const specChanged = !isEqual(prevSpec, spec);
71268
72661
  result.reRender = true;
71269
72662
  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)) {
71270
72663
  result.reMake = true;
@@ -71274,8 +72667,17 @@
71274
72667
  var _a, _b;
71275
72668
  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);
71276
72669
  });
72670
+ if (specChanged && !result.reMake && this._isComponentOnlySpecChange(spec, prevSpec)) {
72671
+ result.effects = Object.assign(Object.assign({}, result.effects), { component: true, layout: true, render: true });
72672
+ }
71277
72673
  return result;
71278
72674
  }
72675
+ _isComponentOnlySpecChange(spec, prevSpec) {
72676
+ const keys = Object.keys(Object.assign(Object.assign({}, prevSpec), spec));
72677
+ return keys.every(key => {
72678
+ 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];
72679
+ });
72680
+ }
71279
72681
  _getAxisAttributes() {
71280
72682
  const spec = this._spec;
71281
72683
  const axisAttrs = {
@@ -73869,6 +75271,10 @@
73869
75271
  this.transformerConstructor = LineLikeSeriesSpecTransformer;
73870
75272
  this._sortDataByAxis = false;
73871
75273
  }
75274
+ _getSpecUpdatePolicy() {
75275
+ const policy = super._getSpecUpdatePolicy();
75276
+ return Object.assign(Object.assign({}, policy), { dataRelatedKeys: Object.assign(Object.assign({}, policy.dataRelatedKeys), LINE_LIKE_SERIES_DATA_RELATED_KEYS) });
75277
+ }
73872
75278
  compile() {
73873
75279
  super.compile();
73874
75280
  this.addSamplingCompile();
@@ -74545,6 +75951,11 @@
74545
75951
  }
74546
75952
  }
74547
75953
 
75954
+ const MARKER_COMPONENT_SPEC_KEYS = {
75955
+ [ComponentTypeEnum.markPoint]: true,
75956
+ [ComponentTypeEnum.markLine]: true,
75957
+ [ComponentTypeEnum.markArea]: true
75958
+ };
74548
75959
  class BaseChart extends CompilableBase {
74549
75960
  getSpec() {
74550
75961
  return this._spec;
@@ -74598,6 +76009,7 @@
74598
76009
  this._regions = [];
74599
76010
  this._series = [];
74600
76011
  this._components = [];
76012
+ this._specTransformer = null;
74601
76013
  this._layoutRect = {
74602
76014
  x: 0,
74603
76015
  y: 0,
@@ -74729,6 +76141,7 @@
74729
76141
  this._spec = spec;
74730
76142
  }
74731
76143
  created(transformer) {
76144
+ this._specTransformer = transformer;
74732
76145
  this._chartData.parseData(this._spec.data);
74733
76146
  this._createGlobalScale();
74734
76147
  this._createBackground();
@@ -75105,12 +76518,18 @@
75105
76518
  }
75106
76519
  }
75107
76520
  _getSpecKeys(spec) {
75108
- const ignoreKeys = { width: true, height: true };
76521
+ const ignoreKeys = {
76522
+ width: true,
76523
+ height: true,
76524
+ xField: true,
76525
+ yField: true
76526
+ };
75109
76527
  return Object.keys(spec)
75110
76528
  .filter(key => !ignoreKeys[key])
75111
76529
  .sort();
75112
76530
  }
75113
76531
  updateSpec(spec) {
76532
+ var _a;
75114
76533
  const result = {
75115
76534
  change: false,
75116
76535
  reMake: false,
@@ -75118,49 +76537,83 @@
75118
76537
  reSize: false,
75119
76538
  reCompile: false
75120
76539
  };
75121
- this.setLayoutTag(true, null, false);
75122
76540
  if (spec.type !== this.type) {
75123
76541
  result.reMake = true;
76542
+ this.setLayoutTag(true, null, false);
75124
76543
  return result;
75125
76544
  }
75126
76545
  const currentKeys = this._getSpecKeys(this._spec);
75127
76546
  const nextKeys = this._getSpecKeys(spec);
75128
76547
  if (!isEqual(currentKeys, nextKeys)) {
75129
76548
  result.reMake = true;
76549
+ this.setLayoutTag(true, null, false);
75130
76550
  return result;
75131
76551
  }
75132
76552
  for (let i = 0; i < currentKeys.length; i++) {
75133
76553
  const key = currentKeys[i];
75134
- if (isArray$1(this._spec[key]) && this._spec[key].length !== array(spec[key]).length) {
76554
+ const currentSpec = this._spec[key];
76555
+ const nextSpec = spec[key];
76556
+ if (isArray$1(currentSpec) &&
76557
+ currentSpec.length !== array(nextSpec).length &&
76558
+ !this._canRemoveMarkerComponentsWithoutRemake(key, currentSpec, nextSpec)) {
75135
76559
  result.reMake = true;
76560
+ this.setLayoutTag(true, null, false);
75136
76561
  return result;
75137
76562
  }
75138
76563
  }
75139
76564
  const oldSpec = this._spec;
76565
+ const onlyMarkerComponentsRemoved = this._isOnlyMarkerComponentsRemoved(this._spec, spec, currentKeys);
76566
+ const onlyComponentSpecsChanged = this._isOnlyComponentSpecsChanged(this._spec, spec, currentKeys);
76567
+ const onlySeriesSpecsChanged = this._isOnlySeriesSpecsChanged(this._spec, spec, currentKeys);
75140
76568
  this._spec = spec;
76569
+ if (onlyMarkerComponentsRemoved) {
76570
+ this._removeMarkerComponentsForEmptySpecs(result);
76571
+ return result;
76572
+ }
75141
76573
  this.updateChartConfig(result, oldSpec);
75142
76574
  if (result.reMake) {
76575
+ this.setLayoutTag(true, null, false);
75143
76576
  return result;
75144
76577
  }
75145
76578
  this.updateGlobalScale(result);
75146
76579
  if (result.reMake) {
76580
+ this.setLayoutTag(true, null, false);
75147
76581
  return result;
75148
76582
  }
75149
76583
  this.updateRegionSpec(result);
75150
76584
  if (result.reMake) {
76585
+ this.setLayoutTag(true, null, false);
75151
76586
  return result;
75152
76587
  }
75153
- this.updateComponentSpec(result);
76588
+ const componentUpdateResult = this.updateComponentSpec(result);
75154
76589
  if (result.reMake) {
76590
+ this.setLayoutTag(true, null, false);
76591
+ return result;
76592
+ }
76593
+ if (isUpdateSpecResultLocalOnly(result)) {
75155
76594
  return result;
75156
76595
  }
76596
+ if (onlyComponentSpecsChanged &&
76597
+ !componentUpdateResult.hasNonComponentOnlyUpdate &&
76598
+ isUpdateSpecResultComponentOnly(result)) {
76599
+ componentUpdateResult.componentOnlyUpdatedComponents.forEach(component => {
76600
+ component.reInit(component.getSpec());
76601
+ });
76602
+ if ((_a = result.effects) === null || _a === void 0 ? void 0 : _a.layout) {
76603
+ this.setLayoutTag(true, null, false);
76604
+ }
76605
+ return result;
76606
+ }
76607
+ this.setLayoutTag(true, null, false);
75157
76608
  this.updateSeriesSpec(result);
75158
76609
  if (result.reMake) {
75159
76610
  return result;
75160
76611
  }
75161
76612
  this.reInit();
75162
- this.updateDataSpec();
75163
- this.updateGlobalScaleDomain();
76613
+ if (!onlySeriesSpecsChanged || !this._canSkipChartDataStages(result)) {
76614
+ this.updateDataSpec();
76615
+ this.updateGlobalScaleDomain();
76616
+ }
75164
76617
  return result;
75165
76618
  }
75166
76619
  updateChartConfig(result, oldSpec) {
@@ -75188,12 +76641,15 @@
75188
76641
  });
75189
76642
  }
75190
76643
  updateComponentSpec(result) {
76644
+ const componentOnlyUpdatedComponents = [];
76645
+ let hasNonComponentOnlyUpdate = false;
75191
76646
  const componentCache = {};
75192
76647
  const checkVisibleComponents = {
75193
76648
  [ComponentTypeEnum.title]: true,
75194
76649
  [ComponentTypeEnum.brush]: true,
75195
76650
  [ComponentTypeEnum.indicator]: true
75196
76651
  };
76652
+ const removedComponents = [];
75197
76653
  this._components.forEach(c => {
75198
76654
  var _a, _b;
75199
76655
  if (c.type === ComponentTypeEnum.label || c.type === ComponentTypeEnum.totalLabel) {
@@ -75209,11 +76665,32 @@
75209
76665
  specCount: cmpSpec.length,
75210
76666
  componentCount: 0
75211
76667
  };
76668
+ if (this._canRemoveMarkerComponentsWithoutRemake(compSpecKey, [c.getSpec()], cmpSpec)) {
76669
+ removedComponents.push(c);
76670
+ return;
76671
+ }
75212
76672
  componentCache[compSpecKey].componentCount++;
75213
- mergeUpdateResult(result, c.updateSpec((_b = cmpSpec[c.getSpecIndex()]) !== null && _b !== void 0 ? _b : {}, cmpSpec));
76673
+ const componentSpec = (_b = cmpSpec[c.getSpecIndex()]) !== null && _b !== void 0 ? _b : {};
76674
+ const previousComponentSpec = c.getSpec();
76675
+ const componentResult = c.updateSpec(componentSpec, cmpSpec);
76676
+ if (isUpdateSpecResultComponentOnly(componentResult)) {
76677
+ componentOnlyUpdatedComponents.push(c);
76678
+ }
76679
+ else if (!isEqual(previousComponentSpec, componentSpec)) {
76680
+ hasNonComponentOnlyUpdate = true;
76681
+ }
76682
+ mergeUpdateResult(result, componentResult);
75214
76683
  }
75215
76684
  else {
75216
- mergeUpdateResult(result, c.updateSpec(cmpSpec));
76685
+ const previousComponentSpec = c.getSpec();
76686
+ const componentResult = c.updateSpec(cmpSpec);
76687
+ if (isUpdateSpecResultComponentOnly(componentResult)) {
76688
+ componentOnlyUpdatedComponents.push(c);
76689
+ }
76690
+ else if (!isEqual(previousComponentSpec, cmpSpec)) {
76691
+ hasNonComponentOnlyUpdate = true;
76692
+ }
76693
+ mergeUpdateResult(result, componentResult);
75217
76694
  }
75218
76695
  });
75219
76696
  for (const key in componentCache) {
@@ -75224,6 +76701,13 @@
75224
76701
  }
75225
76702
  }
75226
76703
  }
76704
+ if (removedComponents.length) {
76705
+ removedComponents.forEach(component => {
76706
+ this._removeComponent(component);
76707
+ });
76708
+ result.change = true;
76709
+ result.effects = Object.assign(Object.assign({}, result.effects), { component: true, localOnly: true });
76710
+ }
75227
76711
  const isVisible = (compSpec) => compSpec && compSpec.visible !== false;
75228
76712
  Object.keys(checkVisibleComponents).forEach(type => {
75229
76713
  if (checkVisibleComponents[type]) {
@@ -75234,6 +76718,92 @@
75234
76718
  }
75235
76719
  }
75236
76720
  });
76721
+ return {
76722
+ componentOnlyUpdatedComponents,
76723
+ hasNonComponentOnlyUpdate
76724
+ };
76725
+ }
76726
+ _canRemoveMarkerComponentsWithoutRemake(key, currentSpec, nextSpec) {
76727
+ return (MARKER_COMPONENT_SPEC_KEYS[key] &&
76728
+ isArray$1(currentSpec) &&
76729
+ currentSpec.length > 0 &&
76730
+ isArray$1(nextSpec) &&
76731
+ nextSpec.length === 0);
76732
+ }
76733
+ _isOnlyMarkerComponentsRemoved(currentSpec, nextSpec, specKeys) {
76734
+ let hasMarkerRemoval = false;
76735
+ const onlyMarkerRemoval = specKeys.every(key => {
76736
+ if (this._canRemoveMarkerComponentsWithoutRemake(key, currentSpec[key], nextSpec[key])) {
76737
+ hasMarkerRemoval = true;
76738
+ return true;
76739
+ }
76740
+ return isEqual(currentSpec[key], nextSpec[key]);
76741
+ });
76742
+ return hasMarkerRemoval && onlyMarkerRemoval;
76743
+ }
76744
+ _isComponentSpecKey(key) {
76745
+ return this._components.some(component => {
76746
+ return (component.specKey || component.type) === key;
76747
+ });
76748
+ }
76749
+ _isOnlyComponentSpecsChanged(currentSpec, nextSpec, specKeys) {
76750
+ let hasComponentSpecChange = false;
76751
+ const currentSpecRecord = currentSpec;
76752
+ const nextSpecRecord = nextSpec;
76753
+ const onlyComponentSpecChange = specKeys.every(key => {
76754
+ if (isEqual(currentSpecRecord[key], nextSpecRecord[key])) {
76755
+ return true;
76756
+ }
76757
+ if (this._isComponentSpecKey(key)) {
76758
+ hasComponentSpecChange = true;
76759
+ return true;
76760
+ }
76761
+ return false;
76762
+ });
76763
+ return hasComponentSpecChange && onlyComponentSpecChange;
76764
+ }
76765
+ _isOnlySeriesSpecsChanged(currentSpec, nextSpec, specKeys) {
76766
+ var _a, _b;
76767
+ let hasSeriesSpecChange = false;
76768
+ const currentSpecRecord = currentSpec;
76769
+ const nextSpecRecord = nextSpec;
76770
+ const seriesRelatedSpecKeys = (_b = (_a = this._specTransformer) === null || _a === void 0 ? void 0 : _a.getSeriesRelatedSpecKeys()) !== null && _b !== void 0 ? _b : {};
76771
+ const onlySeriesSpecChange = specKeys.every(key => {
76772
+ if (isEqual(currentSpecRecord[key], nextSpecRecord[key])) {
76773
+ return true;
76774
+ }
76775
+ if (seriesRelatedSpecKeys[key]) {
76776
+ hasSeriesSpecChange = true;
76777
+ return true;
76778
+ }
76779
+ return false;
76780
+ });
76781
+ return hasSeriesSpecChange && onlySeriesSpecChange;
76782
+ }
76783
+ _canSkipChartDataStages(result) {
76784
+ const effects = result.effects;
76785
+ return !!(effects === null || effects === void 0 ? void 0 : effects.series) && !effects.remake && !effects.data && !effects.scaleDomain && !result.reMake;
76786
+ }
76787
+ _removeMarkerComponentsForEmptySpecs(result) {
76788
+ const removedComponents = this._components.filter(component => {
76789
+ var _a;
76790
+ const compSpecKey = component.specKey || component.type;
76791
+ const cmpSpec = (_a = this._spec[compSpecKey]) !== null && _a !== void 0 ? _a : {};
76792
+ return this._canRemoveMarkerComponentsWithoutRemake(compSpecKey, [component.getSpec()], cmpSpec);
76793
+ });
76794
+ if (!removedComponents.length) {
76795
+ return;
76796
+ }
76797
+ removedComponents.forEach(component => {
76798
+ this._removeComponent(component);
76799
+ });
76800
+ result.change = true;
76801
+ result.effects = Object.assign(Object.assign({}, result.effects), { component: true, localOnly: true });
76802
+ }
76803
+ _removeComponent(component) {
76804
+ this._components = this._components.filter(c => c !== component);
76805
+ this._idMap.delete(component.id);
76806
+ component.release();
75237
76807
  }
75238
76808
  updateSeriesSpec(result) {
75239
76809
  if (this._spec.series.length !== this._series.length) {
@@ -75344,10 +76914,12 @@
75344
76914
  });
75345
76915
  (_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);
75346
76916
  }
75347
- release() {
75348
- [...this._components, ...this._regions, ...this._series].forEach(m => {
75349
- m.beforeRelease();
75350
- });
76917
+ release(forceReleaseVRenderComponents = true) {
76918
+ if (forceReleaseVRenderComponents) {
76919
+ [...this._components, ...this._regions, ...this._series].forEach(m => {
76920
+ m.beforeRelease();
76921
+ });
76922
+ }
75351
76923
  super.release();
75352
76924
  this.clear();
75353
76925
  [...this._components, ...this._regions, ...this._series].forEach(m => {
@@ -75606,8 +77178,18 @@
75606
77178
  return undefined;
75607
77179
  };
75608
77180
 
77181
+ const DEFAULT_SERIES_RELATED_CHART_SPEC_KEYS = {
77182
+ series: true,
77183
+ label: true,
77184
+ animationAppear: true,
77185
+ animationEnter: true,
77186
+ animationUpdate: true,
77187
+ animationExit: true,
77188
+ animationNormal: true
77189
+ };
75609
77190
  class BaseChartSpecTransformer {
75610
77191
  constructor(option) {
77192
+ this._seriesRelatedSpecKeys = Object.assign({}, DEFAULT_SERIES_RELATED_CHART_SPEC_KEYS);
75611
77193
  this._option = option;
75612
77194
  this.type = option.type;
75613
77195
  this.seriesType = option.seriesType;
@@ -75703,8 +77285,19 @@
75703
77285
  _isValidSeries(seriesType) {
75704
77286
  return true;
75705
77287
  }
77288
+ getSeriesRelatedSpecKeys() {
77289
+ return this._seriesRelatedSpecKeys;
77290
+ }
77291
+ _addSeriesRelatedSpecKeys(...keysList) {
77292
+ keysList.forEach(keys => {
77293
+ keys === null || keys === void 0 ? void 0 : keys.forEach(key => {
77294
+ this._seriesRelatedSpecKeys[key] = true;
77295
+ });
77296
+ });
77297
+ }
75706
77298
  _getDefaultSeriesSpec(chartSpec, pickKeys, pickKeys2) {
75707
77299
  var _a, _b, _c, _d, _e;
77300
+ this._addSeriesRelatedSpecKeys(pickKeys, pickKeys2);
75708
77301
  const series = {
75709
77302
  dataKey: chartSpec.dataKey,
75710
77303
  hover: chartSpec.hover,
@@ -77190,6 +78783,10 @@
77190
78783
  this.transformerConstructor = AreaSeriesSpecTransformer;
77191
78784
  this._sortDataByAxis = false;
77192
78785
  }
78786
+ _getSpecUpdatePolicy() {
78787
+ const policy = super._getSpecUpdatePolicy();
78788
+ return Object.assign(Object.assign({}, policy), { dataRelatedKeys: Object.assign(Object.assign({}, policy.dataRelatedKeys), LINE_LIKE_SERIES_DATA_RELATED_KEYS) });
78789
+ }
77193
78790
  initMark() {
77194
78791
  var _a;
77195
78792
  const seriesMark = (_a = this._spec.seriesMark) !== null && _a !== void 0 ? _a : 'area';
@@ -77580,6 +79177,14 @@
77580
79177
  };
77581
79178
 
77582
79179
  const DefaultBandWidth$2 = 6;
79180
+ const BAR_SERIES_COMPILE_ONLY_KEYS = {
79181
+ barWidth: true,
79182
+ barMinWidth: true,
79183
+ barMaxWidth: true,
79184
+ barGapInGroup: true,
79185
+ barMinHeight: true,
79186
+ stackCornerRadius: true
79187
+ };
77583
79188
  class BarSeries extends CartesianSeries {
77584
79189
  constructor() {
77585
79190
  super(...arguments);
@@ -77681,6 +79286,10 @@
77681
79286
  this._barBackgroundPositionYEncoder = encoder.bind(this);
77682
79287
  };
77683
79288
  }
79289
+ _getSpecUpdatePolicy() {
79290
+ const policy = super._getSpecUpdatePolicy();
79291
+ return Object.assign(Object.assign({}, policy), { compileOnlyKeys: Object.assign(Object.assign({}, policy.compileOnlyKeys), BAR_SERIES_COMPILE_ONLY_KEYS) });
79292
+ }
77684
79293
  initMark() {
77685
79294
  this._initBarBackgroundMark();
77686
79295
  this._barMark = this._createMark(Object.assign(Object.assign({}, BarSeries.mark.bar), { name: this._barMarkName, type: this._barMarkType }), {
@@ -77705,6 +79314,19 @@
77705
79314
  fill: this.getColorAttribute()
77706
79315
  }, 'normal', exports.AttributeLevel.Series);
77707
79316
  }
79317
+ this.initRectMarkStyle();
79318
+ }
79319
+ initRectMarkStyle() {
79320
+ var _a;
79321
+ if (!this._barMark) {
79322
+ return;
79323
+ }
79324
+ const bandAxisHelper = this.direction === "vertical" ? this._xAxisHelper : this._yAxisHelper;
79325
+ const scale = (_a = bandAxisHelper === null || bandAxisHelper === void 0 ? void 0 : bandAxisHelper.getScale) === null || _a === void 0 ? void 0 : _a.call(bandAxisHelper, 0);
79326
+ if (!scale) {
79327
+ return;
79328
+ }
79329
+ scale.type === 'band' ? this.initBandRectMarkStyle() : this.initLinearRectMarkStyle();
77708
79330
  }
77709
79331
  initLabelMarkStyle(textMark) {
77710
79332
  if (!textMark) {
@@ -77817,14 +79439,8 @@
77817
79439
  this._barBackgroundViewData = new CompilableData(this._option, barBackgroundData);
77818
79440
  }
77819
79441
  init(option) {
77820
- var _a, _b;
77821
79442
  super.init(option);
77822
- if (this.direction === 'vertical') {
77823
- ((_a = this._xAxisHelper) === null || _a === void 0 ? void 0 : _a.getScale(0).type) === 'band' ? this.initBandRectMarkStyle() : this.initLinearRectMarkStyle();
77824
- }
77825
- else {
77826
- ((_b = this._yAxisHelper) === null || _b === void 0 ? void 0 : _b.getScale(0).type) === 'band' ? this.initBandRectMarkStyle() : this.initLinearRectMarkStyle();
77827
- }
79443
+ this.initRectMarkStyle();
77828
79444
  }
77829
79445
  _shouldDoPreCalculate() {
77830
79446
  const region = this.getRegion();
@@ -77947,6 +79563,13 @@
77947
79563
  _initStackBarMarkStyle() {
77948
79564
  var _a, _b, _c, _d;
77949
79565
  if (!this._spec.stackCornerRadius) {
79566
+ const markConfig = this._barMark.getMarkConfig();
79567
+ if (markConfig.clip || !isNil$1(markConfig.clipPath)) {
79568
+ this._barMark.setMarkConfig({
79569
+ clip: false,
79570
+ clipPath: []
79571
+ });
79572
+ }
77950
79573
  return;
77951
79574
  }
77952
79575
  const xScale = (_b = (_a = this._xAxisHelper) === null || _a === void 0 ? void 0 : _a.getScale) === null || _b === void 0 ? void 0 : _b.call(_a, 0);
@@ -78376,6 +79999,9 @@
78376
79999
  }
78377
80000
  };
78378
80001
 
80002
+ const SCATTER_SERIES_DATA_RELATED_KEYS = {
80003
+ sizeField: true
80004
+ };
78379
80005
  class ScatterSeries extends CartesianSeries {
78380
80006
  constructor() {
78381
80007
  super(...arguments);
@@ -78383,6 +80009,10 @@
78383
80009
  this.transformerConstructor = ScatterSeriesSpecTransformer;
78384
80010
  this._invalidType = 'zero';
78385
80011
  }
80012
+ _getSpecUpdatePolicy() {
80013
+ const policy = super._getSpecUpdatePolicy();
80014
+ return Object.assign(Object.assign({}, policy), { dataRelatedKeys: Object.assign(Object.assign({}, policy.dataRelatedKeys), SCATTER_SERIES_DATA_RELATED_KEYS) });
80015
+ }
78386
80016
  setAttrFromSpec() {
78387
80017
  super.setAttrFromSpec();
78388
80018
  this._size = this._spec.size;
@@ -80837,6 +82467,9 @@
80837
82467
  }
80838
82468
  };
80839
82469
 
82470
+ const WATERFALL_SERIES_DATA_RELATED_KEYS = {
82471
+ calculationMode: true
82472
+ };
80840
82473
  class WaterfallSeries extends BarSeries {
80841
82474
  constructor() {
80842
82475
  super(...arguments);
@@ -80857,6 +82490,10 @@
80857
82490
  var _a;
80858
82491
  return (_a = this._totalData) === null || _a === void 0 ? void 0 : _a.getLatestData();
80859
82492
  }
82493
+ _getSpecUpdatePolicy() {
82494
+ const policy = super._getSpecUpdatePolicy();
82495
+ return Object.assign(Object.assign({}, policy), { dataRelatedKeys: Object.assign(Object.assign({}, policy.dataRelatedKeys), WATERFALL_SERIES_DATA_RELATED_KEYS) });
82496
+ }
80860
82497
  initGroups() {
80861
82498
  const groupFields = this.getGroupFields();
80862
82499
  if (groupFields && groupFields.length) {
@@ -81912,6 +83549,12 @@
81912
83549
  const DEFAULT_FILL_COLOR = '#FFF';
81913
83550
  const DEFAULT_STROKE_COLOR = '#000';
81914
83551
  const DEFAULT_OUTLIER_SIZE = 10;
83552
+ const BOX_PLOT_SERIES_COMPILE_ONLY_KEYS = {
83553
+ boxWidth: true,
83554
+ boxMinWidth: true,
83555
+ boxMaxWidth: true,
83556
+ boxGapInGroup: true
83557
+ };
81915
83558
  class BoxPlotSeries extends CartesianSeries {
81916
83559
  constructor() {
81917
83560
  super(...arguments);
@@ -81949,6 +83592,10 @@
81949
83592
  getOutliersStyle() {
81950
83593
  return this._outliersStyle;
81951
83594
  }
83595
+ _getSpecUpdatePolicy() {
83596
+ const policy = super._getSpecUpdatePolicy();
83597
+ return Object.assign(Object.assign({}, policy), { compileOnlyKeys: Object.assign(Object.assign({}, policy.compileOnlyKeys), BOX_PLOT_SERIES_COMPILE_ONLY_KEYS) });
83598
+ }
81952
83599
  setAttrFromSpec() {
81953
83600
  var _a, _b, _c, _d, _e, _f, _g;
81954
83601
  super.setAttrFromSpec();
@@ -82022,6 +83669,7 @@
82022
83669
  size: isNumber$2((_f = this._outliersStyle) === null || _f === void 0 ? void 0 : _f.size) ? this._outliersStyle.size : DEFAULT_OUTLIER_SIZE
82023
83670
  }, exports.STATE_VALUE_ENUM.STATE_NORMAL, exports.AttributeLevel.Series);
82024
83671
  }
83672
+ this.initBoxPlotMarkStyle();
82025
83673
  }
82026
83674
  initBoxPlotMarkStyle() {
82027
83675
  var _a, _b;
@@ -83352,6 +85000,16 @@
83352
85000
  }
83353
85001
  };
83354
85002
 
85003
+ const PIE_SERIES_DATA_RELATED_KEYS = {
85004
+ valueField: true,
85005
+ angleField: true,
85006
+ startAngle: true,
85007
+ endAngle: true,
85008
+ minAngle: true
85009
+ };
85010
+ const PIE_SERIES_COMPILE_ONLY_KEYS = {
85011
+ outerRadius: true
85012
+ };
83355
85013
  class BasePieSeries extends PolarSeries {
83356
85014
  constructor() {
83357
85015
  super(...arguments);
@@ -83602,6 +85260,10 @@
83602
85260
  computeDatumRadius(datum, state) {
83603
85261
  return this._computeLayoutRadius() * this.getRadius(state) + this._centerOffset;
83604
85262
  }
85263
+ _getSpecUpdatePolicy() {
85264
+ const policy = super._getSpecUpdatePolicy();
85265
+ 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) });
85266
+ }
83605
85267
  _compareSpec(spec, prevSpec, ignoreCheckKeys) {
83606
85268
  ignoreCheckKeys = ignoreCheckKeys !== null && ignoreCheckKeys !== void 0 ? ignoreCheckKeys : { data: true };
83607
85269
  const defaultIgnoreKeys = [
@@ -85924,6 +87586,9 @@
85924
87586
  }
85925
87587
  };
85926
87588
 
87589
+ const CIRCULAR_PROGRESS_SERIES_COMPILE_ONLY_KEYS = {
87590
+ cornerRadius: true
87591
+ };
85927
87592
  class CircularProgressSeries extends ProgressLikeSeries {
85928
87593
  constructor() {
85929
87594
  super(...arguments);
@@ -85953,6 +87618,10 @@
85953
87618
  this.radiusAxisHelper.getScale(0).step());
85954
87619
  };
85955
87620
  }
87621
+ _getSpecUpdatePolicy() {
87622
+ const policy = super._getSpecUpdatePolicy();
87623
+ return Object.assign(Object.assign({}, policy), { compileOnlyKeys: Object.assign(Object.assign({}, policy.compileOnlyKeys), CIRCULAR_PROGRESS_SERIES_COMPILE_ONLY_KEYS) });
87624
+ }
85956
87625
  getStackGroupFields() {
85957
87626
  return this.getGroupFields();
85958
87627
  }
@@ -86144,6 +87813,17 @@
86144
87813
  }
86145
87814
  };
86146
87815
 
87816
+ const LINEAR_PROGRESS_SERIES_COMPILE_ONLY_KEYS = {
87817
+ bandWidth: true
87818
+ };
87819
+ const LINEAR_PROGRESS_SERIES_COMPILE_ONLY_SUB_KEYS = {
87820
+ progress: {
87821
+ topPadding: true,
87822
+ bottomPadding: true,
87823
+ leftPadding: true,
87824
+ rightPadding: true
87825
+ }
87826
+ };
86147
87827
  class LinearProgressSeries extends CartesianSeries {
86148
87828
  constructor() {
86149
87829
  super(...arguments);
@@ -86210,6 +87890,10 @@
86210
87890
  return path;
86211
87891
  };
86212
87892
  }
87893
+ _getSpecUpdatePolicy() {
87894
+ const policy = super._getSpecUpdatePolicy();
87895
+ 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) });
87896
+ }
86213
87897
  initMark() {
86214
87898
  this._initTrackMark();
86215
87899
  this._initProgressMark();
@@ -96273,6 +97957,9 @@
96273
97957
  };
96274
97958
 
96275
97959
  const DefaultBandWidth = 6;
97960
+ const HEATMAP_SERIES_DATA_RELATED_KEYS = {
97961
+ valueField: true
97962
+ };
96276
97963
  class HeatmapSeries extends CartesianSeries {
96277
97964
  constructor() {
96278
97965
  super(...arguments);
@@ -96285,6 +97972,10 @@
96285
97972
  setFieldValue(f) {
96286
97973
  this._fieldValue = array(f);
96287
97974
  }
97975
+ _getSpecUpdatePolicy() {
97976
+ const policy = super._getSpecUpdatePolicy();
97977
+ return Object.assign(Object.assign({}, policy), { dataRelatedKeys: Object.assign(Object.assign({}, policy.dataRelatedKeys), HEATMAP_SERIES_DATA_RELATED_KEYS) });
97978
+ }
96288
97979
  setAttrFromSpec() {
96289
97980
  super.setAttrFromSpec();
96290
97981
  this.setFieldValue(this._spec.valueField);
@@ -98168,6 +99859,7 @@
98168
99859
  'useSequentialAnimation',
98169
99860
  'layoutRadius'
98170
99861
  ]);
99862
+ this._addSeriesRelatedSpecKeys(['valueField', 'angleField']);
98171
99863
  seriesSpec.categoryField = spec.categoryField || spec.seriesField;
98172
99864
  seriesSpec.valueField = spec.valueField || spec.angleField;
98173
99865
  seriesSpec.emptyCircle = (_a = spec.emptyPlaceholder) === null || _a === void 0 ? void 0 : _a.emptyCircle;
@@ -98872,6 +100564,7 @@
98872
100564
  _getDefaultSeriesSpec(spec) {
98873
100565
  var _a, _b;
98874
100566
  const series = super._getDefaultSeriesSpec(spec);
100567
+ this._addSeriesRelatedSpecKeys(['cornerRadius']);
98875
100568
  series.progress = spec.progress;
98876
100569
  series.track = spec.track;
98877
100570
  series.tickMask = spec.tickMask;
@@ -99473,6 +101166,7 @@
99473
101166
  }
99474
101167
  _getDefaultSeriesSpec(spec) {
99475
101168
  const series = super._getDefaultSeriesSpec(spec);
101169
+ this._addSeriesRelatedSpecKeys(['bar', 'stackLabel', 'leaderLine', 'total', 'calculationMode']);
99476
101170
  series.bar = spec.bar;
99477
101171
  series.stackLabel = spec.stackLabel;
99478
101172
  series.leaderLine = spec.leaderLine;
@@ -99924,6 +101618,13 @@
99924
101618
  return data;
99925
101619
  };
99926
101620
 
101621
+ const LEGEND_COMPONENT_ONLY_CHANGE_KEYS = {
101622
+ position: true,
101623
+ item: true,
101624
+ title: true,
101625
+ pager: true,
101626
+ background: true
101627
+ };
99927
101628
  class BaseLegend extends BaseComponent {
99928
101629
  constructor() {
99929
101630
  super(...arguments);
@@ -99989,15 +101690,31 @@
99989
101690
  _compareSpec(spec, prevSpec) {
99990
101691
  const result = super._compareSpec(spec, prevSpec);
99991
101692
  result.reRender = true;
101693
+ const specChanged = !isEqual(prevSpec, spec);
101694
+ if (result.reMake) {
101695
+ return result;
101696
+ }
99992
101697
  if ((spec === null || spec === void 0 ? void 0 : spec.orient) !== (prevSpec === null || prevSpec === void 0 ? void 0 : prevSpec.orient)) {
99993
101698
  result.reMake = true;
99994
101699
  return result;
99995
101700
  }
99996
- if (!isEqual(prevSpec, spec)) {
101701
+ if (specChanged && !result.reCompile && this._isComponentOnlySpecChange(spec, prevSpec)) {
101702
+ result.effects = Object.assign(Object.assign({}, result.effects), { component: true, layout: true, render: true });
101703
+ return result;
101704
+ }
101705
+ if (specChanged) {
99997
101706
  result.reCompile = true;
99998
101707
  }
99999
101708
  return result;
100000
101709
  }
101710
+ _isComponentOnlySpecChange(spec, prevSpec) {
101711
+ const prevSpecRecord = prevSpec;
101712
+ const specRecord = spec;
101713
+ const keys = Object.keys(Object.assign(Object.assign({}, prevSpec), spec));
101714
+ return keys.every(key => {
101715
+ 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];
101716
+ });
101717
+ }
100001
101718
  _bindLegendDataChange() {
100002
101719
  this._preSelectedData = this._selectedData.slice();
100003
101720
  this._initSelectedData();
@@ -105739,10 +107456,72 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
105739
107456
  return data;
105740
107457
  }
105741
107458
 
107459
+ const getDataViewsInDataSet = (dataView) => {
107460
+ var _a;
107461
+ const dataViewMap = (_a = dataView === null || dataView === void 0 ? void 0 : dataView.dataSet) === null || _a === void 0 ? void 0 : _a.dataViewMap;
107462
+ return dataViewMap ? Object.values(dataViewMap).filter(Boolean) : [];
107463
+ };
107464
+ const detachDataViewListener = (source, target) => {
107465
+ var _a, _b;
107466
+ (_a = source === null || source === void 0 ? void 0 : source.target) === null || _a === void 0 ? void 0 : _a.removeListener('change', target.reRunAllTransform);
107467
+ (_b = source === null || source === void 0 ? void 0 : source.target) === null || _b === void 0 ? void 0 : _b.removeListener('markRunning', target.markRunning);
107468
+ };
107469
+ const detachDataViewDependencies = (dataView) => {
107470
+ if (!dataView) {
107471
+ return;
107472
+ }
107473
+ const dataViews = getDataViewsInDataSet(dataView);
107474
+ dataViews.forEach(source => {
107475
+ detachDataViewListener(source, dataView);
107476
+ });
107477
+ const dependencies = dataView === null || dataView === void 0 ? void 0 : dataView.rawData;
107478
+ if (Array.isArray(dependencies)) {
107479
+ dependencies.forEach(dependency => {
107480
+ detachDataViewListener(dependency, dataView);
107481
+ });
107482
+ }
107483
+ };
107484
+ const releaseDataViews = (dataViews) => {
107485
+ const releaseDataViews = Array.from(new Set(dataViews.filter(Boolean)));
107486
+ if (!releaseDataViews.length) {
107487
+ return;
107488
+ }
107489
+ releaseDataViews.forEach(detachDataViewDependencies);
107490
+ releaseDataViews.forEach(dataView => {
107491
+ var _a;
107492
+ (_a = dataView.destroy) === null || _a === void 0 ? void 0 : _a.call(dataView);
107493
+ });
107494
+ };
107495
+ const releaseDataViewWithDependencies = (dataView, shouldReleaseDependency) => {
107496
+ if (!dataView) {
107497
+ return;
107498
+ }
107499
+ const dataViewsInDataSet = new Set(getDataViewsInDataSet(dataView));
107500
+ const releaseDependencies = [];
107501
+ const collectReleaseDependencies = (currentDataView) => {
107502
+ const dependencies = currentDataView === null || currentDataView === void 0 ? void 0 : currentDataView.rawData;
107503
+ if (!Array.isArray(dependencies)) {
107504
+ return;
107505
+ }
107506
+ dependencies.forEach(dependency => {
107507
+ if (dataViewsInDataSet.has(dependency) &&
107508
+ shouldReleaseDependency(dependency) &&
107509
+ !releaseDependencies.includes(dependency)) {
107510
+ releaseDependencies.push(dependency);
107511
+ collectReleaseDependencies(dependency);
107512
+ }
107513
+ });
107514
+ };
107515
+ collectReleaseDependencies(dataView);
107516
+ releaseDataViews([dataView, ...releaseDependencies]);
107517
+ };
107518
+
105742
107519
  class BaseMarker extends BaseComponent {
105743
107520
  constructor() {
105744
107521
  super(...arguments);
105745
107522
  this.layoutType = 'none';
107523
+ this._markerDataChangeHandler = null;
107524
+ this._markerDataOwned = false;
105746
107525
  this._layoutOffsetX = 0;
105747
107526
  this._layoutOffsetY = 0;
105748
107527
  }
@@ -105822,6 +107601,33 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
105822
107601
  }
105823
107602
  return this._relativeSeries.getViewData();
105824
107603
  }
107604
+ _setMarkerData(data, owned = false) {
107605
+ this._releaseMarkerData();
107606
+ this._markerData = data;
107607
+ this._markerDataOwned = owned;
107608
+ }
107609
+ _bindMarkerDataChange() {
107610
+ var _a;
107611
+ if (!((_a = this._markerData) === null || _a === void 0 ? void 0 : _a.target)) {
107612
+ return;
107613
+ }
107614
+ this._markerDataChangeHandler = () => {
107615
+ this._markerLayout();
107616
+ };
107617
+ this._markerData.target.on('change', this._markerDataChangeHandler);
107618
+ }
107619
+ _releaseMarkerData() {
107620
+ const markerData = this._markerData;
107621
+ if ((markerData === null || markerData === void 0 ? void 0 : markerData.target) && this._markerDataChangeHandler) {
107622
+ markerData.target.removeListener('change', this._markerDataChangeHandler);
107623
+ }
107624
+ this._markerDataChangeHandler = null;
107625
+ if (this._markerDataOwned) {
107626
+ releaseDataViewWithDependencies(markerData, dataView => dataView.name === `${this.type}_${this.id}_data`);
107627
+ }
107628
+ this._markerData = null;
107629
+ this._markerDataOwned = false;
107630
+ }
105825
107631
  updateLayoutAttribute() {
105826
107632
  var _a, _b, _c;
105827
107633
  const markerVisible = (_a = this._spec.visible) !== null && _a !== void 0 ? _a : true;
@@ -105873,8 +107679,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
105873
107679
  }
105874
107680
  clear() {
105875
107681
  super.clear();
107682
+ this._markerComponent = null;
105876
107683
  this._firstSeries = null;
105877
107684
  }
107685
+ release() {
107686
+ this._releaseMarkerData();
107687
+ super.release();
107688
+ }
105878
107689
  _getFirstSeries() {
105879
107690
  var _a;
105880
107691
  if (this._firstSeries) {
@@ -105926,10 +107737,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
105926
107737
  type: 'markerFilter',
105927
107738
  options: this._getAllRelativeSeries()
105928
107739
  });
105929
- data.target.on('change', () => {
105930
- this._markerLayout();
105931
- });
105932
- this._markerData = data;
107740
+ this._setMarkerData(data, true);
107741
+ this._bindMarkerDataChange();
105933
107742
  }
105934
107743
  }
105935
107744
 
@@ -106060,7 +107869,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
106060
107869
  const spec = this._spec;
106061
107870
  const isCoordinateProcess = 'coordinates' in spec;
106062
107871
  const { doXProcess, doYProcess, doXYY1Process, doYXX1Process, doXYProcess, doAngleProcess, doRadiusProcess, doAngRadRad1Process, doRadAngAng1Process, doRadAngProcess } = getMarkLineProcessInfo(spec);
106063
- this._markerData = this._getRelativeDataView();
107872
+ this._setMarkerData(this._getRelativeDataView());
106064
107873
  if (!doXProcess &&
106065
107874
  !doYProcess &&
106066
107875
  !doXYY1Process &&
@@ -106098,10 +107907,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
106098
107907
  type: 'markerFilter',
106099
107908
  options: this._getAllRelativeSeries()
106100
107909
  });
106101
- data.target.on('change', () => {
106102
- this._markerLayout();
106103
- });
106104
- this._markerData = data;
107910
+ this._setMarkerData(data, true);
107911
+ this._bindMarkerDataChange();
106105
107912
  }
106106
107913
  }
106107
107914
  BaseMarkLine.specKey = 'markLine';
@@ -106551,11 +108358,15 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
106551
108358
  }
106552
108359
  _compareSpec(spec, prevSpec) {
106553
108360
  const result = super._compareSpec(spec, prevSpec);
108361
+ const specChanged = !isEqual(prevSpec, spec);
106554
108362
  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) {
106555
108363
  result.reMake = true;
106556
108364
  }
106557
108365
  result.change = true;
106558
108366
  result.reRender = true;
108367
+ if (specChanged && !result.reMake) {
108368
+ result.effects = Object.assign(Object.assign({}, result.effects), { component: true, layout: true, render: true });
108369
+ }
106559
108370
  return result;
106560
108371
  }
106561
108372
  afterSetLayoutStartPoint(pos) {
@@ -107720,7 +109531,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
107720
109531
  Object.keys(removedComponents).forEach(name => {
107721
109532
  const comp = removedComponents[name];
107722
109533
  if (comp) {
107723
- comp.release();
109534
+ if (!comp.releaseWithExitAnimation()) {
109535
+ comp.release();
109536
+ }
107724
109537
  this._labelComponentMap.delete(comp);
107725
109538
  }
107726
109539
  });
@@ -108405,6 +110218,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
108405
110218
  });
108406
110219
  });
108407
110220
  }
110221
+ reInit(spec) {
110222
+ super.reInit(spec);
110223
+ this.init();
110224
+ }
108408
110225
  _initNeedOperatedItem() {
108409
110226
  const seriesUserId = this._spec.seriesId;
108410
110227
  const seriesIndex = this._spec.seriesIndex;