@visactor/vgrammar-core 0.10.2 → 0.10.4

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 (154) hide show
  1. package/cjs/component/axis.js +1 -1
  2. package/cjs/component/axis.js.map +1 -1
  3. package/cjs/component/datazoom.js +23 -30
  4. package/cjs/component/datazoom.js.map +1 -1
  5. package/cjs/component/label.js +11 -11
  6. package/cjs/component/label.js.map +1 -1
  7. package/cjs/component/legend.js +4 -6
  8. package/cjs/component/legend.js.map +1 -1
  9. package/cjs/component/player.js +4 -12
  10. package/cjs/component/player.js.map +1 -1
  11. package/cjs/component/scrollbar.js +12 -24
  12. package/cjs/component/scrollbar.js.map +1 -1
  13. package/cjs/component/slider.js +1 -3
  14. package/cjs/component/slider.js.map +1 -1
  15. package/cjs/glyph/boxplot.js +34 -20
  16. package/cjs/glyph/boxplot.js.map +1 -1
  17. package/cjs/glyph/violin.js +18 -11
  18. package/cjs/glyph/violin.js.map +1 -1
  19. package/cjs/graph/animation/animation/clip.js +2 -2
  20. package/cjs/graph/animation/animation/clip.js.map +1 -1
  21. package/cjs/graph/animation/animation/grow-cartesian.js +11 -11
  22. package/cjs/graph/animation/animation/grow-cartesian.js.map +1 -1
  23. package/cjs/graph/animation/animation/grow-interval.js +18 -18
  24. package/cjs/graph/animation/animation/grow-interval.js.map +1 -1
  25. package/cjs/graph/animation/animation/grow-points.js +3 -3
  26. package/cjs/graph/animation/animation/grow-points.js.map +1 -1
  27. package/cjs/graph/animation/animation/grow-polar.js +8 -8
  28. package/cjs/graph/animation/animation/grow-polar.js.map +1 -1
  29. package/cjs/graph/animation/animation/move.js +12 -14
  30. package/cjs/graph/animation/animation/move.js.map +1 -1
  31. package/cjs/graph/animation/animation/update.js +1 -1
  32. package/cjs/graph/animation/animation/update.js.map +1 -1
  33. package/cjs/graph/animation/attribute.js +2 -2
  34. package/cjs/graph/animation/attribute.js.map +1 -1
  35. package/cjs/graph/attributes/helpers.js +9 -11
  36. package/cjs/graph/attributes/helpers.js.map +1 -1
  37. package/cjs/graph/attributes/transform.js +1 -1
  38. package/cjs/graph/attributes/transform.js.map +1 -1
  39. package/cjs/graph/element.js +1 -1
  40. package/cjs/graph/element.js.map +1 -1
  41. package/cjs/graph/layout/grid.js +1 -1
  42. package/cjs/graph/layout/grid.js.map +1 -1
  43. package/cjs/graph/mark/graphic.js +31 -22
  44. package/cjs/graph/mark/graphic.js.map +1 -1
  45. package/cjs/index.d.ts +1 -1
  46. package/cjs/index.js +1 -1
  47. package/cjs/index.js.map +1 -1
  48. package/cjs/interactions/brush-base.js +3 -5
  49. package/cjs/interactions/brush-base.js.map +1 -1
  50. package/cjs/interactions/view-navigation-base.js +3 -3
  51. package/cjs/interactions/view-navigation-base.js.map +1 -1
  52. package/cjs/interactions/view-roam.js +10 -10
  53. package/cjs/interactions/view-roam.js.map +1 -1
  54. package/cjs/interactions/view-scroll-mixin.js +1 -1
  55. package/cjs/interactions/view-scroll-mixin.js.map +1 -1
  56. package/cjs/interactions/view-zoom-mixin.js +2 -2
  57. package/cjs/interactions/view-zoom-mixin.js.map +1 -1
  58. package/cjs/parse/event.js +1 -2
  59. package/cjs/parse/event.js.map +1 -1
  60. package/cjs/parse/scale.js +5 -4
  61. package/cjs/parse/scale.js.map +1 -1
  62. package/cjs/parse/view.js +11 -10
  63. package/cjs/parse/view.js.map +1 -1
  64. package/cjs/view/View.js +12 -13
  65. package/cjs/view/View.js.map +1 -1
  66. package/cjs/view/animate.js +11 -11
  67. package/cjs/view/animate.js.map +1 -1
  68. package/cjs/view/mark.js +6 -10
  69. package/cjs/view/mark.js.map +1 -1
  70. package/es/component/axis.js +1 -1
  71. package/es/component/axis.js.map +1 -1
  72. package/es/component/datazoom.js +23 -26
  73. package/es/component/datazoom.js.map +1 -1
  74. package/es/component/label.js +11 -11
  75. package/es/component/label.js.map +1 -1
  76. package/es/component/legend.js +4 -6
  77. package/es/component/legend.js.map +1 -1
  78. package/es/component/player.js +4 -12
  79. package/es/component/player.js.map +1 -1
  80. package/es/component/scrollbar.js +7 -18
  81. package/es/component/scrollbar.js.map +1 -1
  82. package/es/component/slider.js +1 -3
  83. package/es/component/slider.js.map +1 -1
  84. package/es/glyph/boxplot.js +22 -19
  85. package/es/glyph/boxplot.js.map +1 -1
  86. package/es/glyph/violin.js +12 -10
  87. package/es/glyph/violin.js.map +1 -1
  88. package/es/graph/animation/animation/clip.js +2 -2
  89. package/es/graph/animation/animation/clip.js.map +1 -1
  90. package/es/graph/animation/animation/grow-cartesian.js +11 -11
  91. package/es/graph/animation/animation/grow-cartesian.js.map +1 -1
  92. package/es/graph/animation/animation/grow-interval.js +18 -18
  93. package/es/graph/animation/animation/grow-interval.js.map +1 -1
  94. package/es/graph/animation/animation/grow-points.js +3 -3
  95. package/es/graph/animation/animation/grow-points.js.map +1 -1
  96. package/es/graph/animation/animation/grow-polar.js +8 -8
  97. package/es/graph/animation/animation/grow-polar.js.map +1 -1
  98. package/es/graph/animation/animation/move.js +9 -9
  99. package/es/graph/animation/animation/move.js.map +1 -1
  100. package/es/graph/animation/animation/update.js +1 -1
  101. package/es/graph/animation/animation/update.js.map +1 -1
  102. package/es/graph/animation/attribute.js +2 -2
  103. package/es/graph/animation/attribute.js.map +1 -1
  104. package/es/graph/attributes/helpers.js +8 -11
  105. package/es/graph/attributes/helpers.js.map +1 -1
  106. package/es/graph/attributes/transform.js +1 -1
  107. package/es/graph/attributes/transform.js.map +1 -1
  108. package/es/graph/element.js +1 -1
  109. package/es/graph/element.js.map +1 -1
  110. package/es/graph/layout/grid.js +1 -1
  111. package/es/graph/layout/grid.js.map +1 -1
  112. package/es/graph/mark/graphic.js +23 -23
  113. package/es/graph/mark/graphic.js.map +1 -1
  114. package/es/index.d.ts +1 -1
  115. package/es/index.js +1 -1
  116. package/es/index.js.map +1 -1
  117. package/es/interactions/brush-base.js +3 -5
  118. package/es/interactions/brush-base.js.map +1 -1
  119. package/es/interactions/brush-filter.js +2 -1
  120. package/es/interactions/element-highlight-by-group.js +1 -2
  121. package/es/interactions/index.js +2 -1
  122. package/es/interactions/legend-filter.js +1 -1
  123. package/es/interactions/player-filter.js +1 -1
  124. package/es/interactions/roll-up.js +1 -1
  125. package/es/interactions/scrollbar-filter.js +1 -1
  126. package/es/interactions/slider-filter.js +1 -1
  127. package/es/interactions/tooltip.js +1 -1
  128. package/es/interactions/utils.js +1 -1
  129. package/es/interactions/view-navigation-base.js +3 -3
  130. package/es/interactions/view-navigation-base.js.map +1 -1
  131. package/es/interactions/view-roam.js +10 -10
  132. package/es/interactions/view-roam.js.map +1 -1
  133. package/es/interactions/view-scroll-mixin.js +1 -1
  134. package/es/interactions/view-scroll-mixin.js.map +1 -1
  135. package/es/interactions/view-zoom-mixin.js +2 -2
  136. package/es/interactions/view-zoom-mixin.js.map +1 -1
  137. package/es/parse/coordinate.js +1 -1
  138. package/es/parse/event.js +2 -2
  139. package/es/parse/event.js.map +1 -1
  140. package/es/parse/mark.js +1 -1
  141. package/es/parse/option.js +1 -1
  142. package/es/parse/scale.js +5 -6
  143. package/es/parse/scale.js.map +1 -1
  144. package/es/parse/transform.js +1 -1
  145. package/es/parse/util.js +1 -1
  146. package/es/parse/view.js +12 -11
  147. package/es/parse/view.js.map +1 -1
  148. package/es/view/View.js +12 -13
  149. package/es/view/View.js.map +1 -1
  150. package/es/view/animate.js +11 -11
  151. package/es/view/animate.js.map +1 -1
  152. package/es/view/mark.js +6 -10
  153. package/es/view/mark.js.map +1 -1
  154. package/package.json +9 -9
@@ -1,15 +1,15 @@
1
1
  import { isFunction, isValidNumber } from "@visactor/vutils";
2
2
 
