@visactor/vrender-components 1.1.0-alpha.2 → 1.1.0-alpha.21

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 (112) hide show
  1. package/cjs/animation/axis-animate.d.ts +1 -0
  2. package/cjs/animation/axis-animate.js +11 -4
  3. package/cjs/animation/axis-animate.js.map +1 -1
  4. package/cjs/animation/exit-release.d.ts +13 -0
  5. package/cjs/animation/exit-release.js +39 -0
  6. package/cjs/animation/exit-release.js.map +1 -0
  7. package/cjs/animation/static-truth.d.ts +2 -0
  8. package/cjs/animation/static-truth.js +21 -0
  9. package/cjs/animation/static-truth.js.map +1 -0
  10. package/cjs/axis/animate/group-transition.d.ts +2 -2
  11. package/cjs/axis/animate/group-transition.js +7 -3
  12. package/cjs/axis/animate/group-transition.js.map +1 -1
  13. package/cjs/axis/base.d.ts +6 -2
  14. package/cjs/axis/base.js +80 -30
  15. package/cjs/axis/base.js.map +1 -1
  16. package/cjs/axis/line.d.ts +1 -1
  17. package/cjs/axis/line.js +2 -2
  18. package/cjs/axis/line.js.map +1 -1
  19. package/cjs/axis/util.js +1 -2
  20. package/cjs/brush/config.js +2 -1
  21. package/cjs/core/type.d.ts +7 -0
  22. package/cjs/core/type.js.map +1 -1
  23. package/cjs/crosshair/polygon-sector.js +1 -2
  24. package/cjs/crosshair/sector.js +2 -1
  25. package/cjs/empty-tip/register.js +1 -2
  26. package/cjs/index.d.ts +1 -1
  27. package/cjs/index.js +1 -1
  28. package/cjs/index.js.map +1 -1
  29. package/cjs/indicator/config.js +2 -1
  30. package/cjs/jsx/index.js +1 -1
  31. package/cjs/label/arc.js +14 -9
  32. package/cjs/label/arc.js.map +1 -1
  33. package/cjs/label/base.d.ts +8 -1
  34. package/cjs/label/base.js +86 -10
  35. package/cjs/label/base.js.map +1 -1
  36. package/cjs/label/dataLabel.d.ts +5 -1
  37. package/cjs/label/dataLabel.js +46 -1
  38. package/cjs/label/dataLabel.js.map +1 -1
  39. package/cjs/legend/discrete/discrete.js +17 -9
  40. package/cjs/legend/discrete/discrete.js.map +1 -1
  41. package/cjs/marker/animate/call-in.js +6 -2
  42. package/cjs/marker/animate/call-in.js.map +1 -1
  43. package/cjs/marker/animate/clip-in.js +6 -2
  44. package/cjs/marker/animate/clip-in.js.map +1 -1
  45. package/cjs/marker/animate/common.js +14 -5
  46. package/cjs/marker/animate/common.js.map +1 -1
  47. package/cjs/marker/base.d.ts +6 -2
  48. package/cjs/marker/base.js +51 -9
  49. package/cjs/marker/base.js.map +1 -1
  50. package/cjs/marker/type.d.ts +2 -1
  51. package/cjs/marker/type.js.map +1 -1
  52. package/cjs/timeline/timeline.js +35 -12
  53. package/cjs/timeline/timeline.js.map +1 -1
  54. package/cjs/title/title.js +5 -2
  55. package/cjs/title/title.js.map +1 -1
  56. package/dist/index.es.js +1631 -297
  57. package/es/animation/axis-animate.d.ts +1 -0
  58. package/es/animation/axis-animate.js +12 -4
  59. package/es/animation/axis-animate.js.map +1 -1
  60. package/es/animation/exit-release.d.ts +13 -0
  61. package/es/animation/exit-release.js +31 -0
  62. package/es/animation/exit-release.js.map +1 -0
  63. package/es/animation/static-truth.d.ts +2 -0
  64. package/es/animation/static-truth.js +14 -0
  65. package/es/animation/static-truth.js.map +1 -0
  66. package/es/axis/animate/group-transition.d.ts +2 -2
  67. package/es/axis/animate/group-transition.js +7 -2
  68. package/es/axis/animate/group-transition.js.map +1 -1
  69. package/es/axis/base.d.ts +6 -2
  70. package/es/axis/base.js +81 -28
  71. package/es/axis/base.js.map +1 -1
  72. package/es/axis/line.d.ts +1 -1
  73. package/es/axis/line.js +2 -2
  74. package/es/axis/line.js.map +1 -1
  75. package/es/axis/util.js +1 -2
  76. package/es/brush/config.js +2 -1
  77. package/es/core/type.d.ts +7 -0
  78. package/es/core/type.js.map +1 -1
  79. package/es/crosshair/polygon-sector.js +1 -2
  80. package/es/crosshair/sector.js +2 -1
  81. package/es/empty-tip/register.js +1 -2
  82. package/es/index.d.ts +1 -1
  83. package/es/index.js +1 -1
  84. package/es/index.js.map +1 -1
  85. package/es/indicator/config.js +2 -1
  86. package/es/jsx/index.js +1 -1
  87. package/es/label/arc.js +14 -9
  88. package/es/label/arc.js.map +1 -1
  89. package/es/label/base.d.ts +8 -1
  90. package/es/label/base.js +88 -9
  91. package/es/label/base.js.map +1 -1
  92. package/es/label/dataLabel.d.ts +5 -1
  93. package/es/label/dataLabel.js +46 -0
  94. package/es/label/dataLabel.js.map +1 -1
  95. package/es/legend/discrete/discrete.js +18 -8
  96. package/es/legend/discrete/discrete.js.map +1 -1
  97. package/es/marker/animate/call-in.js +7 -2
  98. package/es/marker/animate/call-in.js.map +1 -1
  99. package/es/marker/animate/clip-in.js +7 -2
  100. package/es/marker/animate/clip-in.js.map +1 -1
  101. package/es/marker/animate/common.js +10 -2
  102. package/es/marker/animate/common.js.map +1 -1
  103. package/es/marker/base.d.ts +6 -2
  104. package/es/marker/base.js +51 -8
  105. package/es/marker/base.js.map +1 -1
  106. package/es/marker/type.d.ts +2 -1
  107. package/es/marker/type.js.map +1 -1
  108. package/es/timeline/timeline.js +36 -11
  109. package/es/timeline/timeline.js.map +1 -1
  110. package/es/title/title.js +5 -2
  111. package/es/title/title.js.map +1 -1
  112. package/package.json +6 -6
