@visactor/vgrammar-core 0.16.4 → 0.17.0-alpha.0

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 (55) hide show
  1. package/cjs/glyph/index.d.ts +1 -1
  2. package/cjs/glyph/index.js +6 -1
  3. package/cjs/glyph/index.js.map +1 -1
  4. package/cjs/glyph/link-path.d.ts +14 -0
  5. package/cjs/glyph/link-path.js +104 -58
  6. package/cjs/glyph/link-path.js.map +1 -1
  7. package/cjs/graph/animation/animator.js +3 -5
  8. package/cjs/graph/animation/animator.js.map +1 -1
  9. package/cjs/graph/animation/attribute.d.ts +1 -2
  10. package/cjs/graph/animation/attribute.js +8 -25
  11. package/cjs/graph/animation/attribute.js.map +1 -1
  12. package/cjs/graph/animation/morph.js +9 -36
  13. package/cjs/graph/animation/morph.js.map +1 -1
  14. package/cjs/index.d.ts +1 -1
  15. package/cjs/index.js +1 -1
  16. package/cjs/index.js.map +1 -1
  17. package/cjs/types/animate.d.ts +2 -1
  18. package/cjs/types/animate.js.map +1 -1
  19. package/es/glyph/index.d.ts +1 -1
  20. package/es/glyph/index.js +1 -1
  21. package/es/glyph/index.js.map +1 -1
  22. package/es/glyph/link-path.d.ts +14 -0
  23. package/es/glyph/link-path.js +90 -56
  24. package/es/glyph/link-path.js.map +1 -1
  25. package/es/graph/animation/animator.js +2 -4
  26. package/es/graph/animation/animator.js.map +1 -1
  27. package/es/graph/animation/attribute.d.ts +1 -2
  28. package/es/graph/animation/attribute.js +8 -23
  29. package/es/graph/animation/attribute.js.map +1 -1
  30. package/es/graph/animation/morph.js +7 -32
  31. package/es/graph/animation/morph.js.map +1 -1
  32. package/es/index.d.ts +1 -1
  33. package/es/index.js +1 -1
  34. package/es/index.js.map +1 -1
  35. package/es/interactions/brush-base.js +2 -1
  36. package/es/interactions/element-active.js +1 -2
  37. package/es/interactions/element-select.js +2 -1
  38. package/es/interactions/filter.js +1 -1
  39. package/es/interactions/fish-eye.js +1 -1
  40. package/es/interactions/index.js +1 -1
  41. package/es/interactions/legend-filter.js +1 -1
  42. package/es/interactions/player-filter.js +1 -1
  43. package/es/interactions/roll-up.js +1 -1
  44. package/es/interactions/scrollbar-filter.js +1 -1
  45. package/es/parse/coordinate.js +1 -1
  46. package/es/parse/event.js +1 -1
  47. package/es/parse/mark.js +1 -1
  48. package/es/parse/option.js +1 -2
  49. package/es/parse/scale.js +1 -1
  50. package/es/parse/transform.js +1 -1
  51. package/es/parse/util.js +1 -1
  52. package/es/parse/view.js +1 -1
  53. package/es/types/animate.d.ts +2 -1
  54. package/es/types/animate.js.map +1 -1
  55. package/package.json +10 -9
@@ -2,6 +2,6 @@ export type { IBoxplotScaleAnimationOptions } from './boxplot';
2
2
  export { registerBoxplotGlyph, registerBarBoxplotGlyph } from './boxplot';
3
3
  export { registerRippleGlyph } from './ripple';
4
4
  export { registerWaveGlyph } from './wave';
5
- export { registerLinkPathGlyph } from './link-path';
5
+ export { registerLinkPathGlyph, registerLinkPathAnimation } from './link-path';
6
6
  export { registerTreePathGlyph } from './tree-path';
7
7
  export { registerViolinGlyph } from './violin';
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.registerViolinGlyph = exports.registerTreePathGlyph = exports.registerLinkPathGlyph = exports.registerWaveGlyph = exports.registerRippleGlyph = exports.registerBarBoxplotGlyph = exports.registerBoxplotGlyph = void 0;
5
+ }), exports.registerViolinGlyph = exports.registerTreePathGlyph = exports.registerLinkPathAnimation = exports.registerLinkPathGlyph = exports.registerWaveGlyph = exports.registerRippleGlyph = exports.registerBarBoxplotGlyph = exports.registerBoxplotGlyph = void 0;
6
6
 
7
7
  var boxplot_1 = require("./boxplot");
8
8
 
@@ -43,6 +43,11 @@ Object.defineProperty(exports, "registerLinkPathGlyph", {
43
43
  get: function() {
44
44
  return link_path_1.registerLinkPathGlyph;
45
45
  }
46
+ }), Object.defineProperty(exports, "registerLinkPathAnimation", {
47
+ enumerable: !0,
48
+ get: function() {
49
+ return link_path_1.registerLinkPathAnimation;
50
+ }
46
51
  });
47
52
 
48
53
  var tree_path_1 = require("./tree-path");
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/glyph/index.ts"],"names":[],"mappings":";;;AACA,qCAA0E;AAAjE,+GAAA,oBAAoB,OAAA;AAAE,kHAAA,uBAAuB,OAAA;AACtD,mCAA+C;AAAtC,6GAAA,mBAAmB,OAAA;AAC5B,+BAA2C;AAAlC,yGAAA,iBAAiB,OAAA;AAC1B,yCAAoD;AAA3C,kHAAA,qBAAqB,OAAA;AAC9B,yCAAoD;AAA3C,kHAAA,qBAAqB,OAAA;AAC9B,mCAA+C;AAAtC,6GAAA,mBAAmB,OAAA","file":"index.js","sourcesContent":["export type { IBoxplotScaleAnimationOptions } from './boxplot';\nexport { registerBoxplotGlyph, registerBarBoxplotGlyph } from './boxplot';\nexport { registerRippleGlyph } from './ripple';\nexport { registerWaveGlyph } from './wave';\nexport { registerLinkPathGlyph } from './link-path';\nexport { registerTreePathGlyph } from './tree-path';\nexport { registerViolinGlyph } from './violin';\n"]}
1
+ {"version":3,"sources":["../src/glyph/index.ts"],"names":[],"mappings":";;;AACA,qCAA0E;AAAjE,+GAAA,oBAAoB,OAAA;AAAE,kHAAA,uBAAuB,OAAA;AACtD,mCAA+C;AAAtC,6GAAA,mBAAmB,OAAA;AAC5B,+BAA2C;AAAlC,yGAAA,iBAAiB,OAAA;AAC1B,yCAA+E;AAAtE,kHAAA,qBAAqB,OAAA;AAAE,sHAAA,yBAAyB,OAAA;AACzD,yCAAoD;AAA3C,kHAAA,qBAAqB,OAAA;AAC9B,mCAA+C;AAAtC,6GAAA,mBAAmB,OAAA","file":"index.js","sourcesContent":["export type { IBoxplotScaleAnimationOptions } from './boxplot';\nexport { registerBoxplotGlyph, registerBarBoxplotGlyph } from './boxplot';\nexport { registerRippleGlyph } from './ripple';\nexport { registerWaveGlyph } from './wave';\nexport { registerLinkPathGlyph, registerLinkPathAnimation } from './link-path';\nexport { registerTreePathGlyph } from './tree-path';\nexport { registerViolinGlyph } from './violin';\n"]}
@@ -1,7 +1,21 @@
1
1
  import type { LinkPathEncoderSpec } from '../types';
2
+ import { ACustomAnimate } from '@visactor/vrender-animate';
2
3
  export interface LinkPathConfig {
3
4
  direction?: 'horizontal' | 'vertical' | 'LR' | 'RL' | 'TB' | 'BL' | 'radial';
4
5
  }
5
6
  export declare const getHorizontalPath: (options: LinkPathEncoderSpec, ratio?: number) => string;
6
7
  export declare const getVerticalPath: (options: LinkPathEncoderSpec, ratio?: number) => string;
8
+ export declare class LinkPathGrowIn extends ACustomAnimate<Record<string, number>> {
9
+ onBind(): void;
10
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
11
+ }
12
+ export declare class LinkPathGrowOut extends ACustomAnimate<Record<string, number>> {
13
+ onBind(): void;
14
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
15
+ }
16
+ export declare class LinkPathUpdate extends ACustomAnimate<Record<string, number>> {
17
+ onBind(): void;
18
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
19
+ }
7
20
  export declare const registerLinkPathGlyph: () => void;
21
+ export declare const registerLinkPathAnimation: () => void;
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.registerLinkPathGlyph = exports.getVerticalPath = exports.getHorizontalPath = void 0;
5
+ }), exports.registerLinkPathAnimation = exports.registerLinkPathGlyph = exports.LinkPathUpdate = exports.LinkPathGrowOut = exports.LinkPathGrowIn = exports.getVerticalPath = exports.getHorizontalPath = void 0;
6
6
 
