@visactor/vgrammar-core 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/cjs/component/axis.js +9 -9
  2. package/cjs/component/axis.js.map +1 -1
  3. package/cjs/component/datazoom.js +9 -9
  4. package/cjs/component/datazoom.js.map +1 -1
  5. package/cjs/component/grid.js +18 -18
  6. package/cjs/component/grid.js.map +1 -1
  7. package/cjs/component/label.js +27 -22
  8. package/cjs/component/label.js.map +1 -1
  9. package/cjs/component/legend.js +13 -13
  10. package/cjs/component/legend.js.map +1 -1
  11. package/cjs/component/scrollbar.js +7 -7
  12. package/cjs/component/scrollbar.js.map +1 -1
  13. package/cjs/component/slider.js +5 -5
  14. package/cjs/component/slider.js.map +1 -1
  15. package/cjs/component/title.js +5 -5
  16. package/cjs/component/title.js.map +1 -1
  17. package/cjs/core/factory.d.ts +5 -1
  18. package/cjs/core/factory.js +13 -3
  19. package/cjs/core/factory.js.map +1 -1
  20. package/cjs/graph/animation/animate.d.ts +1 -0
  21. package/cjs/graph/animation/animate.js +4 -0
  22. package/cjs/graph/animation/animate.js.map +1 -1
  23. package/cjs/graph/animation/animation/move.js +10 -8
  24. package/cjs/graph/animation/animation/move.js.map +1 -1
  25. package/cjs/graph/attributes/common.js +2 -10
  26. package/cjs/graph/attributes/common.js.map +1 -1
  27. package/cjs/graph/attributes/helpers.d.ts +2 -2
  28. package/cjs/graph/attributes/helpers.js +50 -17
  29. package/cjs/graph/attributes/helpers.js.map +1 -1
  30. package/cjs/graph/attributes/index.d.ts +4 -10
  31. package/cjs/graph/attributes/index.js +16 -251
  32. package/cjs/graph/attributes/index.js.map +1 -1
  33. package/cjs/graph/attributes/line.d.ts +3 -0
  34. package/cjs/graph/attributes/line.js +46 -0
  35. package/cjs/graph/attributes/line.js.map +1 -0
  36. package/cjs/graph/attributes/transform.d.ts +5 -0
  37. package/cjs/graph/attributes/transform.js +167 -0
  38. package/cjs/graph/attributes/transform.js.map +1 -0
  39. package/cjs/graph/canvas-renderer.js +1 -1
  40. package/cjs/graph/canvas-renderer.js.map +1 -1
  41. package/cjs/graph/constants.d.ts +0 -1
  42. package/cjs/graph/constants.js +2 -3
  43. package/cjs/graph/constants.js.map +1 -1
  44. package/cjs/graph/element.js +12 -14
  45. package/cjs/graph/element.js.map +1 -1
  46. package/cjs/graph/glyph-element.js +6 -7
  47. package/cjs/graph/glyph-element.js.map +1 -1
  48. package/cjs/graph/layout/relative.js.map +1 -1
  49. package/cjs/graph/mark/encode.js +4 -4
  50. package/cjs/graph/mark/encode.js.map +1 -1
  51. package/cjs/index.d.ts +3 -1
  52. package/cjs/index.js +3 -2
  53. package/cjs/index.js.map +1 -1
  54. package/cjs/interactions/base.js.map +1 -1
  55. package/cjs/interactions/brush-base.js +2 -2
  56. package/cjs/interactions/brush-base.js.map +1 -1
  57. package/cjs/interactions/brush-filter.js +2 -2
  58. package/cjs/interactions/brush-filter.js.map +1 -1
  59. package/cjs/interactions/crosshair.d.ts +1 -1
  60. package/cjs/interactions/crosshair.js +15 -15
  61. package/cjs/interactions/crosshair.js.map +1 -1
  62. package/cjs/interactions/datazoom-filter.js +3 -3
  63. package/cjs/interactions/datazoom-filter.js.map +1 -1
  64. package/cjs/interactions/drill-down.js +2 -2
  65. package/cjs/interactions/drill-down.js.map +1 -1
  66. package/cjs/interactions/legend-filter.js +3 -3
  67. package/cjs/interactions/legend-filter.js.map +1 -1
  68. package/cjs/interactions/player-filter.js +3 -3
  69. package/cjs/interactions/player-filter.js.map +1 -1
  70. package/cjs/interactions/roll-up.js +2 -2
  71. package/cjs/interactions/roll-up.js.map +1 -1
  72. package/cjs/interactions/scrollbar-filter.js +3 -3
  73. package/cjs/interactions/scrollbar-filter.js.map +1 -1
  74. package/cjs/interactions/slider-filter.js +3 -3
  75. package/cjs/interactions/slider-filter.js.map +1 -1
  76. package/cjs/parse/view.js +1 -1
  77. package/cjs/parse/view.js.map +1 -1
  78. package/cjs/semantic-marks/cell.d.ts +3 -1
  79. package/cjs/semantic-marks/cell.js +10 -4
  80. package/cjs/semantic-marks/cell.js.map +1 -1
  81. package/cjs/semantic-marks/interval.d.ts +2 -0
  82. package/cjs/semantic-marks/interval.js +10 -4
  83. package/cjs/semantic-marks/interval.js.map +1 -1
  84. package/cjs/semantic-marks/text.d.ts +1 -0
  85. package/cjs/semantic-marks/text.js +3 -3
  86. package/cjs/semantic-marks/text.js.map +1 -1
  87. package/cjs/theme/common/component.d.ts +2 -1
  88. package/cjs/theme/common/component.js +13 -1
  89. package/cjs/theme/common/component.js.map +1 -1
  90. package/cjs/theme/dark.js.map +1 -1
  91. package/cjs/transforms/data/sampling.d.ts +2 -0
  92. package/cjs/transforms/data/sampling.js +111 -0
  93. package/cjs/transforms/data/sampling.js.map +1 -0
  94. package/cjs/transforms/index.d.ts +1 -1
  95. package/cjs/transforms/index.js +6 -6
  96. package/cjs/transforms/index.js.map +1 -1
  97. package/cjs/transforms/util/util.d.ts +4 -0
  98. package/cjs/transforms/util/util.js +20 -2
  99. package/cjs/transforms/util/util.js.map +1 -1
  100. package/cjs/types/animate.d.ts +6 -1
  101. package/cjs/types/animate.js.map +1 -1
  102. package/cjs/types/grammar.d.ts +1 -1
  103. package/cjs/types/grammar.js.map +1 -1
  104. package/cjs/types/mark.d.ts +5 -1
  105. package/cjs/types/mark.js.map +1 -1
  106. package/cjs/types/theme.d.ts +2 -1
  107. package/cjs/types/theme.js.map +1 -1
  108. package/cjs/types/transform.d.ts +5 -5
  109. package/cjs/types/transform.js.map +1 -1
  110. package/cjs/types/view.d.ts +2 -0
  111. package/cjs/types/view.js.map +1 -1
  112. package/cjs/view/View.d.ts +0 -1
  113. package/cjs/view/View.js +18 -27
  114. package/cjs/view/View.js.map +1 -1
  115. package/cjs/view/animate.d.ts +1 -0
  116. package/cjs/view/animate.js +12 -12
  117. package/cjs/view/animate.js.map +1 -1
  118. package/cjs/view/constants.d.ts +0 -3
  119. package/cjs/view/constants.js +2 -3
  120. package/cjs/view/constants.js.map +1 -1
  121. package/cjs/view/dataflow.d.ts +1 -0
  122. package/cjs/view/dataflow.js +9 -4
  123. package/cjs/view/dataflow.js.map +1 -1
  124. package/cjs/view/grammar-record.js +5 -5
  125. package/cjs/view/grammar-record.js.map +1 -1
  126. package/cjs/view/mark.js +1 -1
  127. package/cjs/view/mark.js.map +1 -1
  128. package/es/component/axis.js +1 -1
  129. package/es/component/axis.js.map +1 -1
  130. package/es/component/datazoom.js +5 -5
  131. package/es/component/datazoom.js.map +1 -1
  132. package/es/component/grid.js +1 -1
  133. package/es/component/grid.js.map +1 -1
  134. package/es/component/label.js +13 -8
  135. package/es/component/label.js.map +1 -1
  136. package/es/component/legend.js +1 -1
  137. package/es/component/legend.js.map +1 -1
  138. package/es/component/scrollbar.js +1 -1
  139. package/es/component/scrollbar.js.map +1 -1
  140. package/es/component/slider.js +1 -1
  141. package/es/component/slider.js.map +1 -1
  142. package/es/component/title.js +1 -1
  143. package/es/component/title.js.map +1 -1
  144. package/es/core/factory.d.ts +5 -1
  145. package/es/core/factory.js +11 -1
  146. package/es/core/factory.js.map +1 -1
  147. package/es/graph/animation/animate.d.ts +1 -0
  148. package/es/graph/animation/animate.js +4 -0
  149. package/es/graph/animation/animate.js.map +1 -1
  150. package/es/graph/animation/animation/move.js +5 -5
  151. package/es/graph/animation/animation/move.js.map +1 -1
  152. package/es/graph/attributes/common.js +2 -7
  153. package/es/graph/attributes/common.js.map +1 -1
  154. package/es/graph/attributes/helpers.d.ts +2 -2
  155. package/es/graph/attributes/helpers.js +46 -12
  156. package/es/graph/attributes/helpers.js.map +1 -1
  157. package/es/graph/attributes/index.d.ts +4 -10
  158. package/es/graph/attributes/index.js +4 -227
  159. package/es/graph/attributes/index.js.map +1 -1
  160. package/es/graph/attributes/line.d.ts +3 -0
  161. package/es/graph/attributes/line.js +42 -0
  162. package/es/graph/attributes/line.js.map +1 -0
  163. package/es/graph/attributes/transform.d.ts +5 -0
  164. package/es/graph/attributes/transform.js +153 -0
  165. package/es/graph/attributes/transform.js.map +1 -0
  166. package/es/graph/canvas-renderer.js +1 -1
  167. package/es/graph/canvas-renderer.js.map +1 -1
  168. package/es/graph/constants.d.ts +0 -1
  169. package/es/graph/constants.js +0 -2
  170. package/es/graph/constants.js.map +1 -1
  171. package/es/graph/element.js +11 -11
  172. package/es/graph/element.js.map +1 -1
  173. package/es/graph/glyph-element.js +3 -4
  174. package/es/graph/glyph-element.js.map +1 -1
  175. package/es/graph/layout/relative.js.map +1 -1
  176. package/es/graph/mark/encode.js +1 -1
  177. package/es/graph/mark/encode.js.map +1 -1
  178. package/es/index.d.ts +3 -1
  179. package/es/index.js +5 -1
  180. package/es/index.js.map +1 -1
  181. package/es/interactions/base.js.map +1 -1
  182. package/es/interactions/brush-base.js +1 -1
  183. package/es/interactions/brush-base.js.map +1 -1
  184. package/es/interactions/brush-filter.js +2 -3
  185. package/es/interactions/brush-filter.js.map +1 -1
  186. package/es/interactions/crosshair.d.ts +1 -1
  187. package/es/interactions/crosshair.js +1 -1
  188. package/es/interactions/crosshair.js.map +1 -1
  189. package/es/interactions/datazoom-filter.js +1 -1
  190. package/es/interactions/datazoom-filter.js.map +1 -1
  191. package/es/interactions/drill-down.js +1 -1
  192. package/es/interactions/drill-down.js.map +1 -1
  193. package/es/interactions/element-highlight-by-group.js +2 -1
  194. package/es/interactions/index.js +1 -2
  195. package/es/interactions/legend-filter.js +2 -2
  196. package/es/interactions/legend-filter.js.map +1 -1
  197. package/es/interactions/player-filter.js +2 -2
  198. package/es/interactions/player-filter.js.map +1 -1
  199. package/es/interactions/roll-up.js +2 -2
  200. package/es/interactions/roll-up.js.map +1 -1
  201. package/es/interactions/scrollbar-filter.js +2 -2
  202. package/es/interactions/scrollbar-filter.js.map +1 -1
  203. package/es/interactions/slider-filter.js +2 -2
  204. package/es/interactions/slider-filter.js.map +1 -1
  205. package/es/interactions/tooltip.js +1 -1
  206. package/es/interactions/view-drag-mixin.js +1 -1
  207. package/es/parse/coordinate.js +1 -1
  208. package/es/parse/event.js +1 -1
  209. package/es/parse/mark.js +1 -1
  210. package/es/parse/option.js +1 -1
  211. package/es/parse/scale.js +2 -1
  212. package/es/parse/transform.js +1 -1
  213. package/es/parse/util.js +1 -1
  214. package/es/parse/view.js +2 -2
  215. package/es/parse/view.js.map +1 -1
  216. package/es/semantic-marks/cell.d.ts +3 -1
  217. package/es/semantic-marks/cell.js +11 -1
  218. package/es/semantic-marks/cell.js.map +1 -1
  219. package/es/semantic-marks/interval.d.ts +2 -0
  220. package/es/semantic-marks/interval.js +9 -1
  221. package/es/semantic-marks/interval.js.map +1 -1
  222. package/es/semantic-marks/text.d.ts +1 -0
  223. package/es/semantic-marks/text.js +3 -1
  224. package/es/semantic-marks/text.js.map +1 -1
  225. package/es/theme/common/component.d.ts +2 -1
  226. package/es/theme/common/component.js +14 -0
  227. package/es/theme/common/component.js.map +1 -1
  228. package/es/theme/dark.js.map +1 -1
  229. package/es/transforms/data/sampling.d.ts +2 -0
  230. package/es/transforms/data/sampling.js +105 -0
  231. package/es/transforms/data/sampling.js.map +1 -0
  232. package/es/transforms/index.d.ts +1 -1
  233. package/es/transforms/index.js +4 -4
  234. package/es/transforms/index.js.map +1 -1
  235. package/es/transforms/util/util.d.ts +4 -0
  236. package/es/transforms/util/util.js +17 -0
  237. package/es/transforms/util/util.js.map +1 -1
  238. package/es/types/animate.d.ts +6 -1
  239. package/es/types/animate.js.map +1 -1
  240. package/es/types/grammar.d.ts +1 -1
  241. package/es/types/grammar.js.map +1 -1
  242. package/es/types/mark.d.ts +5 -1
  243. package/es/types/mark.js.map +1 -1
  244. package/es/types/theme.d.ts +2 -1
  245. package/es/types/theme.js.map +1 -1
  246. package/es/types/transform.d.ts +5 -5
  247. package/es/types/transform.js.map +1 -1
  248. package/es/types/view.d.ts +2 -0
  249. package/es/types/view.js.map +1 -1
  250. package/es/view/View.d.ts +0 -1
  251. package/es/view/View.js +15 -29
  252. package/es/view/View.js.map +1 -1
  253. package/es/view/animate.d.ts +1 -0
  254. package/es/view/animate.js +6 -6
  255. package/es/view/animate.js.map +1 -1
  256. package/es/view/constants.d.ts +0 -3
  257. package/es/view/constants.js +0 -6
  258. package/es/view/constants.js.map +1 -1
  259. package/es/view/dataflow.d.ts +1 -0
  260. package/es/view/dataflow.js +9 -4
  261. package/es/view/dataflow.js.map +1 -1
  262. package/es/view/grammar-record.js +1 -1
  263. package/es/view/grammar-record.js.map +1 -1
  264. package/es/view/mark.js +1 -1
  265. package/es/view/mark.js.map +1 -1
  266. package/package.json +9 -9
  267. package/cjs/transforms/mark/lttb-sample.d.ts +0 -2
  268. package/cjs/transforms/mark/lttb-sample.js +0 -68
  269. package/cjs/transforms/mark/lttb-sample.js.map +0 -1
  270. package/es/transforms/mark/lttb-sample.d.ts +0 -2
  271. package/es/transforms/mark/lttb-sample.js +0 -60
  272. package/es/transforms/mark/lttb-sample.js.map +0 -1