@@ -5,6 +5,7 @@ export declare class AxisEnter extends AComponentAnimate<any> {
5
5
  export declare class AxisUpdate extends AComponentAnimate<any> {
6
6
  onBind(): void;
7
7
  deleteSelfAttr(key: string): void;
8
+ deleteSelfAttrs(keys: string[]): void;
8
9
  protected tryPreventConflict(): void;
9
10
  }
10
11
  export declare function registerAxisAnimate(): void;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.registerAxisAnimate = exports.AxisUpdate = exports.AxisEnter = void 0;
6
6
 
7
- const vrender_animate_1 = require("@visactor/vrender-animate");
7
+ const vrender_animate_1 = require("@visactor/vrender-animate"), static_truth_1 = require("./static-truth");
8
8
 
9
9
  class AxisEnter extends vrender_animate_1.AComponentAnimate {
10
10
  onBind() {
@@ -17,7 +17,10 @@ class AxisEnter extends vrender_animate_1.AComponentAnimate {
17
17
  if (lastScale && getTickCoord && currData) {
18
18
  ratio = .7;
19
19
  const point = getTickCoord(lastScale.scale(currData.rawValue)), newX = this.target.attribute.x, newY = this.target.attribute.y;
20
- this.target.setAttributes({
20
+ (0, static_truth_1.commitUpdateAnimationTarget)(this.target, {
21
+ x: newX,
22
+ y: newY
23
+ }, {
21
24
  x: point.x,
22
25
  y: point.y
23
26
  }), animator.animate(this.target, {
@@ -45,7 +48,8 @@ class AxisUpdate extends vrender_animate_1.AComponentAnimate {
45
48
  onBind() {
46
49
  const animator = (0, vrender_animate_1.createComponentAnimator)(this.target);
47
50
  this._animator = animator;
48
- const duration = this.duration, easing = this.easing, {config: config, diffAttrs: diffAttrs} = this.params;
51
+ const duration = this.duration, easing = this.easing, {diffAttrs: diffAttrs} = this.params;
52
+ (0, static_truth_1.commitUpdateAnimationTarget)(this.target, Object.assign({}, diffAttrs)),
49
53
  animator.animate(this.target, {
50
54
  type: "to",
51
55
  to: Object.assign({}, diffAttrs),
@@ -57,7 +61,10 @@ class AxisUpdate extends vrender_animate_1.AComponentAnimate {
57
61
  }), this.completeBind(animator);
58
62
  }
59
63
  deleteSelfAttr(key) {
60
- super.deleteSelfAttr(key), this._animator.deleteSelfAttr(key);
64
+ this.deleteSelfAttrs([ key ]);
65
+ }
66
+ deleteSelfAttrs(keys) {
67
+ super.deleteSelfAttrs(keys), this._animator.deleteSelfAttrs(keys);
61
68
  }
62
69
  tryPreventConflict() {}
63
70
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/animation/axis-animate.ts"],"names":[],"mappings":";;;AAAA,+DAAwG;AAKxG,MAAa,SAAU,SAAQ,mCAAsB;IACnD,MAAM;;QACJ,MAAM,QAAQ,GAAG,IAAA,yCAAuB,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,SAAS,G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C,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;CACF;AAjED,8BAiEC;AAKD,MAAa,UAAW,SAAQ,mCAAsB;IACpD,MAAM;QACJ,MAAM,QAAQ,GAAG,IAAA,yCAAuB,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QAmB1C,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE;YAC5B,IAAI,EAAE,IAAI;YACV,EAAE,oBAAO,SAAS,CAAE;YACpB,QAAQ;YACR,MAAM;YACN,gBAAgB,EAAE;gBAChB,SAAS,oBAAO,SAAS,CAAE;aAC5B;SACF,CAAC,CAAC;QACH,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;IAGD,cAAc,CAAC,GAAW;QACxB,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC;IAGS,kBAAkB;QAC1B,OAAO;IACT,CAAC;CACF;AA/CD,gCA+CC;AAED,SAAgB,mBAAmB;IAEjC,iCAAe,CAAC,sBAAsB,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAC/D,iCAAe,CAAC,sBAAsB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AACnE,CAAC;AAJD,kDAIC","file":"axis-animate.js","sourcesContent":["import { AComponentAnimate, AnimateExecutor, createComponentAnimator } from '@visactor/vrender-animate';\n\n/**\n * AxisEnter class handles the enter animation for Axis components\n */\nexport class AxisEnter extends AComponentAnimate<any> {\n onBind(): void {\n const animator = createComponentAnimator(this.target);\n this._animator = animator;\n const duration = this.duration;\n const easing = this.easing;\n const { config, lastScale, getTickCoord } = this.params;\n\n let ratio = 1;\n const currData = this.target.data;\n if (lastScale && getTickCoord && currData) {\n ratio = 0.7;\n\n const oldValue = lastScale.scale(currData.rawValue);\n const point = getTickCoord(oldValue);\n const newX = this.target.attribute.x;\n const newY = this.target.attribute.y;\n\n this.target.setAttributes({ x: point.x, y: point.y });\n animator.animate(this.target, {\n type: 'to',\n to: { x: newX, y: newY },\n duration,\n easing\n });\n }\n\n // if (updateEls && updateEls.length > 1) {\n // ratio = 0.5;\n // const oldData1 = updateEls[0].oldEl.data;\n // const { rawValue: oldRawValue1, value: oldValue1 } = oldData1;\n // const oldData2 = updateEls[1].oldEl.data;\n // const { rawValue: oldRawValue2, value: oldValue2 } = oldData2;\n // const data = this.target.data;\n // const { rawValue: newRawValue } = data;\n // // rawValue 是原始值,value是映射出来的值,假设是线性映射,计算一下newRawValue在old阶段的value是什么值\n // const oldValue =\n // oldValue1 + ((oldValue2 - oldValue1) * (newRawValue - oldRawValue1)) / (oldRawValue2 - oldRawValue1);\n // // 将 x 和 y 做映射\n // const oldX1 = updateEls[0].oldEl.attribute.x;\n // const oldY1 = updateEls[0].oldEl.attribute.y;\n // const oldX2 = updateEls[1].oldEl.attribute.x;\n // const oldY2 = updateEls[1].oldEl.attribute.y;\n // const oldX = oldX1 + ((oldX2 - oldX1) * (oldValue - oldValue1)) / (oldValue2 - oldValue1);\n // const oldY = oldY1 + ((oldY2 - oldY1) * (oldValue - oldValue1)) / (oldValue2 - oldValue1);\n // const newX = this.target.attribute.x;\n // const newY = this.target.attribute.y;\n\n // this.target.setAttributes({ x: oldX, y: oldY });\n // animator.animate(this.target, {\n // type: 'to',\n // to: { x: newX, y: newY },\n // duration,\n // easing\n // });\n // }\n\n animator.animate(this.target, {\n type: config.type ?? 'fadeIn',\n to: config.to,\n duration: duration * ratio,\n easing\n });\n this.completeBind(animator);\n }\n}\n\n/**\n * AxisUpdate class handles the update animation for Axis components\n */\nexport class AxisUpdate extends AComponentAnimate<any> {\n onBind(): void {\n const animator = createComponentAnimator(this.target);\n this._animator = animator;\n const duration = this.duration;\n const easing = this.easing;\n const { config, diffAttrs } = this.params;\n // this.target.applyAnimationState(\n // ['update'],\n // [\n // {\n // name: 'update',\n // animation: {\n // type: 'to',\n // to: { ...this.props },\n // duration,\n // easing,\n // customParameters: {\n // diffAttrs: { ...this.props }\n // }\n // }\n // }\n // ]\n // );\n // console.log('this.props', this.props, { ...this.target.attribute });\n animator.animate(this.target, {\n type: 'to',\n to: { ...diffAttrs },\n duration,\n easing,\n customParameters: {\n diffAttrs: { ...diffAttrs }\n }\n });\n this.completeBind(animator);\n }\n\n // 轴动画本身没有逻辑,具体通过animator中执行,所以当需要屏蔽自身属性时,需要通过animator中执行\n deleteSelfAttr(key: string): void {\n super.deleteSelfAttr(key);\n this._animator.deleteSelfAttr(key);\n }\n\n // 轴动画本身没有逻辑,具体通过animator中执行,所以本身不需要屏蔽冲突\n protected tryPreventConflict(): void {\n return;\n }\n}\n\nexport function registerAxisAnimate() {\n // Label update animation\n AnimateExecutor.registerBuiltInAnimate('axisEnter', AxisEnter);\n AnimateExecutor.registerBuiltInAnimate('axisUpdate', AxisUpdate);\n}\n"]}
1
+ {"version":3,"sources":["../src/animation/axis-animate.ts"],"names":[],"mappings":";;;AAAA,+DAAwG;AACxG,iDAA6D;AAK7D,MAAa,SAAU,SAAQ,mCAAsB;IACnD,MAAM;;QACJ,MAAM,QAAQ,GAAG,IAAA,yCAAuB,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QAExD,IAAI,K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uB,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC3B,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QAmBlC,IAAA,0CAA2B,EAAC,IAAI,CAAC,MAAM,oBAAO,SAAS,EAAG,CAAC;QAC3D,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE;YAC5B,IAAI,EAAE,IAAI;YACV,EAAE,oBAAO,SAAS,CAAE;YACpB,QAAQ;YACR,MAAM;YACN,gBAAgB,EAAE;gBAChB,SAAS,oBAAO,SAAS,CAAE;aAC5B;SACF,CAAC,CAAC;QACH,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;IAGD,cAAc,CAAC,GAAW;QACxB,IAAI,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,CAAC;IAED,eAAe,CAAC,IAAc;QAC5B,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAC5B,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAGS,kBAAkB;QAC1B,OAAO;IACT,CAAC;CACF;AApDD,gCAoDC;AAED,SAAgB,mBAAmB;IAEjC,iCAAe,CAAC,sBAAsB,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAC/D,iCAAe,CAAC,sBAAsB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AACnE,CAAC;AAJD,kDAIC","file":"axis-animate.js","sourcesContent":["import { AComponentAnimate, AnimateExecutor, createComponentAnimator } from '@visactor/vrender-animate';\nimport { commitUpdateAnimationTarget } from './static-truth';\n\n/**\n * AxisEnter class handles the enter animation for Axis components\n */\nexport class AxisEnter extends AComponentAnimate<any> {\n onBind(): void {\n const animator = createComponentAnimator(this.target);\n this._animator = animator;\n const duration = this.duration;\n const easing = this.easing;\n const { config, lastScale, getTickCoord } = this.params;\n\n let ratio = 1;\n const currData = this.target.data;\n if (lastScale && getTickCoord && currData) {\n ratio = 0.7;\n\n const oldValue = lastScale.scale(currData.rawValue);\n const point = getTickCoord(oldValue);\n const newX = this.target.attribute.x;\n const newY = this.target.attribute.y;\n\n commitUpdateAnimationTarget(this.target, { x: newX, y: newY }, { x: point.x, y: point.y });\n animator.animate(this.target, {\n type: 'to',\n to: { x: newX, y: newY },\n duration,\n easing\n });\n }\n\n // if (updateEls && updateEls.length > 1) {\n // ratio = 0.5;\n // const oldData1 = updateEls[0].oldEl.data;\n // const { rawValue: oldRawValue1, value: oldValue1 } = oldData1;\n // const oldData2 = updateEls[1].oldEl.data;\n // const { rawValue: oldRawValue2, value: oldValue2 } = oldData2;\n // const data = this.target.data;\n // const { rawValue: newRawValue } = data;\n // // rawValue 是原始值,value是映射出来的值,假设是线性映射,计算一下newRawValue在old阶段的value是什么值\n // const oldValue =\n // oldValue1 + ((oldValue2 - oldValue1) * (newRawValue - oldRawValue1)) / (oldRawValue2 - oldRawValue1);\n // // 将 x 和 y 做映射\n // const oldX1 = updateEls[0].oldEl.attribute.x;\n // const oldY1 = updateEls[0].oldEl.attribute.y;\n // const oldX2 = updateEls[1].oldEl.attribute.x;\n // const oldY2 = updateEls[1].oldEl.attribute.y;\n // const oldX = oldX1 + ((oldX2 - oldX1) * (oldValue - oldValue1)) / (oldValue2 - oldValue1);\n // const oldY = oldY1 + ((oldY2 - oldY1) * (oldValue - oldValue1)) / (oldValue2 - oldValue1);\n // const newX = this.target.attribute.x;\n // const newY = this.target.attribute.y;\n\n // this.target.setAttributes({ x: oldX, y: oldY });\n // animator.animate(this.target, {\n // type: 'to',\n // to: { x: newX, y: newY },\n // duration,\n // easing\n // });\n // }\n\n animator.animate(this.target, {\n type: config.type ?? 'fadeIn',\n to: config.to,\n duration: duration * ratio,\n easing\n });\n this.completeBind(animator);\n }\n}\n\n/**\n * AxisUpdate class handles the update animation for Axis components\n */\nexport class AxisUpdate extends AComponentAnimate<any> {\n onBind(): void {\n const animator = createComponentAnimator(this.target);\n this._animator = animator;\n const duration = this.duration;\n const easing = this.easing;\n const { diffAttrs } = this.params;\n // this.target.applyAnimationState(\n // ['update'],\n // [\n // {\n // name: 'update',\n // animation: {\n // type: 'to',\n // to: { ...this.props },\n // duration,\n // easing,\n // customParameters: {\n // diffAttrs: { ...this.props }\n // }\n // }\n // }\n // ]\n // );\n // console.log('this.props', this.props, { ...this.target.attribute });\n commitUpdateAnimationTarget(this.target, { ...diffAttrs });\n animator.animate(this.target, {\n type: 'to',\n to: { ...diffAttrs },\n duration,\n easing,\n customParameters: {\n diffAttrs: { ...diffAttrs }\n }\n });\n this.completeBind(animator);\n }\n\n // 轴动画本身没有逻辑,具体通过animator中执行,所以当需要屏蔽自身属性时,需要通过animator中执行\n deleteSelfAttr(key: string): void {\n this.deleteSelfAttrs([key]);\n }\n\n deleteSelfAttrs(keys: string[]): void {\n super.deleteSelfAttrs(keys);\n this._animator.deleteSelfAttrs(keys);\n }\n\n // 轴动画本身没有逻辑,具体通过animator中执行,所以本身不需要屏蔽冲突\n protected tryPreventConflict(): void {\n return;\n }\n}\n\nexport function registerAxisAnimate() {\n // Label update animation\n AnimateExecutor.registerBuiltInAnimate('axisEnter', AxisEnter);\n AnimateExecutor.registerBuiltInAnimate('axisUpdate', AxisUpdate);\n}\n"]}
@@ -0,0 +1,13 @@
1
+ import type { IAnimate, IGraphic } from '@visactor/vrender-core';
2
+ export type ExitReleaseCallbackState = {
3
+ finalized: boolean;
4
+ removeFromParent: boolean;
5
+ onComplete: (() => void)[];
6
+ };
7
+ export type AnimateExitReleaseState = ExitReleaseCallbackState & {
8
+ pendingAnimates: Set<IAnimate>;
9
+ };
10
+ export declare function collectTrackedAnimates(graphic: IGraphic, animates?: IAnimate[], visited?: Set<IAnimate>): IAnimate[];
11
+ export declare function appendExitReleaseCallback(state: ExitReleaseCallbackState | undefined, callback?: () => void): void;
12
+ export declare function runExitReleaseCallbacks(callbacks: (() => void)[]): void;
13
+ export declare function bindExitReleaseAnimates<T extends AnimateExitReleaseState>(exitAnimates: IAnimate[], getState: () => T | undefined, finalize: () => void): void;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ function collectTrackedAnimates(graphic, animates = [], visited = new Set) {
4
+ var _a, _b, _c, _d, _e;
5
+ const trackedAnimates = null !== (_c = null === (_b = (_a = graphic).getTrackedAnimates) || void 0 === _b ? void 0 : _b.call(_a)) && void 0 !== _c ? _c : graphic.animates;
6
+ return null == trackedAnimates || trackedAnimates.forEach((animate => {
7
+ animate && !visited.has(animate) && (visited.add(animate), animates.push(animate));
8
+ })), null === (_e = (_d = graphic).forEachChildren) || void 0 === _e || _e.call(_d, (child => {
9
+ collectTrackedAnimates(child, animates, visited);
10
+ })), animates;
11
+ }
12
+
13
+ function appendExitReleaseCallback(state, callback) {
14
+ callback && (null == state || state.onComplete.push(callback));
15
+ }
16
+
17
+ function runExitReleaseCallbacks(callbacks) {
18
+ callbacks.forEach((callback => {
19
+ callback();
20
+ }));
21
+ }
22
+
23
+ function bindExitReleaseAnimates(exitAnimates, getState, finalize) {
24
+ const finish = animate => {
25
+ const state = getState();
26
+ state && !state.finalized && state.pendingAnimates.has(animate) && (state.pendingAnimates.delete(animate),
27
+ state.pendingAnimates.size || finalize());
28
+ };
29
+ exitAnimates.forEach((animate => {
30
+ animate.onEnd((() => finish(animate))), animate.onRemove((() => finish(animate)));
31
+ }));
32
+ }
33
+
34
+ Object.defineProperty(exports, "__esModule", {
35
+ value: !0
36
+ }), exports.bindExitReleaseAnimates = exports.runExitReleaseCallbacks = exports.appendExitReleaseCallback = exports.collectTrackedAnimates = void 0,
37
+ exports.collectTrackedAnimates = collectTrackedAnimates, exports.appendExitReleaseCallback = appendExitReleaseCallback,
38
+ exports.runExitReleaseCallbacks = runExitReleaseCallbacks, exports.bindExitReleaseAnimates = bindExitReleaseAnimates;
39
+ //# sourceMappingURL=exit-release.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/animation/exit-release.ts"],"names":[],"mappings":";;;AAYA,SAAgB,sBAAsB,CACpC,OAAiB,EACjB,WAAuB,EAAE,EACzB,UAAyB,IAAI,GAAG,EAAE;;IAElC,MAAM,eAAe,GAAG,MAAA,MAAA,MAAC,OAAe,EAAC,kBAAkB,kDAAI,mCAAK,OAAe,CAAC,QAAQ,CAAC;IAE7F,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,OAAO,CAAC,CAAC,OAAiB,EAAE,EAAE;QAC7C,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;YACpC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACrB,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SACxB;IACH,CAAC,CAAC,CAAC;IAEH,MAAA,MAAC,OAAkB,EAAC,eAAe,mDAAG,CAAC,KAAe,EAAE,EAAE;QACxD,sBAAsB,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC;AAnBD,wDAmBC;AAED,SAAgB,yBAAyB,CAAC,KAA2C,EAAE,QAAqB;IAC1G,IAAI,QAAQ,EAAE;QACZ,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;KAClC;AACH,CAAC;AAJD,8DAIC;AAED,SAAgB,uBAAuB,CAAC,SAAyB;IAC/D,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QAC3B,QAAQ,EAAE,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC;AAJD,0DAIC;AAED,SAAgB,uBAAuB,CACrC,YAAwB,EACxB,QAA6B,EAC7B,QAAoB;IAEpB,MAAM,MAAM,GAAG,CAAC,OAAiB,EAAE,EAAE;QACnC,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;QACzB,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;YACpE,OAAO;SACR;QAED,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE;YAC/B,QAAQ,EAAE,CAAC;SACZ;IACH,CAAC,CAAC;IAEF,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC7B,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QACrC,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC;AArBD,0DAqBC","file":"exit-release.js","sourcesContent":["import type { IAnimate, IGraphic, IGroup } from '@visactor/vrender-core';\n\nexport type ExitReleaseCallbackState = {\n finalized: boolean;\n removeFromParent: boolean;\n onComplete: (() => void)[];\n};\n\nexport type AnimateExitReleaseState = ExitReleaseCallbackState & {\n pendingAnimates: Set<IAnimate>;\n};\n\nexport function collectTrackedAnimates(\n graphic: IGraphic,\n animates: IAnimate[] = [],\n visited: Set<IAnimate> = new Set()\n): IAnimate[] {\n const trackedAnimates = (graphic as any).getTrackedAnimates?.() ?? (graphic as any).animates;\n\n trackedAnimates?.forEach((animate: IAnimate) => {\n if (animate && !visited.has(animate)) {\n visited.add(animate);\n animates.push(animate);\n }\n });\n\n (graphic as IGroup).forEachChildren?.((child: IGraphic) => {\n collectTrackedAnimates(child, animates, visited);\n });\n\n return animates;\n}\n\nexport function appendExitReleaseCallback(state: ExitReleaseCallbackState | undefined, callback?: () => void) {\n if (callback) {\n state?.onComplete.push(callback);\n }\n}\n\nexport function runExitReleaseCallbacks(callbacks: (() => void)[]) {\n callbacks.forEach(callback => {\n callback();\n });\n}\n\nexport function bindExitReleaseAnimates<T extends AnimateExitReleaseState>(\n exitAnimates: IAnimate[],\n getState: () => T | undefined,\n finalize: () => void\n) {\n const finish = (animate: IAnimate) => {\n const state = getState();\n if (!state || state.finalized || !state.pendingAnimates.has(animate)) {\n return;\n }\n\n state.pendingAnimates.delete(animate);\n if (!state.pendingAnimates.size) {\n finalize();\n }\n };\n\n exitAnimates.forEach(animate => {\n animate.onEnd(() => finish(animate));\n animate.onRemove(() => finish(animate));\n });\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import { type IGraphic } from '@visactor/vrender-core';
2
+ export declare function commitUpdateAnimationTarget(graphic?: IGraphic, targetAttrs?: Record<string, any>, startAttrs?: Record<string, any>): void;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.commitUpdateAnimationTarget = void 0;
6
+
7
+ const vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@visactor/vutils");
8
+
9
+ function commitUpdateAnimationTarget(graphic, targetAttrs, startAttrs) {
10
+ var _a, _b, _c, _d;
11
+ if (!graphic || !targetAttrs) return;
12
+ const committedTargetAttrs = (0, vutils_1.cloneDeep)(targetAttrs), transientStartAttrs = (0,
13
+ vutils_1.cloneDeep)(null != startAttrs ? startAttrs : graphic.attribute);
14
+ graphic.setAttributes(committedTargetAttrs), null === (_b = (_a = graphic).setFinalAttributes) || void 0 === _b || _b.call(_a, committedTargetAttrs),
15
+ null === (_d = (_c = graphic).setAttributesAndPreventAnimate) || void 0 === _d || _d.call(_c, transientStartAttrs, !1, {
16
+ type: vrender_core_1.AttributeUpdateType.ANIMATE_BIND
17
+ });
18
+ }
19
+
20
+ exports.commitUpdateAnimationTarget = commitUpdateAnimationTarget;
21
+ //# sourceMappingURL=static-truth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/animation/static-truth.ts"],"names":[],"mappings":";;;AAAA,yDAA4E;AAC5E,6CAA6C;AAE7C,SAAgB,2BAA2B,CACzC,OAAkB,EAClB,WAAiC,EACjC,UAAgC;;IAEhC,IAAI,CAAC,OAAO,IAAI,CAAC,WAAW,EAAE;QAC5B,OAAO;KACR;IAED,MAAM,oBAAoB,GAAG,IAAA,kBAAS,EAAC,WAAW,CAAC,CAAC;IACpD,MAAM,mBAAmB,GAAG,IAAA,kBAAS,EAAC,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,OAAO,CAAC,SAAS,CAAC,CAAC;IAEvE,OAAO,CAAC,aAAa,CAAC,oBAA2B,CAAC,CAAC;IACnD,MAAA,MAAC,OAAe,EAAC,kBAAkB,mDAAG,oBAAoB,CAAC,CAAC;IAC5D,MAAA,MAAC,OAAe,EAAC,8BAA8B,mDAAG,mBAA0B,EAAE,KAAK,EAAE;QACnF,IAAI,EAAE,kCAAmB,CAAC,YAAY;KACvC,CAAC,CAAC;AACL,CAAC;AAjBD,kEAiBC","file":"static-truth.js","sourcesContent":["import { AttributeUpdateType, type IGraphic } from '@visactor/vrender-core';\nimport { cloneDeep } from '@visactor/vutils';\n\nexport function commitUpdateAnimationTarget(\n graphic?: IGraphic,\n targetAttrs?: Record<string, any>,\n startAttrs?: Record<string, any>\n) {\n if (!graphic || !targetAttrs) {\n return;\n }\n\n const committedTargetAttrs = cloneDeep(targetAttrs);\n const transientStartAttrs = cloneDeep(startAttrs ?? graphic.attribute);\n\n graphic.setAttributes(committedTargetAttrs as any);\n (graphic as any).setFinalAttributes?.(committedTargetAttrs);\n (graphic as any).setAttributesAndPreventAnimate?.(transientStartAttrs as any, false, {\n type: AttributeUpdateType.ANIMATE_BIND\n });\n}\n"]}
@@ -1,9 +1,9 @@
1
- import { AnimateMode } from '@visactor/vrender-core';
2
- import type { IGroup } from '@visactor/vrender-core';
1
+ import { AnimateMode, type IGroup } from '@visactor/vrender-core';
3
2
  import { ACustomAnimate } from '@visactor/vrender-animate';
4
3
  export declare class GroupTransition extends ACustomAnimate<any> {
5
4
  target: IGroup;
6
5
  private _newElementAttrMap;
6
+ private _started;
7
7
  mode: AnimateMode;
8
8
  onBind(): void;
9
9
  onStart(): void;
@@ -4,13 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.GroupTransition = void 0;
6
6
 
7
- const vrender_core_1 = require("@visactor/vrender-core"), vrender_animate_1 = require("@visactor/vrender-animate"), vutils_1 = require("@visactor/vutils"), util_1 = require("../../util");
7
+ const vrender_core_1 = require("@visactor/vrender-core"), vrender_animate_1 = require("@visactor/vrender-animate"), vutils_1 = require("@visactor/vutils"), util_1 = require("../../util"), static_truth_1 = require("../../animation/static-truth");
8
8
 
9
9
  class GroupTransition extends vrender_animate_1.ACustomAnimate {
10
10
  constructor() {
11
11
  super(...arguments), this.mode = vrender_core_1.AnimateMode.NORMAL;
12
12
  }
13
13
  onBind() {
14
+ this._started = !1;
14
15
  const currentInnerView = this.target.getInnerView(), prevInnerView = this.target.getPrevInnerView();
15
16
  prevInnerView && (this._newElementAttrMap = {}, (0, util_1.traverseGroup)(currentInnerView, (el => {
16
17
  var _a, _b, _c, _d, _e, _f;
@@ -27,7 +28,8 @@ class GroupTransition extends vrender_animate_1.ACustomAnimate {
27
28
  fillOpacity: null !== (_b = newProps.fillOpacity) && void 0 !== _b ? _b : 1,
28
29
  strokeOpacity: null !== (_c = newProps.strokeOpacity) && void 0 !== _c ? _c : 1
29
30
  })
30
- }, el.setAttributes(oldEl.attribute);
31
+ }, (0, static_truth_1.commitUpdateAnimationTarget)(el, this._newElementAttrMap[el.id].attrs, (0,
32
+ vutils_1.cloneDeep)(oldEl.attribute));
31
33
  }
32
34
  } else {
33
35
  const finalOpacityAttrs = {
@@ -39,7 +41,7 @@ class GroupTransition extends vrender_animate_1.ACustomAnimate {
39
41
  state: "enter",
40
42
  node: el,
41
43
  attrs: finalOpacityAttrs
42
- }, el.setAttributes({
44
+ }, (0, static_truth_1.commitUpdateAnimationTarget)(el, finalOpacityAttrs, {
43
45
  opacity: 0,
44
46
  fillOpacity: 0,
45
47
  strokeOpacity: 0
@@ -49,6 +51,8 @@ class GroupTransition extends vrender_animate_1.ACustomAnimate {
49
51
  })));
50
52
  }
51
53
  onStart() {
54
+ if (this._started) return;
55
+ this._started = !0;
52
56
  let duration = this.duration, easing = this.easing;
53
57
  this._newElementAttrMap && Object.keys(this._newElementAttrMap).forEach((id => {
54
58
  var _a;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/axis/animate/group-transition.ts"],"names":[],"mappings":";;;AAAA,yDAAqD;AAErD,+DAA2D;AAE3D,6CAAwF;AACxF,qCAA2C;AAE3C,MAAa,eAAgB,SAAQ,gCAAmB;IAAxD;;QAIE,SAAI,GAAG,0BAAW,CAAC,MAAM,CAAC;IAgG5B,CAAC;IA9FC,MAAM;QAEJ,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QAEpD,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;QACrD,IAAI,CAAC,aAAa,EAAE;YAClB,OAAO;SACR;QAED,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;QAI7B,IAAA,oBAAa,EAAC,gBAAgB,EAAE,CAAC,EAAY,EAAE,EAAE;;YAC/C,IAAK,EAAe,CAAC,IAAI,KAAK,OAAO,IAAI,EAAE,CAAC,EAAE,EAAE;gBAC9C,MAAM,KAAK,GAAG,aAAa,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;gBACnC,IAAI,KAAK,EAAE;oBACT,IAAI,CAAC,IAAA,gBAAO,EAAE,EAAe,CAAC,SAAS,EAAG,KAAkB,CAAC,SAAS,CAAC,EAAE;wBAEvE,MAAM,QAAQ,GAAG,IAAA,kBAAS,EAAE,EAAe,CAAC,SAAS,CAAC,CAAC;wBACvD,IAAI,CAAC,kBAAkB,CA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K,EAAE,GAAG,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;gBAC3D,IAAI,KAAK,KAAK,OAAO,EAAE;oBACrB,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,MAAA,IAAI,CAAC,MAAM,mCAAI,EAAE,CAAC;oBACzC,QAAQ,GAAG,IAAA,sBAAa,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;oBACrE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;iBAC/C;gBACD,IAAK,IAAiB,CAAC,IAAI,KAAK,MAAM,EAAE;oBACrC,IAAiB;yBACf,OAAO,CAAC;wBACP,WAAW,CAAC,GAAW,EAAE,KAAa,EAAE,IAAS,EAAE,EAAO,EAAE,cAAmB;4BAC7E,IAAI,GAAG,KAAK,MAAM,EAAE;gCAClB,cAAc,CAAC,IAAI,GAAG,IAAA,0BAAiB,EAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;gCACzD,OAAO,IAAI,CAAC;6BACb;4BAED,OAAO,KAAK,CAAC;wBACf,CAAC;qBACF,CAAC;yBAED,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAoB,CAAC,CAAC;iBAC9C;qBAAM;oBACJ,IAAiB;yBACf,OAAO,EAAE;yBAET,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAoB,CAAC,CAAC;iBAC9C;YACH,CAAC,CAAC,CAAC;IACP,CAAC;IAED,QAAQ,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;IAE9D,CAAC;CACF;AApGD,0CAoGC","file":"group-transition.js","sourcesContent":["import { AnimateMode } from '@visactor/vrender-core';\nimport type { EasingType, IGraphic, IGroup } from '@visactor/vrender-core';\nimport { ACustomAnimate } from '@visactor/vrender-animate';\nimport type { Dict } from '@visactor/vutils';\nimport { cloneDeep, interpolateString, isEqual, isValidNumber } from '@visactor/vutils';\nimport { traverseGroup } from '../../util';\n\nexport class GroupTransition extends ACustomAnimate<any> {\n declare target: IGroup;\n\n private _newElementAttrMap: Dict<any>;\n mode = AnimateMode.NORMAL; // 组件的群组动画不需要设置走 AnimateMode.SET_ATTR_IMMEDIATELY\n\n onBind(): void {\n // @ts-ignore\n const currentInnerView = this.target.getInnerView();\n // @ts-ignore\n const prevInnerView = this.target.getPrevInnerView();\n if (!prevInnerView) {\n return;\n }\n\n this._newElementAttrMap = {};\n\n // 遍历新的场景树,将新节点属性更新为旧节点\n // TODO: 目前只处理更新场景\n traverseGroup(currentInnerView, (el: IGraphic) => {\n if ((el as IGraphic).type !== 'group' && el.id) {\n const oldEl = prevInnerView[el.id];\n if (oldEl) {\n if (!isEqual((el as IGraphic).attribute, (oldEl as IGraphic).attribute)) {\n // 更新\n const newProps = cloneDeep((el as IGraphic).attribute);\n this._newElementAttrMap[el.id] = {\n state: 'update',\n node: el,\n attrs: {\n ...newProps,\n opacity: newProps.opacity ?? 1,\n fillOpacity: newProps.fillOpacity ?? 1,\n strokeOpacity: newProps.strokeOpacity ?? 1\n }\n };\n\n (el as IGraphic).setAttributes((oldEl as IGraphic).attribute);\n }\n } else {\n // 新入场元素,进行 fadeIn 动画\n const finalOpacityAttrs = {\n opacity: el.attribute.opacity ?? 1,\n fillOpacity: el.attribute.fillOpacity ?? 1,\n strokeOpacity: el.attribute.strokeOpacity ?? 1\n };\n this._newElementAttrMap[el.id] = {\n state: 'enter',\n node: el,\n attrs: finalOpacityAttrs\n };\n (el as IGraphic).setAttributes({\n opacity: 0,\n fillOpacity: 0,\n strokeOpacity: 0\n });\n }\n }\n });\n }\n\n onStart(): void {\n let duration = this.duration;\n let easing = this.easing;\n\n // 新的场景树\n this._newElementAttrMap &&\n Object.keys(this._newElementAttrMap).forEach(id => {\n const { node, attrs, state } = this._newElementAttrMap[id];\n if (state === 'enter') {\n const { enter = {} } = this.params ?? {};\n duration = isValidNumber(enter.duration) ? enter.duration : duration;\n easing = enter.easing ? enter.easing : easing;\n }\n if ((node as IGraphic).type === 'path') {\n (node as IGraphic)\n .animate({\n interpolate(key: string, ratio: number, from: any, to: any, nextAttributes: any) {\n if (key === 'path') {\n nextAttributes.path = interpolateString(from, to)(ratio);\n return true;\n }\n\n return false;\n }\n })\n // .wait(delay)\n .to(attrs, duration, easing as EasingType);\n } else {\n (node as IGraphic)\n .animate()\n // .wait(delay)\n .to(attrs, duration, easing as EasingType);\n }\n });\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n // do nothing\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/axis/animate/group-transition.ts"],"names":[],"mappings":";;;AAAA,yDAAkG;AAClG,+DAA2D;AAC3D,6CAAmG;AACnG,qCAA2C;AAC3C,+DAA2E;AAE3E,MAAa,eAAgB,SAAQ,gCAAmB;IAAxD;;QAKE,SAAI,GAAG,0BAAW,CAAC,MAAM,CAAC;IA0G5B,CAAC;IAxGC,MAAM;QACJ,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QAEtB,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QAEpD,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;QACrD,IAAI,CAAC,aAAa,EAAE;YAClB,OAAO;SACR;QAED,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;QAI7B,IAAA,oBAAa,EAAC,gBAAgB,EAAE,CAAC,EAAY,EAAE,EAAE;;YAC/C,IAAK,EAAe,CAAC,IAAI,KAAK,OAAO,IAAI,EAAE,CAAC,EAAE,EAAE;gBAC9C,MAAM,KAAK,GAAG,aAAa,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;gBACnC,IAAI,KAAK,EAAE;oBACT,IAAI,CAAC,IAAA,gBAAO,EAAE,EAAe,CAAC,SAAS,EAAG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AC9C;qBAAM;oBACJ,IAAiB;yBACf,OAAO,EAAE;yBAET,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAoB,CAAC,CAAC;iBAC9C;YACH,CAAC,CAAC,CAAC;IACP,CAAC;IAED,QAAQ,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;IAE9D,CAAC;CACF;AA/GD,0CA+GC","file":"group-transition.js","sourcesContent":["import { AnimateMode, type EasingType, type IGraphic, type IGroup } from '@visactor/vrender-core';\nimport { ACustomAnimate } from '@visactor/vrender-animate';\nimport { cloneDeep, interpolateString, isEqual, isValidNumber, type Dict } from '@visactor/vutils';\nimport { traverseGroup } from '../../util';\nimport { commitUpdateAnimationTarget } from '../../animation/static-truth';\n\nexport class GroupTransition extends ACustomAnimate<any> {\n declare target: IGroup;\n\n private _newElementAttrMap: Dict<any>;\n private _started: boolean;\n mode = AnimateMode.NORMAL; // 组件的群组动画不需要设置走 AnimateMode.SET_ATTR_IMMEDIATELY\n\n onBind(): void {\n this._started = false;\n // @ts-ignore\n const currentInnerView = this.target.getInnerView();\n // @ts-ignore\n const prevInnerView = this.target.getPrevInnerView();\n if (!prevInnerView) {\n return;\n }\n\n this._newElementAttrMap = {};\n\n // 遍历新的场景树,将新节点属性更新为旧节点\n // TODO: 目前只处理更新场景\n traverseGroup(currentInnerView, (el: IGraphic) => {\n if ((el as IGraphic).type !== 'group' && el.id) {\n const oldEl = prevInnerView[el.id];\n if (oldEl) {\n if (!isEqual((el as IGraphic).attribute, (oldEl as IGraphic).attribute)) {\n // 更新\n const newProps = cloneDeep((el as IGraphic).attribute);\n this._newElementAttrMap[el.id] = {\n state: 'update',\n node: el,\n attrs: {\n ...newProps,\n opacity: newProps.opacity ?? 1,\n fillOpacity: newProps.fillOpacity ?? 1,\n strokeOpacity: newProps.strokeOpacity ?? 1\n }\n };\n\n commitUpdateAnimationTarget(\n el as IGraphic,\n this._newElementAttrMap[el.id].attrs,\n cloneDeep((oldEl as IGraphic).attribute)\n );\n }\n } else {\n // 新入场元素,进行 fadeIn 动画\n const finalOpacityAttrs = {\n opacity: el.attribute.opacity ?? 1,\n fillOpacity: el.attribute.fillOpacity ?? 1,\n strokeOpacity: el.attribute.strokeOpacity ?? 1\n };\n this._newElementAttrMap[el.id] = {\n state: 'enter',\n node: el,\n attrs: finalOpacityAttrs\n };\n commitUpdateAnimationTarget(el as IGraphic, finalOpacityAttrs, {\n opacity: 0,\n fillOpacity: 0,\n strokeOpacity: 0\n });\n }\n }\n });\n }\n\n onStart(): void {\n if (this._started) {\n return;\n }\n this._started = true;\n\n let duration = this.duration;\n let easing = this.easing;\n\n // 新的场景树\n this._newElementAttrMap &&\n Object.keys(this._newElementAttrMap).forEach(id => {\n const { node, attrs, state } = this._newElementAttrMap[id];\n if (state === 'enter') {\n const { enter = {} } = this.params ?? {};\n duration = isValidNumber(enter.duration) ? enter.duration : duration;\n easing = enter.easing ? enter.easing : easing;\n }\n if ((node as IGraphic).type === 'path') {\n (node as IGraphic)\n .animate({\n interpolate(key: string, ratio: number, from: any, to: any, nextAttributes: any) {\n if (key === 'path') {\n nextAttributes.path = interpolateString(from, to)(ratio);\n return true;\n }\n\n return false;\n }\n })\n // .wait(delay)\n .to(attrs, duration, easing as EasingType);\n } else {\n (node as IGraphic)\n .animate()\n // .wait(delay)\n .to(attrs, duration, easing as EasingType);\n }\n });\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n // do nothing\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { IGroup, ITextGraphicAttribute, TextAlignType, TextBaselineType, IGraphic, IText } from '@visactor/vrender-core';
2
2
  import type { Dict } from '@visactor/vutils';
3
- import type { Point } from '../core/type';
3
+ import type { ComponentExitReleaseOptions, Point } from '../core/type';
4
4
  import type { TagAttributes } from '../tag';
5
5
  import type { AxisBaseAttributes, AxisItem, TransformedAxisItem, TickLineItem } from './type';
6
6
  import { AnimateComponent } from '../animation/animate-component';
@@ -30,6 +30,7 @@ export declare abstract class AxisBase<T extends AxisBaseAttributes> extends Ani
30
30
  protected axisContainer: IGroup;
31
31
  private _lastHover;
32
32
  private _lastSelect;
33
+ private _exitReleaseState?;
33
34
  protected _newElementAttrMap: Dict<any>;
34
35
  protected abstract renderLine(container: IGroup): void;
35
36
  abstract isInValidValue(value: number): boolean;
@@ -45,6 +46,9 @@ export declare abstract class AxisBase<T extends AxisBaseAttributes> extends Ani
45
46
  textBaseline: TextBaselineType;
46
47
  };
47
48
  getBoundsWithoutRender(attributes: Partial<T>): import("@visactor/vutils").IBounds;
49
+ private _finalizeExitRelease;
50
+ private _runExitAnimationBeforeRelease;
51
+ releaseWithExitAnimation(options?: ComponentExitReleaseOptions): boolean;
48
52
  protected render(): void;
49
53
  protected _prepare(): void;
50
54
  private _bindEvent;
@@ -63,5 +67,5 @@ export declare abstract class AxisBase<T extends AxisBaseAttributes> extends Ani
63
67
  protected getLabelPosition(point: Point, vector: [number, number], text: string | number, style: Partial<ITextGraphicAttribute>): Point;
64
68
  private _transformItems;
65
69
  protected runAnimation(): void;
66
- release(): void;
70
+ release(all?: boolean): void;
67
71
  }
package/cjs/axis/base.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.AxisBase = void 0;
6
6
 
7
- const vrender_core_1 = require("@visactor/vrender-core"), graphic_creator_1 = require("../util/graphic-creator"), vutils_1 = require("@visactor/vutils"), util_1 = require("../util"), constant_1 = require("../constant"), constant_2 = require("./constant"), config_1 = require("./config"), tag_1 = require("../tag/tag"), util_2 = require("./util"), interaction_1 = require("../util/interaction"), animate_component_1 = require("../animation/animate-component"), config_2 = require("./animate/config");
7
+ const vrender_core_1 = require("@visactor/vrender-core"), graphic_creator_1 = require("../util/graphic-creator"), vutils_1 = require("@visactor/vutils"), util_1 = require("../util"), constant_1 = require("../constant"), constant_2 = require("./constant"), config_1 = require("./config"), tag_1 = require("../tag/tag"), util_2 = require("./util"), interaction_1 = require("../util/interaction"), animate_component_1 = require("../animation/animate-component"), static_truth_1 = require("../animation/static-truth"), exit_release_1 = require("../animation/exit-release"), config_2 = require("./animate/config");
8
8
 
9
9
  class AxisBase extends animate_component_1.AnimateComponent {
10
10
  constructor() {
@@ -34,14 +34,66 @@ class AxisBase extends animate_component_1.AnimateComponent {
34
34
  return this.add(offscreenGroup), this._renderInner(offscreenGroup), this.removeChild(offscreenGroup),
35
35
  this.attribute = currentAttribute, offscreenGroup.AABBBounds;
36
36
  }
37
+ _finalizeExitRelease() {
38
+ var _a, _b;
39
+ const state = this._exitReleaseState;
40
+ if (null == state ? void 0 : state.finalized) return;
41
+ state && (state.finalized = !0);
42
+ const parent = this.parent, removeFromParent = !!(null == state ? void 0 : state.removeFromParent), callbacks = null !== (_a = null == state ? void 0 : state.onComplete) && void 0 !== _a ? _a : [];
43
+ this._exitReleaseState = void 0, this._prevInnerView = null, this._innerView = null,
44
+ this.axisLabelsContainer = null, this.axisContainer = null, this.removeAllChild(!0),
45
+ super.release(!0), removeFromParent && (null === (_b = null != parent ? parent : this.parent) || void 0 === _b || _b.removeChild(this)),
46
+ (0, exit_release_1.runExitReleaseCallbacks)(callbacks);
47
+ }
48
+ _runExitAnimationBeforeRelease(options = {}) {
49
+ var _a, _b, _c;
50
+ if (this._exitReleaseState && !this._exitReleaseState.finalized) return this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent,
51
+ (0, exit_release_1.appendExitReleaseCallback)(this._exitReleaseState, options.onComplete),
52
+ !0;
53
+ if (!this.stage || !1 === this.attribute.animation || !1 === this.attribute.animationExit || !this._innerView) return !1;
54
+ if (this._prepare(), !(null === (_a = this._animationConfig) || void 0 === _a ? void 0 : _a.exit)) return !1;
55
+ const exitTargets = new Set;
56
+ if ((0, util_1.traverseGroup)(this._innerView, (el => {
57
+ "group" !== el.type && exitTargets.add(el);
58
+ })), !exitTargets.size) return !1;
59
+ const existingAnimates = (0, exit_release_1.collectTrackedAnimates)(this), {delay: delay = 0, duration: duration = config_2.DefaultAxisAnimation.duration, easing: easing = config_2.DefaultAxisAnimation.easing} = this._animationConfig.exit;
60
+ exitTargets.forEach((target => {
61
+ var _a, _b, _c;
62
+ const startAttrs = {
63
+ opacity: null !== (_a = target.attribute.opacity) && void 0 !== _a ? _a : 1,
64
+ fillOpacity: null !== (_b = target.attribute.fillOpacity) && void 0 !== _b ? _b : 1,
65
+ strokeOpacity: null !== (_c = target.attribute.strokeOpacity) && void 0 !== _c ? _c : 1
66
+ }, endAttrs = {
67
+ opacity: 0,
68
+ fillOpacity: 0,
69
+ strokeOpacity: 0
70
+ };
71
+ (0, static_truth_1.commitUpdateAnimationTarget)(target, endAttrs, startAttrs), target.animate().wait(delay).to(endAttrs, duration, easing);
72
+ }));
73
+ const exitAnimates = (0, exit_release_1.collectTrackedAnimates)(this).filter((animate => !existingAnimates.includes(animate)));
74
+ if (!exitAnimates.length) return !1;
75
+ this.setAttribute("childrenPickable", !1), null === (_c = (_b = this._innerView).removeAllEventListeners) || void 0 === _c || _c.call(_b),
76
+ this.releaseStatus = "willRelease";
77
+ const pendingAnimates = new Set(exitAnimates);
78
+ return this._exitReleaseState = {
79
+ pendingAnimates: pendingAnimates,
80
+ finalized: !1,
81
+ removeFromParent: !!options.removeFromParent,
82
+ onComplete: options.onComplete ? [ options.onComplete ] : []
83
+ }, (0, exit_release_1.bindExitReleaseAnimates)(exitAnimates, (() => this._exitReleaseState), (() => this._finalizeExitRelease())),
84
+ !0;
85
+ }
86
+ releaseWithExitAnimation(options = {}) {
87
+ return "released" !== this.releaseStatus && this._runExitAnimationBeforeRelease(options);
88
+ }
37
89
  render() {
38
- this._prepare(), this._prevInnerView = this._innerView && (0, util_2.getElMap)(this._innerView),
39
- this.removeAllChild(!0), this._innerView = graphic_creator_1.graphicCreator.group({
90
+ this._exitReleaseState || (this._prepare(), this._prevInnerView = this._innerView && (0,
91
+ util_2.getElMap)(this._innerView), this.removeAllChild(!0), this._innerView = graphic_creator_1.graphicCreator.group({
40
92
  x: 0,
41
93
  y: 0,
42
94
  pickable: !1
43
95
  }), this.add(this._innerView), this._renderInner(this._innerView), this._bindEvent(),
44
- this.runAnimation();
96
+ this.runAnimation());
45
97
  }
46
98
  _prepare() {
47
99
  this._prepareAnimate(config_2.DefaultAxisAnimation);
@@ -283,33 +335,29 @@ class AxisBase extends animate_component_1.AnimateComponent {
283
335
  var _a;
284
336
  if ("group" !== el.type && el.id) {
285
337
  const oldEl = prevInnerView[el.id];
286
- if (el.setFinalAttributes(el.attribute), oldEl) {
338
+ if (oldEl) {
287
339
  oldEl.release();
288
- const oldAttrs = oldEl.attribute, finalAttrs = el.getFinalAttribute(), diffAttrs = (0,
340
+ const oldAttrs = (0, vutils_1.cloneDeep)(oldEl.attribute), finalAttrs = (0, vutils_1.cloneDeep)(el.attribute), diffAttrs = (0,
289
341
  vrender_core_1.diff)(oldAttrs, finalAttrs);
290
342
  let hasDiff = Object.keys(diffAttrs).length > 0;
291
- if ("opacity" in oldAttrs && finalAttrs.opacity !== oldAttrs.opacity && (diffAttrs.opacity = null !== (_a = finalAttrs.opacity) && void 0 !== _a ? _a : 1,
292
- hasDiff = !0), animationConfig.update && hasDiff) {
293
- this._newElementAttrMap[el.id] = {
294
- state: "update",
295
- node: el,
296
- attrs: el.attribute
297
- };
298
- const oldAttrs = oldEl.attribute;
299
- el.setAttributes(oldAttrs), el.applyAnimationState([ "update" ], [ {
300
- name: "update",
301
- animation: Object.assign(Object.assign({
302
- selfOnly: !0
303
- }, animationConfig.update), {
304
- type: "axisUpdate",
305
- customParameters: {
306
- config: animationConfig.update,
307
- diffAttrs: diffAttrs,
308
- lastScale: lastScale
309
- }
310
- })
311
- } ]);
312
- }
343
+ "opacity" in oldAttrs && finalAttrs.opacity !== oldAttrs.opacity && (diffAttrs.opacity = null !== (_a = finalAttrs.opacity) && void 0 !== _a ? _a : 1,
344
+ hasDiff = !0), animationConfig.update && hasDiff && (this._newElementAttrMap[el.id] = {
345
+ state: "update",
346
+ node: el,
347
+ attrs: finalAttrs
348
+ }, (0, static_truth_1.commitUpdateAnimationTarget)(el, finalAttrs, oldAttrs), el.applyAnimationState([ "update" ], [ {
349
+ name: "update",
350
+ animation: Object.assign(Object.assign({
351
+ selfOnly: !0
352
+ }, animationConfig.update), {
353
+ type: "axisUpdate",
354
+ customParameters: {
355
+ config: animationConfig.update,
356
+ diffAttrs: diffAttrs,
357
+ lastScale: lastScale
358
+ }
359
+ })
360
+ } ]));
313
361
  } else animationConfig.enter && (this._newElementAttrMap[el.id] = {
314
362
  state: "enter",
315
363
  node: el,
@@ -330,8 +378,10 @@ class AxisBase extends animate_component_1.AnimateComponent {
330
378
  }));
331
379
  }
332
380
  }
333
- release() {
334
- super.release(), this._prevInnerView = null, this._innerView = null;
381
+ release(all) {
382
+ this._exitReleaseState ? this._finalizeExitRelease() : (all && this.removeAllChild(!0),
383
+ super.release(all), all && this.removeAllChild(!0), this._prevInnerView = null,
384
+ this._innerView = null);
335
385
  }
336
386
  }
337
387