7
- const factory_1 = require("../core/factory"), vutils_1 = require("@visactor/vutils"), graphic_1 = require("../graph/mark/graphic"), glyph_1 = require("../view/glyph"), getHorizontalPath = (options, ratio) => {
7
+ const factory_1 = require("../core/factory"), graphic_1 = require("../graph/mark/graphic"), glyph_1 = require("../view/glyph"), vrender_animate_1 = require("@visactor/vrender-animate"), getHorizontalPath = (options, ratio) => {
8
8
  var _a;
9
9
  const curvature = null !== (_a = options.curvature) && void 0 !== _a ? _a : .5, thickness = "number" == typeof ratio ? options.thickness * ratio : options.thickness;
10
10
  let x0 = options.x0, x1 = options.x1, y00 = options.y0, y10 = options.y1, cpx0 = x0 + curvature * (x1 - x0), cpx1 = x1 + curvature * (x0 - x1), formatter = v => v;
@@ -47,22 +47,15 @@ const encoder = (encodeValues, datum, element, config) => {
47
47
  path: parsePath(encodeValues, isRatioShow ? encodeValues.ratio : 1)
48
48
  }
49
49
  } : {};
50
- }, linkPathGrowIn = (element, options, animationParameters) => {
50
+ }, linkPathGrowIn = (graphic, options, animationParameters) => {
51
51
  const linkValues = {
52
- x0: element.getGraphicAttribute("x0", !1),
53
- x1: element.getGraphicAttribute("x1", !1),
54
- y0: element.getGraphicAttribute("y0", !1),
55
- y1: element.getGraphicAttribute("y1", !1),
56
- thickness: element.getGraphicAttribute("thickness", !1),
57
- round: element.getGraphicAttribute("round", !1),
58
- align: element.getGraphicAttribute("align", !1),
59
- pathType: element.getGraphicAttribute("pathType", !1),
60
- endArrow: element.getGraphicAttribute("endArrow", !1),
61
- startArrow: element.getGraphicAttribute("startArrow", !1)
52
+ x0: graphic.getFinalAttribute().x0,
53
+ x1: graphic.getFinalAttribute().x1,
54
+ y0: graphic.getFinalAttribute().y0,
55
+ y1: graphic.getFinalAttribute().y1,
56
+ thickness: graphic.getFinalAttribute().thickness
62
57
  };
63
- return Object.keys(linkValues).forEach((key => {
64
- (0, vutils_1.isNil)(linkValues[key]) && delete linkValues[key];
65
- })), {
58
+ return {
66
59
  from: Object.assign({}, linkValues, {
67
60
  x1: linkValues.x0,
68
61
  y1: linkValues.y0
@@ -71,53 +64,100 @@ const encoder = (encodeValues, datum, element, config) => {
71
64
  };
72
65
  }, linkPathGrowOut = (element, options, animationParameters) => {
73
66
  const linkValues = {
74
- x0: element.getGraphicAttribute("x0", !0),
75
- x1: element.getGraphicAttribute("x1", !0),
76
- y0: element.getGraphicAttribute("y0", !0),
77
- y1: element.getGraphicAttribute("y1", !0),
78
- thickness: element.getGraphicAttribute("thickness", !0),
79
- round: element.getGraphicAttribute("round", !0),
80
- align: element.getGraphicAttribute("align", !0),
81
- pathType: element.getGraphicAttribute("pathType", !0),
82
- endArrow: element.getGraphicAttribute("endArrow", !0),
83
- startArrow: element.getGraphicAttribute("startArrow", !0)
67
+ x0: element.getFinalAttribute().x0,
68
+ x1: element.getFinalAttribute().x1,
69
+ y0: element.getFinalAttribute().y0,
70
+ y1: element.getFinalAttribute().y1,
71
+ thickness: element.getFinalAttribute().thickness
84
72
  };
85
- return Object.keys(linkValues).forEach((key => {
86
- (0, vutils_1.isNil)(linkValues[key]) && delete linkValues[key];
87
- })), {
73
+ return {
88
74
  from: linkValues,
89
75
  to: Object.assign({}, linkValues, {
90
76
  x1: linkValues.x0,
91
77
  y1: linkValues.y0
92
78
  })
93
79
  };
94
- }, linkPathUpdate = (element, options, animationParameters) => {
95
- const bassLinkValues = {
96
- thickness: element.getGraphicAttribute("thickness", !1),
97
- round: element.getGraphicAttribute("round", !1),
98
- align: element.getGraphicAttribute("align", !1),
99
- pathType: element.getGraphicAttribute("pathType", !1),
100
- endArrow: element.getGraphicAttribute("endArrow", !1),
101
- startArrow: element.getGraphicAttribute("startArrow", !1)
102
- };
103
- Object.keys(bassLinkValues).forEach((key => {
104
- (0, vutils_1.isNil)(bassLinkValues[key]) && delete bassLinkValues[key];
105
- }));
80
+ }, linkPathUpdate = (graphic, options, animationParameters) => {
81
+ let from, to;
82
+ {
83
+ const {x0: x0, x1: x1, y0: y0, y1: y1} = graphic.getFinalAttribute();
84
+ from = {
85
+ x0: x0,
86
+ x1: x1,
87
+ y0: y0,
88
+ y1: y1
89
+ };
90
+ }
91
+ {
92
+ const {x0: x0, x1: x1, y0: y0, y1: y1} = graphic.attribute;
93
+ to = {
94
+ x0: x0,
95
+ x1: x1,
96
+ y0: y0,
97
+ y1: y1
98
+ };
99
+ }
106
100
  return {
107
- from: Object.assign(Object.assign({
108
- x0: element.getGraphicAttribute("x0", !0),
109
- x1: element.getGraphicAttribute("x1", !0),
110
- y0: element.getGraphicAttribute("y0", !0),
111
- y1: element.getGraphicAttribute("y1", !0)
112
- }, bassLinkValues), bassLinkValues),
113
- to: Object.assign({
114
- x0: element.getGraphicAttribute("x0", !1),
115
- x1: element.getGraphicAttribute("x1", !1),
116
- y0: element.getGraphicAttribute("y0", !1),
117
- y1: element.getGraphicAttribute("y1", !1)
118
- }, bassLinkValues)
101
+ from: from,
102
+ to: to
119
103
  };
120
- }, registerLinkPathGlyph = () => {
104
+ };
105
+
106
+ class LinkPathGrowIn extends vrender_animate_1.ACustomAnimate {
107
+ onBind() {
108
+ var _a, _b, _c;
109
+ (null === (_a = this.params) || void 0 === _a ? void 0 : _a.diffAttrs) && this.target.setAttributes(this.params.diffAttrs);
110
+ const {from: from, to: to} = linkPathGrowIn(this.target, this.params.options, this.params), fromAttrs = null !== (_c = null === (_b = this.target.context) || void 0 === _b ? void 0 : _b.lastAttrs) && void 0 !== _c ? _c : from;
111
+ this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
112
+ this.animate.reSyncProps(), this.from = fromAttrs, this.to = to, this.target.setAttributes(fromAttrs);
113
+ }
114
+ onUpdate(end, ratio, out) {
115
+ const attribute = this.target.attribute;
116
+ this.propKeys.forEach((key => {
117
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
118
+ })), this.target.setAttributes(attribute);
119
+ }
120
+ }
121
+
122
+ exports.LinkPathGrowIn = LinkPathGrowIn;
123
+
124
+ class LinkPathGrowOut extends vrender_animate_1.ACustomAnimate {
125
+ onBind() {
126
+ var _a, _b, _c;
127
+ (null === (_a = this.params) || void 0 === _a ? void 0 : _a.diffAttrs) && this.target.setAttributes(this.params.diffAttrs);
128
+ const {from: from, to: to} = linkPathGrowOut(this.target, this.params.options, this.params), fromAttrs = null !== (_c = null === (_b = this.target.context) || void 0 === _b ? void 0 : _b.lastAttrs) && void 0 !== _c ? _c : from;
129
+ this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
130
+ this.animate.reSyncProps(), this.from = fromAttrs, this.to = to, this.target.setAttributes(fromAttrs);
131
+ }
132
+ onUpdate(end, ratio, out) {
133
+ const attribute = this.target.attribute;
134
+ this.propKeys.forEach((key => {
135
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
136
+ })), this.target.setAttributes(attribute);
137
+ }
138
+ }
139
+
140
+ exports.LinkPathGrowOut = LinkPathGrowOut;
141
+
142
+ class LinkPathUpdate extends vrender_animate_1.ACustomAnimate {
143
+ onBind() {
144
+ var _a, _b, _c;
145
+ (null === (_a = this.params) || void 0 === _a ? void 0 : _a.diffAttrs) && this.target.setAttributes(this.params.diffAttrs);
146
+ const {from: from, to: to} = linkPathUpdate(this.target, this.params.options, this.params), fromAttrs = null !== (_c = null === (_b = this.target.context) || void 0 === _b ? void 0 : _b.lastAttrs) && void 0 !== _c ? _c : from;
147
+ this.props = to, this.propKeys = Object.keys(to).filter((key => null != to[key])),
148
+ this.animate.reSyncProps(), this.from = fromAttrs, this.to = to, this.target.setAttributes(fromAttrs);
149
+ }
150
+ onUpdate(end, ratio, out) {
151
+ const attribute = this.target.attribute;
152
+ this.propKeys.forEach((key => {
153
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
154
+ })), this.target.setAttributes(attribute);
155
+ }
156
+ }
157
+
158
+ exports.LinkPathUpdate = LinkPathUpdate;
159
+
160
+ const registerLinkPathGlyph = () => {
121
161
  factory_1.Factory.registerGlyph("linkPath", {
122
162
  back: "path",
123
163
  front: "path"
@@ -130,9 +170,15 @@ const encoder = (encodeValues, datum, element, config) => {
130
170
  front: {
131
171
  zIndex: 1
132
172
  }
133
- }))), factory_1.Factory.registerAnimationType("linkPathGrowIn", linkPathGrowIn),
134
- factory_1.Factory.registerAnimationType("linkPathGrowOut", linkPathGrowOut), factory_1.Factory.registerAnimationType("linkPathUpdate", linkPathUpdate),
135
- (0, glyph_1.registerGlyphMark)(), (0, graphic_1.registerGlyphGraphic)(), (0, graphic_1.registerPathGraphic)();
173
+ }))), (0, glyph_1.registerGlyphMark)(), (0, graphic_1.registerGlyphGraphic)(), (0,
174
+ graphic_1.registerPathGraphic)();
175
+ };
176
+
177
+ exports.registerLinkPathGlyph = registerLinkPathGlyph;
178
+
179
+ const registerLinkPathAnimation = () => {
180
+ vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("linkPathGrowIn", LinkPathGrowIn),
181
+ vrender_animate_1.AnimateExecutor.registerBuiltInAnimate("linkPathGrowOut", LinkPathGrowOut);
136
182
  };