3
3
  export const moveIn = (element, options, animationParameters) => {
4
- var _a, _b, _c;
5
- const offset = null !== (_a = null == options ? void 0 : options.offset) && void 0 !== _a ? _a : 0;
4
+ var _a, _b;
5
+ const {offset: offset = 0, orient: orient, direction: direction, point: pointOpt} = null != options ? options : {};
6
6
  let changedX = 0, changedY = 0;
7
- "negative" === (null == options ? void 0 : options.orient) && (animationParameters.group ? (changedX = null !== (_b = animationParameters.groupWidth) && void 0 !== _b ? _b : animationParameters.group.getBounds().width(),
8
- changedY = null !== (_c = animationParameters.groupHeight) && void 0 !== _c ? _c : animationParameters.group.getBounds().height(),
7
+ "negative" === orient && (animationParameters.group ? (changedX = null !== (_a = animationParameters.groupWidth) && void 0 !== _a ? _a : animationParameters.group.getBounds().width(),
8
+ changedY = null !== (_b = animationParameters.groupHeight) && void 0 !== _b ? _b : animationParameters.group.getBounds().height(),
9
9
  animationParameters.groupWidth = changedX, animationParameters.groupHeight = changedY) : (changedX = animationParameters.width,
10
10
  changedY = animationParameters.height)), changedX += offset, changedY += offset;
11
- const point = isFunction(null == options ? void 0 : options.point) ? options.point.call(null, element.getDatum(), element, animationParameters) : null == options ? void 0 : options.point, fromX = isValidNumber(null == point ? void 0 : point.x) ? point.x : changedX, fromY = isValidNumber(null == point ? void 0 : point.y) ? point.y : changedY;
12
- switch (null == options ? void 0 : options.direction) {
11
+ const point = isFunction(pointOpt) ? pointOpt.call(null, element.getDatum(), element, animationParameters) : pointOpt, fromX = point && isValidNumber(point.x) ? point.x : changedX, fromY = point && isValidNumber(point.y) ? point.y : changedY;
12
+ switch (direction) {
13
13
  case "x":
14
14
  return {
15
15
  from: {
@@ -45,9 +45,9 @@ export const moveIn = (element, options, animationParameters) => {
45
45
  };
46
46
 
47
47
  export const moveOut = (element, options, animationParameters) => {
48
- var _a, _b, _c;
49
- const offset = null !== (_a = null == options ? void 0 : options.offset) && void 0 !== _a ? _a : 0, groupBounds = animationParameters.group ? animationParameters.group.getBounds() : null, groupWidth = null !== (_b = null == groupBounds ? void 0 : groupBounds.width()) && void 0 !== _b ? _b : animationParameters.width, groupHeight = null !== (_c = null == groupBounds ? void 0 : groupBounds.height()) && void 0 !== _c ? _c : animationParameters.height, changedX = ("negative" === (null == options ? void 0 : options.orient) ? groupWidth : 0) + offset, changedY = ("negative" === (null == options ? void 0 : options.orient) ? groupHeight : 0) + offset, point = isFunction(null == options ? void 0 : options.point) ? options.point.call(null, element.getDatum(), element, animationParameters) : null == options ? void 0 : options.point, fromX = isValidNumber(null == point ? void 0 : point.x) ? point.x : changedX, fromY = isValidNumber(null == point ? void 0 : point.y) ? point.y : changedY;
50
- switch (null == options ? void 0 : options.direction) {
48
+ var _a, _b;
49
+ const {offset: offset = 0, orient: orient, direction: direction, point: pointOpt} = null != options ? options : {}, groupBounds = animationParameters.group ? animationParameters.group.getBounds() : null, groupWidth = null !== (_a = null == groupBounds ? void 0 : groupBounds.width()) && void 0 !== _a ? _a : animationParameters.width, groupHeight = null !== (_b = null == groupBounds ? void 0 : groupBounds.height()) && void 0 !== _b ? _b : animationParameters.height, changedX = ("negative" === orient ? groupWidth : 0) + offset, changedY = ("negative" === orient ? groupHeight : 0) + offset, point = isFunction(pointOpt) ? pointOpt.call(null, element.getDatum(), element, animationParameters) : pointOpt, fromX = point && isValidNumber(point.x) ? point.x : changedX, fromY = point && isValidNumber(point.y) ? point.y : changedY;
50
+ switch (direction) {
51
51
  case "x":
52
52
  return {
53
53
  from: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph/animation/animation/move.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAM7D,MAAM,CAAC,MAAM,MAAM,GAA4B,CAC7C,OAAiB,EACjB,OAA8B,EAC9B,mBAAyC,EACzC,EAAE;;IACF,MAAM,MAAM,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,mCAAI,CAAC,CAAC;IACpC,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,IAAI,QAAQ,GAAG,CAAC,CAAC;IAEjB,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,MAAK,UAAU,EAAE;QAElC,IAAI,mBAAmB,CAAC,KAAK,EAAE;YAC7B,QAAQ,GAAG,MAAC,mBAA2B,CAAC,UAAU,mCAAI,mBAAmB,CAAC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,IAAI,EAAE;oBACJ,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC;oBACzC,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC;iBAC1C;gBACD,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE;aAC3B,CAAC;KACL;AACH,CAAC,CAAC","file":"move.js","sourcesContent":["import { isFunction, isValidNumber } from '@visactor/vutils';\nimport type { IElement, IMoveAnimationOptions, IAnimationParameters, TypeAnimation } from '../../../types';\n\n// When user did not provide proper x/y value, move animation will never work properly,\n// due to that, default x/y value won't be set.\n\nexport const moveIn: TypeAnimation<IElement> = (\n element: IElement,\n options: IMoveAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const offset = options?.offset ?? 0;\n let changedX = 0;\n let changedY = 0;\n\n if (options?.orient === 'negative') {\n // consider the offset of group\n if (animationParameters.group) {\n changedX = (animationParameters as any).groupWidth ?? animationParameters.group.getBounds().width();\n changedY = (animationParameters as any).groupHeight ?? animationParameters.group.getBounds().height();\n\n (animationParameters as any).groupWidth = changedX;\n (animationParameters as any).groupHeight = changedY;\n } else {\n changedX = animationParameters.width;\n changedY = animationParameters.height;\n }\n }\n\n changedX += offset;\n changedY += offset;\n const point = isFunction(options?.point)\n ? options.point.call(null, element.getDatum(), element, animationParameters)\n : options?.point;\n const fromX = isValidNumber(point?.x) ? point.x : changedX;\n const fromY = isValidNumber(point?.y) ? point.y : changedY;\n switch (options?.direction) {\n case 'x':\n return {\n from: { x: fromX },\n to: { x: element.getGraphicAttribute('x', false) }\n };\n case 'y':\n return {\n from: { y: fromY },\n to: { y: element.getGraphicAttribute('y', false) }\n };\n case 'xy':\n default:\n return {\n from: { x: fromX, y: fromY },\n to: {\n x: element.getGraphicAttribute('x', false),\n y: element.getGraphicAttribute('y', false)\n }\n };\n }\n};\n\nexport const moveOut: TypeAnimation<IElement> = (\n element: IElement,\n options: IMoveAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const offset = options?.offset ?? 0;\n // consider the offset of group\n const groupBounds = animationParameters.group ? animationParameters.group.getBounds() : null;\n const groupWidth = groupBounds?.width() ?? animationParameters.width;\n const groupHeight = groupBounds?.height() ?? animationParameters.height;\n const changedX = (options?.orient === 'negative' ? groupWidth : 0) + offset;\n const changedY = (options?.orient === 'negative' ? groupHeight : 0) + offset;\n const point = isFunction(options?.point)\n ? options.point.call(null, element.getDatum(), element, animationParameters)\n : options?.point;\n const fromX = isValidNumber(point?.x) ? point.x : changedX;\n const fromY = isValidNumber(point?.y) ? point.y : changedY;\n\n switch (options?.direction) {\n case 'x':\n return {\n from: { x: element.getGraphicAttribute('x', true) },\n to: { x: fromX }\n };\n case 'y':\n return {\n from: { y: element.getGraphicAttribute('y', true) },\n to: { y: fromY }\n };\n case 'xy':\n default:\n return {\n from: {\n x: element.getGraphicAttribute('x', true),\n y: element.getGraphicAttribute('y', true)\n },\n to: { x: fromX, y: fromY }\n };\n }\n};\n"]}
1
+ {"version":3,"sources":["../src/graph/animation/animation/move.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAM7D,MAAM,CAAC,MAAM,MAAM,GAA4B,CAC7C,OAAiB,EACjB,OAA8B,EAC9B,mBAAyC,EACzC,EAAE;;IACF,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC;IACzE,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,IAAI,QAAQ,GAAG,CAAC,CAAC;IAEjB,IAAI,MAAM,KAAK,UAAU,EAAE;QAEzB,IAAI,mBAAmB,CAAC,KAAK,EAAE;YAC7B,QAAQ,GAAG,MAAC,mBAA2B,CAAC,UAAU,mCAAI,mBAAmB,CAAC,KAAK,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nimationParameters, TypeAnimation } from '../../../types';\n\n// When user did not provide proper x/y value, move animation will never work properly,\n// due to that, default x/y value won't be set.\n\nexport const moveIn: TypeAnimation<IElement> = (\n element: IElement,\n options: IMoveAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const { offset = 0, orient, direction, point: pointOpt } = options ?? {};\n let changedX = 0;\n let changedY = 0;\n\n if (orient === 'negative') {\n // consider the offset of group\n if (animationParameters.group) {\n changedX = (animationParameters as any).groupWidth ?? animationParameters.group.getBounds().width();\n changedY = (animationParameters as any).groupHeight ?? animationParameters.group.getBounds().height();\n\n (animationParameters as any).groupWidth = changedX;\n (animationParameters as any).groupHeight = changedY;\n } else {\n changedX = animationParameters.width;\n changedY = animationParameters.height;\n }\n }\n\n changedX += offset;\n changedY += offset;\n const point = isFunction(pointOpt) ? pointOpt.call(null, element.getDatum(), element, animationParameters) : pointOpt;\n const fromX = point && isValidNumber(point.x) ? point.x : changedX;\n const fromY = point && isValidNumber(point.y) ? point.y : changedY;\n switch (direction) {\n case 'x':\n return {\n from: { x: fromX },\n to: { x: element.getGraphicAttribute('x', false) }\n };\n case 'y':\n return {\n from: { y: fromY },\n to: { y: element.getGraphicAttribute('y', false) }\n };\n case 'xy':\n default:\n return {\n from: { x: fromX, y: fromY },\n to: {\n x: element.getGraphicAttribute('x', false),\n y: element.getGraphicAttribute('y', false)\n }\n };\n }\n};\n\nexport const moveOut: TypeAnimation<IElement> = (\n element: IElement,\n options: IMoveAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const { offset = 0, orient, direction, point: pointOpt } = options ?? {};\n\n // consider the offset of group\n const groupBounds = animationParameters.group ? animationParameters.group.getBounds() : null;\n const groupWidth = groupBounds?.width() ?? animationParameters.width;\n const groupHeight = groupBounds?.height() ?? animationParameters.height;\n const changedX = (orient === 'negative' ? groupWidth : 0) + offset;\n const changedY = (orient === 'negative' ? groupHeight : 0) + offset;\n const point = isFunction(pointOpt) ? pointOpt.call(null, element.getDatum(), element, animationParameters) : pointOpt;\n const fromX = point && isValidNumber(point.x) ? point.x : changedX;\n const fromY = point && isValidNumber(point.y) ? point.y : changedY;\n\n switch (direction) {\n case 'x':\n return {\n from: { x: element.getGraphicAttribute('x', true) },\n to: { x: fromX }\n };\n case 'y':\n return {\n from: { y: element.getGraphicAttribute('y', true) },\n to: { y: fromY }\n };\n case 'xy':\n default:\n return {\n from: {\n x: element.getGraphicAttribute('x', true),\n y: element.getGraphicAttribute('y', true)\n },\n to: { x: fromX, y: fromY }\n };\n }\n};\n"]}
@@ -4,7 +4,7 @@ import { isEqual } from "@visactor/vgrammar-util";
4
4
 
5
5
  export const update = (element, options, animationParameters) => {
6
6
  const from = Object.assign({}, element.getPrevGraphicAttributes()), to = Object.assign({}, element.getNextGraphicAttributes());
7
- return array(null == options ? void 0 : options.excludeChannels).forEach((key => {
7
+ return options && array(options.excludeChannels).forEach((key => {
8
8
  delete from[key], delete to[key];
9
9
  })), Object.keys(to).forEach((key => {
10
10
  isEqual(key, from, to) && (delete from[key], delete to[key]);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph/animation/animation/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAQlD,MAAM,CAAC,MAAM,MAAM,GAA4B,CAC7C,OAAiB,EACjB,OAAgC,EAChC,mBAAyC,EACzC,EAAE;IACF,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAC;IACnE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAC;IACjE,KAAK,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QAC5C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACjB,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QAC5B,IAAI,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE;YAC1B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;YACjB,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;SAChB;IACH,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AACtB,CAAC,CAAC","file":"update.js","sourcesContent":["import { array } from '@visactor/vutils';\nimport { isEqual } from '@visactor/vgrammar-util';\nimport type { IElement } from '../../../types';\nimport type { IAnimationParameters, TypeAnimation } from '../../../types/animate';\n\nexport interface IUpdateAnimationOptions {\n excludeChannels: string[];\n}\n\nexport const update: TypeAnimation<IElement> = (\n element: IElement,\n options: IUpdateAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const from = Object.assign({}, element.getPrevGraphicAttributes());\n const to = Object.assign({}, element.getNextGraphicAttributes());\n array(options?.excludeChannels).forEach(key => {\n delete from[key];\n delete to[key];\n });\n Object.keys(to).forEach(key => {\n if (isEqual(key, from, to)) {\n delete from[key];\n delete to[key];\n }\n });\n return { from, to };\n};\n"]}
1
+ {"version":3,"sources":["../src/graph/animation/animation/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAQlD,MAAM,CAAC,MAAM,MAAM,GAA4B,CAC7C,OAAiB,EACjB,OAAgC,EAChC,mBAAyC,EACzC,EAAE;IACF,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAC;IACnE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAC;IACjE,IAAI,OAAO,EAAE;QACX,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC3C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;YACjB,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;KACJ;IACD,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QAC5B,IAAI,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE;YAC1B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;YACjB,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;SAChB;IACH,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AACtB,CAAC,CAAC","file":"update.js","sourcesContent":["import { array } from '@visactor/vutils';\nimport { isEqual } from '@visactor/vgrammar-util';\nimport type { IElement } from '../../../types';\nimport type { IAnimationParameters, TypeAnimation } from '../../../types/animate';\n\nexport interface IUpdateAnimationOptions {\n excludeChannels: string[];\n}\n\nexport const update: TypeAnimation<IElement> = (\n element: IElement,\n options: IUpdateAnimationOptions,\n animationParameters: IAnimationParameters\n) => {\n const from = Object.assign({}, element.getPrevGraphicAttributes());\n const to = Object.assign({}, element.getNextGraphicAttributes());\n if (options) {\n array(options.excludeChannels).forEach(key => {\n delete from[key];\n delete to[key];\n });\n }\n Object.keys(to).forEach(key => {\n if (isEqual(key, from, to)) {\n delete from[key];\n delete to[key];\n }\n });\n return { from, to };\n};\n"]}
@@ -8,7 +8,7 @@ import { Factory } from "../../core/factory";
8
8
 
9
9
  const transformAnimationAttributes = (attributes, element) => {
10
10
  if (!attributes) return null;
11
- if (null == attributes ? void 0 : attributes.from) {
11
+ if (attributes.from) {
12
12
  const from = attributes.from, fromKeys = Object.keys(from);
13
13
  fromKeys.forEach((channel => {
14
14
  isNil(from[channel]) && delete from[channel];
@@ -21,7 +21,7 @@ const transformAnimationAttributes = (attributes, element) => {
21
21
  attributes.from = element.transformElementItems(items, element.mark.markType, computePoints);
22
22
  }
23
23
  }
24
- if (null == attributes ? void 0 : attributes.to) {
24
+ if (attributes.to) {
25
25
  const to = attributes.to, toKeys = Object.keys(to);
26
26
  toKeys.forEach((channel => {
27
27
  isNil(to[channel]) && delete to[channel];
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph/animation/attribute.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClG,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AASjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,MAAM,4BAA4B,GAAG,CAAC,UAAiC,EAAE,OAAiB,EAAyB,EAAE;IACnH,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,IAAI,CAAC;KACb;IAED,IAAI,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,EAAE;QACpB,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC7B,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACzB,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE;gBACxB,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;aACtB;QACH,CAAC,CAAC,CAAC;QACH,MAAM,aAAa,GAAG,oBAAoB,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAA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IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,cAAc,CACpB,CAAC;IACJ,CAAC;CACF","file":"attribute.js","sourcesContent":["import type { EasingType, IGraphic } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { ACustomAnimate, AttributeUpdateType, NOWORK_ANIMATE_ATTR } from '@visactor/vrender-core';\nimport { isArray, isFunction, isNil, isObject, isValid } from '@visactor/vutils';\nimport type {\n IAnimationChannelInterpolator,\n IAnimationEffect,\n IAnimationParameters,\n IElement,\n IGlyphElement,\n IParsedAnimationAttrs\n} from '../../types';\nimport { isValidPointsChannel } from '../attributes/helpers';\nimport { Factory } from '../../core/factory';\n\nconst transformAnimationAttributes = (attributes: IParsedAnimationAttrs, element: IElement): IParsedAnimationAttrs => {\n if (!attributes) {\n return null;\n }\n\n if (attributes?.from) {\n const from = attributes.from;\n const fromKeys = Object.keys(from);\n fromKeys.forEach(channel => {\n if (isNil(from[channel])) {\n delete from[channel];\n }\n });\n const computePoints = isValidPointsChannel(fromKeys, element.mark.markType) && !isValid(from.segments);\n if (computePoints) {\n const items = element.items.map(item => Object.assign({}, item, { nextAttrs: from }));\n attributes.from = element.transformElementItems(items, element.mark.markType, computePoints);\n }\n }\n if (attributes?.to) {\n const to = attributes.to;\n const toKeys = Object.keys(to);\n toKeys.forEach(channel => {\n if (isNil(to[channel])) {\n delete to[channel];\n }\n });\n const computePoints = isValidPointsChannel(toKeys, element.mark.markType) && !isValid(to.segments);\n if (computePoints) {\n const items = element.items.map(item => Object.assign({}, item, { nextAttrs: to }));\n attributes.to = element.transformElementItems(items, element.mark.markType, computePoints);\n }\n }\n\n return attributes;\n};\n\nexport function typeAnimationAttributes(\n element: IElement,\n effect: IAnimationEffect,\n animationParameters: IAnimationParameters,\n parameters: any\n): IParsedAnimationAttrs {\n // const parameters =\n const options = isFunction(effect.options)\n ? effect.options.call(null, element.getDatum(), element, parameters)\n : effect.options;\n if (!effect.type || !Factory.getAnimationType(effect.type)) {\n return null;\n }\n const attributes = Factory.getAnimationType(effect.type)(element as IGlyphElement, options, animationParameters);\n return transformAnimationAttributes(attributes, element);\n}\n\nconst parseChannelValue = (\n element: IElement,\n channel: string,\n channelValue: any,\n animationParameters: IAnimationParameters,\n parameters: any\n) => {\n return isFunction(channelValue) ? channelValue(element.getDatum(), element, parameters) : channelValue;\n};\n\nexport function channelAnimationAttributes(\n element: IElement,\n effect: IAnimationEffect,\n animationParameters: IAnimationParameters,\n parameters: any\n): IParsedAnimationAttrs {\n const channel = effect.channel;\n let attributes: IParsedAnimationAttrs = null;\n\n if (isArray(channel)) {\n attributes = channel.reduce(\n (res, key) => {\n res.from[key] = element.getGraphicAttribute(key, true);\n res.to[key] = element.getGraphicAttribute(key, false);\n return res;\n },\n { from: {}, to: {} }\n );\n } else if (isObject(channel)) {\n attributes = Object.keys(channel).reduce(\n (res, key) => {\n const hasFrom = !isNil(channel[key]?.from);\n const hasTo = !isNil(channel[key]?.to);\n\n if (hasFrom || hasTo) {\n res.from[key] = hasFrom\n ? parseChannelValue(element, key, channel[key].from, animationParameters, parameters)\n : undefined;\n res.to[key] = hasTo\n ? parseChannelValue(element, key, channel[key].to, animationParameters, parameters)\n : element.getGraphicAttribute(key, false);\n }\n\n return res;\n },\n { from: {}, to: {} }\n );\n }\n\n return transformAnimationAttributes(attributes, element);\n}\n\nexport class CustomInterpolator extends ACustomAnimate<any> {\n private _element: IElement;\n private _interpolator?: IAnimationChannelInterpolator;\n\n constructor(\n from: any,\n to: any,\n duration: number,\n easing: EasingType,\n params: { interpolator: IAnimationChannelInterpolator; element: IElement; parameters?: any }\n ) {\n super(from, to, duration, easing, params);\n this._interpolator = params?.interpolator;\n this._element = params?.element;\n }\n\n onBind() {\n this.from = this.from ?? {};\n this.to = this.to ?? {};\n }\n\n getEndProps(): void | Record<string, any> {\n return this.to;\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n if (!this._interpolator || !this._element) {\n return;\n }\n this._interpolator.call(\n this,\n ratio,\n this.from,\n this.to,\n out,\n this._element.getDatum(),\n this._element,\n this.params.parameters\n );\n }\n}\n\nexport class AttributeAnimate extends ACustomAnimate<any> {\n declare target: IGraphic;\n\n private _fromAttribute: any;\n private _toAttribute: any;\n\n getEndProps(): Record<string, any> {\n return this.to;\n }\n\n onBind() {\n this.from = this.from ?? {};\n this.to = this.to ?? {};\n }\n\n onStart(): void {\n const excludedChannelMap = (this.target.constructor as any).NOWORK_ANIMATE_ATTR ?? NOWORK_ANIMATE_ATTR;\n const excludedChannels = Object.keys(excludedChannelMap).filter(channel => excludedChannelMap[channel] !== 0);\n this.subAnimate.animate.preventAttrs(excludedChannels);\n\n const from = Object.assign({}, this.from);\n const to = Object.assign({}, this.to);\n Object.keys(to).forEach(k => {\n if (excludedChannels.includes(k)) {\n from[k] = to[k];\n this.from[k] = to[k];\n } else if (isNil(from[k])) {\n from[k] = this.target.getComputedAttribute(k);\n }\n // if (this.to[k] === from[k]) {\n // delete from[k];\n // }\n });\n\n this.target.setAttributes(from, false, {\n type: AttributeUpdateType.ANIMATE_UPDATE,\n animationState: { ratio: 0, end: false }\n });\n\n this._fromAttribute = from;\n this._toAttribute = to;\n }\n\n onEnd(): void {\n this.target.setAttributes(this._toAttribute, false, {\n type: AttributeUpdateType.ANIMATE_END\n });\n }\n\n update(end: boolean, ratio: number, out: Record<string, any>): void {\n if (this.updateCount === 0) {\n this.onFirstRun();\n }\n this.updateCount += 1;\n\n // Hack: waiting for canopus to remove invalid key when updating\n const lastProps = this.step.getLastProps();\n Object.keys(lastProps).forEach(key => {\n if (this.subAnimate.animate.validAttr(key)) {\n out[key] = lastProps[key];\n }\n });\n this.onUpdate(end, ratio, out);\n if (end) {\n this.onEnd();\n }\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n this.target.stepInterpolate(\n this.subAnimate,\n this.subAnimate.animate,\n out,\n this.step,\n ratio,\n end,\n this._toAttribute,\n this._fromAttribute\n );\n }\n}\n"]}
1
+ {"version":3,"sources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,GAAY,EAAE,KAAa,EAAE,GAAwB;QAC1D,IAAI,IAAI,CAAC,WAAW,KAAK,CAAC,EAAE;YAC1B,IAAI,CAAC,UAAU,EAAE,CAAC;SACnB;QACD,IAAI,CAAC,WAAW,IAAI,CAAC,CAAC;QAGtB,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;QAC3C,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACnC,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;gBAC1C,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;aAC3B;QACH,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QAC/B,IAAI,GAAG,EAAE;YACP,IAAI,CAAC,KAAK,EAAE,CAAC;SACd;IACH,CAAC;IAED,QAAQ,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;QAC5D,IAAI,CAAC,MAAM,CAAC,eAAe,CACzB,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,UAAU,CAAC,OAAO,EACvB,GAAG,EACH,IAAI,CAAC,IAAI,EACT,KAAK,EACL,GAAG,EACH,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,cAAc,CACpB,CAAC;IACJ,CAAC;CACF","file":"attribute.js","sourcesContent":["import type { EasingType, IGraphic } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { ACustomAnimate, AttributeUpdateType, NOWORK_ANIMATE_ATTR } from '@visactor/vrender-core';\nimport { isArray, isFunction, isNil, isObject, isValid } from '@visactor/vutils';\nimport type {\n IAnimationChannelInterpolator,\n IAnimationEffect,\n IAnimationParameters,\n IElement,\n IGlyphElement,\n IParsedAnimationAttrs\n} from '../../types';\nimport { isValidPointsChannel } from '../attributes/helpers';\nimport { Factory } from '../../core/factory';\n\nconst transformAnimationAttributes = (attributes: IParsedAnimationAttrs, element: IElement): IParsedAnimationAttrs => {\n if (!attributes) {\n return null;\n }\n\n if (attributes.from) {\n const from = attributes.from;\n const fromKeys = Object.keys(from);\n fromKeys.forEach(channel => {\n if (isNil(from[channel])) {\n delete from[channel];\n }\n });\n const computePoints = isValidPointsChannel(fromKeys, element.mark.markType) && !isValid(from.segments);\n if (computePoints) {\n const items = element.items.map(item => Object.assign({}, item, { nextAttrs: from }));\n attributes.from = element.transformElementItems(items, element.mark.markType, computePoints);\n }\n }\n if (attributes.to) {\n const to = attributes.to;\n const toKeys = Object.keys(to);\n toKeys.forEach(channel => {\n if (isNil(to[channel])) {\n delete to[channel];\n }\n });\n const computePoints = isValidPointsChannel(toKeys, element.mark.markType) && !isValid(to.segments);\n if (computePoints) {\n const items = element.items.map(item => Object.assign({}, item, { nextAttrs: to }));\n attributes.to = element.transformElementItems(items, element.mark.markType, computePoints);\n }\n }\n\n return attributes;\n};\n\nexport function typeAnimationAttributes(\n element: IElement,\n effect: IAnimationEffect,\n animationParameters: IAnimationParameters,\n parameters: any\n): IParsedAnimationAttrs {\n // const parameters =\n const options = isFunction(effect.options)\n ? effect.options.call(null, element.getDatum(), element, parameters)\n : effect.options;\n if (!effect.type || !Factory.getAnimationType(effect.type)) {\n return null;\n }\n const attributes = Factory.getAnimationType(effect.type)(element as IGlyphElement, options, animationParameters);\n return transformAnimationAttributes(attributes, element);\n}\n\nconst parseChannelValue = (\n element: IElement,\n channel: string,\n channelValue: any,\n animationParameters: IAnimationParameters,\n parameters: any\n) => {\n return isFunction(channelValue) ? channelValue(element.getDatum(), element, parameters) : channelValue;\n};\n\nexport function channelAnimationAttributes(\n element: IElement,\n effect: IAnimationEffect,\n animationParameters: IAnimationParameters,\n parameters: any\n): IParsedAnimationAttrs {\n const channel = effect.channel;\n let attributes: IParsedAnimationAttrs = null;\n\n if (isArray(channel)) {\n attributes = channel.reduce(\n (res, key) => {\n res.from[key] = element.getGraphicAttribute(key, true);\n res.to[key] = element.getGraphicAttribute(key, false);\n return res;\n },\n { from: {}, to: {} }\n );\n } else if (isObject(channel)) {\n attributes = Object.keys(channel).reduce(\n (res, key) => {\n const hasFrom = !isNil(channel[key]?.from);\n const hasTo = !isNil(channel[key]?.to);\n\n if (hasFrom || hasTo) {\n res.from[key] = hasFrom\n ? parseChannelValue(element, key, channel[key].from, animationParameters, parameters)\n : undefined;\n res.to[key] = hasTo\n ? parseChannelValue(element, key, channel[key].to, animationParameters, parameters)\n : element.getGraphicAttribute(key, false);\n }\n\n return res;\n },\n { from: {}, to: {} }\n );\n }\n\n return transformAnimationAttributes(attributes, element);\n}\n\nexport class CustomInterpolator extends ACustomAnimate<any> {\n private _element: IElement;\n private _interpolator?: IAnimationChannelInterpolator;\n\n constructor(\n from: any,\n to: any,\n duration: number,\n easing: EasingType,\n params: { interpolator: IAnimationChannelInterpolator; element: IElement; parameters?: any }\n ) {\n super(from, to, duration, easing, params);\n this._interpolator = params?.interpolator;\n this._element = params?.element;\n }\n\n onBind() {\n this.from = this.from ?? {};\n this.to = this.to ?? {};\n }\n\n getEndProps(): void | Record<string, any> {\n return this.to;\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n if (!this._interpolator || !this._element) {\n return;\n }\n this._interpolator.call(\n this,\n ratio,\n this.from,\n this.to,\n out,\n this._element.getDatum(),\n this._element,\n this.params.parameters\n );\n }\n}\n\nexport class AttributeAnimate extends ACustomAnimate<any> {\n declare target: IGraphic;\n\n private _fromAttribute: any;\n private _toAttribute: any;\n\n getEndProps(): Record<string, any> {\n return this.to;\n }\n\n onBind() {\n this.from = this.from ?? {};\n this.to = this.to ?? {};\n }\n\n onStart(): void {\n const excludedChannelMap = (this.target.constructor as any).NOWORK_ANIMATE_ATTR ?? NOWORK_ANIMATE_ATTR;\n const excludedChannels = Object.keys(excludedChannelMap).filter(channel => excludedChannelMap[channel] !== 0);\n this.subAnimate.animate.preventAttrs(excludedChannels);\n\n const from = Object.assign({}, this.from);\n const to = Object.assign({}, this.to);\n Object.keys(to).forEach(k => {\n if (excludedChannels.includes(k)) {\n from[k] = to[k];\n this.from[k] = to[k];\n } else if (isNil(from[k])) {\n from[k] = this.target.getComputedAttribute(k);\n }\n // if (this.to[k] === from[k]) {\n // delete from[k];\n // }\n });\n\n this.target.setAttributes(from, false, {\n type: AttributeUpdateType.ANIMATE_UPDATE,\n animationState: { ratio: 0, end: false }\n });\n\n this._fromAttribute = from;\n this._toAttribute = to;\n }\n\n onEnd(): void {\n this.target.setAttributes(this._toAttribute, false, {\n type: AttributeUpdateType.ANIMATE_END\n });\n }\n\n update(end: boolean, ratio: number, out: Record<string, any>): void {\n if (this.updateCount === 0) {\n this.onFirstRun();\n }\n this.updateCount += 1;\n\n // Hack: waiting for canopus to remove invalid key when updating\n const lastProps = this.step.getLastProps();\n Object.keys(lastProps).forEach(key => {\n if (this.subAnimate.animate.validAttr(key)) {\n out[key] = lastProps[key];\n }\n });\n this.onUpdate(end, ratio, out);\n if (end) {\n this.onEnd();\n }\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n this.target.stepInterpolate(\n this.subAnimate,\n this.subAnimate.animate,\n out,\n this.step,\n ratio,\n end,\n this._toAttribute,\n this._fromAttribute\n );\n }\n}\n"]}
@@ -33,33 +33,30 @@ export function getRulePoints(nextAttrs) {
33
33
  export function getLinePoints(items, includeOnePoint, lastPoints, isArea) {
34
34
  if (!items || !items.length || 1 === items.length && includeOnePoint) return [];
35
35
  return items.some((item => isValidPointsChannel(Object.keys(item.nextAttrs), "line"))) ? items.map(((item, index) => {
36
- var _a, _b, _c, _d, _e;
37
- const attrs = item.nextAttrs;
38
- return isNil(attrs.x) && (attrs.x = null === (_a = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _a ? void 0 : _a.x),
39
- isNil(attrs.y) && (attrs.y = null === (_b = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _b ? void 0 : _b.y),
40
- isNil(attrs.defined) && !1 === (null === (_c = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _c ? void 0 : _c.defined) && (attrs.defined = !1),
41
- attrs.context = item.key, isArea && (isNil(attrs.x1) && (attrs.x1 = null === (_d = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _d ? void 0 : _d.x1),
42
- isNil(attrs.y1) && (attrs.y1 = null === (_e = null == lastPoints ? void 0 : lastPoints[index]) || void 0 === _e ? void 0 : _e.y1)),
36
+ var _a;
37
+ const attrs = item.nextAttrs, {x: x, y: y, x1: x1, y1: y1, defined: defined} = null !== (_a = null == lastPoints ? void 0 : lastPoints[index]) && void 0 !== _a ? _a : {};
38
+ return isNil(attrs.x) && (attrs.x = x), isNil(attrs.y) && (attrs.y = y), isNil(attrs.defined) && !1 === defined && (attrs.defined = !1),
39
+ attrs.context = item.key, isArea && (isNil(attrs.x1) && (attrs.x1 = x1), isNil(attrs.y1) && (attrs.y1 = y1)),
43
40
  attrs;
44
41
  })) : null != lastPoints ? lastPoints : [];
45
42
  }
46
43
 
47
- export function getLargeRectsPoints(items, includeOnePoint, lastPoints) {
44
+ export function getLargeRectsPoints(items, includeOnePoint, lastPoints = []) {
48
45
  if (!items || !items.length || 1 === items.length && includeOnePoint) return [];
49
46
  const arr = new Float32Array(4 * items.length);
50
47
  return items.forEach(((item, index) => {
51
48
  var _a, _b, _c, _d;
52
- const attrs = item.nextAttrs, x = null !== (_a = attrs.x) && void 0 !== _a ? _a : null == lastPoints ? void 0 : lastPoints[4 * index], y = null !== (_b = attrs.y) && void 0 !== _b ? _b : null == lastPoints ? void 0 : lastPoints[4 * index + 1], width = null !== (_c = attrs.width) && void 0 !== _c ? _c : null == lastPoints ? void 0 : lastPoints[4 * index + 2], y1 = null !== (_d = attrs.y1) && void 0 !== _d ? _d : null == lastPoints ? void 0 : lastPoints[4 * index + 3];
49
+ const attrs = item.nextAttrs, x = null !== (_a = attrs.x) && void 0 !== _a ? _a : lastPoints[4 * index], y = null !== (_b = attrs.y) && void 0 !== _b ? _b : lastPoints[4 * index + 1], width = null !== (_c = attrs.width) && void 0 !== _c ? _c : lastPoints[4 * index + 2], y1 = null !== (_d = attrs.y1) && void 0 !== _d ? _d : lastPoints[4 * index + 3];
53
50
  arr[4 * index] = x, arr[4 * index + 1] = y, arr[4 * index + 2] = width, arr[4 * index + 3] = y1 - y;
54
51
  })), arr;
55
52
  }
56
53
 
57
- export function getLargeSymbolsPoints(items, includeOnePoint, lastPoints) {
54
+ export function getLargeSymbolsPoints(items, includeOnePoint, lastPoints = []) {
58
55
  if (!items || !items.length || 1 === items.length && includeOnePoint) return [];
59
56
  const arr = new Float32Array(2 * items.length);
60
57
  return items.forEach(((item, index) => {
61
58
  var _a, _b;
62
- const attrs = item.nextAttrs, x = null !== (_a = attrs.x) && void 0 !== _a ? _a : null == lastPoints ? void 0 : lastPoints[2 * index], y = null !== (_b = attrs.y) && void 0 !== _b ? _b : null == lastPoints ? void 0 : lastPoints[2 * index + 1];
59
+ const attrs = item.nextAttrs, x = null !== (_a = attrs.x) && void 0 !== _a ? _a : lastPoints[2 * index], y = null !== (_b = attrs.y) && void 0 !== _b ? _b : lastPoints[2 * index + 1];
63
60
  arr[2 * index] = x, arr[2 * index + 1] = y;
64
61
  })), arr;
65
62
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph/attributes/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,UAAU,oBAAoB,CAAC,QAAkB,EAAE,QAAkB;IACzE,QAAQ,QAAQ,EAAE;QAChB,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3E,KA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,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACvB,CAAC","file":"helpers.js","sourcesContent":["import type { IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isNil, isValidNumber } from '@visactor/vutils';\nimport type { MarkElementItem, MarkType } from '../../types';\nimport { GrammarMarkType } from '../enums';\n\nexport function isValidPointsChannel(channels: string[], markType: MarkType): boolean {\n switch (markType) {\n case 'line':\n return channels.some(channel => ['x', 'y', 'defined'].includes(channel));\n case 'area':\n return channels.some(channel => ['x', 'y', 'x1', 'y1', 'defined'].includes(channel));\n case 'largeRects':\n return channels.some(channel => ['x', 'y', 'width', 'y1'].includes(channel));\n case 'largeSymbols':\n return channels.some(channel => ['x', 'y'].includes(channel));\n }\n return false;\n}\n\n/**\n * 获取rule的points\n * 相对位置\n * @param {*} item\n * @returns\n */\nexport function getRulePoints(nextAttrs: { x: number; y: number; x1: number; y1: number }) {\n const { x, y, x1, y1 } = nextAttrs;\n\n if (!isValidNumber(x) || !isValidNumber(y) || !isValidNumber(x1) || !isValidNumber(y1)) {\n return [];\n }\n return [\n { x, y },\n { x: x1, y: y1 }\n ];\n}\n/**\n * 生成用于渲染的点数组\n * @param {*} item\n * @returns {IPointLike[]}\n */\nexport function getLinePoints(\n items?: MarkElementItem[],\n includeOnePoint?: boolean,\n lastPoints?: IPointLike[],\n isArea?: boolean\n) {\n if (!items || !items.length || (items.length === 1 && includeOnePoint)) {\n return [];\n }\n const hasValidChannel = items.some(item => {\n return isValidPointsChannel(Object.keys(item.nextAttrs), 'line');\n });\n if (!hasValidChannel) {\n return lastPoints ?? [];\n }\n return items.map((item, index) => {\n const attrs = item.nextAttrs;\n\n if (isNil(attrs.x)) {\n attrs.x = lastPoints?.[index]?.x;\n }\n if (isNil(attrs.y)) {\n attrs.y = lastPoints?.[index]?.y;\n }\n\n if (isNil(attrs.defined) && lastPoints?.[index]?.defined === false) {\n attrs.defined = false;\n }\n\n attrs.context = item.key;\n\n if (isArea) {\n if (isNil(attrs.x1)) {\n attrs.x1 = lastPoints?.[index]?.x1;\n }\n if (isNil(attrs.y1)) {\n attrs.y1 = lastPoints?.[index]?.y1;\n }\n }\n\n return attrs;\n });\n}\n\nexport function getLargeRectsPoints(\n items?: MarkElementItem[],\n includeOnePoint?: boolean,\n lastPoints?: Float32Array | number[]\n): Float32Array | number[] {\n if (!items || !items.length || (items.length === 1 && includeOnePoint)) {\n return [];\n }\n const arr: Float32Array = new Float32Array(items.length * 4);\n\n items.forEach((item, index) => {\n const attrs = item.nextAttrs;\n const x = attrs.x ?? lastPoints?.[index * 4];\n const y = attrs.y ?? lastPoints?.[index * 4 + 1];\n const width = attrs.width ?? lastPoints?.[index * 4 + 2];\n const y1 = attrs.y1 ?? lastPoints?.[index * 4 + 3];\n arr[index * 4] = x;\n arr[index * 4 + 1] = y;\n arr[index * 4 + 2] = width;\n arr[index * 4 + 3] = y1 - y;\n });\n\n return arr;\n}\n\nexport function getLargeSymbolsPoints(\n items?: MarkElementItem[],\n includeOnePoint?: boolean,\n lastPoints?: Float32Array | number[]\n): Float32Array | number[] {\n if (!items || !items.length || (items.length === 1 && includeOnePoint)) {\n return [];\n }\n const arr: Float32Array = new Float32Array(items.length * 2);\n\n items.forEach((item, index) => {\n const attrs = item.nextAttrs;\n const x = attrs.x ?? lastPoints?.[index * 2];\n const y = attrs.y ?? lastPoints?.[index * 2 + 1];\n arr[index * 2] = x;\n arr[index * 2 + 1] = y;\n });\n\n return arr;\n}\n\nexport function isPositionOrSizeChannel(type: string, channel: string) {\n if (['x', 'y', 'dx', 'dy'].includes(channel)) {\n return true;\n }\n\n switch (type) {\n case GrammarMarkType.arc:\n return ['innerRadius', 'outerRadius', 'startAngle', 'endAngle'].includes(channel);\n case GrammarMarkType.group:\n case GrammarMarkType.rect:\n case GrammarMarkType.image:\n return ['width', 'height', 'y1'].includes(channel);\n case GrammarMarkType.path:\n case GrammarMarkType.shape:\n return ['path', 'customPath'].includes(channel);\n case GrammarMarkType.line:\n return channel === 'defined';\n case GrammarMarkType.area:\n return ['x1', 'y1', 'defined'].includes(channel);\n case GrammarMarkType.rule:\n return ['x1', 'y1'].includes(channel);\n case GrammarMarkType.symbol:\n return channel === 'size';\n case GrammarMarkType.polygon:\n return channel === 'points';\n case GrammarMarkType.text:\n return channel === 'text';\n }\n\n return false;\n}\n\nexport function isPointsMarkType(markType: MarkType): boolean {\n return (\n [GrammarMarkType.line, GrammarMarkType.area, GrammarMarkType.largeRects, GrammarMarkType.largeSymbols] as MarkType[]\n ).includes(markType);\n}\n"]}
1
+ {"version":3,"sources":["../src/graph/attributes/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,UAAU,oBAAoB,CAAC,QAAkB,EAAE,QAAkB;IACzE,QAAQ,QAAQ,EAAE;QAChB,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3E,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QACvF,KAAK,YAAY;YACf,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/E,KAAK,cAAc;YACjB,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ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AE,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACxC,KAAK,eAAe,CAAC,MAAM;YACzB,OAAO,OAAO,KAAK,MAAM,CAAC;QAC5B,KAAK,eAAe,CAAC,OAAO;YAC1B,OAAO,OAAO,KAAK,QAAQ,CAAC;QAC9B,KAAK,eAAe,CAAC,IAAI;YACvB,OAAO,OAAO,KAAK,MAAM,CAAC;KAC7B;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,QAAkB;IACjD,OACE,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,UAAU,EAAE,eAAe,CAAC,YAAY,CACtG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACvB,CAAC","file":"helpers.js","sourcesContent":["import type { IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { isNil, isValidNumber } from '@visactor/vutils';\nimport type { MarkElementItem, MarkType } from '../../types';\nimport { GrammarMarkType } from '../enums';\n\nexport function isValidPointsChannel(channels: string[], markType: MarkType): boolean {\n switch (markType) {\n case 'line':\n return channels.some(channel => ['x', 'y', 'defined'].includes(channel));\n case 'area':\n return channels.some(channel => ['x', 'y', 'x1', 'y1', 'defined'].includes(channel));\n case 'largeRects':\n return channels.some(channel => ['x', 'y', 'width', 'y1'].includes(channel));\n case 'largeSymbols':\n return channels.some(channel => ['x', 'y'].includes(channel));\n }\n return false;\n}\n\n/**\n * 获取rule的points\n * 相对位置\n * @param {*} item\n * @returns\n */\nexport function getRulePoints(nextAttrs: { x: number; y: number; x1: number; y1: number }) {\n const { x, y, x1, y1 } = nextAttrs;\n\n if (!isValidNumber(x) || !isValidNumber(y) || !isValidNumber(x1) || !isValidNumber(y1)) {\n return [];\n }\n return [\n { x, y },\n { x: x1, y: y1 }\n ];\n}\n/**\n * 生成用于渲染的点数组\n * @param {*} item\n * @returns {IPointLike[]}\n */\nexport function getLinePoints(\n items?: MarkElementItem[],\n includeOnePoint?: boolean,\n lastPoints?: IPointLike[],\n isArea?: boolean\n) {\n if (!items || !items.length || (items.length === 1 && includeOnePoint)) {\n return [];\n }\n const hasValidChannel = items.some(item => {\n return isValidPointsChannel(Object.keys(item.nextAttrs), 'line');\n });\n if (!hasValidChannel) {\n return lastPoints ?? [];\n }\n return items.map((item, index) => {\n const attrs = item.nextAttrs;\n const { x, y, x1, y1, defined } = lastPoints?.[index] ?? {};\n if (isNil(attrs.x)) {\n attrs.x = x;\n }\n if (isNil(attrs.y)) {\n attrs.y = y;\n }\n\n if (isNil(attrs.defined) && defined === false) {\n attrs.defined = false;\n }\n\n attrs.context = item.key;\n\n if (isArea) {\n if (isNil(attrs.x1)) {\n attrs.x1 = x1;\n }\n if (isNil(attrs.y1)) {\n attrs.y1 = y1;\n }\n }\n\n return attrs;\n });\n}\n\nexport function getLargeRectsPoints(\n items?: MarkElementItem[],\n includeOnePoint?: boolean,\n lastPoints: Float32Array | number[] = []\n): Float32Array | number[] {\n if (!items || !items.length || (items.length === 1 && includeOnePoint)) {\n return [];\n }\n const arr: Float32Array = new Float32Array(items.length * 4);\n\n items.forEach((item, index) => {\n const attrs = item.nextAttrs;\n const x = attrs.x ?? lastPoints[index * 4];\n const y = attrs.y ?? lastPoints[index * 4 + 1];\n const width = attrs.width ?? lastPoints[index * 4 + 2];\n const y1 = attrs.y1 ?? lastPoints[index * 4 + 3];\n arr[index * 4] = x;\n arr[index * 4 + 1] = y;\n arr[index * 4 + 2] = width;\n arr[index * 4 + 3] = y1 - y;\n });\n\n return arr;\n}\n\nexport function getLargeSymbolsPoints(\n items?: MarkElementItem[],\n includeOnePoint?: boolean,\n lastPoints: Float32Array | number[] = []\n): Float32Array | number[] {\n if (!items || !items.length || (items.length === 1 && includeOnePoint)) {\n return [];\n }\n const arr: Float32Array = new Float32Array(items.length * 2);\n\n items.forEach((item, index) => {\n const attrs = item.nextAttrs;\n const x = attrs.x ?? lastPoints[index * 2];\n const y = attrs.y ?? lastPoints[index * 2 + 1];\n arr[index * 2] = x;\n arr[index * 2 + 1] = y;\n });\n\n return arr;\n}\n\nexport function isPositionOrSizeChannel(type: string, channel: string) {\n if (['x', 'y', 'dx', 'dy'].includes(channel)) {\n return true;\n }\n\n switch (type) {\n case GrammarMarkType.arc:\n return ['innerRadius', 'outerRadius', 'startAngle', 'endAngle'].includes(channel);\n case GrammarMarkType.group:\n case GrammarMarkType.rect:\n case GrammarMarkType.image:\n return ['width', 'height', 'y1'].includes(channel);\n case GrammarMarkType.path:\n case GrammarMarkType.shape:\n return ['path', 'customPath'].includes(channel);\n case GrammarMarkType.line:\n return channel === 'defined';\n case GrammarMarkType.area:\n return ['x1', 'y1', 'defined'].includes(channel);\n case GrammarMarkType.rule:\n return ['x1', 'y1'].includes(channel);\n case GrammarMarkType.symbol:\n return channel === 'size';\n case GrammarMarkType.polygon:\n return channel === 'points';\n case GrammarMarkType.text:\n return channel === 'text';\n }\n\n return false;\n}\n\nexport function isPointsMarkType(markType: MarkType): boolean {\n return (\n [GrammarMarkType.line, GrammarMarkType.area, GrammarMarkType.largeRects, GrammarMarkType.largeSymbols] as MarkType[]\n ).includes(markType);\n}\n"]}
@@ -95,7 +95,7 @@ export function cloneTransformAttributes(markType, attributes) {
95
95
 
96
96
  export const transformAttributes = (markType, nextAttrs, element, markName) => {
97
97
  const graphicAttributes = {}, changedKeys = nextAttrs ? Object.keys(nextAttrs) : [], transforms = isString(markType) ? transformsByType[markType] : markType;
98
- if (null == transforms ? void 0 : transforms.length) {
98
+ if (transforms && transforms.length) {
99
99
  const tags = [];
100
100
  changedKeys.forEach((key => {
101
101
  let isTransformed = !1;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph/attributes/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtF,OAAO,EAAE,eAAe,EAAE,MA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AAC,iBAAiB,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;iBAC7D;qBAAM;oBACL,iBAAiB,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;iBACzC;aACF;QACH,CAAC,CAAC,CAAC;KACJ;SAAM;QACL,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACxB,IAAI,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBAClC,wBAAwB,CAAC,iBAAiB,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;aAC7D;iBAAM;gBACL,iBAAiB,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;aACzC;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC","file":"transform.js","sourcesContent":["import { has, isNil, isPlainObject, isString, isValidNumber } from '@visactor/vutils';\nimport type { IElement, IGlyphElement } from '../../types/element';\nimport type { AttributeTransform, MarkType } from '../../types/mark';\nimport { GrammarMarkType } from '../enums';\nimport { getRulePoints } from './helpers';\nimport { commonAttributes, transformCommonAttribute } from './common';\n\nfunction storeOriginAttributes(\n name: string,\n channels: string[],\n graphicAttributes: any,\n nextAttrs: any,\n element: IElement,\n markName: string\n): Record<string, any> {\n const prevStoredAttrs = (element as IGlyphElement).getGraphicAttribute(name, false, markName);\n\n if (prevStoredAttrs) {\n channels.forEach(channel => {\n if (channel in nextAttrs) {\n prevStoredAttrs[channel] = nextAttrs[channel];\n }\n });\n\n return prevStoredAttrs;\n }\n const storedAttrs = {};\n channels.forEach(channel => {\n storedAttrs[channel] = nextAttrs[channel];\n });\n graphicAttributes[name] = storedAttrs;\n return storedAttrs;\n}\n\nexport const transformsByType: Record<string, AttributeTransform[]> = {\n rect3d: [\n {\n channels: ['x', 'y', 'z', 'x1', 'y1', 'width', 'height', 'length'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n // width\n if (isValidNumber(nextAttrs.width) || (!isValidNumber(nextAttrs.x1) && isValidNumber(storedAttrs.width))) {\n graphicAttributes.x = Math.min(storedAttrs.x ?? 0, storedAttrs.x1 ?? Infinity);\n graphicAttributes.width = storedAttrs.width;\n } else if (isValidNumber(nextAttrs.x1) || (!isValidNumber(nextAttrs.width) && isValidNumber(storedAttrs.x1))) {\n graphicAttributes.x = Math.min(storedAttrs.x, storedAttrs.x1);\n graphicAttributes.width = Math.abs(storedAttrs.x1 - storedAttrs.x);\n } else {\n graphicAttributes.x = Math.min(storedAttrs.x ?? 0, storedAttrs.x1 ?? Infinity);\n graphicAttributes.width = storedAttrs.width;\n }\n\n // height\n if (isValidNumber(nextAttrs.height) || (!isValidNumber(nextAttrs.y1) && isValidNumber(storedAttrs.height))) {\n graphicAttributes.y = Math.min(storedAttrs.y ?? 0, storedAttrs.y1 ?? Infinity);\n graphicAttributes.height = storedAttrs.height;\n } else if (isValidNumber(nextAttrs.y1) || (!isValidNumber(nextAttrs.height) && isValidNumber(storedAttrs.y1))) {\n graphicAttributes.y = Math.min(storedAttrs.y, storedAttrs.y1);\n graphicAttributes.height = Math.abs(storedAttrs.y1 - storedAttrs.y);\n } else {\n graphicAttributes.y = Math.min(storedAttrs.y ?? 0, storedAttrs.y1 ?? Infinity);\n graphicAttributes.height = storedAttrs.height;\n }\n\n // length\n if (isValidNumber(nextAttrs.length) || (!isValidNumber(nextAttrs.z1) && isValidNumber(storedAttrs.length))) {\n graphicAttributes.z = Math.min(storedAttrs.z ?? 0, storedAttrs.z1 ?? Infinity);\n graphicAttributes.length = storedAttrs.length;\n } else if (isValidNumber(nextAttrs.z1) || (!isValidNumber(nextAttrs.length) && isValidNumber(storedAttrs.z1))) {\n graphicAttributes.z = Math.min(storedAttrs.z, storedAttrs.z1);\n graphicAttributes.length = Math.abs(storedAttrs.z1 - storedAttrs.z);\n } else {\n graphicAttributes.z = Math.min(storedAttrs.z ?? 0, storedAttrs.z1 ?? Infinity);\n graphicAttributes.length = storedAttrs.length;\n }\n },\n storedAttrs: 'sizeAttrs'\n }\n ],\n [GrammarMarkType.text]: [\n {\n channels: ['text', 'limit', 'autoLimit', 'maxLineWidth'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n const limit = storedAttrs.limit ?? Infinity;\n const autoLimit = storedAttrs.autoLimit ?? Infinity;\n const maxWidth = Math.min(limit, autoLimit);\n const isTextConfig = isPlainObject(storedAttrs.text) && !isNil(storedAttrs.text.text);\n const text = isTextConfig ? storedAttrs.text.text : storedAttrs.text;\n\n if (Array.isArray(text)) {\n graphicAttributes.maxLineWidth = maxWidth === Infinity ? storedAttrs.maxLineWidth : maxWidth;\n } else {\n graphicAttributes.maxLineWidth = maxWidth === Infinity ? storedAttrs.maxLineWidth : maxWidth;\n }\n\n if (isTextConfig) {\n if (storedAttrs.text.type === 'html') {\n graphicAttributes.html = {\n dom: text,\n width: nextAttrs.width ?? maxWidth,\n height: nextAttrs.height ?? nextAttrs.fontSize,\n anchorType: 'position'\n };\n graphicAttributes.text = '';\n } else if (storedAttrs.text.type === 'rich') {\n graphicAttributes.textConfig = text;\n } else {\n graphicAttributes.text = text;\n }\n } else {\n graphicAttributes.text = text;\n }\n },\n storedAttrs: 'limitAttrs'\n }\n ],\n [GrammarMarkType.rule]: [\n {\n channels: ['x', 'y', 'x1', 'y1'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n const points = getRulePoints(storedAttrs);\n graphicAttributes.points = points;\n graphicAttributes.x = 0;\n graphicAttributes.y = 0;\n },\n storedAttrs: 'pointAttrs'\n }\n ],\n [GrammarMarkType.symbol]: [\n {\n channels: ['shape', 'symbolType'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n graphicAttributes.symbolType = nextAttrs.shape ?? nextAttrs.symbolType;\n }\n },\n {\n channels: ['image', 'fill', 'background'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n if (nextAttrs.image) {\n graphicAttributes.background = nextAttrs.image;\n graphicAttributes.fill = false;\n } else if (storedAttrs.image) {\n graphicAttributes.background = storedAttrs.image;\n graphicAttributes.fill = false;\n } else {\n graphicAttributes.fill = storedAttrs.fill;\n graphicAttributes.background = storedAttrs.background;\n }\n },\n storedAttrs: 'imageAttrs'\n }\n ],\n [GrammarMarkType.richtext]: [\n {\n channels: ['text', 'textConfig'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n graphicAttributes.text = null;\n\n if (nextAttrs.text?.type === 'rich') {\n graphicAttributes.textConfig = nextAttrs.text.text;\n } else if (nextAttrs.textConfig?.type === 'html') {\n graphicAttributes.html = {\n dom: nextAttrs.textConfig.text,\n width: nextAttrs.width,\n height: nextAttrs.height ?? nextAttrs.fontSize,\n anchorType: 'position'\n };\n graphicAttributes.text = '';\n } else if (nextAttrs.textConfig?.type === 'rich') {\n graphicAttributes.textConfig = nextAttrs.textConfig.text;\n } else {\n graphicAttributes.textConfig = nextAttrs.textConfig;\n }\n }\n }\n ]\n};\n\nexport function cloneTransformAttributes(markType: MarkType, attributes: any) {\n const transforms = transformsByType[markType] ?? [];\n return transforms.reduce((clonedAttributes, transform) => {\n transform.channels.forEach(channel => {\n if (has(attributes, channel)) {\n clonedAttributes[channel] = attributes[channel];\n }\n });\n return clonedAttributes;\n }, {} as any);\n}\n\nexport const transformAttributes = (\n markType: MarkType | AttributeTransform[],\n nextAttrs: any,\n element: IElement,\n markName?: string\n) => {\n const graphicAttributes = {};\n const changedKeys = nextAttrs ? Object.keys(nextAttrs) : [];\n const transforms: AttributeTransform[] = isString(markType)\n ? transformsByType[markType]\n : (markType as AttributeTransform[]);\n\n if (transforms?.length) {\n const tags: boolean[] = [];\n\n changedKeys.forEach(key => {\n let isTransformed = false;\n\n transforms.forEach((transform, index) => {\n if (transform.channels.includes(key)) {\n if (!tags[index]) {\n if (transform.storedAttrs) {\n const storedAttrs = storeOriginAttributes(\n transform.storedAttrs,\n transform.channels,\n graphicAttributes,\n nextAttrs,\n element,\n markName\n );\n transform.transform(graphicAttributes, nextAttrs, storedAttrs);\n } else {\n transform.transform(graphicAttributes, nextAttrs, null);\n }\n }\n // 记录一下,不重复处理\n tags[index] = true;\n isTransformed = true;\n }\n });\n\n if (!isTransformed) {\n if (commonAttributes.includes(key)) {\n transformCommonAttribute(graphicAttributes, key, nextAttrs);\n } else {\n graphicAttributes[key] = nextAttrs[key];\n }\n }\n });\n } else {\n changedKeys.forEach(key => {\n if (commonAttributes.includes(key)) {\n transformCommonAttribute(graphicAttributes, key, nextAttrs);\n } else {\n graphicAttributes[key] = nextAttrs[key];\n }\n });\n }\n\n return graphicAttributes;\n};\n"]}
1
+ {"version":3,"sources":["../src/graph/attributes/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtF,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEtE,SAAS,qBAAqB,CAC5B,IAAY,EACZ,QAAkB,EAClB,iBAAsB,EACtB,SAAc,EACd,OAAiB,EACjB,QAAgB;IAEhB,MAAM,eAAe,GAAI,OAAyB,CAAC,mBAAmB,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IAE9F,IAAI,eAAe,EAAE;QACnB,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACzB,IAAI,OAAO,IAAI,SAAS,EAAE;gBACxB,eAAe,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;aAC/C;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,eAAe,CAAC;KACxB;IACD,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,OAAO,CA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EAAE;wBAChB,IAAI,SAAS,CAAC,WAAW,EAAE;4BACzB,MAAM,WAAW,GAAG,qBAAqB,CACvC,SAAS,CAAC,WAAW,EACrB,SAAS,CAAC,QAAQ,EAClB,iBAAiB,EACjB,SAAS,EACT,OAAO,EACP,QAAQ,CACT,CAAC;4BACF,SAAS,CAAC,SAAS,CAAC,iBAAiB,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;yBAChE;6BAAM;4BACL,SAAS,CAAC,SAAS,CAAC,iBAAiB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;yBACzD;qBACF;oBAED,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;oBACnB,aAAa,GAAG,IAAI,CAAC;iBACtB;YACH,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,aAAa,EAAE;gBAClB,IAAI,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;oBAClC,wBAAwB,CAAC,iBAAiB,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;iBAC7D;qBAAM;oBACL,iBAAiB,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;iBACzC;aACF;QACH,CAAC,CAAC,CAAC;KACJ;SAAM;QACL,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACxB,IAAI,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBAClC,wBAAwB,CAAC,iBAAiB,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;aAC7D;iBAAM;gBACL,iBAAiB,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;aACzC;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC","file":"transform.js","sourcesContent":["import { has, isNil, isPlainObject, isString, isValidNumber } from '@visactor/vutils';\nimport type { IElement, IGlyphElement } from '../../types/element';\nimport type { AttributeTransform, MarkType } from '../../types/mark';\nimport { GrammarMarkType } from '../enums';\nimport { getRulePoints } from './helpers';\nimport { commonAttributes, transformCommonAttribute } from './common';\n\nfunction storeOriginAttributes(\n name: string,\n channels: string[],\n graphicAttributes: any,\n nextAttrs: any,\n element: IElement,\n markName: string\n): Record<string, any> {\n const prevStoredAttrs = (element as IGlyphElement).getGraphicAttribute(name, false, markName);\n\n if (prevStoredAttrs) {\n channels.forEach(channel => {\n if (channel in nextAttrs) {\n prevStoredAttrs[channel] = nextAttrs[channel];\n }\n });\n\n return prevStoredAttrs;\n }\n const storedAttrs = {};\n channels.forEach(channel => {\n storedAttrs[channel] = nextAttrs[channel];\n });\n graphicAttributes[name] = storedAttrs;\n return storedAttrs;\n}\n\nexport const transformsByType: Record<string, AttributeTransform[]> = {\n rect3d: [\n {\n channels: ['x', 'y', 'z', 'x1', 'y1', 'width', 'height', 'length'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n // width\n if (isValidNumber(nextAttrs.width) || (!isValidNumber(nextAttrs.x1) && isValidNumber(storedAttrs.width))) {\n graphicAttributes.x = Math.min(storedAttrs.x ?? 0, storedAttrs.x1 ?? Infinity);\n graphicAttributes.width = storedAttrs.width;\n } else if (isValidNumber(nextAttrs.x1) || (!isValidNumber(nextAttrs.width) && isValidNumber(storedAttrs.x1))) {\n graphicAttributes.x = Math.min(storedAttrs.x, storedAttrs.x1);\n graphicAttributes.width = Math.abs(storedAttrs.x1 - storedAttrs.x);\n } else {\n graphicAttributes.x = Math.min(storedAttrs.x ?? 0, storedAttrs.x1 ?? Infinity);\n graphicAttributes.width = storedAttrs.width;\n }\n\n // height\n if (isValidNumber(nextAttrs.height) || (!isValidNumber(nextAttrs.y1) && isValidNumber(storedAttrs.height))) {\n graphicAttributes.y = Math.min(storedAttrs.y ?? 0, storedAttrs.y1 ?? Infinity);\n graphicAttributes.height = storedAttrs.height;\n } else if (isValidNumber(nextAttrs.y1) || (!isValidNumber(nextAttrs.height) && isValidNumber(storedAttrs.y1))) {\n graphicAttributes.y = Math.min(storedAttrs.y, storedAttrs.y1);\n graphicAttributes.height = Math.abs(storedAttrs.y1 - storedAttrs.y);\n } else {\n graphicAttributes.y = Math.min(storedAttrs.y ?? 0, storedAttrs.y1 ?? Infinity);\n graphicAttributes.height = storedAttrs.height;\n }\n\n // length\n if (isValidNumber(nextAttrs.length) || (!isValidNumber(nextAttrs.z1) && isValidNumber(storedAttrs.length))) {\n graphicAttributes.z = Math.min(storedAttrs.z ?? 0, storedAttrs.z1 ?? Infinity);\n graphicAttributes.length = storedAttrs.length;\n } else if (isValidNumber(nextAttrs.z1) || (!isValidNumber(nextAttrs.length) && isValidNumber(storedAttrs.z1))) {\n graphicAttributes.z = Math.min(storedAttrs.z, storedAttrs.z1);\n graphicAttributes.length = Math.abs(storedAttrs.z1 - storedAttrs.z);\n } else {\n graphicAttributes.z = Math.min(storedAttrs.z ?? 0, storedAttrs.z1 ?? Infinity);\n graphicAttributes.length = storedAttrs.length;\n }\n },\n storedAttrs: 'sizeAttrs'\n }\n ],\n [GrammarMarkType.text]: [\n {\n channels: ['text', 'limit', 'autoLimit', 'maxLineWidth'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n const limit = storedAttrs.limit ?? Infinity;\n const autoLimit = storedAttrs.autoLimit ?? Infinity;\n const maxWidth = Math.min(limit, autoLimit);\n const isTextConfig = isPlainObject(storedAttrs.text) && !isNil(storedAttrs.text.text);\n const text = isTextConfig ? storedAttrs.text.text : storedAttrs.text;\n\n if (Array.isArray(text)) {\n graphicAttributes.maxLineWidth = maxWidth === Infinity ? storedAttrs.maxLineWidth : maxWidth;\n } else {\n graphicAttributes.maxLineWidth = maxWidth === Infinity ? storedAttrs.maxLineWidth : maxWidth;\n }\n\n if (isTextConfig) {\n if (storedAttrs.text.type === 'html') {\n graphicAttributes.html = {\n dom: text,\n width: nextAttrs.width ?? maxWidth,\n height: nextAttrs.height ?? nextAttrs.fontSize,\n anchorType: 'position'\n };\n graphicAttributes.text = '';\n } else if (storedAttrs.text.type === 'rich') {\n graphicAttributes.textConfig = text;\n } else {\n graphicAttributes.text = text;\n }\n } else {\n graphicAttributes.text = text;\n }\n },\n storedAttrs: 'limitAttrs'\n }\n ],\n [GrammarMarkType.rule]: [\n {\n channels: ['x', 'y', 'x1', 'y1'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n const points = getRulePoints(storedAttrs);\n graphicAttributes.points = points;\n graphicAttributes.x = 0;\n graphicAttributes.y = 0;\n },\n storedAttrs: 'pointAttrs'\n }\n ],\n [GrammarMarkType.symbol]: [\n {\n channels: ['shape', 'symbolType'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n graphicAttributes.symbolType = nextAttrs.shape ?? nextAttrs.symbolType;\n }\n },\n {\n channels: ['image', 'fill', 'background'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n if (nextAttrs.image) {\n graphicAttributes.background = nextAttrs.image;\n graphicAttributes.fill = false;\n } else if (storedAttrs.image) {\n graphicAttributes.background = storedAttrs.image;\n graphicAttributes.fill = false;\n } else {\n graphicAttributes.fill = storedAttrs.fill;\n graphicAttributes.background = storedAttrs.background;\n }\n },\n storedAttrs: 'imageAttrs'\n }\n ],\n [GrammarMarkType.richtext]: [\n {\n channels: ['text', 'textConfig'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n graphicAttributes.text = null;\n\n if (nextAttrs.text?.type === 'rich') {\n graphicAttributes.textConfig = nextAttrs.text.text;\n } else if (nextAttrs.textConfig?.type === 'html') {\n graphicAttributes.html = {\n dom: nextAttrs.textConfig.text,\n width: nextAttrs.width,\n height: nextAttrs.height ?? nextAttrs.fontSize,\n anchorType: 'position'\n };\n graphicAttributes.text = '';\n } else if (nextAttrs.textConfig?.type === 'rich') {\n graphicAttributes.textConfig = nextAttrs.textConfig.text;\n } else {\n graphicAttributes.textConfig = nextAttrs.textConfig;\n }\n }\n }\n ]\n};\n\nexport function cloneTransformAttributes(markType: MarkType, attributes: any) {\n const transforms = transformsByType[markType] ?? [];\n return transforms.reduce((clonedAttributes, transform) => {\n transform.channels.forEach(channel => {\n if (has(attributes, channel)) {\n clonedAttributes[channel] = attributes[channel];\n }\n });\n return clonedAttributes;\n }, {} as any);\n}\n\nexport const transformAttributes = (\n markType: MarkType | AttributeTransform[],\n nextAttrs: any,\n element: IElement,\n markName?: string\n) => {\n const graphicAttributes = {};\n const changedKeys = nextAttrs ? Object.keys(nextAttrs) : [];\n const transforms: AttributeTransform[] = isString(markType)\n ? transformsByType[markType]\n : (markType as AttributeTransform[]);\n\n if (transforms && transforms.length) {\n const tags: boolean[] = [];\n\n changedKeys.forEach(key => {\n let isTransformed = false;\n\n transforms.forEach((transform, index) => {\n if (transform.channels.includes(key)) {\n if (!tags[index]) {\n if (transform.storedAttrs) {\n const storedAttrs = storeOriginAttributes(\n transform.storedAttrs,\n transform.channels,\n graphicAttributes,\n nextAttrs,\n element,\n markName\n );\n transform.transform(graphicAttributes, nextAttrs, storedAttrs);\n } else {\n transform.transform(graphicAttributes, nextAttrs, null);\n }\n }\n // 记录一下,不重复处理\n tags[index] = true;\n isTransformed = true;\n }\n });\n\n if (!isTransformed) {\n if (commonAttributes.includes(key)) {\n transformCommonAttribute(graphicAttributes, key, nextAttrs);\n } else {\n graphicAttributes[key] = nextAttrs[key];\n }\n }\n });\n } else {\n changedKeys.forEach(key => {\n if (commonAttributes.includes(key)) {\n transformCommonAttribute(graphicAttributes, key, nextAttrs);\n } else {\n graphicAttributes[key] = nextAttrs[key];\n }\n });\n }\n\n return graphicAttributes;\n};\n"]}
@@ -191,7 +191,7 @@ export class Element {
191
191
  var _a, _b, _c, _d;
192
192
  const item = items[0];
193
193
  if (!item.nextAttrs || 0 === Object.keys(item.nextAttrs).length) return {};
194
- let nextAttrs = null == item ? void 0 : item.nextAttrs;
194
+ let nextAttrs = item.nextAttrs;
195
195
  if (isPointsMarkType(markType) && items && items.length && isNil(null === (_a = item.nextAttrs) || void 0 === _a ? void 0 : _a.points) && (!0 === computePoints || isValidPointsChannel(Object.keys(item.nextAttrs), this.mark.markType))) {
196
196
  const lastPoints = this.getGraphicAttribute("points", !1), lastSegments = this.getGraphicAttribute("segments", !1), enableSegments = this.mark.getSpec().enableSegments, itemNextAttrs = items.map((item => item.nextAttrs)), isProgressive = this.mark.isProgressive();
197
197
  if (nextAttrs = parseCollectionMarkAttributes(nextAttrs), markType === GrammarMarkType.line || markType === GrammarMarkType.area) {