@@ -1,231 +1,8 @@
1
- import { has, isNil, isPlainObject, isString, isValidNumber } from "@visactor/vutils";
1
+ export * from "./common";
2
2
 
3
- import { transformCommonAttribute, commonAttributes } from "./common";
3
+ export * from "./helpers";
4
4
 
5
- import { getRulePoints } from "./helpers";
5
+ export * from "./line";
6
6
 
7
- import { GrammarMarkType } from "../enums";
8
-
9
- export { transformCommonAttribute };
10
-
11
- export function isPointsMarkType(markType) {
12
- return [ GrammarMarkType.line, GrammarMarkType.area, GrammarMarkType.largeRects, GrammarMarkType.largeSymbols ].includes(markType);
13
- }
14
-
15
- function storeOriginAttributes(name, channels, graphicAttributes, nextAttrs, element, markName) {
16
- var _a;
17
- const prevStoredAttrs = null !== (_a = element.getGraphicAttribute(name, !1, markName)) && void 0 !== _a ? _a : {}, storedAttrs = {};
18
- return channels.forEach((channel => {
19
- var _a;
20
- storedAttrs[channel] = null !== (_a = nextAttrs[channel]) && void 0 !== _a ? _a : prevStoredAttrs[channel];
21
- })), graphicAttributes[name] = storedAttrs, storedAttrs;
22
- }
23
-
24
- export const transformsByType = {
25
- [GrammarMarkType.largeRects]: [ {
26
- channels: [ "x", "y", "y1", "x1", "width", "height" ],
27
- transform: (graphicAttributes, nextAttrs, storedAttrs) => {
28
- graphicAttributes.x = 0, graphicAttributes.y = 0;
29
- }
30
- } ],
31
- [GrammarMarkType.largeSymbols]: [ {
32
- channels: [ "x", "y", "size" ],
33
- transform: (graphicAttributes, nextAttrs, storedAttrs) => {
34
- graphicAttributes.x = 0, graphicAttributes.y = 0;
35
- }
36
- } ],
37
- [GrammarMarkType.area]: [ {
38
- channels: [ "x", "y", "x1", "y1" ],
39
- transform: (graphicAttributes, nextAttrs, storedAttrs) => {
40
- graphicAttributes.x = 0, graphicAttributes.y = 0, graphicAttributes.x1 = 0, graphicAttributes.y1 = 0;
41
- }
42
- } ],
43
- [GrammarMarkType.line]: [ {
44
- channels: [ "x", "y", "defined", "enableSegments" ],
45
- transform: (graphicAttributes, nextAttrs, storedAttrs) => {
46
- graphicAttributes.x = 0, graphicAttributes.y = 0;
47
- }
48
- } ],
49
- [GrammarMarkType.rect]: [ {
50
- channels: [ "x", "y", "x1", "y1", "width", "height" ],
51
- transform: (graphicAttributes, nextAttrs, storedAttrs) => {
52
- var _a, _b, _c, _d, _e, _f, _g, _h;
53
- isValidNumber(nextAttrs.width) || !isValidNumber(nextAttrs.x1) && isValidNumber(storedAttrs.width) ? (graphicAttributes.x = Math.min(null !== (_a = storedAttrs.x) && void 0 !== _a ? _a : 0, null !== (_b = storedAttrs.x1) && void 0 !== _b ? _b : 1 / 0),
54
- graphicAttributes.width = storedAttrs.width) : isValidNumber(nextAttrs.x1) || !isValidNumber(nextAttrs.width) && isValidNumber(storedAttrs.x1) ? (graphicAttributes.x = Math.min(storedAttrs.x, storedAttrs.x1),
55
- graphicAttributes.width = Math.abs(storedAttrs.x1 - storedAttrs.x)) : (graphicAttributes.x = Math.min(null !== (_c = storedAttrs.x) && void 0 !== _c ? _c : 0, null !== (_d = storedAttrs.x1) && void 0 !== _d ? _d : 1 / 0),
56
- graphicAttributes.width = storedAttrs.width), isValidNumber(nextAttrs.height) || !isValidNumber(nextAttrs.y1) && isValidNumber(storedAttrs.height) ? (graphicAttributes.y = Math.min(null !== (_e = storedAttrs.y) && void 0 !== _e ? _e : 0, null !== (_f = storedAttrs.y1) && void 0 !== _f ? _f : 1 / 0),
57
- graphicAttributes.height = storedAttrs.height) : isValidNumber(nextAttrs.y1) || !isValidNumber(nextAttrs.height) && isValidNumber(storedAttrs.y1) ? (graphicAttributes.y = Math.min(storedAttrs.y, storedAttrs.y1),
58
- graphicAttributes.height = Math.abs(storedAttrs.y1 - storedAttrs.y)) : (graphicAttributes.y = Math.min(null !== (_g = storedAttrs.y) && void 0 !== _g ? _g : 0, null !== (_h = storedAttrs.y1) && void 0 !== _h ? _h : 1 / 0),
59
- graphicAttributes.height = storedAttrs.height);
60
- },
61
- storedAttrs: "sizeAttrs"
62
- } ],
63
- rect3d: [ {
64
- channels: [ "x", "y", "z", "x1", "y1", "width", "height", "length" ],
65
- transform: (graphicAttributes, nextAttrs, storedAttrs) => {
66
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
67
- isValidNumber(nextAttrs.width) || !isValidNumber(nextAttrs.x1) && isValidNumber(storedAttrs.width) ? (graphicAttributes.x = Math.min(null !== (_a = storedAttrs.x) && void 0 !== _a ? _a : 0, null !== (_b = storedAttrs.x1) && void 0 !== _b ? _b : 1 / 0),
68
- graphicAttributes.width = storedAttrs.width) : isValidNumber(nextAttrs.x1) || !isValidNumber(nextAttrs.width) && isValidNumber(storedAttrs.x1) ? (graphicAttributes.x = Math.min(storedAttrs.x, storedAttrs.x1),
69
- graphicAttributes.width = Math.abs(storedAttrs.x1 - storedAttrs.x)) : (graphicAttributes.x = Math.min(null !== (_c = storedAttrs.x) && void 0 !== _c ? _c : 0, null !== (_d = storedAttrs.x1) && void 0 !== _d ? _d : 1 / 0),
70
- graphicAttributes.width = storedAttrs.width), isValidNumber(nextAttrs.height) || !isValidNumber(nextAttrs.y1) && isValidNumber(storedAttrs.height) ? (graphicAttributes.y = Math.min(null !== (_e = storedAttrs.y) && void 0 !== _e ? _e : 0, null !== (_f = storedAttrs.y1) && void 0 !== _f ? _f : 1 / 0),
71
- graphicAttributes.height = storedAttrs.height) : isValidNumber(nextAttrs.y1) || !isValidNumber(nextAttrs.height) && isValidNumber(storedAttrs.y1) ? (graphicAttributes.y = Math.min(storedAttrs.y, storedAttrs.y1),
72
- graphicAttributes.height = Math.abs(storedAttrs.y1 - storedAttrs.y)) : (graphicAttributes.y = Math.min(null !== (_g = storedAttrs.y) && void 0 !== _g ? _g : 0, null !== (_h = storedAttrs.y1) && void 0 !== _h ? _h : 1 / 0),
73
- graphicAttributes.height = storedAttrs.height), isValidNumber(nextAttrs.length) || !isValidNumber(nextAttrs.z1) && isValidNumber(storedAttrs.length) ? (graphicAttributes.z = Math.min(null !== (_j = storedAttrs.z) && void 0 !== _j ? _j : 0, null !== (_k = storedAttrs.z1) && void 0 !== _k ? _k : 1 / 0),
74
- graphicAttributes.length = storedAttrs.length) : isValidNumber(nextAttrs.z1) || !isValidNumber(nextAttrs.length) && isValidNumber(storedAttrs.z1) ? (graphicAttributes.z = Math.min(storedAttrs.z, storedAttrs.z1),
75
- graphicAttributes.length = Math.abs(storedAttrs.z1 - storedAttrs.z)) : (graphicAttributes.z = Math.min(null !== (_l = storedAttrs.z) && void 0 !== _l ? _l : 0, null !== (_m = storedAttrs.z1) && void 0 !== _m ? _m : 1 / 0),
76
- graphicAttributes.length = storedAttrs.length);
77
- },
78
- storedAttrs: "sizeAttrs"
79
- } ],
80
- [GrammarMarkType.text]: [ {
81
- channels: [ "text", "limit", "autoLimit", "maxLineWidth" ],
82
- transform: (graphicAttributes, nextAttrs, storedAttrs) => {
83
- var _a, _b, _c, _d;
84
- const limit = null !== (_a = storedAttrs.limit) && void 0 !== _a ? _a : 1 / 0, autoLimit = null !== (_b = storedAttrs.autoLimit) && void 0 !== _b ? _b : 1 / 0, maxWidth = Math.min(limit, autoLimit), isTextConfig = isPlainObject(storedAttrs.text) && !isNil(storedAttrs.text.text), text = isTextConfig ? storedAttrs.text.text : storedAttrs.text;
85
- Array.isArray(text), graphicAttributes.maxLineWidth = maxWidth === 1 / 0 ? storedAttrs.maxLineWidth : maxWidth,
86
- isTextConfig ? "html" === storedAttrs.text.type ? (graphicAttributes.html = {
87
- dom: text,
88
- width: null !== (_c = nextAttrs.width) && void 0 !== _c ? _c : maxWidth,
89
- height: null !== (_d = nextAttrs.height) && void 0 !== _d ? _d : nextAttrs.fontSize,
90
- anchorType: "position"
91
- }, graphicAttributes.text = "") : "rich" === storedAttrs.text.type ? graphicAttributes.textConfig = text : graphicAttributes.text = text : graphicAttributes.text = text;
92
- },
93
- storedAttrs: "limitAttrs"
94
- } ],
95
- [GrammarMarkType.rule]: [ {
96
- channels: [ "x", "y", "x1", "y1" ],
97
- transform: (graphicAttributes, nextAttrs, storedAttrs) => {
98
- const points = getRulePoints(storedAttrs);
99
- graphicAttributes.points = points, graphicAttributes.x = 0, graphicAttributes.y = 0;
100
- },
101
- storedAttrs: "pointAttrs"
102
- } ],
103
- [GrammarMarkType.symbol]: [ {
104
- channels: [ "shape", "symbolType" ],
105
- transform: (graphicAttributes, nextAttrs, storedAttrs) => {
106
- var _a;
107
- graphicAttributes.symbolType = null !== (_a = nextAttrs.shape) && void 0 !== _a ? _a : nextAttrs.symbolType;
108
- }
109
- }, {
110
- channels: [ "image", "fill", "background" ],
111
- transform: (graphicAttributes, nextAttrs, storedAttrs) => {
112
- nextAttrs.image ? (graphicAttributes.background = nextAttrs.image, graphicAttributes.fill = !1) : storedAttrs.image ? (graphicAttributes.background = storedAttrs.image,
113
- graphicAttributes.fill = !1) : (graphicAttributes.fill = storedAttrs.fill, graphicAttributes.background = storedAttrs.background);
114
- },
115
- storedAttrs: "imageAttrs"
116
- } ],
117
- [GrammarMarkType.richtext]: [ {
118
- channels: [ "text", "textConfig" ],
119
- transform: (graphicAttributes, nextAttrs, storedAttrs) => {
120
- var _a, _b, _c, _d;
121
- graphicAttributes.text = null, "rich" === (null === (_a = nextAttrs.text) || void 0 === _a ? void 0 : _a.type) ? graphicAttributes.textConfig = nextAttrs.text.text : "html" === (null === (_b = nextAttrs.textConfig) || void 0 === _b ? void 0 : _b.type) ? (graphicAttributes.html = {
122
- dom: nextAttrs.textConfig.text,
123
- width: nextAttrs.width,
124
- height: null !== (_c = nextAttrs.height) && void 0 !== _c ? _c : nextAttrs.fontSize,
125
- anchorType: "position"
126
- }, graphicAttributes.text = "") : "rich" === (null === (_d = nextAttrs.textConfig) || void 0 === _d ? void 0 : _d.type) ? graphicAttributes.textConfig = nextAttrs.textConfig.text : graphicAttributes.textConfig = nextAttrs.textConfig;
127
- }
128
- } ]
129
- };
130
-
131
- export function cloneTransformAttributes(markType, attributes) {
132
- var _a;
133
- return (null !== (_a = transformsByType[markType]) && void 0 !== _a ? _a : []).reduce(((clonedAttributes, transform) => (transform.channels.forEach((channel => {
134
- has(attributes, channel) && (clonedAttributes[channel] = attributes[channel]);
135
- })), clonedAttributes)), {});
136
- }
137
-
138
- export const transformAttributes = (markType, nextAttrs, element, markName) => {
139
- const graphicAttributes = {}, changedKeys = nextAttrs ? Object.keys(nextAttrs) : [], transforms = isString(markType) ? transformsByType[markType] : markType;
140
- if (null == transforms ? void 0 : transforms.length) {
141
- const tags = [];
142
- changedKeys.forEach((key => {
143
- let isTransformed = !1;
144
- transforms.forEach(((transform, index) => {
145
- if (transform.channels.includes(key)) {
146
- if (!tags[index]) if (transform.storedAttrs) {
147
- const storedAttrs = storeOriginAttributes(transform.storedAttrs, transform.channels, graphicAttributes, nextAttrs, element, markName);
148
- transform.transform(graphicAttributes, nextAttrs, storedAttrs);
149
- } else transform.transform(graphicAttributes, nextAttrs, null);
150
- tags[index] = !0, isTransformed = !0;
151
- }
152
- })), isTransformed || (commonAttributes.includes(key) ? transformCommonAttribute(graphicAttributes, key, nextAttrs) : graphicAttributes[key] = nextAttrs[key]);
153
- }));
154
- } else changedKeys.forEach((key => {
155
- commonAttributes.includes(key) ? transformCommonAttribute(graphicAttributes, key, nextAttrs) : graphicAttributes[key] = nextAttrs[key];
156
- }));
157
- return graphicAttributes;
158
- };
159
-
160
- const isStopsEqual = (prev, next) => {
161
- var _a, _b;
162
- if (prev === next) return !0;
163
- const prevLength = null !== (_a = prev && prev.length) && void 0 !== _a ? _a : 0;
164
- return prevLength === (null !== (_b = next && next.length) && void 0 !== _b ? _b : 0) && 0 !== prevLength && prev.every(((prevEntry, prevIndex) => !prevEntry && !next[prevIndex] || prevEntry && next[prevIndex] && prevEntry.color === next[prevIndex].color && prevEntry.offset === next[prevIndex].offset));
165
- }, isColorAttrEqual = (prev, next) => {
166
- if (prev === next) return !0;
167
- if (typeof prev != typeof next) return !1;
168
- if (isString(prev)) return !1;
169
- if (prev.gradient !== next.gradient) return !1;
170
- const prevKeys = Object.keys(prev), nextKeys = Object.keys(next);
171
- return prevKeys.length === nextKeys.length && prevKeys.every((key => "stops" === key ? isStopsEqual(prev[key], next[key]) : prev[key] === next[key]));
172
- }, isLineDashEqual = (prev, next) => prev.length === next.length && prev.join("-") === next.join("-"), isSegmentAttrEqual = (prev, next, key) => !(!isNil(prev) || !isNil(next)) || !isNil(prev) && (!isNil(next) && ("lineDash" === key ? isLineDashEqual(prev, next) : "stroke" === key || "fill" === key ? isColorAttrEqual(prev, next) : prev === next)), fillAttrs = [ "fill", "fillOpacity", "background", "texture", "texturePadding", "textureSize", "textureColor" ], strokeAttrs = [ "stroke", "strokeOpacity", "lineDash", "lineDashOffset", "lineCap", "lineJoin", "lineWidth", "miterLimit" ], areaAttrs = fillAttrs.concat(strokeAttrs);
173
-
174
- export function getLineSegmentConfigs(items, points, element) {
175
- var _a;
176
- if (!items || items.length <= 1) return null;
177
- const checkAttributes = "area" === (null === (_a = null == element ? void 0 : element.mark) || void 0 === _a ? void 0 : _a.markType) ? areaAttrs : strokeAttrs, segments = [];
178
- let prevSegmentAttrs = null;
179
- return items.forEach(((item, index) => {
180
- prevSegmentAttrs && checkAttributes.every((key => isSegmentAttrEqual(prevSegmentAttrs[key], item[key], key))) || (segments.length && (segments[segments.length - 1].endIndex = index),
181
- prevSegmentAttrs = item, segments.push({
182
- attrs: prevSegmentAttrs,
183
- startIndex: index
184
- }));
185
- })), segments.length >= 2 ? segments.map((entry => {
186
- const res = transformAttributes(GrammarMarkType.line, entry.attrs, element);
187
- return res.points = points.slice(entry.startIndex, isNil(entry.endIndex) ? points.length : entry.endIndex),
188
- res;
189
- })) : null;
190
- }
191
-
192
- export function getLinePointsFromSegments(segments) {
193
- return segments ? segments.reduce(((points, segment) => points.concat(segment.points)), []) : null;
194
- }
195
-
196
- export function isPositionOrSizeChannel(type, channel) {
197
- if ([ "x", "y", "dx", "dy" ].includes(channel)) return !0;
198
- switch (type) {
199
- case GrammarMarkType.arc:
200
- return [ "innerRadius", "outerRadius", "startAngle", "endAngle" ].includes(channel);
201
-
202
- case GrammarMarkType.group:
203
- case GrammarMarkType.rect:
204
- case GrammarMarkType.image:
205
- return [ "width", "height", "y1" ].includes(channel);
206
-
207
- case GrammarMarkType.path:
208
- case GrammarMarkType.shape:
209
- return [ "path", "customPath" ].includes(channel);
210
-
211
- case GrammarMarkType.line:
212
- return "defined" === channel;
213
-
214
- case GrammarMarkType.area:
215
- return [ "x1", "y1", "defined" ].includes(channel);
216
-
217
- case GrammarMarkType.rule:
218
- return [ "x1", "y1" ].includes(channel);
219
-
220
- case GrammarMarkType.symbol:
221
- return "size" === channel;
222
-
223
- case GrammarMarkType.polygon:
224
- return "points" === channel;
225
-
226
- case GrammarMarkType.text:
227
- return "text" === channel;
228
- }
229
- return !1;
230
- }
7
+ export * from "./transform";
231
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph/attributes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC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,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","file":"index.js","sourcesContent":["import { has, isNil, isPlainObject, isString, isValidNumber } from '@visactor/vutils';\nimport type { IColor, IColorStop } from '@visactor/vrender-core';\nimport { transformCommonAttribute, commonAttributes } from './common';\nimport { getRulePoints } from './helpers';\nimport { GrammarMarkType } from '../enums';\nimport type { AttributeTransform, IElement, IGlyphElement, MarkType } from '../../types';\n\nexport { transformCommonAttribute };\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\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 const storedAttrs = {};\n channels.forEach(channel => {\n storedAttrs[channel] = nextAttrs[channel] ?? prevStoredAttrs[channel];\n });\n graphicAttributes[name] = storedAttrs;\n return storedAttrs;\n}\n\nexport const transformsByType: Record<string, AttributeTransform[]> = {\n [GrammarMarkType.largeRects]: [\n {\n channels: ['x', 'y', 'y1', 'x1', 'width', 'height'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n graphicAttributes.x = 0;\n graphicAttributes.y = 0;\n }\n }\n ],\n [GrammarMarkType.largeSymbols]: [\n {\n channels: ['x', 'y', 'size'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n graphicAttributes.x = 0;\n graphicAttributes.y = 0;\n }\n }\n ],\n [GrammarMarkType.area]: [\n {\n channels: ['x', 'y', 'x1', 'y1'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n graphicAttributes.x = 0;\n graphicAttributes.y = 0;\n graphicAttributes.x1 = 0;\n graphicAttributes.y1 = 0;\n }\n }\n ],\n [GrammarMarkType.line]: [\n {\n channels: ['x', 'y', 'defined', 'enableSegments'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n graphicAttributes.x = 0;\n graphicAttributes.y = 0;\n }\n }\n ],\n [GrammarMarkType.rect]: [\n {\n channels: ['x', 'y', 'x1', 'y1', 'width', 'height'],\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 storedAttrs: 'sizeAttrs'\n }\n ],\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\nconst isStopsEqual = (prev: IColorStop[], next: IColorStop[]) => {\n if (prev === next) {\n return true;\n }\n const prevLength = (prev && prev.length) ?? 0;\n const nextLength = (next && next.length) ?? 0;\n\n if (prevLength !== nextLength || prevLength === 0) {\n return false;\n }\n\n return prev.every((prevEntry, prevIndex) => {\n return (\n (!prevEntry && !next[prevIndex]) ||\n (prevEntry &&\n next[prevIndex] &&\n prevEntry.color === next[prevIndex].color &&\n prevEntry.offset === next[prevIndex].offset)\n );\n });\n};\n\nconst isColorAttrEqual = (prev: IColor, next: IColor) => {\n if (prev === next) {\n return true;\n }\n\n if (typeof prev !== typeof next) {\n return false;\n }\n\n if (isString(prev)) {\n return false;\n }\n\n if (prev.gradient !== (next as any).gradient) {\n return false;\n }\n\n const prevKeys = Object.keys(prev);\n const nextKeys = Object.keys(next);\n\n if (prevKeys.length !== nextKeys.length) {\n return false;\n }\n\n return prevKeys.every(key => {\n if (key === 'stops') {\n return isStopsEqual(prev[key], next[key]);\n }\n\n return prev[key] === next[key];\n });\n};\n\nconst isLineDashEqual = (prev: number[], next: number[]) => {\n if (prev.length !== next.length) {\n return false;\n }\n\n if (prev.join('-') === next.join('-')) {\n return true;\n }\n\n return false;\n};\n\nconst isSegmentAttrEqual = (prev: any, next: any, key: string) => {\n if (isNil(prev) && isNil(next)) {\n return true;\n }\n\n if (isNil(prev)) {\n return false;\n }\n\n if (isNil(next)) {\n return false;\n }\n\n if (key === 'lineDash') {\n return isLineDashEqual(prev, next);\n }\n\n if (key === 'stroke' || key === 'fill') {\n return isColorAttrEqual(prev, next);\n }\n\n return prev === next;\n};\n\nconst fillAttrs = ['fill', 'fillOpacity', 'background', 'texture', 'texturePadding', 'textureSize', 'textureColor'];\nconst strokeAttrs = [\n 'stroke',\n 'strokeOpacity',\n 'lineDash',\n 'lineDashOffset',\n 'lineCap',\n 'lineJoin',\n 'lineWidth',\n 'miterLimit'\n];\nconst areaAttrs = fillAttrs.concat(strokeAttrs);\n\n/**\n * 生成用于渲染的点数组\n * @param {*} item\n * @returns {IPointLike[]}\n */\nexport function getLineSegmentConfigs(items: any[], points: any[], element?: IElement) {\n if (!items || items.length <= 1) {\n return null;\n }\n\n const checkAttributes = element?.mark?.markType === 'area' ? areaAttrs : strokeAttrs;\n\n const segments: any[] = [];\n let prevSegmentAttrs: any = null;\n\n items.forEach((item, index) => {\n if (\n !prevSegmentAttrs ||\n !checkAttributes.every(key => {\n return isSegmentAttrEqual(prevSegmentAttrs[key], item[key], key);\n })\n ) {\n if (segments.length) {\n segments[segments.length - 1].endIndex = index;\n }\n\n prevSegmentAttrs = item;\n segments.push({\n attrs: prevSegmentAttrs,\n startIndex: index\n });\n }\n });\n\n if (segments.length >= 2) {\n return segments.map(entry => {\n const res = transformAttributes(GrammarMarkType.line, entry.attrs, element) as any;\n\n res.points = points.slice(entry.startIndex, isNil(entry.endIndex) ? points.length : entry.endIndex);\n return res;\n });\n }\n\n return null;\n}\n\nexport function getLinePointsFromSegments(segments: any[]) {\n if (!segments) {\n return null;\n }\n return segments.reduce((points, segment) => {\n return points.concat(segment.points);\n }, []);\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"]}
1
+ {"version":3,"sources":["../src/graph/attributes/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC","file":"index.js","sourcesContent":["export * from './common';\nexport * from './helpers';\nexport * from './line';\nexport * from './transform';\n"]}
@@ -0,0 +1,3 @@
1
+ import type { IElement } from '../../types';
2
+ export declare function getLineSegmentConfigs(items: any[], points: any[], element?: IElement): any[];
3
+ export declare function getLinePointsFromSegments(segments: any[]): any;
@@ -0,0 +1,42 @@
1
+ import { isNil, isString } from "@visactor/vutils";
2
+
3
+ import { transformAttributes } from "./transform";
4
+
5
+ import { GrammarMarkType } from "../enums";
6
+
7
+ const isStopsEqual = (prev, next) => {
8
+ var _a, _b;
9
+ if (prev === next) return !0;
10
+ const prevLength = null !== (_a = prev && prev.length) && void 0 !== _a ? _a : 0;
11
+ return prevLength === (null !== (_b = next && next.length) && void 0 !== _b ? _b : 0) && 0 !== prevLength && prev.every(((prevEntry, prevIndex) => !prevEntry && !next[prevIndex] || prevEntry && next[prevIndex] && prevEntry.color === next[prevIndex].color && prevEntry.offset === next[prevIndex].offset));
12
+ }, isColorAttrEqual = (prev, next) => {
13
+ if (prev === next) return !0;
14
+ if (typeof prev != typeof next) return !1;
15
+ if (isString(prev)) return !1;
16
+ if (prev.gradient !== next.gradient) return !1;
17
+ const prevKeys = Object.keys(prev), nextKeys = Object.keys(next);
18
+ return prevKeys.length === nextKeys.length && prevKeys.every((key => "stops" === key ? isStopsEqual(prev[key], next[key]) : prev[key] === next[key]));
19
+ }, isLineDashEqual = (prev, next) => prev.length === next.length && prev.join("-") === next.join("-"), isSegmentAttrEqual = (prev, next, key) => !(!isNil(prev) || !isNil(next)) || !isNil(prev) && (!isNil(next) && ("lineDash" === key ? isLineDashEqual(prev, next) : "stroke" === key || "fill" === key ? isColorAttrEqual(prev, next) : prev === next)), fillAttrs = [ "fill", "fillOpacity", "background", "texture", "texturePadding", "textureSize", "textureColor" ], strokeAttrs = [ "stroke", "strokeOpacity", "lineDash", "lineDashOffset", "lineCap", "lineJoin", "lineWidth", "miterLimit" ], areaAttrs = fillAttrs.concat(strokeAttrs);
20
+
21
+ export function getLineSegmentConfigs(items, points, element) {
22
+ var _a;
23
+ if (!items || items.length <= 1) return null;
24
+ const checkAttributes = "area" === (null === (_a = null == element ? void 0 : element.mark) || void 0 === _a ? void 0 : _a.markType) ? areaAttrs : strokeAttrs, segments = [];
25
+ let prevSegmentAttrs = null;
26
+ return items.forEach(((item, index) => {
27
+ prevSegmentAttrs && checkAttributes.every((key => isSegmentAttrEqual(prevSegmentAttrs[key], item[key], key))) || (segments.length && (segments[segments.length - 1].endIndex = index),
28
+ prevSegmentAttrs = item, segments.push({
29
+ attrs: prevSegmentAttrs,
30
+ startIndex: index
31
+ }));
32
+ })), segments.length >= 2 ? segments.map((entry => {
33
+ const res = transformAttributes(GrammarMarkType.line, entry.attrs, element);
34
+ return res.points = points.slice(entry.startIndex, isNil(entry.endIndex) ? points.length : entry.endIndex),
35
+ res;
36
+ })) : null;
37
+ }
38
+
39
+ export function getLinePointsFromSegments(segments) {
40
+ return segments ? segments.reduce(((points, segment) => points.concat(segment.points)), []) : null;
41
+ }
42
+ //# sourceMappingURL=line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/graph/attributes/line.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C,MAAM,YAAY,GAAG,CAAC,IAAkB,EAAE,IAAkB,EAAE,EAAE;;IAC9D,IAAI,IAAI,KAAK,IAAI,EAAE;QACjB,OAAO,IAAI,CAAC;KACb;IACD,MAAM,UAAU,GAAG,MAAA,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,mCAAI,CAAC,CAAC;IAC9C,MAAM,UAAU,GAAG,MAAA,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,mCAAI,CAAC,CAAC;IAE9C,IAAI,UAAU,KAAK,UAAU,IAAI,UAAU,KAAK,CAAC,EAAE;QACjD,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE;QACzC,OAAO,CACL,CAAC,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAChC,CAAC,SAAS;gBACR,IAAI,CAAC,SAAS,CAAC;gBACf,SAAS,CAAC,KAAK,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK;gBACzC,SAAS,CAAC,MAAM,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAC/C,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,IAAY,EAAE,EAAE;IACtD,IAAI,IAAI,KAAK,IAAI,EAAE;QACjB,OAAO,IAAI,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AAC;IACvC,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC","file":"line.js","sourcesContent":["import type { IColor, IColorStop } from '@visactor/vrender-core';\nimport { isNil, isString } from '@visactor/vutils';\nimport { transformAttributes } from './transform';\nimport { GrammarMarkType } from '../enums';\nimport type { IElement } from '../../types';\n\nconst isStopsEqual = (prev: IColorStop[], next: IColorStop[]) => {\n if (prev === next) {\n return true;\n }\n const prevLength = (prev && prev.length) ?? 0;\n const nextLength = (next && next.length) ?? 0;\n\n if (prevLength !== nextLength || prevLength === 0) {\n return false;\n }\n\n return prev.every((prevEntry, prevIndex) => {\n return (\n (!prevEntry && !next[prevIndex]) ||\n (prevEntry &&\n next[prevIndex] &&\n prevEntry.color === next[prevIndex].color &&\n prevEntry.offset === next[prevIndex].offset)\n );\n });\n};\n\nconst isColorAttrEqual = (prev: IColor, next: IColor) => {\n if (prev === next) {\n return true;\n }\n\n if (typeof prev !== typeof next) {\n return false;\n }\n\n if (isString(prev)) {\n return false;\n }\n\n if (prev.gradient !== (next as any).gradient) {\n return false;\n }\n\n const prevKeys = Object.keys(prev);\n const nextKeys = Object.keys(next);\n\n if (prevKeys.length !== nextKeys.length) {\n return false;\n }\n\n return prevKeys.every(key => {\n if (key === 'stops') {\n return isStopsEqual(prev[key], next[key]);\n }\n\n return prev[key] === next[key];\n });\n};\n\nconst isLineDashEqual = (prev: number[], next: number[]) => {\n if (prev.length !== next.length) {\n return false;\n }\n\n if (prev.join('-') === next.join('-')) {\n return true;\n }\n\n return false;\n};\n\nconst isSegmentAttrEqual = (prev: any, next: any, key: string) => {\n if (isNil(prev) && isNil(next)) {\n return true;\n }\n\n if (isNil(prev)) {\n return false;\n }\n\n if (isNil(next)) {\n return false;\n }\n\n if (key === 'lineDash') {\n return isLineDashEqual(prev, next);\n }\n\n if (key === 'stroke' || key === 'fill') {\n return isColorAttrEqual(prev, next);\n }\n\n return prev === next;\n};\n\nconst fillAttrs = ['fill', 'fillOpacity', 'background', 'texture', 'texturePadding', 'textureSize', 'textureColor'];\nconst strokeAttrs = [\n 'stroke',\n 'strokeOpacity',\n 'lineDash',\n 'lineDashOffset',\n 'lineCap',\n 'lineJoin',\n 'lineWidth',\n 'miterLimit'\n];\nconst areaAttrs = fillAttrs.concat(strokeAttrs);\n\n/**\n * 生成用于渲染的点数组\n * @param {*} item\n * @returns {IPointLike[]}\n */\nexport function getLineSegmentConfigs(items: any[], points: any[], element?: IElement) {\n if (!items || items.length <= 1) {\n return null;\n }\n\n const checkAttributes = element?.mark?.markType === 'area' ? areaAttrs : strokeAttrs;\n\n const segments: any[] = [];\n let prevSegmentAttrs: any = null;\n\n items.forEach((item, index) => {\n if (\n !prevSegmentAttrs ||\n !checkAttributes.every(key => {\n return isSegmentAttrEqual(prevSegmentAttrs[key], item[key], key);\n })\n ) {\n if (segments.length) {\n segments[segments.length - 1].endIndex = index;\n }\n\n prevSegmentAttrs = item;\n segments.push({\n attrs: prevSegmentAttrs,\n startIndex: index\n });\n }\n });\n\n if (segments.length >= 2) {\n return segments.map(entry => {\n const res = transformAttributes(GrammarMarkType.line, entry.attrs, element) as any;\n\n res.points = points.slice(entry.startIndex, isNil(entry.endIndex) ? points.length : entry.endIndex);\n return res;\n });\n }\n\n return null;\n}\n\nexport function getLinePointsFromSegments(segments: any[]) {\n if (!segments) {\n return null;\n }\n return segments.reduce((points, segment) => {\n return points.concat(segment.points);\n }, []);\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import type { IElement } from '../../types/element';
2
+ import type { AttributeTransform, MarkType } from '../../types/mark';
3
+ export declare const transformsByType: Record<string, AttributeTransform[]>;
4
+ export declare function cloneTransformAttributes(markType: MarkType, attributes: any): any;
5
+ export declare const transformAttributes: (markType: MarkType | AttributeTransform[], nextAttrs: any, element: IElement, markName?: string) => {};
@@ -0,0 +1,153 @@
1
+ import { has, isNil, isPlainObject, isString, isValidNumber } from "@visactor/vutils";
2
+
3
+ import { GrammarMarkType } from "../enums";
4
+
5
+ import { getRulePoints } from "./helpers";
6
+
7
+ import { commonAttributes, transformCommonAttribute } from "./common";
8
+
9
+ function storeOriginAttributes(name, channels, graphicAttributes, nextAttrs, element, markName) {
10
+ var _a;
11
+ const prevStoredAttrs = null !== (_a = element.getGraphicAttribute(name, !1, markName)) && void 0 !== _a ? _a : {}, storedAttrs = {};
12
+ return channels.forEach((channel => {
13
+ var _a;
14
+ storedAttrs[channel] = null !== (_a = nextAttrs[channel]) && void 0 !== _a ? _a : prevStoredAttrs[channel];
15
+ })), graphicAttributes[name] = storedAttrs, storedAttrs;
16
+ }
17
+
18
+ export const transformsByType = {
19
+ [GrammarMarkType.largeRects]: [ {
20
+ channels: [ "x", "y", "y1", "x1", "width", "height" ],
21
+ transform: (graphicAttributes, nextAttrs, storedAttrs) => {
22
+ graphicAttributes.x = 0, graphicAttributes.y = 0;
23
+ }
24
+ } ],
25
+ [GrammarMarkType.largeSymbols]: [ {
26
+ channels: [ "x", "y", "size" ],
27
+ transform: (graphicAttributes, nextAttrs, storedAttrs) => {
28
+ graphicAttributes.x = 0, graphicAttributes.y = 0;
29
+ }
30
+ } ],
31
+ [GrammarMarkType.area]: [ {
32
+ channels: [ "x", "y", "x1", "y1" ],
33
+ transform: (graphicAttributes, nextAttrs, storedAttrs) => {
34
+ graphicAttributes.x = 0, graphicAttributes.y = 0, graphicAttributes.x1 = 0, graphicAttributes.y1 = 0;
35
+ }
36
+ } ],
37
+ [GrammarMarkType.line]: [ {
38
+ channels: [ "x", "y", "defined", "enableSegments" ],
39
+ transform: (graphicAttributes, nextAttrs, storedAttrs) => {
40
+ graphicAttributes.x = 0, graphicAttributes.y = 0;
41
+ }
42
+ } ],
43
+ [GrammarMarkType.rect]: [ {
44
+ channels: [ "x", "y", "x1", "y1", "width", "height" ],
45
+ transform: (graphicAttributes, nextAttrs, storedAttrs) => {
46
+ var _a, _b, _c, _d, _e, _f, _g, _h;
47
+ isValidNumber(nextAttrs.width) || !isValidNumber(nextAttrs.x1) && isValidNumber(storedAttrs.width) ? (graphicAttributes.x = Math.min(null !== (_a = storedAttrs.x) && void 0 !== _a ? _a : 0, null !== (_b = storedAttrs.x1) && void 0 !== _b ? _b : 1 / 0),
48
+ graphicAttributes.width = storedAttrs.width) : isValidNumber(nextAttrs.x1) || !isValidNumber(nextAttrs.width) && isValidNumber(storedAttrs.x1) ? (graphicAttributes.x = Math.min(storedAttrs.x, storedAttrs.x1),
49
+ graphicAttributes.width = Math.abs(storedAttrs.x1 - storedAttrs.x)) : (graphicAttributes.x = Math.min(null !== (_c = storedAttrs.x) && void 0 !== _c ? _c : 0, null !== (_d = storedAttrs.x1) && void 0 !== _d ? _d : 1 / 0),
50
+ graphicAttributes.width = storedAttrs.width), isValidNumber(nextAttrs.height) || !isValidNumber(nextAttrs.y1) && isValidNumber(storedAttrs.height) ? (graphicAttributes.y = Math.min(null !== (_e = storedAttrs.y) && void 0 !== _e ? _e : 0, null !== (_f = storedAttrs.y1) && void 0 !== _f ? _f : 1 / 0),
51
+ graphicAttributes.height = storedAttrs.height) : isValidNumber(nextAttrs.y1) || !isValidNumber(nextAttrs.height) && isValidNumber(storedAttrs.y1) ? (graphicAttributes.y = Math.min(storedAttrs.y, storedAttrs.y1),
52
+ graphicAttributes.height = Math.abs(storedAttrs.y1 - storedAttrs.y)) : (graphicAttributes.y = Math.min(null !== (_g = storedAttrs.y) && void 0 !== _g ? _g : 0, null !== (_h = storedAttrs.y1) && void 0 !== _h ? _h : 1 / 0),
53
+ graphicAttributes.height = storedAttrs.height);
54
+ },
55
+ storedAttrs: "sizeAttrs"
56
+ } ],
57
+ rect3d: [ {
58
+ channels: [ "x", "y", "z", "x1", "y1", "width", "height", "length" ],
59
+ transform: (graphicAttributes, nextAttrs, storedAttrs) => {
60
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
61
+ isValidNumber(nextAttrs.width) || !isValidNumber(nextAttrs.x1) && isValidNumber(storedAttrs.width) ? (graphicAttributes.x = Math.min(null !== (_a = storedAttrs.x) && void 0 !== _a ? _a : 0, null !== (_b = storedAttrs.x1) && void 0 !== _b ? _b : 1 / 0),
62
+ graphicAttributes.width = storedAttrs.width) : isValidNumber(nextAttrs.x1) || !isValidNumber(nextAttrs.width) && isValidNumber(storedAttrs.x1) ? (graphicAttributes.x = Math.min(storedAttrs.x, storedAttrs.x1),
63
+ graphicAttributes.width = Math.abs(storedAttrs.x1 - storedAttrs.x)) : (graphicAttributes.x = Math.min(null !== (_c = storedAttrs.x) && void 0 !== _c ? _c : 0, null !== (_d = storedAttrs.x1) && void 0 !== _d ? _d : 1 / 0),
64
+ graphicAttributes.width = storedAttrs.width), isValidNumber(nextAttrs.height) || !isValidNumber(nextAttrs.y1) && isValidNumber(storedAttrs.height) ? (graphicAttributes.y = Math.min(null !== (_e = storedAttrs.y) && void 0 !== _e ? _e : 0, null !== (_f = storedAttrs.y1) && void 0 !== _f ? _f : 1 / 0),
65
+ graphicAttributes.height = storedAttrs.height) : isValidNumber(nextAttrs.y1) || !isValidNumber(nextAttrs.height) && isValidNumber(storedAttrs.y1) ? (graphicAttributes.y = Math.min(storedAttrs.y, storedAttrs.y1),
66
+ graphicAttributes.height = Math.abs(storedAttrs.y1 - storedAttrs.y)) : (graphicAttributes.y = Math.min(null !== (_g = storedAttrs.y) && void 0 !== _g ? _g : 0, null !== (_h = storedAttrs.y1) && void 0 !== _h ? _h : 1 / 0),
67
+ graphicAttributes.height = storedAttrs.height), isValidNumber(nextAttrs.length) || !isValidNumber(nextAttrs.z1) && isValidNumber(storedAttrs.length) ? (graphicAttributes.z = Math.min(null !== (_j = storedAttrs.z) && void 0 !== _j ? _j : 0, null !== (_k = storedAttrs.z1) && void 0 !== _k ? _k : 1 / 0),
68
+ graphicAttributes.length = storedAttrs.length) : isValidNumber(nextAttrs.z1) || !isValidNumber(nextAttrs.length) && isValidNumber(storedAttrs.z1) ? (graphicAttributes.z = Math.min(storedAttrs.z, storedAttrs.z1),
69
+ graphicAttributes.length = Math.abs(storedAttrs.z1 - storedAttrs.z)) : (graphicAttributes.z = Math.min(null !== (_l = storedAttrs.z) && void 0 !== _l ? _l : 0, null !== (_m = storedAttrs.z1) && void 0 !== _m ? _m : 1 / 0),
70
+ graphicAttributes.length = storedAttrs.length);
71
+ },
72
+ storedAttrs: "sizeAttrs"
73
+ } ],
74
+ [GrammarMarkType.text]: [ {
75
+ channels: [ "text", "limit", "autoLimit", "maxLineWidth" ],
76
+ transform: (graphicAttributes, nextAttrs, storedAttrs) => {
77
+ var _a, _b, _c, _d;
78
+ const limit = null !== (_a = storedAttrs.limit) && void 0 !== _a ? _a : 1 / 0, autoLimit = null !== (_b = storedAttrs.autoLimit) && void 0 !== _b ? _b : 1 / 0, maxWidth = Math.min(limit, autoLimit), isTextConfig = isPlainObject(storedAttrs.text) && !isNil(storedAttrs.text.text), text = isTextConfig ? storedAttrs.text.text : storedAttrs.text;
79
+ Array.isArray(text), graphicAttributes.maxLineWidth = maxWidth === 1 / 0 ? storedAttrs.maxLineWidth : maxWidth,
80
+ isTextConfig ? "html" === storedAttrs.text.type ? (graphicAttributes.html = {
81
+ dom: text,
82
+ width: null !== (_c = nextAttrs.width) && void 0 !== _c ? _c : maxWidth,
83
+ height: null !== (_d = nextAttrs.height) && void 0 !== _d ? _d : nextAttrs.fontSize,
84
+ anchorType: "position"
85
+ }, graphicAttributes.text = "") : "rich" === storedAttrs.text.type ? graphicAttributes.textConfig = text : graphicAttributes.text = text : graphicAttributes.text = text;
86
+ },
87
+ storedAttrs: "limitAttrs"
88
+ } ],
89
+ [GrammarMarkType.rule]: [ {
90
+ channels: [ "x", "y", "x1", "y1" ],
91
+ transform: (graphicAttributes, nextAttrs, storedAttrs) => {
92
+ const points = getRulePoints(storedAttrs);
93
+ graphicAttributes.points = points, graphicAttributes.x = 0, graphicAttributes.y = 0;
94
+ },
95
+ storedAttrs: "pointAttrs"
96
+ } ],
97
+ [GrammarMarkType.symbol]: [ {
98
+ channels: [ "shape", "symbolType" ],
99
+ transform: (graphicAttributes, nextAttrs, storedAttrs) => {
100
+ var _a;
101
+ graphicAttributes.symbolType = null !== (_a = nextAttrs.shape) && void 0 !== _a ? _a : nextAttrs.symbolType;
102
+ }
103
+ }, {
104
+ channels: [ "image", "fill", "background" ],
105
+ transform: (graphicAttributes, nextAttrs, storedAttrs) => {
106
+ nextAttrs.image ? (graphicAttributes.background = nextAttrs.image, graphicAttributes.fill = !1) : storedAttrs.image ? (graphicAttributes.background = storedAttrs.image,
107
+ graphicAttributes.fill = !1) : (graphicAttributes.fill = storedAttrs.fill, graphicAttributes.background = storedAttrs.background);
108
+ },
109
+ storedAttrs: "imageAttrs"
110
+ } ],
111
+ [GrammarMarkType.richtext]: [ {
112
+ channels: [ "text", "textConfig" ],
113
+ transform: (graphicAttributes, nextAttrs, storedAttrs) => {
114
+ var _a, _b, _c, _d;
115
+ graphicAttributes.text = null, "rich" === (null === (_a = nextAttrs.text) || void 0 === _a ? void 0 : _a.type) ? graphicAttributes.textConfig = nextAttrs.text.text : "html" === (null === (_b = nextAttrs.textConfig) || void 0 === _b ? void 0 : _b.type) ? (graphicAttributes.html = {
116
+ dom: nextAttrs.textConfig.text,
117
+ width: nextAttrs.width,
118
+ height: null !== (_c = nextAttrs.height) && void 0 !== _c ? _c : nextAttrs.fontSize,
119
+ anchorType: "position"
120
+ }, graphicAttributes.text = "") : "rich" === (null === (_d = nextAttrs.textConfig) || void 0 === _d ? void 0 : _d.type) ? graphicAttributes.textConfig = nextAttrs.textConfig.text : graphicAttributes.textConfig = nextAttrs.textConfig;
121
+ }
122
+ } ]
123
+ };
124
+
125
+ export function cloneTransformAttributes(markType, attributes) {
126
+ var _a;
127
+ return (null !== (_a = transformsByType[markType]) && void 0 !== _a ? _a : []).reduce(((clonedAttributes, transform) => (transform.channels.forEach((channel => {
128
+ has(attributes, channel) && (clonedAttributes[channel] = attributes[channel]);
129
+ })), clonedAttributes)), {});
130
+ }
131
+
132
+ export const transformAttributes = (markType, nextAttrs, element, markName) => {
133
+ const graphicAttributes = {}, changedKeys = nextAttrs ? Object.keys(nextAttrs) : [], transforms = isString(markType) ? transformsByType[markType] : markType;
134
+ if (null == transforms ? void 0 : transforms.length) {
135
+ const tags = [];
136
+ changedKeys.forEach((key => {
137
+ let isTransformed = !1;
138
+ transforms.forEach(((transform, index) => {
139
+ if (transform.channels.includes(key)) {
140
+ if (!tags[index]) if (transform.storedAttrs) {
141
+ const storedAttrs = storeOriginAttributes(transform.storedAttrs, transform.channels, graphicAttributes, nextAttrs, element, markName);
142
+ transform.transform(graphicAttributes, nextAttrs, storedAttrs);
143
+ } else transform.transform(graphicAttributes, nextAttrs, null);
144
+ tags[index] = !0, isTransformed = !0;
145
+ }
146
+ })), isTransformed || (commonAttributes.includes(key) ? transformCommonAttribute(graphicAttributes, key, nextAttrs) : graphicAttributes[key] = nextAttrs[key]);
147
+ }));
148
+ } else changedKeys.forEach((key => {
149
+ commonAttributes.includes(key) ? transformCommonAttribute(graphicAttributes, key, nextAttrs) : graphicAttributes[key] = nextAttrs[key];
150
+ }));
151
+ return graphicAttributes;
152
+ };
153
+ //# sourceMappingURL=transform.js.map
@@ -0,0 +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,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,GAAG,MAAC,OAAyB,CAAC,mBAAmB,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,mCAAI,EAAE,CAAC;IACpG,MAAM,W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,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 const storedAttrs = {};\n channels.forEach(channel => {\n storedAttrs[channel] = nextAttrs[channel] ?? prevStoredAttrs[channel];\n });\n graphicAttributes[name] = storedAttrs;\n return storedAttrs;\n}\n\nexport const transformsByType: Record<string, AttributeTransform[]> = {\n [GrammarMarkType.largeRects]: [\n {\n channels: ['x', 'y', 'y1', 'x1', 'width', 'height'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n graphicAttributes.x = 0;\n graphicAttributes.y = 0;\n }\n }\n ],\n [GrammarMarkType.largeSymbols]: [\n {\n channels: ['x', 'y', 'size'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n graphicAttributes.x = 0;\n graphicAttributes.y = 0;\n }\n }\n ],\n [GrammarMarkType.area]: [\n {\n channels: ['x', 'y', 'x1', 'y1'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n graphicAttributes.x = 0;\n graphicAttributes.y = 0;\n graphicAttributes.x1 = 0;\n graphicAttributes.y1 = 0;\n }\n }\n ],\n [GrammarMarkType.line]: [\n {\n channels: ['x', 'y', 'defined', 'enableSegments'],\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => {\n graphicAttributes.x = 0;\n graphicAttributes.y = 0;\n }\n }\n ],\n [GrammarMarkType.rect]: [\n {\n channels: ['x', 'y', 'x1', 'y1', 'width', 'height'],\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 storedAttrs: 'sizeAttrs'\n }\n ],\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"]}