137
183
 
138
- exports.registerLinkPathGlyph = registerLinkPathGlyph;
184
+ exports.registerLinkPathAnimation = registerLinkPathAnimation;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/glyph/link-path.ts"],"names":[],"mappings":";;;AAEA,6CAA0C;AAC1C,6CAAyC;AACzC,mDAAkF;AAClF,yCAAkD;AAS3C,MAAM,iBAAiB,GAAG,CAAC,OAA4B,EAAE,KAAc,EAAE,EAAE;;IAChF,MAAM,SAAS,GAAG,MAAA,OAAO,CAAC,SAAS,mCAAI,GAAG,CAAC;IAC3C,MAAM,YAAY,GAAG,IAAI,CAAC;IAC1B,MAAM,SAAS,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IAE5F,IAAI,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;IACpB,IAAI,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;IACpB,IAAI,GAAG,GAAG,OAAO,CAAC,EAAE,CAAC;IACrB,IAAI,GAAG,GAAG,OAAO,CAAC,EAAE,CAAC;IACrB,IAAI,IAAI,GAAG,EAAE,GAAG,SAAS,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IACtC,IAAI,IAAI,GAAG,EAAE,G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';\nimport type { IElement } from '../types/element';\nimport { Factory } from '../core/factory';\nimport { isNil } from '@visactor/vutils';\nimport { registerGlyphGraphic, registerPathGraphic } from '../graph/mark/graphic';\nimport { registerGlyphMark } from '../view/glyph';\n\nexport interface LinkPathConfig {\n direction?: 'horizontal' | 'vertical' | 'LR' | 'RL' | 'TB' | 'BL' | 'radial';\n}\n\n// const isValidThickness = (thickness: number) => isValidNumber(thickness) && thickness > 1;\n// const hasValidThickness = (options: LinkPathEncodeValues) => isValidThickness(options.thickness);\n\nexport const getHorizontalPath = (options: LinkPathEncoderSpec, ratio?: number) => {\n const curvature = options.curvature ?? 0.5;\n const hasThickness = true;\n const thickness = typeof ratio === 'number' ? options.thickness * ratio : options.thickness;\n\n let x0 = options.x0;\n let x1 = options.x1;\n let y00 = options.y0;\n let y10 = options.y1;\n let cpx0 = x0 + curvature * (x1 - x0);\n let cpx1 = x1 + curvature * (x0 - x1);\n let formatter = (v: number) => v;\n\n if (options.round !== false) {\n x0 = Math.round(x0);\n x1 = Math.round(x1);\n y00 = Math.round(y00);\n y10 = Math.round(y10);\n cpx0 = Math.round(cpx0);\n cpx1 = Math.round(cpx1);\n formatter = Math.round;\n }\n const topPath =\n options.pathType === 'line'\n ? `M${x0},${y00}L${x1},${y10}`\n : options.pathType === 'polyline'\n ? `M${x0},${y00}L${cpx0},${y00}L${cpx0},${y10}L${x1},${y10}`\n : `M${x0},${y00}C${cpx0},${y00},${cpx1},${y10},${x1},${y10}`;\n\n if (!hasThickness) {\n // simplified to a single path\n return topPath;\n }\n\n if (options.align === 'center') {\n y00 = formatter(options.y0 - thickness / 2);\n y10 = formatter(options.y1 - thickness / 2);\n } else if (options.align === 'end') {\n y00 = formatter(options.y0 + options.thickness / 2 - thickness);\n y10 = formatter(options.y1 + options.thickness / 2 - thickness);\n } else {\n y00 = formatter(options.y0 - options.thickness / 2);\n y10 = formatter(options.y1 - options.thickness / 2);\n }\n\n const y01 = formatter(y00 + thickness);\n const y11 = formatter(y10 + thickness);\n\n const hasLength = Math.abs(x1 - x0) > 1e-6;\n const endArrowPath =\n options.endArrow && hasLength\n ? `L${x1},${formatter(y10 - thickness / 2)}L${formatter(x1 + thickness)},${formatter(\n (y10 + y11) / 2\n )}L${x1},${formatter(y11 + thickness / 2)}`\n : '';\n const startArrowPath =\n options.startArrow && hasLength\n ? `L${x0},${formatter(y01 + thickness / 2)}L${formatter(x0 - thickness)},${formatter(\n (y00 + y01) / 2\n )}L${x0},${formatter(y00 - thickness / 2)}`\n : '';\n\n if (options.pathType === 'line') {\n return `M${x0},${y00}L${x1},${y10}${endArrowPath}L${x1},${y11}L${x0},${y01}${startArrowPath}Z`;\n } else if (options.pathType === 'polyline') {\n return `M${x0},${y00}L${cpx0},${y00}L${cpx0},${y10}L${x1},${y10}\n ${endArrowPath}L${x1},${y11}L${cpx0},${y11}L${cpx0},${y01}L${x0},${y01}${startArrowPath}Z`;\n }\n\n return `M${x0},${y00}C${cpx0},${y00},${cpx1},${y10},${x1},${y10}\n ${endArrowPath}L${x1},${y11}C${cpx1},${y11},${cpx0},${y01},${x0},${y01}${startArrowPath}Z`;\n};\n\nexport const getVerticalPath = (options: LinkPathEncoderSpec, ratio?: number) => {\n const curvature = options.curvature ?? 0.5;\n const hasThickness = true;\n const thickness = typeof ratio === 'number' ? options.thickness * ratio : options.thickness;\n let y0 = options.y0;\n let y1 = options.y1;\n let x00 = options.x0;\n let x10 = options.x1;\n let cpy0 = y0 + curvature * (y1 - y0);\n let cpy1 = y1 + curvature * (y0 - y1);\n let formatter = (v: number) => v;\n\n if (options.round !== false) {\n formatter = Math.round;\n y0 = Math.round(y0);\n y1 = Math.round(y1);\n x00 = Math.round(x00);\n x10 = Math.round(x10);\n cpy0 = Math.round(cpy0);\n cpy1 = Math.round(cpy1);\n }\n const leftpath =\n options.pathType === 'line'\n ? `M${x00},${y0}L${x10},${y1}`\n : options.pathType === 'polyline'\n ? `M${x00},${y0}L${x00},${cpy0}L${x10},${cpy0}L${x10},${y1}`\n : `M${x00},${y0}C${x00},${cpy0},${x10},${cpy1},${x10},${y1}`;\n if (!hasThickness) {\n // simplified to a single path\n return leftpath;\n }\n\n if (options.align === 'center') {\n x00 = formatter(options.x0 - thickness / 2);\n x10 = formatter(options.x1 - thickness / 2);\n } else if (options.align === 'end') {\n x00 = formatter(options.x0 + options.thickness / 2 - thickness);\n x10 = formatter(options.x1 + options.thickness / 2 - thickness);\n } else {\n x00 = formatter(options.x0 - options.thickness / 2);\n x10 = formatter(options.x1 - options.thickness / 2);\n }\n\n const x01 = formatter(x00 + thickness);\n const x11 = formatter(x10 + thickness);\n\n const hasLength = Math.abs(y1 - y0) > 1e-6;\n const endArrowPath =\n options.endArrow && hasLength\n ? `L${formatter(x10 - thickness / 2)},${y1}L${formatter((x10 + x11) / 2)},${formatter(\n y1 + thickness\n )}L${formatter(x11 + thickness / 2)},${y1}`\n : '';\n const startArrowPath =\n options.startArrow && hasLength\n ? `L${formatter(x01 + thickness / 2)},${y0}L${formatter((x01 + x00) / 2)},${formatter(\n y0 - thickness\n )}L${formatter(x00 - thickness / 2)},${y0}`\n : '';\n\n if (options.pathType === 'line') {\n return `M${x00},${y0}L${x10},${y1}${endArrowPath}L${x11},${y1}L${x01},${y0}${startArrowPath}Z`;\n } else if (options.pathType === 'polyline') {\n return `M${x00},${y0}L${x00},${cpy0}L${x10},${cpy0}L${x10},${y1}\n ${endArrowPath}L${x11},${y1}L${x11},${cpy0}L${x01},${cpy0}L${x01},${y0}${startArrowPath}Z`;\n }\n\n return `M${x00},${y0}C${x00},${cpy0},${x10},${cpy1},${x10},${y1}\n ${endArrowPath}L${x11},${y1}C${x11},${cpy1},${x01},${cpy0},${x01},${y0}${startArrowPath}Z`;\n};\n\nconst encoder = (encodeValues: LinkPathEncoderSpec, datum: any, element: IElement, config: LinkPathConfig) => {\n const direction = encodeValues.direction ?? config?.direction;\n const parsePath = ['vertical', 'TB', 'BT'].includes(direction) ? getVerticalPath : getHorizontalPath;\n const isRatioShow = typeof encodeValues.ratio === 'number' && encodeValues.ratio >= 0 && encodeValues.ratio <= 1;\n\n const encodeChannels = Object.keys(encodeValues);\n // parse path when all required channels are included\n if (['x0', 'y0', 'x1', 'y1'].every(channel => encodeChannels.includes(channel))) {\n return {\n back: {\n path: isRatioShow ? parsePath(encodeValues, 1) : ''\n },\n front: {\n path: parsePath(encodeValues, isRatioShow ? encodeValues.ratio : 1)\n }\n };\n }\n\n return {};\n};\n\nconst linkPathGrowIn: TypeAnimation<IElement> = (\n element: IElement,\n options: any,\n animationParameters: IAnimationParameters\n) => {\n const linkValues: LinkPathEncoderSpec = {\n x0: element.getGraphicAttribute('x0', false),\n x1: element.getGraphicAttribute('x1', false),\n y0: element.getGraphicAttribute('y0', false),\n y1: element.getGraphicAttribute('y1', false),\n thickness: element.getGraphicAttribute('thickness', false),\n round: element.getGraphicAttribute('round', false),\n align: element.getGraphicAttribute('align', false),\n pathType: element.getGraphicAttribute('pathType', false),\n endArrow: element.getGraphicAttribute('endArrow', false),\n startArrow: element.getGraphicAttribute('startArrow', false)\n };\n // FIXME: undefined channel animation will cause vRender warning\n Object.keys(linkValues).forEach(key => {\n if (isNil(linkValues[key])) {\n delete linkValues[key];\n }\n });\n return {\n from: Object.assign({}, linkValues, { x1: linkValues.x0, y1: linkValues.y0 }),\n to: linkValues\n };\n};\n\nconst linkPathGrowOut: TypeAnimation<IElement> = (\n element: IElement,\n options: any,\n animationParameters: IAnimationParameters\n) => {\n const linkValues: LinkPathEncoderSpec = {\n x0: element.getGraphicAttribute('x0', true),\n x1: element.getGraphicAttribute('x1', true),\n y0: element.getGraphicAttribute('y0', true),\n y1: element.getGraphicAttribute('y1', true),\n thickness: element.getGraphicAttribute('thickness', true),\n round: element.getGraphicAttribute('round', true),\n align: element.getGraphicAttribute('align', true),\n pathType: element.getGraphicAttribute('pathType', true),\n endArrow: element.getGraphicAttribute('endArrow', true),\n startArrow: element.getGraphicAttribute('startArrow', true)\n };\n // FIXME: undefined channel animation will cause vRender warning\n Object.keys(linkValues).forEach(key => {\n if (isNil(linkValues[key])) {\n delete linkValues[key];\n }\n });\n return {\n from: linkValues,\n to: Object.assign({}, linkValues, { x1: linkValues.x0, y1: linkValues.y0 })\n };\n};\n\nconst linkPathUpdate: TypeAnimation<IElement> = (\n element: IElement,\n options: any,\n animationParameters: IAnimationParameters\n) => {\n const bassLinkValues = {\n thickness: element.getGraphicAttribute('thickness', false),\n round: element.getGraphicAttribute('round', false),\n align: element.getGraphicAttribute('align', false),\n pathType: element.getGraphicAttribute('pathType', false),\n endArrow: element.getGraphicAttribute('endArrow', false),\n startArrow: element.getGraphicAttribute('startArrow', false)\n };\n // FIXME: undefined channel animation will cause vRender warning\n Object.keys(bassLinkValues).forEach(key => {\n if (isNil(bassLinkValues[key])) {\n delete bassLinkValues[key];\n }\n });\n const prevLinkValues: LinkPathEncoderSpec = Object.assign(\n {\n x0: element.getGraphicAttribute('x0', true),\n x1: element.getGraphicAttribute('x1', true),\n y0: element.getGraphicAttribute('y0', true),\n y1: element.getGraphicAttribute('y1', true),\n ...bassLinkValues\n },\n bassLinkValues\n );\n const nextLinkValues: LinkPathEncoderSpec = Object.assign(\n {\n x0: element.getGraphicAttribute('x0', false),\n x1: element.getGraphicAttribute('x1', false),\n y0: element.getGraphicAttribute('y0', false),\n y1: element.getGraphicAttribute('y1', false)\n },\n bassLinkValues\n );\n\n return {\n from: prevLinkValues,\n to: nextLinkValues\n };\n};\n\nexport const registerLinkPathGlyph = () => {\n Factory.registerGlyph<LinkPathEncoderSpec, LinkPathConfig>('linkPath', {\n back: 'path',\n front: 'path'\n })\n .registerFunctionEncoder(encoder)\n .registerChannelEncoder('backgroundStyle', (channel, encodeValue) => {\n return {\n back: encodeValue\n };\n })\n .registerDefaultEncoder(() => {\n return {\n back: { zIndex: 0 },\n front: { zIndex: 1 }\n };\n });\n\n Factory.registerAnimationType('linkPathGrowIn', linkPathGrowIn);\n Factory.registerAnimationType('linkPathGrowOut', linkPathGrowOut);\n Factory.registerAnimationType('linkPathUpdate', linkPathUpdate);\n registerGlyphMark();\n registerGlyphGraphic();\n registerPathGraphic();\n};\n"]}
1
+ {"version":3,"sources":["../src/glyph/link-path.ts"],"names":[],"mappings":";;;AAEA,6CAA0C;AAC1C,mDAAkF;AAClF,yCAAkD;AAClD,+DAA4E;AAarE,MAAM,iBAAiB,GAAG,CAAC,OAA4B,EAAE,KAAc,EAAE,EAAE;;IAChF,MAAM,SAAS,GAAG,MAAA,OAAO,CAAC,SAAS,mCAAI,GAAG,CAAC;IAC3C,MAAM,YAAY,GAAG,IAAI,CAAC;IAC1B,MAAM,SAAS,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IAE5F,IAAI,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;IACpB,IAAI,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;IACpB,IAAI,GAAG,GAAG,OAAO,CAAC,EAAE,CAAC;IACrB,IAAI,GAAG,GAAG,OAAO,CAAC,EAAE,CAAC;IACrB,IAAI,IAAI,GAAG,EAAE,GAAG,SAAS,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IACtC,IAAI,IAAI,GAAG,EAAE,GAAG,SAAS,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IACtC,IAAI,SAAS,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC;IAEjC,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,EAAE;QAC3B,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACpB,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACpB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtB,IAAI,GAAG,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CAAC,CAAC;AAHW,QAAA,yBAAyB,6BAGpC","file":"link-path.js","sourcesContent":["import type { IElement, LinkPathEncoderSpec } from '../types';\nimport type { IGraphic } from '@visactor/vrender-core';\nimport { Factory } from '../core/factory';\nimport { registerGlyphGraphic, registerPathGraphic } from '../graph/mark/graphic';\nimport { registerGlyphMark } from '../view/glyph';\nimport { ACustomAnimate, AnimateExecutor } from '@visactor/vrender-animate';\n\nexport interface LinkPathConfig {\n direction?: 'horizontal' | 'vertical' | 'LR' | 'RL' | 'TB' | 'BL' | 'radial';\n}\n\ntype TypeAnimation<T extends IGraphic> = (\n graphic: T,\n options: LinkPathConfig,\n // animationParameters: IAnimationParameters\n animationParameters: any\n) => { from?: { [channel: string]: any }; to?: { [channel: string]: any } };\n\nexport const getHorizontalPath = (options: LinkPathEncoderSpec, ratio?: number) => {\n const curvature = options.curvature ?? 0.5;\n const hasThickness = true;\n const thickness = typeof ratio === 'number' ? options.thickness * ratio : options.thickness;\n\n let x0 = options.x0;\n let x1 = options.x1;\n let y00 = options.y0;\n let y10 = options.y1;\n let cpx0 = x0 + curvature * (x1 - x0);\n let cpx1 = x1 + curvature * (x0 - x1);\n let formatter = (v: number) => v;\n\n if (options.round !== false) {\n x0 = Math.round(x0);\n x1 = Math.round(x1);\n y00 = Math.round(y00);\n y10 = Math.round(y10);\n cpx0 = Math.round(cpx0);\n cpx1 = Math.round(cpx1);\n formatter = Math.round;\n }\n const topPath =\n options.pathType === 'line'\n ? `M${x0},${y00}L${x1},${y10}`\n : options.pathType === 'polyline'\n ? `M${x0},${y00}L${cpx0},${y00}L${cpx0},${y10}L${x1},${y10}`\n : `M${x0},${y00}C${cpx0},${y00},${cpx1},${y10},${x1},${y10}`;\n\n if (!hasThickness) {\n // simplified to a single path\n return topPath;\n }\n\n if (options.align === 'center') {\n y00 = formatter(options.y0 - thickness / 2);\n y10 = formatter(options.y1 - thickness / 2);\n } else if (options.align === 'end') {\n y00 = formatter(options.y0 + options.thickness / 2 - thickness);\n y10 = formatter(options.y1 + options.thickness / 2 - thickness);\n } else {\n y00 = formatter(options.y0 - options.thickness / 2);\n y10 = formatter(options.y1 - options.thickness / 2);\n }\n\n const y01 = formatter(y00 + thickness);\n const y11 = formatter(y10 + thickness);\n\n const hasLength = Math.abs(x1 - x0) > 1e-6;\n const endArrowPath =\n options.endArrow && hasLength\n ? `L${x1},${formatter(y10 - thickness / 2)}L${formatter(x1 + thickness)},${formatter(\n (y10 + y11) / 2\n )}L${x1},${formatter(y11 + thickness / 2)}`\n : '';\n const startArrowPath =\n options.startArrow && hasLength\n ? `L${x0},${formatter(y01 + thickness / 2)}L${formatter(x0 - thickness)},${formatter(\n (y00 + y01) / 2\n )}L${x0},${formatter(y00 - thickness / 2)}`\n : '';\n\n if (options.pathType === 'line') {\n return `M${x0},${y00}L${x1},${y10}${endArrowPath}L${x1},${y11}L${x0},${y01}${startArrowPath}Z`;\n } else if (options.pathType === 'polyline') {\n return `M${x0},${y00}L${cpx0},${y00}L${cpx0},${y10}L${x1},${y10}\n ${endArrowPath}L${x1},${y11}L${cpx0},${y11}L${cpx0},${y01}L${x0},${y01}${startArrowPath}Z`;\n }\n\n return `M${x0},${y00}C${cpx0},${y00},${cpx1},${y10},${x1},${y10}\n ${endArrowPath}L${x1},${y11}C${cpx1},${y11},${cpx0},${y01},${x0},${y01}${startArrowPath}Z`;\n};\n\nexport const getVerticalPath = (options: LinkPathEncoderSpec, ratio?: number) => {\n const curvature = options.curvature ?? 0.5;\n const hasThickness = true;\n const thickness = typeof ratio === 'number' ? options.thickness * ratio : options.thickness;\n let y0 = options.y0;\n let y1 = options.y1;\n let x00 = options.x0;\n let x10 = options.x1;\n let cpy0 = y0 + curvature * (y1 - y0);\n let cpy1 = y1 + curvature * (y0 - y1);\n let formatter = (v: number) => v;\n\n if (options.round !== false) {\n formatter = Math.round;\n y0 = Math.round(y0);\n y1 = Math.round(y1);\n x00 = Math.round(x00);\n x10 = Math.round(x10);\n cpy0 = Math.round(cpy0);\n cpy1 = Math.round(cpy1);\n }\n const leftpath =\n options.pathType === 'line'\n ? `M${x00},${y0}L${x10},${y1}`\n : options.pathType === 'polyline'\n ? `M${x00},${y0}L${x00},${cpy0}L${x10},${cpy0}L${x10},${y1}`\n : `M${x00},${y0}C${x00},${cpy0},${x10},${cpy1},${x10},${y1}`;\n if (!hasThickness) {\n // simplified to a single path\n return leftpath;\n }\n\n if (options.align === 'center') {\n x00 = formatter(options.x0 - thickness / 2);\n x10 = formatter(options.x1 - thickness / 2);\n } else if (options.align === 'end') {\n x00 = formatter(options.x0 + options.thickness / 2 - thickness);\n x10 = formatter(options.x1 + options.thickness / 2 - thickness);\n } else {\n x00 = formatter(options.x0 - options.thickness / 2);\n x10 = formatter(options.x1 - options.thickness / 2);\n }\n\n const x01 = formatter(x00 + thickness);\n const x11 = formatter(x10 + thickness);\n\n const hasLength = Math.abs(y1 - y0) > 1e-6;\n const endArrowPath =\n options.endArrow && hasLength\n ? `L${formatter(x10 - thickness / 2)},${y1}L${formatter((x10 + x11) / 2)},${formatter(\n y1 + thickness\n )}L${formatter(x11 + thickness / 2)},${y1}`\n : '';\n const startArrowPath =\n options.startArrow && hasLength\n ? `L${formatter(x01 + thickness / 2)},${y0}L${formatter((x01 + x00) / 2)},${formatter(\n y0 - thickness\n )}L${formatter(x00 - thickness / 2)},${y0}`\n : '';\n\n if (options.pathType === 'line') {\n return `M${x00},${y0}L${x10},${y1}${endArrowPath}L${x11},${y1}L${x01},${y0}${startArrowPath}Z`;\n } else if (options.pathType === 'polyline') {\n return `M${x00},${y0}L${x00},${cpy0}L${x10},${cpy0}L${x10},${y1}\n ${endArrowPath}L${x11},${y1}L${x11},${cpy0}L${x01},${cpy0}L${x01},${y0}${startArrowPath}Z`;\n }\n\n return `M${x00},${y0}C${x00},${cpy0},${x10},${cpy1},${x10},${y1}\n ${endArrowPath}L${x11},${y1}C${x11},${cpy1},${x01},${cpy0},${x01},${y0}${startArrowPath}Z`;\n};\n\nconst encoder = (encodeValues: LinkPathEncoderSpec, datum: any, element: IElement, config: LinkPathConfig) => {\n const direction = encodeValues.direction ?? config?.direction;\n const parsePath = ['vertical', 'TB', 'BT'].includes(direction) ? getVerticalPath : getHorizontalPath;\n const isRatioShow = typeof encodeValues.ratio === 'number' && encodeValues.ratio >= 0 && encodeValues.ratio <= 1;\n\n const encodeChannels = Object.keys(encodeValues);\n // parse path when all required channels are included\n if (['x0', 'y0', 'x1', 'y1'].every(channel => encodeChannels.includes(channel))) {\n return {\n back: {\n path: isRatioShow ? parsePath(encodeValues, 1) : ''\n },\n front: {\n path: parsePath(encodeValues, isRatioShow ? encodeValues.ratio : 1)\n }\n };\n }\n\n return {};\n};\n\nconst linkPathGrowIn: TypeAnimation<IGraphic> = (graphic: IGraphic, options: any, animationParameters: any) => {\n const linkValues: Partial<LinkPathEncoderSpec> = {\n x0: graphic.getFinalAttribute().x0,\n x1: graphic.getFinalAttribute().x1,\n y0: graphic.getFinalAttribute().y0,\n y1: graphic.getFinalAttribute().y1,\n thickness: graphic.getFinalAttribute().thickness\n };\n // // FIXME: undefined channel animation will cause vRender warning\n // Object.keys(linkValues).forEach(key => {\n // if (isNil(linkValues[key])) {\n // delete linkValues[key];\n // }\n // });\n return {\n from: Object.assign({}, linkValues, { x1: linkValues.x0, y1: linkValues.y0 }),\n to: linkValues\n };\n};\n\nconst linkPathGrowOut: TypeAnimation<IGraphic> = (element: IGraphic, options: any, animationParameters: any) => {\n const linkValues: LinkPathEncoderSpec = {\n x0: element.getFinalAttribute().x0,\n x1: element.getFinalAttribute().x1,\n y0: element.getFinalAttribute().y0,\n y1: element.getFinalAttribute().y1,\n thickness: element.getFinalAttribute().thickness\n };\n // // FIXME: undefined channel animation will cause vRender warning\n // Object.keys(linkValues).forEach(key => {\n // if (isNil(linkValues[key])) {\n // delete linkValues[key];\n // }\n // });\n return {\n from: linkValues,\n to: Object.assign({}, linkValues, { x1: linkValues.x0, y1: linkValues.y0 })\n };\n};\n\nconst linkPathUpdate: TypeAnimation<IGraphic> = (graphic: IGraphic, options: any, animationParameters: any) => {\n let from;\n let to;\n {\n const { x0, x1, y0, y1 } = graphic.getFinalAttribute();\n from = { x0, x1, y0, y1 };\n }\n {\n const { x0, x1, y0, y1 } = graphic.attribute as any;\n to = { x0, x1, y0, y1 };\n }\n\n return {\n from,\n to\n };\n};\n\nexport class LinkPathGrowIn extends ACustomAnimate<Record<string, number>> {\n onBind(): void {\n if (this.params?.diffAttrs) {\n this.target.setAttributes(this.params.diffAttrs);\n }\n const { from, to } = linkPathGrowIn(this.target, this.params.options, this.params);\n const fromAttrs = this.target.context?.lastAttrs ?? from;\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.animate.reSyncProps();\n this.from = fromAttrs;\n this.to = to;\n this.target.setAttributes(fromAttrs);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const attribute: Record<string, any> = this.target.attribute;\n this.propKeys.forEach(key => {\n attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.setAttributes(attribute);\n }\n}\n\nexport class LinkPathGrowOut extends ACustomAnimate<Record<string, number>> {\n onBind(): void {\n if (this.params?.diffAttrs) {\n this.target.setAttributes(this.params.diffAttrs);\n }\n const { from, to } = linkPathGrowOut(this.target, this.params.options, this.params);\n const fromAttrs = this.target.context?.lastAttrs ?? from;\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.animate.reSyncProps();\n this.from = fromAttrs;\n this.to = to;\n this.target.setAttributes(fromAttrs);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const attribute: Record<string, any> = this.target.attribute;\n this.propKeys.forEach(key => {\n attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.setAttributes(attribute);\n }\n}\n\nexport class LinkPathUpdate extends ACustomAnimate<Record<string, number>> {\n onBind(): void {\n if (this.params?.diffAttrs) {\n this.target.setAttributes(this.params.diffAttrs);\n }\n const { from, to } = linkPathUpdate(this.target, this.params.options, this.params);\n const fromAttrs = this.target.context?.lastAttrs ?? from;\n this.props = to;\n this.propKeys = Object.keys(to).filter(key => to[key] != null);\n this.animate.reSyncProps();\n this.from = fromAttrs;\n this.to = to;\n this.target.setAttributes(fromAttrs);\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n const attribute: Record<string, any> = this.target.attribute;\n this.propKeys.forEach(key => {\n attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;\n });\n this.target.setAttributes(attribute);\n }\n}\n\nexport const registerLinkPathGlyph = () => {\n Factory.registerGlyph<LinkPathEncoderSpec, LinkPathConfig>('linkPath', {\n back: 'path',\n front: 'path'\n })\n .registerFunctionEncoder(encoder)\n .registerChannelEncoder('backgroundStyle', (channel, encodeValue) => {\n return {\n back: encodeValue\n };\n })\n .registerDefaultEncoder(() => {\n return {\n back: { zIndex: 0 },\n front: { zIndex: 1 }\n };\n });\n\n // Factory.registerAnimationType('linkPathGrowIn', linkPathGrowIn);\n // Factory.registerAnimationType('linkPathUpdate', linkPathUpdate);\n registerGlyphMark();\n registerGlyphGraphic();\n registerPathGraphic();\n};\n\nexport const registerLinkPathAnimation = () => {\n AnimateExecutor.registerBuiltInAnimate('linkPathGrowIn', LinkPathGrowIn);\n AnimateExecutor.registerBuiltInAnimate('linkPathGrowOut', LinkPathGrowOut);\n};\n"]}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.Animator = void 0;
6
6
 
7
- const vutils_1 = require("@visactor/vutils"), vrender_core_1 = require("@visactor/vrender-core"), attribute_1 = require("./attribute");
8
-
9
- vrender_core_1.Animate.mode |= vrender_core_1.AnimateMode.SET_ATTR_IMMEDIATELY;
7
+ const vutils_1 = require("@visactor/vutils"), vrender_animate_1 = require("@visactor/vrender-animate"), attribute_1 = require("./attribute");
10
8
 
11
9
  let GlobalAnimatorId = 0;
12
10
 
@@ -14,7 +12,7 @@ const isCustomAnimateCtor = custom => {
14
12
  var _a;
15
13
  if ((0, vutils_1.isNil)(custom) || (0, vutils_1.isNil)(custom.prototype)) return !1;
16
14
  const prototype = null !== (_a = custom.prototype) && void 0 !== _a ? _a : {};
17
- return prototype instanceof vrender_core_1.ACustomAnimate || "onBind" in prototype && "onStart" in prototype && "onEnd" in prototype && "onUpdate" in prototype;
15
+ return prototype instanceof vrender_animate_1.ACustomAnimate || "onBind" in prototype && "onStart" in prototype && "onEnd" in prototype && "onUpdate" in prototype;
18
16
  };
19
17
 
20
18
  class Animator {
@@ -86,7 +84,7 @@ class Animator {
86
84
  parameters: customParametersOption
87
85
  }) : isCustomAnimate ? new customOption(attributes.from, attributes.to, duration, effect.easing, customParametersOption) : attributes.to ? new attribute_1.AttributeAnimate(attributes.from, attributes.to, duration, effect.easing) : void 0;
88
86
  })).filter((animate => !(0, vutils_1.isNil)(animate)));
89
- 1 === customAnimates.length ? graphicAnimate.play(customAnimates[0]) : customAnimates.length > 1 && graphicAnimate.play(new vrender_core_1.AnimateGroup(duration, customAnimates));
87
+ 1 === customAnimates.length ? graphicAnimate.play(customAnimates[0]) : customAnimates.length;
90
88
  }
91
89
  delayAfter > 0 && graphicAnimate.wait(delayAfter);
92
90
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph/animation/animator.ts"],"names":[],"mappings":";;;AAAA,6CAAwD;AAGxD,yDAA4F;AAa5F,2CAAwH;AAExH,sBAAO,CAAC,IAAI,IAAI,0BAAW,CAAC,oBAAoB,CAAC;AAEjD,IAAI,gBAAgB,GAAG,CAAC,CAAC;AAEzB,MAAM,mBAAmB,GAAG,CAAC,MAAoE,EAAE,EAAE;;IACnG,IAAI,IAAA,cAAK,EAAC,MAAM,CAAC,IAAI,IAAA,cAAK,EAAC,MAAM,CAAC,SAAS,CAAC,EAAE;QAC5C,OAAO,KAAK,CAAC;KACd;IACD,MAAM,SAAS,GAAG,MAAA,MAAM,CAAC,SAAS,mCAAI,EAAE,CAAC;IACzC,OAAO,CACL,S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AAC,CAAC,CAAC,CAAC,CAAC;aACxC;iBAAM,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;gBACpC,cAAc,CAAC,IAAI,CAAC,IAAI,2BAAY,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC;aACjE;SACF;QAED,IAAI,UAAU,GAAG,CAAC,EAAE;YAClB,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACjC;IACH,CAAC;CACF;AArMD,4BAqMC","file":"animator.js","sourcesContent":["import { isNil, isValidNumber } from '@visactor/vutils';\nimport type { IAnimate as IGraphicAnimate } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { ACustomAnimate, Animate, AnimateGroup, AnimateMode } from '@visactor/vrender-core';\nimport type {\n IAnimationChannelInterpolator,\n IAnimationCustomConstructor,\n IAnimationTimeline,\n IAnimator,\n IAnimatorOptions,\n IAnimationUnit,\n IAnimationParameters,\n IAnimationTimeSlice,\n IElement,\n IAnimationEffect\n} from '../../types';\nimport { AttributeAnimate, channelAnimationAttributes, CustomInterpolator, typeAnimationAttributes } from './attribute';\n\nAnimate.mode |= AnimateMode.SET_ATTR_IMMEDIATELY;\n\nlet GlobalAnimatorId = 0;\n\nconst isCustomAnimateCtor = (custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor) => {\n if (isNil(custom) || isNil(custom.prototype)) {\n return false;\n }\n const prototype = custom.prototype ?? {};\n return (\n prototype instanceof ACustomAnimate ||\n // similar to ACustomAnimate, apply for different vrender version\n ('onBind' in prototype && 'onStart' in prototype && 'onEnd' in prototype && 'onUpdate' in prototype)\n );\n};\n\nexport class Animator implements IAnimator {\n id: number = GlobalAnimatorId++;\n element: IElement;\n animationOptions: IAnimatorOptions;\n isAnimating: boolean = false;\n\n private unit: IAnimationUnit;\n private runnings: IGraphicAnimate[] = [];\n private callbackFunction: (...args: any[]) => any;\n\n constructor(\n element: IElement,\n unit: IAnimationUnit,\n animationOptions: {\n state: string;\n timeline: IAnimationTimeline;\n id: string;\n }\n ) {\n this.element = element;\n this.animationOptions = animationOptions;\n this.unit = unit;\n }\n\n callback(callbackFunction: (...args: any[]) => void): this {\n this.callbackFunction = callbackFunction;\n return this;\n }\n\n animate(animationParameters: IAnimationParameters, parameters: any): this {\n this.isAnimating = true;\n\n this.animateElement(animationParameters, parameters);\n\n // if no valid running, end animating immediately\n if (this.runnings.length === 0) {\n this.animationEnd();\n }\n return this;\n }\n\n stop(stopState: 'start' | 'end' | null = 'end', invokeCallback: boolean = true): this {\n // FIXME: wait for VRender to fix 'end' parameter\n this.runnings.forEach(running => running.stop(stopState));\n this.animationEnd(invokeCallback);\n return this;\n }\n\n pause(): this {\n this.runnings.forEach(running => running.pause());\n return this;\n }\n\n resume(): this {\n this.runnings.forEach(running => running.resume());\n return this;\n }\n\n startAt(startTime: number): this {\n this.runnings.forEach(running => {\n const initialDelay = this.unit.initialDelay;\n running.startAt(initialDelay + startTime);\n });\n return this;\n }\n\n getTotalAnimationTime() {\n const timeLineDuration = this.unit.initialDelay + this.unit.loopDuration * this.unit.loopCount;\n return this.unit.totalTime ?? timeLineDuration;\n }\n\n getEndAttributes() {\n return this.runnings.reduce((attributes, running) => {\n return Object.assign(attributes, running.getEndProps());\n }, {} as Record<string, any>);\n }\n\n private animationEnd(invokeCallback: boolean = true) {\n this.isAnimating = false;\n this.runnings = null;\n if (invokeCallback) {\n this.callbackFunction?.call(null);\n }\n }\n\n private animateElement(animationParameters: IAnimationParameters, parameters: any) {\n const graphicItem = this.element.getGraphicItem();\n\n if (!graphicItem) {\n return;\n }\n\n const graphicAnimate: IGraphicAnimate = graphicItem.animate();\n this.runnings.push(graphicAnimate);\n // initialDelay is only used at first loop\n graphicAnimate.startAt(this.unit.initialDelay);\n // execute loop animation\n graphicAnimate.wait(this.unit.loopDelay);\n this.unit.timeSlices.forEach(timeSlice => {\n this.animateTimeSlice(graphicAnimate, timeSlice, animationParameters, parameters);\n });\n graphicAnimate.wait(this.unit.loopDelayAfter);\n\n graphicAnimate.loop(this.unit.loopCount - 1);\n\n if (isValidNumber(this.unit.totalTime)) {\n // FIXME: use VRender api instead after VRender refactor is finished\n setTimeout(() => {\n if (graphicAnimate) {\n graphicAnimate.stop('end');\n }\n }, this.unit.totalTime);\n }\n\n graphicAnimate.onEnd(() => {\n this.runnings = this.runnings.filter(running => running !== graphicAnimate);\n if (this.runnings.length === 0) {\n this.animationEnd();\n }\n });\n }\n\n private animateTimeSlice(\n graphicAnimate: IGraphicAnimate,\n timeSlice: IAnimationTimeSlice,\n animationParameters: IAnimationParameters,\n parameters: any\n ) {\n const delay = timeSlice.delay as number;\n const delayAfter = timeSlice.delayAfter as number;\n const duration = timeSlice.duration as number;\n const effects = timeSlice.effects as IAnimationEffect[];\n\n // wait in loop animation before animation starts\n if (delay > 0) {\n graphicAnimate.wait(delay);\n }\n\n if (effects.length < 0) {\n graphicAnimate.wait(duration);\n } else {\n const customAnimates = effects\n .map((effect, index) => {\n const attributes =\n (effect.type\n ? typeAnimationAttributes(this.element, effect, animationParameters, parameters)\n : effect.channel\n ? channelAnimationAttributes(this.element, effect, animationParameters, parameters)\n : undefined) ?? {};\n\n const customOption = attributes.custom || effect?.custom;\n const customParametersOption = attributes?.customParameters || effect?.customParameters;\n\n if (\n attributes.from &&\n Object.keys(attributes.from).length &&\n this.unit &&\n this.animationOptions.timeline.controlOptions.immediatelyApply &&\n this.element.mark.markType !== 'component'\n ) {\n this.element.getGraphicItem().setAttributes(attributes.from);\n }\n\n const isCustomAnimate = isCustomAnimateCtor(customOption);\n const isCustomInterpolator = !isNil(customOption) && !isCustomAnimateCtor(customOption);\n\n if (isCustomInterpolator) {\n return new CustomInterpolator(attributes.from, attributes.to, duration, effect.easing, {\n interpolator: customOption as IAnimationChannelInterpolator,\n element: this.element,\n parameters: customParametersOption\n });\n } else if (isCustomAnimate) {\n return new (customOption as IAnimationCustomConstructor)(\n attributes.from,\n attributes.to,\n duration,\n effect.easing,\n customParametersOption\n );\n } else if (attributes.to) {\n return new AttributeAnimate(attributes.from, attributes.to, duration, effect.easing);\n }\n })\n .filter(animate => !isNil(animate));\n\n if (customAnimates.length === 1) {\n graphicAnimate.play(customAnimates[0]);\n } else if (customAnimates.length > 1) {\n graphicAnimate.play(new AnimateGroup(duration, customAnimates));\n }\n }\n\n if (delayAfter > 0) {\n graphicAnimate.wait(delayAfter);\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/graph/animation/animator.ts"],"names":[],"mappings":";;;AAAA,6CAAwD;AAGxD,+DAA2D;AAgB3D,2CAAwH;AAIxH,IAAI,gBAAgB,GAAG,CAAC,CAAC;AAEzB,MAAM,mBAAmB,GAAG,CAAC,MAAoE,EAAE,EAAE;;IACnG,IAAI,IAAA,cAAK,EAAC,MAAM,CAAC,IAAI,IAAA,cAAK,EAAC,MAAM,CAAC,SAAS,CAAC,EAAE;QAC5C,OAAO,KAAK,CAAC;KACd;IACD,MAAM,SAAS,GAAG,MAAA,MAAM,CAAC,SAAS,mCAAI,EAAE,CAAC;IACzC,OAAO,CACL,SAAS,YAAY,gCAAc;QAEnC,CAAC,QAAQ,IAAI,SAAS,IAAI,SAAS,IAAI,SAAS,IAAI,OAAO,IAAI,SAAS,IAAI,UAAU,IAAI,SAAS,CAAC,CACrG,CAAC;AACJ,CAAC,CAAC;AAEF,MAAa,QAAQ;IAUnB,YACE,OAAiB,EACjB,IAAoB,EACpB,gBAIC;QAhBH,OAAE,GAAW,gBAAgB,EAAE,CAAC;QAGhC,gBAAW,GAAY,KAAK,CAAC;QAGrB,aAAQ,GAAsB,EAAE,CAAC;QAYvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,QAAQ,CAAC,gBAA0C;QACjD,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IA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rF,YAAY,EAAE,YAA6C;wBAC3D,OAAO,EAAE,IAAI,CAAC,OAAO;wBACrB,UAAU,EAAE,sBAAsB;qBACnC,CAAC,CAAC;iBACJ;qBAAM,IAAI,eAAe,EAAE;oBAC1B,OAAO,IAAK,YAA4C,CACtD,UAAU,CAAC,IAAI,EACf,UAAU,CAAC,EAAE,EACb,QAAQ,EACR,MAAM,CAAC,MAAM,EACb,sBAAsB,CACvB,CAAC;iBACH;qBAAM,IAAI,UAAU,CAAC,EAAE,EAAE;oBACxB,OAAO,IAAI,4BAAgB,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;iBACtF;YACH,CAAC,CAAC;iBACD,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAA,cAAK,EAAC,OAAO,CAAC,CAAC,CAAC;YAEtC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC/B,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;aACxC;iBAAM,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;aAErC;SACF;QAED,IAAI,UAAU,GAAG,CAAC,EAAE;YAClB,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACjC;IACH,CAAC;CACF;AArMD,4BAqMC","file":"animator.js","sourcesContent":["import { isNil, isValidNumber } from '@visactor/vutils';\n// import type { IAnimate as IGraphicAnimate } from '@visactor/vrender-animate';\n// // eslint-disable-next-line no-duplicate-imports\nimport { ACustomAnimate } from '@visactor/vrender-animate';\nimport type { IAnimate as IGraphicAnimate } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\n// import { ACustomAnimate, Animate, AnimateMode } from '@visactor/vrender-core';\nimport type {\n IAnimationChannelInterpolator,\n IAnimationCustomConstructor,\n IAnimationTimeline,\n IAnimator,\n IAnimatorOptions,\n IAnimationUnit,\n IAnimationParameters,\n IAnimationTimeSlice,\n IElement,\n IAnimationEffect\n} from '../../types';\nimport { AttributeAnimate, channelAnimationAttributes, CustomInterpolator, typeAnimationAttributes } from './attribute';\n\n// Animate.mode |= AnimateMode.SET_ATTR_IMMEDIATELY;\n\nlet GlobalAnimatorId = 0;\n\nconst isCustomAnimateCtor = (custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor) => {\n if (isNil(custom) || isNil(custom.prototype)) {\n return false;\n }\n const prototype = custom.prototype ?? {};\n return (\n prototype instanceof ACustomAnimate ||\n // similar to ACustomAnimate, apply for different vrender version\n ('onBind' in prototype && 'onStart' in prototype && 'onEnd' in prototype && 'onUpdate' in prototype)\n );\n};\n\nexport class Animator implements IAnimator {\n id: number = GlobalAnimatorId++;\n element: IElement;\n animationOptions: IAnimatorOptions;\n isAnimating: boolean = false;\n\n private unit: IAnimationUnit;\n private runnings: IGraphicAnimate[] = [];\n private callbackFunction: (...args: any[]) => any;\n\n constructor(\n element: IElement,\n unit: IAnimationUnit,\n animationOptions: {\n state: string;\n timeline: IAnimationTimeline;\n id: string;\n }\n ) {\n this.element = element;\n this.animationOptions = animationOptions;\n this.unit = unit;\n }\n\n callback(callbackFunction: (...args: any[]) => void): this {\n this.callbackFunction = callbackFunction;\n return this;\n }\n\n animate(animationParameters: IAnimationParameters, parameters: any): this {\n this.isAnimating = true;\n\n this.animateElement(animationParameters, parameters);\n\n // if no valid running, end animating immediately\n if (this.runnings.length === 0) {\n this.animationEnd();\n }\n return this;\n }\n\n stop(stopState: 'start' | 'end' | null = 'end', invokeCallback: boolean = true): this {\n // FIXME: wait for VRender to fix 'end' parameter\n this.runnings.forEach(running => running.stop(stopState));\n this.animationEnd(invokeCallback);\n return this;\n }\n\n pause(): this {\n this.runnings.forEach(running => running.pause());\n return this;\n }\n\n resume(): this {\n this.runnings.forEach(running => running.resume());\n return this;\n }\n\n startAt(startTime: number): this {\n this.runnings.forEach(running => {\n const initialDelay = this.unit.initialDelay;\n running.startAt(initialDelay + startTime);\n });\n return this;\n }\n\n getTotalAnimationTime() {\n const timeLineDuration = this.unit.initialDelay + this.unit.loopDuration * this.unit.loopCount;\n return this.unit.totalTime ?? timeLineDuration;\n }\n\n getEndAttributes() {\n return this.runnings.reduce((attributes, running) => {\n return Object.assign(attributes, running.getEndProps());\n }, {} as Record<string, any>);\n }\n\n private animationEnd(invokeCallback: boolean = true) {\n this.isAnimating = false;\n this.runnings = null;\n if (invokeCallback) {\n this.callbackFunction?.call(null);\n }\n }\n\n private animateElement(animationParameters: IAnimationParameters, parameters: any) {\n const graphicItem = this.element.getGraphicItem();\n\n if (!graphicItem) {\n return;\n }\n\n const graphicAnimate: IGraphicAnimate = graphicItem.animate();\n this.runnings.push(graphicAnimate);\n // initialDelay is only used at first loop\n graphicAnimate.startAt(this.unit.initialDelay);\n // execute loop animation\n graphicAnimate.wait(this.unit.loopDelay);\n this.unit.timeSlices.forEach(timeSlice => {\n this.animateTimeSlice(graphicAnimate, timeSlice, animationParameters, parameters);\n });\n graphicAnimate.wait(this.unit.loopDelayAfter);\n\n graphicAnimate.loop(this.unit.loopCount - 1);\n\n if (isValidNumber(this.unit.totalTime)) {\n // FIXME: use VRender api instead after VRender refactor is finished\n setTimeout(() => {\n if (graphicAnimate) {\n graphicAnimate.stop('end');\n }\n }, this.unit.totalTime);\n }\n\n graphicAnimate.onEnd(() => {\n this.runnings = this.runnings.filter(running => running !== graphicAnimate);\n if (this.runnings.length === 0) {\n this.animationEnd();\n }\n });\n }\n\n private animateTimeSlice(\n graphicAnimate: IGraphicAnimate,\n timeSlice: IAnimationTimeSlice,\n animationParameters: IAnimationParameters,\n parameters: any\n ) {\n const delay = timeSlice.delay as number;\n const delayAfter = timeSlice.delayAfter as number;\n const duration = timeSlice.duration as number;\n const effects = timeSlice.effects as IAnimationEffect[];\n\n // wait in loop animation before animation starts\n if (delay > 0) {\n graphicAnimate.wait(delay);\n }\n\n if (effects.length < 0) {\n graphicAnimate.wait(duration);\n } else {\n const customAnimates = effects\n .map((effect, index) => {\n const attributes =\n (effect.type\n ? typeAnimationAttributes(this.element, effect, animationParameters, parameters)\n : effect.channel\n ? channelAnimationAttributes(this.element, effect, animationParameters, parameters)\n : undefined) ?? {};\n\n const customOption = attributes.custom || effect?.custom;\n const customParametersOption = attributes?.customParameters || effect?.customParameters;\n\n if (\n attributes.from &&\n Object.keys(attributes.from).length &&\n this.unit &&\n this.animationOptions.timeline.controlOptions.immediatelyApply &&\n this.element.mark.markType !== 'component'\n ) {\n this.element.getGraphicItem().setAttributes(attributes.from);\n }\n\n const isCustomAnimate = isCustomAnimateCtor(customOption);\n const isCustomInterpolator = !isNil(customOption) && !isCustomAnimateCtor(customOption);\n\n if (isCustomInterpolator) {\n return new CustomInterpolator(attributes.from, attributes.to, duration, effect.easing, {\n interpolator: customOption as IAnimationChannelInterpolator,\n element: this.element,\n parameters: customParametersOption\n });\n } else if (isCustomAnimate) {\n return new (customOption as IAnimationCustomConstructor)(\n attributes.from,\n attributes.to,\n duration,\n effect.easing,\n customParametersOption\n );\n } else if (attributes.to) {\n return new AttributeAnimate(attributes.from, attributes.to, duration, effect.easing);\n }\n })\n .filter(animate => !isNil(animate));\n\n if (customAnimates.length === 1) {\n graphicAnimate.play(customAnimates[0]);\n } else if (customAnimates.length > 1) {\n // graphicAnimate.play(new AnimateGroup(duration, customAnimates));\n }\n }\n\n if (delayAfter > 0) {\n graphicAnimate.wait(delayAfter);\n }\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { EasingType, IGraphic } from '@visactor/vrender-core';
2
- import { ACustomAnimate } from '@visactor/vrender-core';
2
+ import { ACustomAnimate } from '@visactor/vrender-animate';
3
3
  import type { IAnimationChannelInterpolator, IAnimationEffect, IAnimationParameters, IElement, IParsedAnimationAttrs } from '../../types';
4
4
  export declare function typeAnimationAttributes(element: IElement, effect: IAnimationEffect, animationParameters: IAnimationParameters, parameters: any): IParsedAnimationAttrs;
5
5
  export declare function channelAnimationAttributes(element: IElement, effect: IAnimationEffect, animationParameters: IAnimationParameters, parameters: any): IParsedAnimationAttrs;
@@ -12,7 +12,6 @@ export declare class CustomInterpolator extends ACustomAnimate<any> {
12
12
  parameters?: any;
13
13
  });
14
14
  onBind(): void;
15
- getEndProps(): void | Record<string, any>;
16
15
  onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
17
16
  }
18
17
  export declare class AttributeAnimate extends ACustomAnimate<any> {
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.AttributeAnimate = exports.CustomInterpolator = exports.channelAnimationAttributes = exports.typeAnimationAttributes = void 0;
6
6
 
7
- const vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@visactor/vutils"), helpers_1 = require("../attributes/helpers"), factory_1 = require("../../core/factory"), transformAnimationAttributes = (attributes, element) => {
7
+ const vrender_animate_1 = require("@visactor/vrender-animate"), vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@visactor/vutils"), helpers_1 = require("../attributes/helpers"), factory_1 = require("../../core/factory"), transformAnimationAttributes = (attributes, element) => {
8
8
  if (!attributes) return null;
9
9
  if (attributes.from) {
10
10
  const from = attributes.from, fromKeys = Object.keys(from);
@@ -71,7 +71,7 @@ function channelAnimationAttributes(element, effect, animationParameters, parame
71
71
 
72
72
  exports.channelAnimationAttributes = channelAnimationAttributes;
73
73
 
74
- class CustomInterpolator extends vrender_core_1.ACustomAnimate {
74
+ class CustomInterpolator extends vrender_animate_1.ACustomAnimate {
75
75
  constructor(from, to, duration, easing, params) {
76
76
  super(from, to, duration, easing, params), this._interpolator = null == params ? void 0 : params.interpolator,
77
77
  this._element = null == params ? void 0 : params.element;
@@ -80,9 +80,6 @@ class CustomInterpolator extends vrender_core_1.ACustomAnimate {
80
80
  var _a, _b;
81
81
  this.from = null !== (_a = this.from) && void 0 !== _a ? _a : {}, this.to = null !== (_b = this.to) && void 0 !== _b ? _b : {};
82
82
  }
83
- getEndProps() {
84
- return this.to;
85
- }
86
83
  onUpdate(end, ratio, out) {
87
84
  this._interpolator && this._element && this._interpolator.call(this, ratio, this.from, this.to, out, this._element.getDatum(), this._element, this.params.parameters);
88
85
  }
@@ -90,27 +87,21 @@ class CustomInterpolator extends vrender_core_1.ACustomAnimate {
90
87
 
91
88
  exports.CustomInterpolator = CustomInterpolator;
92
89
 
93
- class AttributeAnimate extends vrender_core_1.ACustomAnimate {
90
+ class AttributeAnimate extends vrender_animate_1.ACustomAnimate {
94
91
  getEndProps() {
95
92
  return this.to;
96
93
  }
97
94
  onBind() {
98
95
  var _a;
99
- const excludedChannelMap = null !== (_a = this.target.constructor.NOWORK_ANIMATE_ATTR) && void 0 !== _a ? _a : vrender_core_1.NOWORK_ANIMATE_ATTR, excludedChannels = Object.keys(excludedChannelMap).filter((channel => 0 !== excludedChannelMap[channel]));
100
- this.subAnimate.animate.preventAttrs(excludedChannels);
101
- const from = Object.assign({}, this.from), to = Object.assign({}, this.to), animatedChannels = [];
96
+ const excludedChannelMap = null !== (_a = this.target.constructor.NOWORK_ANIMATE_ATTR) && void 0 !== _a ? _a : vrender_core_1.NOWORK_ANIMATE_ATTR, excludedChannels = Object.keys(excludedChannelMap).filter((channel => 0 !== excludedChannelMap[channel])), from = Object.assign({}, this.from), to = Object.assign({}, this.to), animatedChannels = [];
102
97
  Object.keys(to).forEach((k => {
103
98
  excludedChannels.includes(k) ? (from[k] = to[k], this.from[k] = to[k]) : (0, vutils_1.isNil)(from[k]) ? from[k] = this.target.getComputedAttribute(k) : animatedChannels.push(k);
104
- })), this.target.animates.forEach((a => {
105
- a !== this.subAnimate.animate && a.preventAttrs(animatedChannels);
106
99
  })), this._fromAttribute = from, this._toAttribute = to;
107
100
  }
108
101
  onStart() {
109
102
  if (this._fromAttribute) {
110
103
  const from = {};
111
- Object.keys(this._fromAttribute).forEach((key => {
112
- this.subAnimate.animate.validAttr(key) && (from[key] = this._fromAttribute[key]);
113
- })), this.target.setAttributes(from, !1, {
104
+ this.target.setAttributes(from, !1, {
114
105
  type: vrender_core_1.AttributeUpdateType.ANIMATE_UPDATE,
115
106
  animationState: {
116
107
  ratio: 0,
@@ -122,23 +113,15 @@ class AttributeAnimate extends vrender_core_1.ACustomAnimate {
122
113
  onEnd() {
123
114
  if (this._toAttribute) {
124
115
  const out = {};
125
- Object.keys(this._toAttribute).forEach((key => {
126
- this.subAnimate.animate.validAttr(key) && (out[key] = this._toAttribute[key]);
127
- })), this.target.setAttributes(out, !1, {
116
+ this.target.setAttributes(out, !1, {
128
117
  type: vrender_core_1.AttributeUpdateType.ANIMATE_END
129
118
  });
130
119
  }
131
120
  }
132
121
  update(end, ratio, out) {
133
- 0 === this.updateCount && this.onFirstRun(), this.updateCount += 1;
134
- const lastProps = this.step.getLastProps();
135
- Object.keys(lastProps).forEach((key => {
136
- this.subAnimate.animate.validAttr(key) && (out[key] = lastProps[key]);
137
- })), this.onUpdate(end, ratio, out), end && this.onEnd();
138
- }
139
- onUpdate(end, ratio, out) {
140
- this.target.stepInterpolate(this.subAnimate, this.subAnimate.animate, out, this.step, ratio, end, this._toAttribute, this._fromAttribute);
122
+ this.onUpdate(end, ratio, out), end && this.onEnd();
141
123
  }
124
+ onUpdate(end, ratio, out) {}
142
125
  }
143
126
 
144
127
  exports.AttributeAnimate = AttributeAnimate;