@visactor/vgrammar-core 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (873) hide show
  1. package/README.md +160 -0
  2. package/README.zh-CN.md +11 -0
  3. package/cjs/component/axis.d.ts +26 -0
  4. package/cjs/component/axis.js +164 -0
  5. package/cjs/component/axis.js.map +1 -0
  6. package/cjs/component/crosshair.d.ts +50 -0
  7. package/cjs/component/crosshair.js +281 -0
  8. package/cjs/component/crosshair.js.map +1 -0
  9. package/cjs/component/datazoom.d.ts +19 -0
  10. package/cjs/component/datazoom.js +166 -0
  11. package/cjs/component/datazoom.js.map +1 -0
  12. package/cjs/component/grid.d.ts +27 -0
  13. package/cjs/component/grid.js +190 -0
  14. package/cjs/component/grid.js.map +1 -0
  15. package/cjs/component/index.d.ts +11 -0
  16. package/cjs/component/index.js +105 -0
  17. package/cjs/component/index.js.map +1 -0
  18. package/cjs/component/label.d.ts +19 -0
  19. package/cjs/component/label.js +121 -0
  20. package/cjs/component/label.js.map +1 -0
  21. package/cjs/component/legend.d.ts +26 -0
  22. package/cjs/component/legend.js +170 -0
  23. package/cjs/component/legend.js.map +1 -0
  24. package/cjs/component/player.d.ts +25 -0
  25. package/cjs/component/player.js +138 -0
  26. package/cjs/component/player.js.map +1 -0
  27. package/cjs/component/scale.d.ts +8 -0
  28. package/cjs/component/scale.js +25 -0
  29. package/cjs/component/scale.js.map +1 -0
  30. package/cjs/component/scrollbar.d.ts +23 -0
  31. package/cjs/component/scrollbar.js +187 -0
  32. package/cjs/component/scrollbar.js.map +1 -0
  33. package/cjs/component/slider.d.ts +19 -0
  34. package/cjs/component/slider.js +86 -0
  35. package/cjs/component/slider.js.map +1 -0
  36. package/cjs/component/title.d.ts +15 -0
  37. package/cjs/component/title.js +56 -0
  38. package/cjs/component/title.js.map +1 -0
  39. package/cjs/component/tooltip.d.ts +62 -0
  40. package/cjs/component/tooltip.js +305 -0
  41. package/cjs/component/tooltip.js.map +1 -0
  42. package/cjs/core/factory.d.ts +35 -0
  43. package/cjs/core/factory.js +73 -0
  44. package/cjs/core/factory.js.map +1 -0
  45. package/cjs/glyph/boxplot.d.ts +10 -0
  46. package/cjs/glyph/boxplot.js +418 -0
  47. package/cjs/glyph/boxplot.js.map +1 -0
  48. package/cjs/glyph/index.d.ts +7 -0
  49. package/cjs/glyph/index.js +64 -0
  50. package/cjs/glyph/index.js.map +1 -0
  51. package/cjs/glyph/link-path.d.ts +7 -0
  52. package/cjs/glyph/link-path.js +138 -0
  53. package/cjs/glyph/link-path.js.map +1 -0
  54. package/cjs/glyph/ripple.d.ts +1 -0
  55. package/cjs/glyph/ripple.js +44 -0
  56. package/cjs/glyph/ripple.js.map +1 -0
  57. package/cjs/glyph/tree-path.d.ts +7 -0
  58. package/cjs/glyph/tree-path.js +152 -0
  59. package/cjs/glyph/tree-path.js.map +1 -0
  60. package/cjs/glyph/violin.d.ts +1 -0
  61. package/cjs/glyph/violin.js +165 -0
  62. package/cjs/glyph/violin.js.map +1 -0
  63. package/cjs/glyph/wave.d.ts +1 -0
  64. package/cjs/glyph/wave.js +67 -0
  65. package/cjs/glyph/wave.js.map +1 -0
  66. package/cjs/graph/animation/animate.d.ts +48 -0
  67. package/cjs/graph/animation/animate.js +250 -0
  68. package/cjs/graph/animation/animate.js.map +1 -0
  69. package/cjs/graph/animation/animation/clip.d.ts +4 -0
  70. package/cjs/graph/animation/animation/clip.js +54 -0
  71. package/cjs/graph/animation/animation/clip.js.map +1 -0
  72. package/cjs/graph/animation/animation/fade.d.ts +4 -0
  73. package/cjs/graph/animation/animation/fade.js +42 -0
  74. package/cjs/graph/animation/animation/fade.js.map +1 -0
  75. package/cjs/graph/animation/animation/grow-cartesian.d.ts +7 -0
  76. package/cjs/graph/animation/animation/grow-cartesian.js +288 -0
  77. package/cjs/graph/animation/animation/grow-cartesian.js.map +1 -0
  78. package/cjs/graph/animation/animation/grow-interval.d.ts +3 -0
  79. package/cjs/graph/animation/animation/grow-interval.js +194 -0
  80. package/cjs/graph/animation/animation/grow-interval.js.map +1 -0
  81. package/cjs/graph/animation/animation/grow-points.d.ts +7 -0
  82. package/cjs/graph/animation/animation/grow-points.js +118 -0
  83. package/cjs/graph/animation/animation/grow-points.js.map +1 -0
  84. package/cjs/graph/animation/animation/grow-polar.d.ts +5 -0
  85. package/cjs/graph/animation/animation/grow-polar.js +164 -0
  86. package/cjs/graph/animation/animation/grow-polar.js.map +1 -0
  87. package/cjs/graph/animation/animation/index.d.ts +11 -0
  88. package/cjs/graph/animation/animation/index.js +191 -0
  89. package/cjs/graph/animation/animation/index.js.map +1 -0
  90. package/cjs/graph/animation/animation/move.d.ts +3 -0
  91. package/cjs/graph/animation/animation/move.js +90 -0
  92. package/cjs/graph/animation/animation/move.js.map +1 -0
  93. package/cjs/graph/animation/animation/rotate.d.ts +3 -0
  94. package/cjs/graph/animation/animation/rotate.js +42 -0
  95. package/cjs/graph/animation/animation/rotate.js.map +1 -0
  96. package/cjs/graph/animation/animation/scale.d.ts +3 -0
  97. package/cjs/graph/animation/animation/scale.js +84 -0
  98. package/cjs/graph/animation/animation/scale.js.map +1 -0
  99. package/cjs/graph/animation/animation/update.d.ts +6 -0
  100. package/cjs/graph/animation/animation/update.js +22 -0
  101. package/cjs/graph/animation/animation/update.js.map +1 -0
  102. package/cjs/graph/animation/animator.d.ts +26 -0
  103. package/cjs/graph/animation/animator.js +88 -0
  104. package/cjs/graph/animation/animator.js.map +1 -0
  105. package/cjs/graph/animation/arranger.d.ts +13 -0
  106. package/cjs/graph/animation/arranger.js +38 -0
  107. package/cjs/graph/animation/arranger.js.map +1 -0
  108. package/cjs/graph/animation/attribute.d.ts +27 -0
  109. package/cjs/graph/animation/attribute.js +124 -0
  110. package/cjs/graph/animation/attribute.js.map +1 -0
  111. package/cjs/graph/animation/config.d.ts +5 -0
  112. package/cjs/graph/animation/config.js +92 -0
  113. package/cjs/graph/animation/config.js.map +1 -0
  114. package/cjs/graph/animation/morph.d.ts +12 -0
  115. package/cjs/graph/animation/morph.js +174 -0
  116. package/cjs/graph/animation/morph.js.map +1 -0
  117. package/cjs/graph/attributes/common.d.ts +2 -0
  118. package/cjs/graph/attributes/common.js +22 -0
  119. package/cjs/graph/attributes/common.js.map +1 -0
  120. package/cjs/graph/attributes/helpers.d.ts +17 -0
  121. package/cjs/graph/attributes/helpers.js +86 -0
  122. package/cjs/graph/attributes/helpers.js.map +1 -0
  123. package/cjs/graph/attributes/index.d.ts +10 -0
  124. package/cjs/graph/attributes/index.js +257 -0
  125. package/cjs/graph/attributes/index.js.map +1 -0
  126. package/cjs/graph/canvas-renderer.d.ts +34 -0
  127. package/cjs/graph/canvas-renderer.js +121 -0
  128. package/cjs/graph/canvas-renderer.js.map +1 -0
  129. package/cjs/graph/constants.d.ts +23 -0
  130. package/cjs/graph/constants.js +21 -0
  131. package/cjs/graph/constants.js.map +1 -0
  132. package/cjs/graph/element.d.ts +66 -0
  133. package/cjs/graph/element.js +297 -0
  134. package/cjs/graph/element.js.map +1 -0
  135. package/cjs/graph/enums.d.ts +153 -0
  136. package/cjs/graph/enums.js +85 -0
  137. package/cjs/graph/enums.js.map +1 -0
  138. package/cjs/graph/glyph-element.d.ts +53 -0
  139. package/cjs/graph/glyph-element.js +202 -0
  140. package/cjs/graph/glyph-element.js.map +1 -0
  141. package/cjs/graph/index.d.ts +3 -0
  142. package/cjs/graph/index.js +44 -0
  143. package/cjs/graph/index.js.map +1 -0
  144. package/cjs/graph/layout/grid.d.ts +3 -0
  145. package/cjs/graph/layout/grid.js +75 -0
  146. package/cjs/graph/layout/grid.js.map +1 -0
  147. package/cjs/graph/layout/layout.d.ts +3 -0
  148. package/cjs/graph/layout/layout.js +33 -0
  149. package/cjs/graph/layout/layout.js.map +1 -0
  150. package/cjs/graph/layout/relative.d.ts +3 -0
  151. package/cjs/graph/layout/relative.js +86 -0
  152. package/cjs/graph/layout/relative.js.map +1 -0
  153. package/cjs/graph/mark/differ.d.ts +20 -0
  154. package/cjs/graph/mark/differ.js +110 -0
  155. package/cjs/graph/mark/differ.js.map +1 -0
  156. package/cjs/graph/mark/encode.d.ts +10 -0
  157. package/cjs/graph/mark/encode.js +95 -0
  158. package/cjs/graph/mark/encode.js.map +1 -0
  159. package/cjs/graph/mark/large-rects.d.ts +10 -0
  160. package/cjs/graph/mark/large-rects.js +31 -0
  161. package/cjs/graph/mark/large-rects.js.map +1 -0
  162. package/cjs/graph/mark/large-symbols.d.ts +11 -0
  163. package/cjs/graph/mark/large-symbols.js +33 -0
  164. package/cjs/graph/mark/large-symbols.js.map +1 -0
  165. package/cjs/graph/mark-tree.d.ts +2 -0
  166. package/cjs/graph/mark-tree.js +21 -0
  167. package/cjs/graph/mark-tree.js.map +1 -0
  168. package/cjs/graph/util/element.d.ts +2 -0
  169. package/cjs/graph/util/element.js +10 -0
  170. package/cjs/graph/util/element.js.map +1 -0
  171. package/cjs/graph/util/env.d.ts +2 -0
  172. package/cjs/graph/util/env.js +14 -0
  173. package/cjs/graph/util/env.js.map +1 -0
  174. package/cjs/graph/util/events-extend.d.ts +5 -0
  175. package/cjs/graph/util/events-extend.js +18 -0
  176. package/cjs/graph/util/events-extend.js.map +1 -0
  177. package/cjs/graph/util/graphic.d.ts +9 -0
  178. package/cjs/graph/util/graphic.js +59 -0
  179. package/cjs/graph/util/graphic.js.map +1 -0
  180. package/cjs/graph/util/point.d.ts +1 -0
  181. package/cjs/graph/util/point.js +75 -0
  182. package/cjs/graph/util/point.js.map +1 -0
  183. package/cjs/index.d.ts +14 -0
  184. package/cjs/index.js +111 -0
  185. package/cjs/index.js.map +1 -0
  186. package/cjs/parse/coordinate.d.ts +7 -0
  187. package/cjs/parse/coordinate.js +70 -0
  188. package/cjs/parse/coordinate.js.map +1 -0
  189. package/cjs/parse/event.d.ts +8 -0
  190. package/cjs/parse/event.js +33 -0
  191. package/cjs/parse/event.js.map +1 -0
  192. package/cjs/parse/mark.d.ts +4 -0
  193. package/cjs/parse/mark.js +25 -0
  194. package/cjs/parse/mark.js.map +1 -0
  195. package/cjs/parse/option.d.ts +3 -0
  196. package/cjs/parse/option.js +19 -0
  197. package/cjs/parse/option.js.map +1 -0
  198. package/cjs/parse/scale.d.ts +8 -0
  199. package/cjs/parse/scale.js +365 -0
  200. package/cjs/parse/scale.js.map +1 -0
  201. package/cjs/parse/transform.d.ts +5 -0
  202. package/cjs/parse/transform.js +103 -0
  203. package/cjs/parse/transform.js.map +1 -0
  204. package/cjs/parse/util.d.ts +13 -0
  205. package/cjs/parse/util.js +82 -0
  206. package/cjs/parse/util.js.map +1 -0
  207. package/cjs/parse/view.d.ts +17 -0
  208. package/cjs/parse/view.js +108 -0
  209. package/cjs/parse/view.js.map +1 -0
  210. package/cjs/semantic-marks/cell.d.ts +13 -0
  211. package/cjs/semantic-marks/cell.js +61 -0
  212. package/cjs/semantic-marks/cell.js.map +1 -0
  213. package/cjs/semantic-marks/interval.d.ts +14 -0
  214. package/cjs/semantic-marks/interval.js +80 -0
  215. package/cjs/semantic-marks/interval.js.map +1 -0
  216. package/cjs/semantic-marks/text.d.ts +10 -0
  217. package/cjs/semantic-marks/text.js +25 -0
  218. package/cjs/semantic-marks/text.js.map +1 -0
  219. package/cjs/theme/common/component.d.ts +15 -0
  220. package/cjs/theme/common/component.js +493 -0
  221. package/cjs/theme/common/component.js.map +1 -0
  222. package/cjs/theme/common/constants.d.ts +1 -0
  223. package/cjs/theme/common/constants.js +6 -0
  224. package/cjs/theme/common/constants.js.map +1 -0
  225. package/cjs/theme/common/mark.d.ts +2 -0
  226. package/cjs/theme/common/mark.js +15 -0
  227. package/cjs/theme/common/mark.js.map +1 -0
  228. package/cjs/theme/dark.d.ts +2 -0
  229. package/cjs/theme/dark.js +94 -0
  230. package/cjs/theme/dark.js.map +1 -0
  231. package/cjs/theme/default.d.ts +2 -0
  232. package/cjs/theme/default.js +18 -0
  233. package/cjs/theme/default.js.map +1 -0
  234. package/cjs/theme/theme-manager.d.ts +8 -0
  235. package/cjs/theme/theme-manager.js +26 -0
  236. package/cjs/theme/theme-manager.js.map +1 -0
  237. package/cjs/transforms/data/bin.d.ts +2 -0
  238. package/cjs/transforms/data/bin.js +21 -0
  239. package/cjs/transforms/data/bin.js.map +1 -0
  240. package/cjs/transforms/data/circular-relation.d.ts +2 -0
  241. package/cjs/transforms/data/circular-relation.js +56 -0
  242. package/cjs/transforms/data/circular-relation.js.map +1 -0
  243. package/cjs/transforms/data/contour.d.ts +2 -0
  244. package/cjs/transforms/data/contour.js +115 -0
  245. package/cjs/transforms/data/contour.js.map +1 -0
  246. package/cjs/transforms/data/filter.d.ts +2 -0
  247. package/cjs/transforms/data/filter.js +10 -0
  248. package/cjs/transforms/data/filter.js.map +1 -0
  249. package/cjs/transforms/data/fold.d.ts +2 -0
  250. package/cjs/transforms/data/fold.js +24 -0
  251. package/cjs/transforms/data/fold.js.map +1 -0
  252. package/cjs/transforms/data/funnel.d.ts +2 -0
  253. package/cjs/transforms/data/funnel.js +25 -0
  254. package/cjs/transforms/data/funnel.js.map +1 -0
  255. package/cjs/transforms/data/join.d.ts +2 -0
  256. package/cjs/transforms/data/join.js +33 -0
  257. package/cjs/transforms/data/join.js.map +1 -0
  258. package/cjs/transforms/data/kde.d.ts +2 -0
  259. package/cjs/transforms/data/kde.js +90 -0
  260. package/cjs/transforms/data/kde.js.map +1 -0
  261. package/cjs/transforms/data/map.d.ts +2 -0
  262. package/cjs/transforms/data/map.js +23 -0
  263. package/cjs/transforms/data/map.js.map +1 -0
  264. package/cjs/transforms/data/pick.d.ts +2 -0
  265. package/cjs/transforms/data/pick.js +20 -0
  266. package/cjs/transforms/data/pick.js.map +1 -0
  267. package/cjs/transforms/data/pie.d.ts +2 -0
  268. package/cjs/transforms/data/pie.js +24 -0
  269. package/cjs/transforms/data/pie.js.map +1 -0
  270. package/cjs/transforms/data/range.d.ts +4 -0
  271. package/cjs/transforms/data/range.js +15 -0
  272. package/cjs/transforms/data/range.js.map +1 -0
  273. package/cjs/transforms/data/sort.d.ts +2 -0
  274. package/cjs/transforms/data/sort.js +17 -0
  275. package/cjs/transforms/data/sort.js.map +1 -0
  276. package/cjs/transforms/data/stack.d.ts +2 -0
  277. package/cjs/transforms/data/stack.js +74 -0
  278. package/cjs/transforms/data/stack.js.map +1 -0
  279. package/cjs/transforms/data/unfold.d.ts +2 -0
  280. package/cjs/transforms/data/unfold.js +49 -0
  281. package/cjs/transforms/data/unfold.js.map +1 -0
  282. package/cjs/transforms/index.d.ts +23 -0
  283. package/cjs/transforms/index.js +213 -0
  284. package/cjs/transforms/index.js.map +1 -0
  285. package/cjs/transforms/mark/dodge.d.ts +2 -0
  286. package/cjs/transforms/mark/dodge.js +81 -0
  287. package/cjs/transforms/mark/dodge.js.map +1 -0
  288. package/cjs/transforms/mark/jitter.d.ts +4 -0
  289. package/cjs/transforms/mark/jitter.js +53 -0
  290. package/cjs/transforms/mark/jitter.js.map +1 -0
  291. package/cjs/transforms/mark/lttb-sample.d.ts +2 -0
  292. package/cjs/transforms/mark/lttb-sample.js +68 -0
  293. package/cjs/transforms/mark/lttb-sample.js.map +1 -0
  294. package/cjs/transforms/mark/mark-overlap.d.ts +2 -0
  295. package/cjs/transforms/mark/mark-overlap.js +79 -0
  296. package/cjs/transforms/mark/mark-overlap.js.map +1 -0
  297. package/cjs/transforms/mark/symmetry.d.ts +2 -0
  298. package/cjs/transforms/mark/symmetry.js +25 -0
  299. package/cjs/transforms/mark/symmetry.js.map +1 -0
  300. package/cjs/transforms/util/util.d.ts +5 -0
  301. package/cjs/transforms/util/util.js +41 -0
  302. package/cjs/transforms/util/util.js.map +1 -0
  303. package/cjs/transforms/view/identifier.d.ts +2 -0
  304. package/cjs/transforms/view/identifier.js +17 -0
  305. package/cjs/transforms/view/identifier.js.map +1 -0
  306. package/cjs/types/animate.d.ts +224 -0
  307. package/cjs/types/animate.js +6 -0
  308. package/cjs/types/animate.js.map +1 -0
  309. package/cjs/types/base.d.ts +36 -0
  310. package/cjs/types/base.js +6 -0
  311. package/cjs/types/base.js.map +1 -0
  312. package/cjs/types/component.d.ts +240 -0
  313. package/cjs/types/component.js +6 -0
  314. package/cjs/types/component.js.map +1 -0
  315. package/cjs/types/coordinate.d.ts +15 -0
  316. package/cjs/types/coordinate.js +6 -0
  317. package/cjs/types/coordinate.js.map +1 -0
  318. package/cjs/types/data.d.ts +55 -0
  319. package/cjs/types/data.js +5 -0
  320. package/cjs/types/data.js.map +1 -0
  321. package/cjs/types/dataflow.d.ts +13 -0
  322. package/cjs/types/dataflow.js +6 -0
  323. package/cjs/types/dataflow.js.map +1 -0
  324. package/cjs/types/element.d.ts +117 -0
  325. package/cjs/types/element.js +6 -0
  326. package/cjs/types/element.js.map +1 -0
  327. package/cjs/types/event.d.ts +58 -0
  328. package/cjs/types/event.js +6 -0
  329. package/cjs/types/event.js.map +1 -0
  330. package/cjs/types/glyph.d.ts +29 -0
  331. package/cjs/types/glyph.js +6 -0
  332. package/cjs/types/glyph.js.map +1 -0
  333. package/cjs/types/grammar.d.ts +184 -0
  334. package/cjs/types/grammar.js +6 -0
  335. package/cjs/types/grammar.js.map +1 -0
  336. package/cjs/types/hooks.d.ts +45 -0
  337. package/cjs/types/hooks.js +6 -0
  338. package/cjs/types/hooks.js.map +1 -0
  339. package/cjs/types/index.d.ts +22 -0
  340. package/cjs/types/index.js +31 -0
  341. package/cjs/types/index.js.map +1 -0
  342. package/cjs/types/layout.d.ts +5 -0
  343. package/cjs/types/layout.js +6 -0
  344. package/cjs/types/layout.js.map +1 -0
  345. package/cjs/types/mark.d.ts +344 -0
  346. package/cjs/types/mark.js +6 -0
  347. package/cjs/types/mark.js.map +1 -0
  348. package/cjs/types/morph.d.ts +29 -0
  349. package/cjs/types/morph.js +6 -0
  350. package/cjs/types/morph.js.map +1 -0
  351. package/cjs/types/plot.d.ts +326 -0
  352. package/cjs/types/plot.js +6 -0
  353. package/cjs/types/plot.js.map +1 -0
  354. package/cjs/types/projection.d.ts +61 -0
  355. package/cjs/types/projection.js +6 -0
  356. package/cjs/types/projection.js.map +1 -0
  357. package/cjs/types/renderer.d.ts +19 -0
  358. package/cjs/types/renderer.js +6 -0
  359. package/cjs/types/renderer.js.map +1 -0
  360. package/cjs/types/scale.d.ts +111 -0
  361. package/cjs/types/scale.js +6 -0
  362. package/cjs/types/scale.js.map +1 -0
  363. package/cjs/types/signal.d.ts +20 -0
  364. package/cjs/types/signal.js +6 -0
  365. package/cjs/types/signal.js.map +1 -0
  366. package/cjs/types/theme.d.ts +41 -0
  367. package/cjs/types/theme.js +6 -0
  368. package/cjs/types/theme.js.map +1 -0
  369. package/cjs/types/transform.d.ts +291 -0
  370. package/cjs/types/transform.js +6 -0
  371. package/cjs/types/transform.js.map +1 -0
  372. package/cjs/types/view.d.ts +217 -0
  373. package/cjs/types/view.js +6 -0
  374. package/cjs/types/view.js.map +1 -0
  375. package/cjs/util/data.d.ts +3 -0
  376. package/cjs/util/data.js +64 -0
  377. package/cjs/util/data.js.map +1 -0
  378. package/cjs/util/grammar-heap.d.ts +14 -0
  379. package/cjs/util/grammar-heap.js +66 -0
  380. package/cjs/util/grammar-heap.js.map +1 -0
  381. package/cjs/util/text.d.ts +19 -0
  382. package/cjs/util/text.js +32 -0
  383. package/cjs/util/text.js.map +1 -0
  384. package/cjs/util/unique-list.d.ts +12 -0
  385. package/cjs/util/unique-list.js +37 -0
  386. package/cjs/util/unique-list.js.map +1 -0
  387. package/cjs/view/View.d.ts +157 -0
  388. package/cjs/view/View.js +800 -0
  389. package/cjs/view/View.js.map +1 -0
  390. package/cjs/view/animate.d.ts +20 -0
  391. package/cjs/view/animate.js +106 -0
  392. package/cjs/view/animate.js.map +1 -0
  393. package/cjs/view/component.d.ts +26 -0
  394. package/cjs/view/component.js +64 -0
  395. package/cjs/view/component.js.map +1 -0
  396. package/cjs/view/constants.d.ts +17 -0
  397. package/cjs/view/constants.js +13 -0
  398. package/cjs/view/constants.js.map +1 -0
  399. package/cjs/view/coordinate.d.ts +23 -0
  400. package/cjs/view/coordinate.js +59 -0
  401. package/cjs/view/coordinate.js.map +1 -0
  402. package/cjs/view/data.d.ts +37 -0
  403. package/cjs/view/data.js +198 -0
  404. package/cjs/view/data.js.map +1 -0
  405. package/cjs/view/dataflow.d.ts +32 -0
  406. package/cjs/view/dataflow.js +146 -0
  407. package/cjs/view/dataflow.js.map +1 -0
  408. package/cjs/view/events.d.ts +4 -0
  409. package/cjs/view/events.js +34 -0
  410. package/cjs/view/events.js.map +1 -0
  411. package/cjs/view/glyph-meta.d.ts +29 -0
  412. package/cjs/view/glyph-meta.js +45 -0
  413. package/cjs/view/glyph-meta.js.map +1 -0
  414. package/cjs/view/glyph.d.ts +14 -0
  415. package/cjs/view/glyph.js +29 -0
  416. package/cjs/view/glyph.js.map +1 -0
  417. package/cjs/view/grammar-base.d.ts +46 -0
  418. package/cjs/view/grammar-base.js +171 -0
  419. package/cjs/view/grammar-base.js.map +1 -0
  420. package/cjs/view/grammar-record.d.ts +39 -0
  421. package/cjs/view/grammar-record.js +180 -0
  422. package/cjs/view/grammar-record.js.map +1 -0
  423. package/cjs/view/group.d.ts +13 -0
  424. package/cjs/view/group.js +39 -0
  425. package/cjs/view/group.js.map +1 -0
  426. package/cjs/view/index.d.ts +1 -0
  427. package/cjs/view/index.js +21 -0
  428. package/cjs/view/index.js.map +1 -0
  429. package/cjs/view/mark.d.ts +112 -0
  430. package/cjs/view/mark.js +600 -0
  431. package/cjs/view/mark.js.map +1 -0
  432. package/cjs/view/scale.d.ts +26 -0
  433. package/cjs/view/scale.js +86 -0
  434. package/cjs/view/scale.js.map +1 -0
  435. package/cjs/view/signal.d.ts +18 -0
  436. package/cjs/view/signal.js +56 -0
  437. package/cjs/view/signal.js.map +1 -0
  438. package/es/component/axis.d.ts +26 -0
  439. package/es/component/axis.js +162 -0
  440. package/es/component/axis.js.map +1 -0
  441. package/es/component/crosshair.d.ts +50 -0
  442. package/es/component/crosshair.js +275 -0
  443. package/es/component/crosshair.js.map +1 -0
  444. package/es/component/datazoom.d.ts +19 -0
  445. package/es/component/datazoom.js +161 -0
  446. package/es/component/datazoom.js.map +1 -0
  447. package/es/component/grid.d.ts +27 -0
  448. package/es/component/grid.js +193 -0
  449. package/es/component/grid.js.map +1 -0
  450. package/es/component/index.d.ts +11 -0
  451. package/es/component/index.js +22 -0
  452. package/es/component/index.js.map +1 -0
  453. package/es/component/label.d.ts +19 -0
  454. package/es/component/label.js +124 -0
  455. package/es/component/label.js.map +1 -0
  456. package/es/component/legend.d.ts +26 -0
  457. package/es/component/legend.js +169 -0
  458. package/es/component/legend.js.map +1 -0
  459. package/es/component/player.d.ts +25 -0
  460. package/es/component/player.js +136 -0
  461. package/es/component/player.js.map +1 -0
  462. package/es/component/scale.d.ts +8 -0
  463. package/es/component/scale.js +19 -0
  464. package/es/component/scale.js.map +1 -0
  465. package/es/component/scrollbar.d.ts +23 -0
  466. package/es/component/scrollbar.js +184 -0
  467. package/es/component/scrollbar.js.map +1 -0
  468. package/es/component/slider.d.ts +19 -0
  469. package/es/component/slider.js +86 -0
  470. package/es/component/slider.js.map +1 -0
  471. package/es/component/title.d.ts +15 -0
  472. package/es/component/title.js +58 -0
  473. package/es/component/title.js.map +1 -0
  474. package/es/component/tooltip.d.ts +62 -0
  475. package/es/component/tooltip.js +303 -0
  476. package/es/component/tooltip.js.map +1 -0
  477. package/es/core/factory.d.ts +35 -0
  478. package/es/core/factory.js +67 -0
  479. package/es/core/factory.js.map +1 -0
  480. package/es/glyph/boxplot.d.ts +10 -0
  481. package/es/glyph/boxplot.js +410 -0
  482. package/es/glyph/boxplot.js.map +1 -0
  483. package/es/glyph/index.d.ts +7 -0
  484. package/es/glyph/index.js +11 -0
  485. package/es/glyph/index.js.map +1 -0
  486. package/es/glyph/link-path.d.ts +7 -0
  487. package/es/glyph/link-path.js +132 -0
  488. package/es/glyph/link-path.js.map +1 -0
  489. package/es/glyph/ripple.d.ts +1 -0
  490. package/es/glyph/ripple.js +38 -0
  491. package/es/glyph/ripple.js.map +1 -0
  492. package/es/glyph/tree-path.d.ts +7 -0
  493. package/es/glyph/tree-path.js +146 -0
  494. package/es/glyph/tree-path.js.map +1 -0
  495. package/es/glyph/violin.d.ts +1 -0
  496. package/es/glyph/violin.js +163 -0
  497. package/es/glyph/violin.js.map +1 -0
  498. package/es/glyph/wave.d.ts +1 -0
  499. package/es/glyph/wave.js +61 -0
  500. package/es/glyph/wave.js.map +1 -0
  501. package/es/graph/animation/animate.d.ts +48 -0
  502. package/es/graph/animation/animate.js +247 -0
  503. package/es/graph/animation/animate.js.map +1 -0
  504. package/es/graph/animation/animation/clip.d.ts +4 -0
  505. package/es/graph/animation/animation/clip.js +44 -0
  506. package/es/graph/animation/animation/clip.js.map +1 -0
  507. package/es/graph/animation/animation/fade.d.ts +4 -0
  508. package/es/graph/animation/animation/fade.js +32 -0
  509. package/es/graph/animation/animation/fade.js.map +1 -0
  510. package/es/graph/animation/animation/grow-cartesian.d.ts +7 -0
  511. package/es/graph/animation/animation/grow-cartesian.js +272 -0
  512. package/es/graph/animation/animation/grow-cartesian.js.map +1 -0
  513. package/es/graph/animation/animation/grow-interval.d.ts +3 -0
  514. package/es/graph/animation/animation/grow-interval.js +184 -0
  515. package/es/graph/animation/animation/grow-interval.js.map +1 -0
  516. package/es/graph/animation/animation/grow-points.d.ts +7 -0
  517. package/es/graph/animation/animation/grow-points.js +107 -0
  518. package/es/graph/animation/animation/grow-points.js.map +1 -0
  519. package/es/graph/animation/animation/grow-polar.d.ts +5 -0
  520. package/es/graph/animation/animation/grow-polar.js +160 -0
  521. package/es/graph/animation/animation/grow-polar.js.map +1 -0
  522. package/es/graph/animation/animation/index.d.ts +11 -0
  523. package/es/graph/animation/animation/index.js +22 -0
  524. package/es/graph/animation/animation/index.js.map +1 -0
  525. package/es/graph/animation/animation/move.d.ts +3 -0
  526. package/es/graph/animation/animation/move.js +78 -0
  527. package/es/graph/animation/animation/move.js.map +1 -0
  528. package/es/graph/animation/animation/rotate.d.ts +3 -0
  529. package/es/graph/animation/animation/rotate.js +32 -0
  530. package/es/graph/animation/animation/rotate.js.map +1 -0
  531. package/es/graph/animation/animation/scale.d.ts +3 -0
  532. package/es/graph/animation/animation/scale.js +74 -0
  533. package/es/graph/animation/animation/scale.js.map +1 -0
  534. package/es/graph/animation/animation/update.d.ts +6 -0
  535. package/es/graph/animation/animation/update.js +20 -0
  536. package/es/graph/animation/animation/update.js.map +1 -0
  537. package/es/graph/animation/animator.d.ts +26 -0
  538. package/es/graph/animation/animator.js +83 -0
  539. package/es/graph/animation/animator.js.map +1 -0
  540. package/es/graph/animation/arranger.d.ts +13 -0
  541. package/es/graph/animation/arranger.js +29 -0
  542. package/es/graph/animation/arranger.js.map +1 -0
  543. package/es/graph/animation/attribute.d.ts +27 -0
  544. package/es/graph/animation/attribute.js +114 -0
  545. package/es/graph/animation/attribute.js.map +1 -0
  546. package/es/graph/animation/config.d.ts +5 -0
  547. package/es/graph/animation/config.js +84 -0
  548. package/es/graph/animation/config.js.map +1 -0
  549. package/es/graph/animation/morph.d.ts +12 -0
  550. package/es/graph/animation/morph.js +171 -0
  551. package/es/graph/animation/morph.js.map +1 -0
  552. package/es/graph/attributes/common.d.ts +2 -0
  553. package/es/graph/attributes/common.js +13 -0
  554. package/es/graph/attributes/common.js.map +1 -0
  555. package/es/graph/attributes/helpers.d.ts +17 -0
  556. package/es/graph/attributes/helpers.js +75 -0
  557. package/es/graph/attributes/helpers.js.map +1 -0
  558. package/es/graph/attributes/index.d.ts +10 -0
  559. package/es/graph/attributes/index.js +231 -0
  560. package/es/graph/attributes/index.js.map +1 -0
  561. package/es/graph/canvas-renderer.d.ts +34 -0
  562. package/es/graph/canvas-renderer.js +115 -0
  563. package/es/graph/canvas-renderer.js.map +1 -0
  564. package/es/graph/constants.d.ts +23 -0
  565. package/es/graph/constants.js +47 -0
  566. package/es/graph/constants.js.map +1 -0
  567. package/es/graph/element.d.ts +66 -0
  568. package/es/graph/element.js +292 -0
  569. package/es/graph/element.js.map +1 -0
  570. package/es/graph/enums.d.ts +153 -0
  571. package/es/graph/enums.js +129 -0
  572. package/es/graph/enums.js.map +1 -0
  573. package/es/graph/glyph-element.d.ts +53 -0
  574. package/es/graph/glyph-element.js +206 -0
  575. package/es/graph/glyph-element.js.map +1 -0
  576. package/es/graph/index.d.ts +3 -0
  577. package/es/graph/index.js +6 -0
  578. package/es/graph/index.js.map +1 -0
  579. package/es/graph/layout/grid.d.ts +3 -0
  580. package/es/graph/layout/grid.js +66 -0
  581. package/es/graph/layout/grid.js.map +1 -0
  582. package/es/graph/layout/layout.d.ts +3 -0
  583. package/es/graph/layout/layout.js +33 -0
  584. package/es/graph/layout/layout.js.map +1 -0
  585. package/es/graph/layout/relative.d.ts +3 -0
  586. package/es/graph/layout/relative.js +85 -0
  587. package/es/graph/layout/relative.js.map +1 -0
  588. package/es/graph/mark/differ.d.ts +20 -0
  589. package/es/graph/mark/differ.js +104 -0
  590. package/es/graph/mark/differ.js.map +1 -0
  591. package/es/graph/mark/encode.d.ts +10 -0
  592. package/es/graph/mark/encode.js +92 -0
  593. package/es/graph/mark/encode.js.map +1 -0
  594. package/es/graph/mark/large-rects.d.ts +10 -0
  595. package/es/graph/mark/large-rects.js +23 -0
  596. package/es/graph/mark/large-rects.js.map +1 -0
  597. package/es/graph/mark/large-symbols.d.ts +11 -0
  598. package/es/graph/mark/large-symbols.js +27 -0
  599. package/es/graph/mark/large-symbols.js.map +1 -0
  600. package/es/graph/mark-tree.d.ts +2 -0
  601. package/es/graph/mark-tree.js +15 -0
  602. package/es/graph/mark-tree.js.map +1 -0
  603. package/es/graph/util/element.d.ts +2 -0
  604. package/es/graph/util/element.js +8 -0
  605. package/es/graph/util/element.js.map +1 -0
  606. package/es/graph/util/env.d.ts +2 -0
  607. package/es/graph/util/env.js +6 -0
  608. package/es/graph/util/env.js.map +1 -0
  609. package/es/graph/util/events-extend.d.ts +5 -0
  610. package/es/graph/util/events-extend.js +12 -0
  611. package/es/graph/util/events-extend.js.map +1 -0
  612. package/es/graph/util/graphic.d.ts +9 -0
  613. package/es/graph/util/graphic.js +59 -0
  614. package/es/graph/util/graphic.js.map +1 -0
  615. package/es/graph/util/point.d.ts +1 -0
  616. package/es/graph/util/point.js +67 -0
  617. package/es/graph/util/point.js.map +1 -0
  618. package/es/index.d.ts +14 -0
  619. package/es/index.js +27 -0
  620. package/es/index.js.map +1 -0
  621. package/es/parse/coordinate.d.ts +7 -0
  622. package/es/parse/coordinate.js +65 -0
  623. package/es/parse/coordinate.js.map +1 -0
  624. package/es/parse/event.d.ts +8 -0
  625. package/es/parse/event.js +23 -0
  626. package/es/parse/event.js.map +1 -0
  627. package/es/parse/mark.d.ts +4 -0
  628. package/es/parse/mark.js +19 -0
  629. package/es/parse/mark.js.map +1 -0
  630. package/es/parse/option.d.ts +3 -0
  631. package/es/parse/option.js +10 -0
  632. package/es/parse/option.js.map +1 -0
  633. package/es/parse/scale.d.ts +8 -0
  634. package/es/parse/scale.js +347 -0
  635. package/es/parse/scale.js.map +1 -0
  636. package/es/parse/transform.d.ts +5 -0
  637. package/es/parse/transform.js +102 -0
  638. package/es/parse/transform.js.map +1 -0
  639. package/es/parse/util.d.ts +13 -0
  640. package/es/parse/util.js +65 -0
  641. package/es/parse/util.js.map +1 -0
  642. package/es/parse/view.d.ts +17 -0
  643. package/es/parse/view.js +98 -0
  644. package/es/parse/view.js.map +1 -0
  645. package/es/semantic-marks/cell.d.ts +13 -0
  646. package/es/semantic-marks/cell.js +57 -0
  647. package/es/semantic-marks/cell.js.map +1 -0
  648. package/es/semantic-marks/interval.d.ts +14 -0
  649. package/es/semantic-marks/interval.js +87 -0
  650. package/es/semantic-marks/interval.js.map +1 -0
  651. package/es/semantic-marks/text.d.ts +10 -0
  652. package/es/semantic-marks/text.js +22 -0
  653. package/es/semantic-marks/text.js.map +1 -0
  654. package/es/theme/common/component.d.ts +15 -0
  655. package/es/theme/common/component.js +510 -0
  656. package/es/theme/common/component.js.map +1 -0
  657. package/es/theme/common/constants.d.ts +1 -0
  658. package/es/theme/common/constants.js +2 -0
  659. package/es/theme/common/constants.js.map +1 -0
  660. package/es/theme/common/mark.d.ts +2 -0
  661. package/es/theme/common/mark.js +11 -0
  662. package/es/theme/common/mark.js.map +1 -0
  663. package/es/theme/dark.d.ts +2 -0
  664. package/es/theme/dark.js +96 -0
  665. package/es/theme/dark.js.map +1 -0
  666. package/es/theme/default.d.ts +2 -0
  667. package/es/theme/default.js +16 -0
  668. package/es/theme/default.js.map +1 -0
  669. package/es/theme/theme-manager.d.ts +8 -0
  670. package/es/theme/theme-manager.js +22 -0
  671. package/es/theme/theme-manager.js.map +1 -0
  672. package/es/transforms/data/bin.d.ts +2 -0
  673. package/es/transforms/data/bin.js +16 -0
  674. package/es/transforms/data/bin.js.map +1 -0
  675. package/es/transforms/data/circular-relation.d.ts +2 -0
  676. package/es/transforms/data/circular-relation.js +44 -0
  677. package/es/transforms/data/circular-relation.js.map +1 -0
  678. package/es/transforms/data/contour.d.ts +2 -0
  679. package/es/transforms/data/contour.js +111 -0
  680. package/es/transforms/data/contour.js.map +1 -0
  681. package/es/transforms/data/filter.d.ts +2 -0
  682. package/es/transforms/data/filter.js +2 -0
  683. package/es/transforms/data/filter.js.map +1 -0
  684. package/es/transforms/data/fold.d.ts +2 -0
  685. package/es/transforms/data/fold.js +16 -0
  686. package/es/transforms/data/fold.js.map +1 -0
  687. package/es/transforms/data/funnel.d.ts +2 -0
  688. package/es/transforms/data/funnel.js +17 -0
  689. package/es/transforms/data/funnel.js.map +1 -0
  690. package/es/transforms/data/join.d.ts +2 -0
  691. package/es/transforms/data/join.js +26 -0
  692. package/es/transforms/data/join.js.map +1 -0
  693. package/es/transforms/data/kde.d.ts +2 -0
  694. package/es/transforms/data/kde.js +80 -0
  695. package/es/transforms/data/kde.js.map +1 -0
  696. package/es/transforms/data/map.d.ts +2 -0
  697. package/es/transforms/data/map.js +16 -0
  698. package/es/transforms/data/map.js.map +1 -0
  699. package/es/transforms/data/pick.d.ts +2 -0
  700. package/es/transforms/data/pick.js +15 -0
  701. package/es/transforms/data/pick.js.map +1 -0
  702. package/es/transforms/data/pie.d.ts +2 -0
  703. package/es/transforms/data/pie.js +18 -0
  704. package/es/transforms/data/pie.js.map +1 -0
  705. package/es/transforms/data/range.d.ts +4 -0
  706. package/es/transforms/data/range.js +9 -0
  707. package/es/transforms/data/range.js.map +1 -0
  708. package/es/transforms/data/sort.d.ts +2 -0
  709. package/es/transforms/data/sort.js +13 -0
  710. package/es/transforms/data/sort.js.map +1 -0
  711. package/es/transforms/data/stack.d.ts +2 -0
  712. package/es/transforms/data/stack.js +72 -0
  713. package/es/transforms/data/stack.js.map +1 -0
  714. package/es/transforms/data/unfold.d.ts +2 -0
  715. package/es/transforms/data/unfold.js +45 -0
  716. package/es/transforms/data/unfold.js.map +1 -0
  717. package/es/transforms/index.d.ts +23 -0
  718. package/es/transforms/index.js +205 -0
  719. package/es/transforms/index.js.map +1 -0
  720. package/es/transforms/mark/dodge.d.ts +2 -0
  721. package/es/transforms/mark/dodge.js +74 -0
  722. package/es/transforms/mark/dodge.js.map +1 -0
  723. package/es/transforms/mark/jitter.d.ts +4 -0
  724. package/es/transforms/mark/jitter.js +48 -0
  725. package/es/transforms/mark/jitter.js.map +1 -0
  726. package/es/transforms/mark/lttb-sample.d.ts +2 -0
  727. package/es/transforms/mark/lttb-sample.js +60 -0
  728. package/es/transforms/mark/lttb-sample.js.map +1 -0
  729. package/es/transforms/mark/mark-overlap.d.ts +2 -0
  730. package/es/transforms/mark/mark-overlap.js +71 -0
  731. package/es/transforms/mark/mark-overlap.js.map +1 -0
  732. package/es/transforms/mark/symmetry.d.ts +2 -0
  733. package/es/transforms/mark/symmetry.js +20 -0
  734. package/es/transforms/mark/symmetry.js.map +1 -0
  735. package/es/transforms/util/util.d.ts +5 -0
  736. package/es/transforms/util/util.js +33 -0
  737. package/es/transforms/util/util.js.map +1 -0
  738. package/es/transforms/view/identifier.d.ts +2 -0
  739. package/es/transforms/view/identifier.js +13 -0
  740. package/es/transforms/view/identifier.js.map +1 -0
  741. package/es/types/animate.d.ts +224 -0
  742. package/es/types/animate.js +2 -0
  743. package/es/types/animate.js.map +1 -0
  744. package/es/types/base.d.ts +36 -0
  745. package/es/types/base.js +2 -0
  746. package/es/types/base.js.map +1 -0
  747. package/es/types/component.d.ts +240 -0
  748. package/es/types/component.js +2 -0
  749. package/es/types/component.js.map +1 -0
  750. package/es/types/coordinate.d.ts +15 -0
  751. package/es/types/coordinate.js +2 -0
  752. package/es/types/coordinate.js.map +1 -0
  753. package/es/types/data.d.ts +55 -0
  754. package/es/types/data.js +1 -0
  755. package/es/types/data.js.map +1 -0
  756. package/es/types/dataflow.d.ts +13 -0
  757. package/es/types/dataflow.js +2 -0
  758. package/es/types/dataflow.js.map +1 -0
  759. package/es/types/element.d.ts +117 -0
  760. package/es/types/element.js +2 -0
  761. package/es/types/element.js.map +1 -0
  762. package/es/types/event.d.ts +58 -0
  763. package/es/types/event.js +2 -0
  764. package/es/types/event.js.map +1 -0
  765. package/es/types/glyph.d.ts +29 -0
  766. package/es/types/glyph.js +2 -0
  767. package/es/types/glyph.js.map +1 -0
  768. package/es/types/grammar.d.ts +184 -0
  769. package/es/types/grammar.js +2 -0
  770. package/es/types/grammar.js.map +1 -0
  771. package/es/types/hooks.d.ts +45 -0
  772. package/es/types/hooks.js +2 -0
  773. package/es/types/hooks.js.map +1 -0
  774. package/es/types/index.d.ts +22 -0
  775. package/es/types/index.js +44 -0
  776. package/es/types/index.js.map +1 -0
  777. package/es/types/layout.d.ts +5 -0
  778. package/es/types/layout.js +2 -0
  779. package/es/types/layout.js.map +1 -0
  780. package/es/types/mark.d.ts +344 -0
  781. package/es/types/mark.js +2 -0
  782. package/es/types/mark.js.map +1 -0
  783. package/es/types/morph.d.ts +29 -0
  784. package/es/types/morph.js +2 -0
  785. package/es/types/morph.js.map +1 -0
  786. package/es/types/plot.d.ts +326 -0
  787. package/es/types/plot.js +2 -0
  788. package/es/types/plot.js.map +1 -0
  789. package/es/types/projection.d.ts +61 -0
  790. package/es/types/projection.js +2 -0
  791. package/es/types/projection.js.map +1 -0
  792. package/es/types/renderer.d.ts +19 -0
  793. package/es/types/renderer.js +2 -0
  794. package/es/types/renderer.js.map +1 -0
  795. package/es/types/scale.d.ts +111 -0
  796. package/es/types/scale.js +2 -0
  797. package/es/types/scale.js.map +1 -0
  798. package/es/types/signal.d.ts +20 -0
  799. package/es/types/signal.js +2 -0
  800. package/es/types/signal.js.map +1 -0
  801. package/es/types/theme.d.ts +41 -0
  802. package/es/types/theme.js +2 -0
  803. package/es/types/theme.js.map +1 -0
  804. package/es/types/transform.d.ts +291 -0
  805. package/es/types/transform.js +2 -0
  806. package/es/types/transform.js.map +1 -0
  807. package/es/types/view.d.ts +217 -0
  808. package/es/types/view.js +2 -0
  809. package/es/types/view.js.map +1 -0
  810. package/es/util/data.d.ts +3 -0
  811. package/es/util/data.js +60 -0
  812. package/es/util/data.js.map +1 -0
  813. package/es/util/grammar-heap.d.ts +14 -0
  814. package/es/util/grammar-heap.js +58 -0
  815. package/es/util/grammar-heap.js.map +1 -0
  816. package/es/util/text.d.ts +19 -0
  817. package/es/util/text.js +25 -0
  818. package/es/util/text.js.map +1 -0
  819. package/es/util/unique-list.d.ts +12 -0
  820. package/es/util/unique-list.js +29 -0
  821. package/es/util/unique-list.js.map +1 -0
  822. package/es/view/View.d.ts +157 -0
  823. package/es/view/View.js +836 -0
  824. package/es/view/View.js.map +1 -0
  825. package/es/view/animate.d.ts +20 -0
  826. package/es/view/animate.js +98 -0
  827. package/es/view/animate.js.map +1 -0
  828. package/es/view/component.d.ts +26 -0
  829. package/es/view/component.js +64 -0
  830. package/es/view/component.js.map +1 -0
  831. package/es/view/constants.d.ts +17 -0
  832. package/es/view/constants.js +32 -0
  833. package/es/view/constants.js.map +1 -0
  834. package/es/view/coordinate.d.ts +23 -0
  835. package/es/view/coordinate.js +52 -0
  836. package/es/view/coordinate.js.map +1 -0
  837. package/es/view/data.d.ts +37 -0
  838. package/es/view/data.js +195 -0
  839. package/es/view/data.js.map +1 -0
  840. package/es/view/dataflow.d.ts +32 -0
  841. package/es/view/dataflow.js +141 -0
  842. package/es/view/dataflow.js.map +1 -0
  843. package/es/view/events.d.ts +4 -0
  844. package/es/view/events.js +26 -0
  845. package/es/view/events.js.map +1 -0
  846. package/es/view/glyph-meta.d.ts +29 -0
  847. package/es/view/glyph-meta.js +37 -0
  848. package/es/view/glyph-meta.js.map +1 -0
  849. package/es/view/glyph.d.ts +14 -0
  850. package/es/view/glyph.js +27 -0
  851. package/es/view/glyph.js.map +1 -0
  852. package/es/view/grammar-base.d.ts +46 -0
  853. package/es/view/grammar-base.js +165 -0
  854. package/es/view/grammar-base.js.map +1 -0
  855. package/es/view/grammar-record.d.ts +39 -0
  856. package/es/view/grammar-record.js +170 -0
  857. package/es/view/grammar-record.js.map +1 -0
  858. package/es/view/group.d.ts +13 -0
  859. package/es/view/group.js +39 -0
  860. package/es/view/group.js.map +1 -0
  861. package/es/view/index.d.ts +1 -0
  862. package/es/view/index.js +2 -0
  863. package/es/view/index.js.map +1 -0
  864. package/es/view/mark.d.ts +112 -0
  865. package/es/view/mark.js +604 -0
  866. package/es/view/mark.js.map +1 -0
  867. package/es/view/scale.d.ts +26 -0
  868. package/es/view/scale.js +82 -0
  869. package/es/view/scale.js.map +1 -0
  870. package/es/view/signal.d.ts +18 -0
  871. package/es/view/signal.js +52 -0
  872. package/es/view/signal.js.map +1 -0
  873. package/package.json +67 -0
@@ -0,0 +1,83 @@
1
+ import { isNil, isValidNumber } from "@visactor/vutils";
2
+
3
+ import { ACustomAnimate, Animate, AnimateGroup, AnimateMode } from "@visactor/vrender";
4
+
5
+ import { AttributeAnimate, channelAnimationAttributes, CustomInterpolator, typeAnimationAttributes } from "./attribute";
6
+
7
+ Animate.mode |= AnimateMode.SET_ATTR_IMMEDIATELY;
8
+
9
+ let GlobalAnimatorId = 0;
10
+
11
+ const isCustomAnimateCtor = custom => !isNil(custom) && custom.prototype instanceof ACustomAnimate;
12
+
13
+ export class Animator {
14
+ constructor(element, unit, animationOptions) {
15
+ this.id = GlobalAnimatorId++, this.isAnimating = !1, this.runnings = [], this.element = element,
16
+ this.animationOptions = animationOptions, this.unit = unit;
17
+ }
18
+ callback(callbackFunction) {
19
+ return this.callbackFunction = callbackFunction, this;
20
+ }
21
+ animate(animationParameters, parameters) {
22
+ return this.isAnimating = !0, this.animateElement(animationParameters, parameters),
23
+ 0 === this.runnings.length && this.animationEnd(), this;
24
+ }
25
+ stop(stopState = "end", invokeCallback = !0) {
26
+ return this.runnings.forEach((running => running.stop(stopState))), this.animationEnd(invokeCallback),
27
+ this;
28
+ }
29
+ pause() {
30
+ return this.runnings.forEach((running => running.pause())), this;
31
+ }
32
+ resume() {
33
+ return this.runnings.forEach((running => running.resume())), this;
34
+ }
35
+ startAt(startTime) {
36
+ return this.runnings.forEach((running => {
37
+ const initialDelay = this.unit.initialDelay;
38
+ running.startAt(initialDelay + startTime);
39
+ })), this;
40
+ }
41
+ getTotalAnimationTime() {
42
+ var _a;
43
+ const timeLineDuration = this.unit.initialDelay + this.unit.loopDuration * this.unit.loopCount;
44
+ return null !== (_a = this.unit.totalTime) && void 0 !== _a ? _a : timeLineDuration;
45
+ }
46
+ getEndAttributes() {
47
+ return this.runnings.reduce(((attributes, running) => Object.assign(attributes, running.getEndProps())), {});
48
+ }
49
+ animationEnd(invokeCallback = !0) {
50
+ var _a;
51
+ this.isAnimating = !1, this.runnings = null, invokeCallback && (null === (_a = this.callbackFunction) || void 0 === _a || _a.call(null));
52
+ }
53
+ animateElement(animationParameters, parameters) {
54
+ const graphicAnimate = this.element.getGraphicItem().animate();
55
+ this.runnings.push(graphicAnimate), graphicAnimate.startAt(this.unit.initialDelay),
56
+ graphicAnimate.wait(this.unit.loopDelay), this.unit.timeSlices.forEach((timeSlice => {
57
+ this.animateTimeSlice(graphicAnimate, timeSlice, animationParameters, parameters);
58
+ })), graphicAnimate.wait(this.unit.loopDelayAfter), graphicAnimate.loop(this.unit.loopCount - 1),
59
+ isValidNumber(this.unit.totalTime) && setTimeout((() => {
60
+ graphicAnimate && graphicAnimate.stop("end");
61
+ }), this.unit.totalTime), graphicAnimate.onEnd((() => {
62
+ this.runnings = this.runnings.filter((running => running !== graphicAnimate)), 0 === this.runnings.length && this.animationEnd();
63
+ }));
64
+ }
65
+ animateTimeSlice(graphicAnimate, timeSlice, animationParameters, parameters) {
66
+ const delay = timeSlice.delay, duration = timeSlice.duration, effects = timeSlice.effects;
67
+ if (delay > 0 && graphicAnimate.wait(delay), effects.length < 0) graphicAnimate.wait(duration); else {
68
+ const customAnimates = effects.map(((effect, index) => {
69
+ var _a;
70
+ const attributes = null !== (_a = effect.type ? typeAnimationAttributes(this.element, effect, animationParameters, parameters) : channelAnimationAttributes(this.element, effect, animationParameters, parameters)) && void 0 !== _a ? _a : {}, customOption = (null == attributes ? void 0 : attributes.custom) || (null == effect ? void 0 : effect.custom), customParametersOption = (null == attributes ? void 0 : attributes.customParameters) || (null == effect ? void 0 : effect.customParameters);
71
+ attributes.from && Object.keys(attributes.from).length && this.unit && this.animationOptions.timeline.controlOptions.immediatelyApply && "component" !== this.element.mark.markType && this.element.getGraphicItem().setAttributes(attributes.from);
72
+ const isCustomAnimate = isCustomAnimateCtor(customOption);
73
+ return !isNil(customOption) && !isCustomAnimateCtor(customOption) ? new CustomInterpolator(attributes.from, attributes.to, duration, effect.easing, {
74
+ interpolator: customOption,
75
+ element: this.element,
76
+ parameters: customParametersOption
77
+ }) : isCustomAnimate ? new customOption(attributes.from, attributes.to, duration, effect.easing, customParametersOption) : attributes.to ? new AttributeAnimate(attributes.from, attributes.to, duration, effect.easing) : void 0;
78
+ })).filter((animate => !isNil(animate)));
79
+ 1 === customAnimates.length ? graphicAnimate.play(customAnimates[0]) : graphicAnimate.play(new AnimateGroup(duration, customAnimates));
80
+ }
81
+ }
82
+ }
83
+ //# sourceMappingURL=animator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/graph/animation/animator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EA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K,CAAC,OAAO,CAAC,CAAC,CAAC;YAEtC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC/B,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;aACxC;iBAAM;gBACL,cAAc,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC;aACjE;SACF;IACH,CAAC;CACF","file":"animator.js","sourcesContent":["import { isNil, isValidNumber } from '@visactor/vutils';\nimport type { IAnimate as IGraphicAnimate } from '@visactor/vrender';\n// eslint-disable-next-line no-duplicate-imports\nimport { ACustomAnimate, Animate, AnimateGroup, AnimateMode } from '@visactor/vrender';\nimport type {\n IAnimationChannelInterpolator,\n IAnimationCustomConstructor,\n IAnimationTimeline,\n IAnimator,\n IAnimatorOptions,\n IAnimationUnit,\n IAnimationParameters,\n IAnimationTimeSlice,\n IElement,\n IAnimationEffect\n} from '../../types';\nimport { AttributeAnimate, channelAnimationAttributes, CustomInterpolator, typeAnimationAttributes } from './attribute';\n\nAnimate.mode |= AnimateMode.SET_ATTR_IMMEDIATELY;\n\nlet GlobalAnimatorId = 0;\n\nconst isCustomAnimateCtor = (custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor) => {\n return !isNil(custom) && custom.prototype instanceof ACustomAnimate;\n};\n\nexport class Animator implements IAnimator {\n id: number = GlobalAnimatorId++;\n element: IElement;\n animationOptions: IAnimatorOptions;\n isAnimating: boolean = false;\n\n private unit: IAnimationUnit;\n private runnings: IGraphicAnimate[] = [];\n private callbackFunction: (...args: any[]) => any;\n\n constructor(\n element: IElement,\n unit: IAnimationUnit,\n animationOptions: {\n state: string;\n timeline: IAnimationTimeline;\n id: string;\n }\n ) {\n this.element = element;\n this.animationOptions = animationOptions;\n this.unit = unit;\n }\n\n callback(callbackFunction: (...args: any[]) => void): this {\n this.callbackFunction = callbackFunction;\n return this;\n }\n\n animate(animationParameters: IAnimationParameters, parameters: any): this {\n this.isAnimating = true;\n\n this.animateElement(animationParameters, parameters);\n\n // if no valid running, end animating immediately\n if (this.runnings.length === 0) {\n this.animationEnd();\n }\n return this;\n }\n\n stop(stopState: 'start' | 'end' = 'end', invokeCallback: boolean = true): this {\n // FIXME: wait for VRender to fix 'end' parameter\n this.runnings.forEach(running => running.stop(stopState));\n this.animationEnd(invokeCallback);\n return this;\n }\n\n pause(): this {\n this.runnings.forEach(running => running.pause());\n return this;\n }\n\n resume(): this {\n this.runnings.forEach(running => running.resume());\n return this;\n }\n\n startAt(startTime: number): this {\n this.runnings.forEach(running => {\n const initialDelay = this.unit.initialDelay;\n running.startAt(initialDelay + startTime);\n });\n return this;\n }\n\n getTotalAnimationTime() {\n const timeLineDuration = this.unit.initialDelay + this.unit.loopDuration * this.unit.loopCount;\n return this.unit.totalTime ?? timeLineDuration;\n }\n\n getEndAttributes() {\n return this.runnings.reduce((attributes, running) => {\n return Object.assign(attributes, running.getEndProps());\n }, {} as Record<string, any>);\n }\n\n private animationEnd(invokeCallback: boolean = true) {\n this.isAnimating = false;\n this.runnings = null;\n if (invokeCallback) {\n this.callbackFunction?.call(null);\n }\n }\n\n private animateElement(animationParameters: IAnimationParameters, parameters: any) {\n const graphicAnimate: IGraphicAnimate = this.element.getGraphicItem().animate();\n this.runnings.push(graphicAnimate);\n // initialDelay is only used at first loop\n graphicAnimate.startAt(this.unit.initialDelay);\n // execute loop animation\n graphicAnimate.wait(this.unit.loopDelay);\n this.unit.timeSlices.forEach(timeSlice => {\n this.animateTimeSlice(graphicAnimate, timeSlice, animationParameters, parameters);\n });\n graphicAnimate.wait(this.unit.loopDelayAfter);\n\n graphicAnimate.loop(this.unit.loopCount - 1);\n\n if (isValidNumber(this.unit.totalTime)) {\n // FIXME: use VRender api instead after VRender refactor is finished\n setTimeout(() => {\n if (graphicAnimate) {\n graphicAnimate.stop('end');\n }\n }, this.unit.totalTime);\n }\n\n graphicAnimate.onEnd(() => {\n this.runnings = this.runnings.filter(running => running !== graphicAnimate);\n if (this.runnings.length === 0) {\n this.animationEnd();\n }\n });\n }\n\n private animateTimeSlice(\n graphicAnimate: IGraphicAnimate,\n timeSlice: IAnimationTimeSlice,\n animationParameters: IAnimationParameters,\n parameters: any\n ) {\n const delay = timeSlice.delay as number;\n const duration = timeSlice.duration as number;\n const effects = timeSlice.effects as IAnimationEffect[];\n\n // wait in loop animation before animation starts\n if (delay > 0) {\n graphicAnimate.wait(delay);\n }\n\n if (effects.length < 0) {\n graphicAnimate.wait(duration);\n } else {\n const customAnimates = effects\n .map((effect, index) => {\n const attributes =\n (effect.type\n ? typeAnimationAttributes(this.element, effect, animationParameters, parameters)\n : channelAnimationAttributes(this.element, effect, animationParameters, parameters)) ?? {};\n const customOption = attributes?.custom || effect?.custom;\n const customParametersOption = attributes?.customParameters || effect?.customParameters;\n\n if (\n attributes.from &&\n Object.keys(attributes.from).length &&\n this.unit &&\n this.animationOptions.timeline.controlOptions.immediatelyApply &&\n this.element.mark.markType !== 'component'\n ) {\n this.element.getGraphicItem().setAttributes(attributes.from);\n }\n\n const isCustomAnimate = isCustomAnimateCtor(customOption);\n const isCustomInterpolator = !isNil(customOption) && !isCustomAnimateCtor(customOption);\n\n if (isCustomInterpolator) {\n return new CustomInterpolator(attributes.from, attributes.to, duration, effect.easing, {\n interpolator: customOption as IAnimationChannelInterpolator,\n element: this.element,\n parameters: customParametersOption\n });\n } else if (isCustomAnimate) {\n return new (customOption as IAnimationCustomConstructor)(\n attributes.from,\n attributes.to,\n duration,\n effect.easing,\n customParametersOption\n );\n } else if (attributes.to) {\n return new AttributeAnimate(attributes.from, attributes.to, duration, effect.easing);\n }\n })\n .filter(animate => !isNil(animate));\n\n if (customAnimates.length === 1) {\n graphicAnimate.play(customAnimates[0]);\n } else {\n graphicAnimate.play(new AnimateGroup(duration, customAnimates));\n }\n }\n }\n}\n"]}
@@ -0,0 +1,13 @@
1
+ import type { IAnimateArranger, IAnimator } from '../../types/animate';
2
+ export declare class Arranger implements IAnimateArranger {
3
+ afterArranger: IAnimateArranger;
4
+ parallelArrangers: IAnimateArranger[];
5
+ animators: IAnimator[];
6
+ totalTime: number;
7
+ startTime: number;
8
+ endTime: number;
9
+ constructor(animators: IAnimator[]);
10
+ parallel(arranger: IAnimateArranger): this;
11
+ after(arranger: IAnimateArranger): this;
12
+ arrangeTime(): void;
13
+ }
@@ -0,0 +1,29 @@
1
+ import { isNil } from "@visactor/vutils";
2
+
3
+ export class Arranger {
4
+ constructor(animators) {
5
+ this.parallelArrangers = [ this ], this.totalTime = 0, this.startTime = 0, this.endTime = 0,
6
+ this.animators = animators.filter((animator => !isNil(animator))), this.totalTime = this.animators.reduce(((time, animator) => Math.max(time, animator.getTotalAnimationTime())), 0);
7
+ }
8
+ parallel(arranger) {
9
+ const parallelArrangers = Array.from(new Set(this.parallelArrangers.concat(arranger.parallelArrangers)));
10
+ return parallelArrangers.forEach((arranger => {
11
+ arranger.parallelArrangers = parallelArrangers;
12
+ })), this.arrangeTime(), this;
13
+ }
14
+ after(arranger) {
15
+ return this.afterArranger = arranger, this.arrangeTime(), this;
16
+ }
17
+ arrangeTime() {
18
+ const parallelTime = this.parallelArrangers.reduce(((time, arranger) => Math.max(time, arranger.totalTime)), this.totalTime), startTime = this.parallelArrangers.reduce(((time, arranger) => {
19
+ var _a, _b;
20
+ return Math.max(time, null !== (_b = null === (_a = arranger.afterArranger) || void 0 === _a ? void 0 : _a.endTime) && void 0 !== _b ? _b : 0);
21
+ }), 0);
22
+ this.parallelArrangers.forEach((arranger => {
23
+ arranger.startTime = startTime, arranger.endTime = startTime + parallelTime, arranger.animators.forEach((animator => {
24
+ animator.startAt(startTime);
25
+ }));
26
+ }));
27
+ }
28
+ }
29
+ //# sourceMappingURL=arranger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/graph/animation/arranger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,MAAM,OAAO,QAAQ;IASnB,YAAY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AAI,CAAC,SAAS,CAAC,CAAC;QACnB,MAAM,SAAS,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE;;YACjE,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,MAAA,MAAA,QAAQ,CAAC,aAAa,0CAAE,OAAO,mCAAI,CAAC,CAAC,CAAC;QAC9D,CAAC,EAAE,CAAC,CAAC,CAAC;QAEN,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YACxC,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAC;YAC/B,QAAQ,CAAC,OAAO,GAAG,SAAS,GAAG,YAAY,CAAC;YAC5C,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;gBACpC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF","file":"arranger.js","sourcesContent":["import { isNil } from '@visactor/vutils';\nimport type { IAnimateArranger, IAnimator } from '../../types/animate';\n\nexport class Arranger implements IAnimateArranger {\n afterArranger: IAnimateArranger;\n parallelArrangers: IAnimateArranger[] = [this];\n\n animators: IAnimator[];\n totalTime: number = 0;\n startTime: number = 0;\n endTime: number = 0;\n\n constructor(animators: IAnimator[]) {\n this.animators = animators.filter(animator => !isNil(animator));\n this.totalTime = this.animators.reduce((time, animator) => {\n return Math.max(time, animator.getTotalAnimationTime());\n }, 0);\n }\n\n parallel(arranger: IAnimateArranger) {\n const parallelArrangers = Array.from(new Set(this.parallelArrangers.concat(arranger.parallelArrangers)));\n parallelArrangers.forEach(arranger => {\n arranger.parallelArrangers = parallelArrangers;\n });\n this.arrangeTime();\n return this;\n }\n\n after(arranger: IAnimateArranger) {\n this.afterArranger = arranger;\n this.arrangeTime();\n return this;\n }\n\n arrangeTime() {\n const parallelTime = this.parallelArrangers.reduce((time, arranger) => {\n return Math.max(time, arranger.totalTime);\n }, this.totalTime);\n const startTime = this.parallelArrangers.reduce((time, arranger) => {\n return Math.max(time, arranger.afterArranger?.endTime ?? 0);\n }, 0);\n\n this.parallelArrangers.forEach(arranger => {\n arranger.startTime = startTime;\n arranger.endTime = startTime + parallelTime;\n arranger.animators.forEach(animator => {\n animator.startAt(startTime);\n });\n });\n }\n}\n"]}
@@ -0,0 +1,27 @@
1
+ import type { EasingType, IGraphic } from '@visactor/vrender';
2
+ import { ACustomAnimate } from '@visactor/vrender';
3
+ import type { IAnimationChannelInterpolator, IAnimationEffect, IAnimationParameters, IElement, IParsedAnimationAttrs } from '../../types';
4
+ export declare function typeAnimationAttributes(element: IElement, effect: IAnimationEffect, animationParameters: IAnimationParameters, parameters: any): IParsedAnimationAttrs;
5
+ export declare function channelAnimationAttributes(element: IElement, effect: IAnimationEffect, animationParameters: IAnimationParameters, parameters: any): IParsedAnimationAttrs;
6
+ export declare class CustomInterpolator extends ACustomAnimate<any> {
7
+ private _element;
8
+ private _interpolator?;
9
+ constructor(from: any, to: any, duration: number, easing: EasingType, params: {
10
+ interpolator: IAnimationChannelInterpolator;
11
+ element: IElement;
12
+ parameters?: any;
13
+ });
14
+ onBind(): void;
15
+ getEndProps(): void | Record<string, any>;
16
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
17
+ }
18
+ export declare class AttributeAnimate extends ACustomAnimate<any> {
19
+ target: IGraphic;
20
+ private _fromAttribute;
21
+ private _toAttribute;
22
+ getEndProps(): Record<string, any>;
23
+ onBind(): void;
24
+ onStart(): void;
25
+ onEnd(): void;
26
+ onUpdate(end: boolean, ratio: number, out: Record<string, any>): void;
27
+ }
@@ -0,0 +1,114 @@
1
+ import { ACustomAnimate, AttributeUpdateType } from "@visactor/vrender";
2
+
3
+ import { isArray, isFunction, isNil, isObject, isValid } from "@visactor/vutils";
4
+
5
+ import { isValidPointsChannel } from "../attributes/helpers";
6
+
7
+ import { Factory } from "../../core/factory";
8
+
9
+ const transformAnimationAttributes = (attributes, element) => {
10
+ if (!attributes) return null;
11
+ if (null == attributes ? void 0 : attributes.from) {
12
+ const from = attributes.from;
13
+ Object.keys(from).forEach((channel => {
14
+ isNil(from[channel]) && delete from[channel];
15
+ }));
16
+ const computePoints = isValidPointsChannel(Object.keys(from), element.mark.markType) && !isValid(from.segments);
17
+ if (computePoints) {
18
+ const items = element.items.map((item => Object.assign({}, item, {
19
+ nextAttrs: from
20
+ })));
21
+ attributes.from = element.transformElementItems(items, element.mark.markType, computePoints);
22
+ }
23
+ }
24
+ if (null == attributes ? void 0 : attributes.to) {
25
+ const to = attributes.to;
26
+ Object.keys(to).forEach((channel => {
27
+ isNil(to[channel]) && delete to[channel];
28
+ }));
29
+ const computePoints = isValidPointsChannel(Object.keys(to), element.mark.markType) && !isValid(to.segments);
30
+ if (computePoints) {
31
+ const items = element.items.map((item => Object.assign({}, item, {
32
+ nextAttrs: to
33
+ })));
34
+ attributes.to = element.transformElementItems(items, element.mark.markType, computePoints);
35
+ }
36
+ }
37
+ return attributes;
38
+ };
39
+
40
+ export function typeAnimationAttributes(element, effect, animationParameters, parameters) {
41
+ const options = isFunction(effect.options) ? effect.options.call(null, element.getDatum(), element, parameters) : effect.options;
42
+ if (!effect.type || !Factory.getAnimationType(effect.type)) return null;
43
+ const attributes = Factory.getAnimationType(effect.type)(element, options, animationParameters);
44
+ return transformAnimationAttributes(attributes, element);
45
+ }
46
+
47
+ const parseChannelValue = (element, channel, channelValue, animationParameters, parameters) => isFunction(channelValue) ? channelValue(element.getDatum(), element, parameters) : channelValue;
48
+
49
+ export function channelAnimationAttributes(element, effect, animationParameters, parameters) {
50
+ const channel = effect.channel;
51
+ let attributes = null;
52
+ return isArray(channel) ? attributes = channel.reduce(((res, key) => (res.from[key] = element.getGraphicAttribute(key, !0),
53
+ res.to[key] = element.getGraphicAttribute(key, !1), res)), {
54
+ from: {},
55
+ to: {}
56
+ }) : isObject(channel) && (attributes = Object.keys(channel).reduce(((res, key) => {
57
+ var _a, _b;
58
+ const hasFrom = !isNil(null === (_a = channel[key]) || void 0 === _a ? void 0 : _a.from), hasTo = !isNil(null === (_b = channel[key]) || void 0 === _b ? void 0 : _b.to);
59
+ return (hasFrom || hasTo) && (res.from[key] = hasFrom ? parseChannelValue(element, 0, channel[key].from, 0, parameters) : void 0,
60
+ res.to[key] = hasTo ? parseChannelValue(element, 0, channel[key].to, 0, parameters) : element.getGraphicAttribute(key, !1)),
61
+ res;
62
+ }), {
63
+ from: {},
64
+ to: {}
65
+ })), transformAnimationAttributes(attributes, element);
66
+ }
67
+
68
+ export class CustomInterpolator extends ACustomAnimate {
69
+ constructor(from, to, duration, easing, params) {
70
+ super(from, to, duration, easing, params), this._interpolator = null == params ? void 0 : params.interpolator,
71
+ this._element = null == params ? void 0 : params.element;
72
+ }
73
+ onBind() {
74
+ var _a, _b;
75
+ this.from = null !== (_a = this.from) && void 0 !== _a ? _a : {}, this.to = null !== (_b = this.to) && void 0 !== _b ? _b : {};
76
+ }
77
+ getEndProps() {
78
+ return this.to;
79
+ }
80
+ onUpdate(end, ratio, out) {
81
+ this._interpolator && this._element && this._interpolator.call(this, ratio, this.from, this.to, out, this._element.getDatum(), this._element, this.params.parameters);
82
+ }
83
+ }
84
+
85
+ export class AttributeAnimate extends ACustomAnimate {
86
+ getEndProps() {
87
+ return this.to;
88
+ }
89
+ onBind() {
90
+ var _a, _b;
91
+ this.from = null !== (_a = this.from) && void 0 !== _a ? _a : {}, this.to = null !== (_b = this.to) && void 0 !== _b ? _b : {};
92
+ }
93
+ onStart() {
94
+ const from = Object.assign({}, this.from), to = Object.assign({}, this.to);
95
+ Object.keys(to).forEach((k => {
96
+ isNil(from[k]) && (from[k] = this.target.getComputedAttribute(k));
97
+ })), this.target.setAttributes(from, !1, {
98
+ type: AttributeUpdateType.ANIMATE_UPDATE,
99
+ animationState: {
100
+ ratio: 0,
101
+ end: !1
102
+ }
103
+ }), this._fromAttribute = from, this._toAttribute = to;
104
+ }
105
+ onEnd() {
106
+ this.target.setAttributes(this._toAttribute, !1, {
107
+ type: AttributeUpdateType.ANIMATE_END
108
+ });
109
+ }
110
+ onUpdate(end, ratio, out) {
111
+ this.target.stepInterpolate(this.subAnimate, this.subAnimate.animate, out, this.step, ratio, end, this._toAttribute, this._fromAttribute);
112
+ }
113
+ }
114
+ //# sourceMappingURL=attribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/graph/animation/attribute.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxE,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,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YAClC,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,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChH,IAAI,aAAa,EAAE;YACjB,MAAM,KAAK,GAAG,O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ute.js","sourcesContent":["import type { EasingType, IGraphic } from '@visactor/vrender';\n// eslint-disable-next-line no-duplicate-imports\nimport { ACustomAnimate, AttributeUpdateType } from '@visactor/vrender';\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 Object.keys(from).forEach(channel => {\n if (isNil(from[channel])) {\n delete from[channel];\n }\n });\n const computePoints = isValidPointsChannel(Object.keys(from), 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 Object.keys(to).forEach(channel => {\n if (isNil(to[channel])) {\n delete to[channel];\n }\n });\n const computePoints = isValidPointsChannel(Object.keys(to), 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 from = Object.assign({}, this.from);\n const to = Object.assign({}, this.to);\n Object.keys(to).forEach(k => {\n 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 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 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"]}
@@ -0,0 +1,5 @@
1
+ import type { IElement } from '../../types';
2
+ import type { IAnimationConfig, IParsedAnimationConfig, MarkFunctionValueType } from '../../types/animate';
3
+ export declare function normalizeAnimationConfig(config: Record<string, IAnimationConfig | IAnimationConfig[]>): Array<IParsedAnimationConfig>;
4
+ export declare function normalizeStateAnimationConfig(state: string, config: IAnimationConfig | IAnimationConfig[], initialIndex?: number): Array<IParsedAnimationConfig>;
5
+ export declare function invokeAnimateSpec<T>(spec: MarkFunctionValueType<T>, element: IElement, parameters: any): T;
@@ -0,0 +1,84 @@
1
+ import { array, isFunction, isNil, merge } from "@visactor/vutils";
2
+
3
+ import { DefaultAnimationControlOptions, DefaultAnimationDelay, DefaultAnimationDuration, DefaultAnimationEasing, DefaultAnimationLoop, DefaultAnimationOneByOne, DefaultAnimationStartTime } from "../constants";
4
+
5
+ function transformToTimelineConfig(animationConfig) {
6
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
7
+ if (isNil(animationConfig.timeSlices)) {
8
+ const typeConfig = animationConfig;
9
+ return {
10
+ startTime: null !== (_a = typeConfig.startTime) && void 0 !== _a ? _a : DefaultAnimationStartTime,
11
+ totalTime: typeConfig.totalTime,
12
+ oneByOne: null !== (_b = typeConfig.oneByOne) && void 0 !== _b ? _b : DefaultAnimationOneByOne,
13
+ loop: null !== (_c = typeConfig.loop) && void 0 !== _c ? _c : DefaultAnimationLoop,
14
+ controlOptions: merge({}, DefaultAnimationControlOptions, null !== (_d = typeConfig.controlOptions) && void 0 !== _d ? _d : {}),
15
+ timeSlices: [ {
16
+ duration: null !== (_e = typeConfig.duration) && void 0 !== _e ? _e : DefaultAnimationDuration,
17
+ delay: null !== (_f = typeConfig.delay) && void 0 !== _f ? _f : DefaultAnimationDelay,
18
+ effects: [ {
19
+ type: typeConfig.type,
20
+ channel: typeConfig.channel,
21
+ custom: typeConfig.custom,
22
+ easing: null !== (_g = typeConfig.easing) && void 0 !== _g ? _g : DefaultAnimationEasing,
23
+ customParameters: typeConfig.customParameters,
24
+ options: typeConfig.options
25
+ } ]
26
+ } ]
27
+ };
28
+ }
29
+ const formattedTimeSlices = array(animationConfig.timeSlices).filter((timeSlice => timeSlice.effects && array(timeSlice.effects).filter((effect => effect.channel || effect.type)).length));
30
+ if (formattedTimeSlices.length) return {
31
+ startTime: null !== (_h = animationConfig.startTime) && void 0 !== _h ? _h : DefaultAnimationStartTime,
32
+ totalTime: animationConfig.totalTime,
33
+ oneByOne: null !== (_j = animationConfig.oneByOne) && void 0 !== _j ? _j : DefaultAnimationOneByOne,
34
+ loop: null !== (_k = animationConfig.loop) && void 0 !== _k ? _k : DefaultAnimationLoop,
35
+ controlOptions: merge({}, DefaultAnimationControlOptions, null !== (_l = animationConfig.controlOptions) && void 0 !== _l ? _l : {}),
36
+ timeSlices: formattedTimeSlices.map((timeSlice => {
37
+ var _a;
38
+ return {
39
+ duration: timeSlice.duration,
40
+ delay: null !== (_a = timeSlice.delay) && void 0 !== _a ? _a : DefaultAnimationDelay,
41
+ effects: array(timeSlice.effects).filter((effect => effect.channel || effect.type)).map((effect => {
42
+ var _a;
43
+ return {
44
+ type: effect.type,
45
+ channel: effect.channel,
46
+ custom: effect.custom,
47
+ easing: null !== (_a = effect.easing) && void 0 !== _a ? _a : DefaultAnimationEasing,
48
+ customParameters: effect.customParameters,
49
+ options: effect.options
50
+ };
51
+ }))
52
+ };
53
+ })),
54
+ partitioner: animationConfig.partitioner,
55
+ sort: animationConfig.sort
56
+ };
57
+ }
58
+
59
+ export function normalizeAnimationConfig(config) {
60
+ let normalizedConfig = [];
61
+ return Object.keys(config).forEach((state => {
62
+ normalizedConfig = normalizedConfig.concat(normalizeStateAnimationConfig(state, config[state]));
63
+ })), normalizedConfig;
64
+ }
65
+
66
+ export function normalizeStateAnimationConfig(state, config, initialIndex = 0) {
67
+ const normalizedConfig = [];
68
+ let index = initialIndex;
69
+ return array(config).forEach((animationConfig => {
70
+ var _a;
71
+ const timelineConfig = transformToTimelineConfig(animationConfig);
72
+ timelineConfig && (normalizedConfig.push({
73
+ state: state,
74
+ id: null !== (_a = timelineConfig.id) && void 0 !== _a ? _a : `${state}-${index}`,
75
+ timeline: timelineConfig,
76
+ originConfig: animationConfig
77
+ }), index += 1);
78
+ })), normalizedConfig;
79
+ }
80
+
81
+ export function invokeAnimateSpec(spec, element, parameters) {
82
+ return isFunction(spec) ? spec.call(null, element.getDatum(), element, parameters) : spec;
83
+ }
84
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/graph/animation/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AASnE,OAAO,EACL,8BAA8B,EAC9B,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,cAAc,CAAC;AAEtB,SAAS,yBAAyB,CAAC,eAAiC;;IAClE,IAA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AAC;IAEzD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QAClC,gBAAgB,GAAG,gBAAgB,CAAC,MAAM,CAAC,6BAA6B,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAClG,CAAC,CAAC,CAAC;IACH,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC3C,KAAa,EACb,MAA6C,EAC7C,eAAuB,CAAC;IAExB,MAAM,gBAAgB,GAAkC,EAAE,CAAC;IAC3D,IAAI,KAAK,GAAG,YAAY,CAAC;IACzB,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE;;QACtC,MAAM,cAAc,GAAG,yBAAyB,CAAC,eAAe,CAAC,CAAC;QAClE,IAAI,cAAc,EAAE;YAClB,gBAAgB,CAAC,IAAI,CAAC;gBACpB,KAAK;gBACL,EAAE,EAAE,MAAA,cAAc,CAAC,EAAE,mCAAI,GAAG,KAAK,IAAI,KAAK,EAAE;gBAC5C,QAAQ,EAAE,cAAc;gBACxB,YAAY,EAAE,eAAe;aAC9B,CAAC,CAAC;YACH,KAAK,IAAI,CAAC,CAAC;SACZ;IACH,CAAC,CAAC,CAAC;IACH,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAI,IAA8B,EAAE,OAAiB,EAAE,UAAe;IACrG,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;KACjE;IACD,OAAO,IAAI,CAAC;AACd,CAAC","file":"config.js","sourcesContent":["import { array, isFunction, isNil, merge } from '@visactor/vutils';\nimport type { IElement } from '../../types';\nimport type {\n IAnimationConfig,\n IAnimationTimeline,\n IAnimationTypeConfig,\n IParsedAnimationConfig,\n MarkFunctionValueType\n} from '../../types/animate';\nimport {\n DefaultAnimationControlOptions,\n DefaultAnimationDelay,\n DefaultAnimationDuration,\n DefaultAnimationEasing,\n DefaultAnimationLoop,\n DefaultAnimationOneByOne,\n DefaultAnimationStartTime\n} from '../constants';\n\nfunction transformToTimelineConfig(animationConfig: IAnimationConfig): IAnimationTimeline {\n if (isNil((animationConfig as IAnimationTimeline).timeSlices)) {\n const typeConfig = animationConfig as IAnimationTypeConfig;\n // transform type animation config into timeline animation config\n return {\n startTime: typeConfig.startTime ?? DefaultAnimationStartTime,\n totalTime: typeConfig.totalTime,\n oneByOne: typeConfig.oneByOne ?? DefaultAnimationOneByOne,\n loop: typeConfig.loop ?? DefaultAnimationLoop,\n controlOptions: merge({}, DefaultAnimationControlOptions, typeConfig.controlOptions ?? {}),\n timeSlices: [\n {\n duration: typeConfig.duration ?? DefaultAnimationDuration,\n delay: typeConfig.delay ?? DefaultAnimationDelay,\n effects: [\n {\n type: typeConfig.type,\n channel: typeConfig.channel,\n custom: typeConfig.custom,\n easing: typeConfig.easing ?? DefaultAnimationEasing,\n customParameters: typeConfig.customParameters,\n options: typeConfig.options\n }\n ]\n }\n ]\n };\n }\n\n const timeSlices = array((animationConfig as IAnimationTimeline).timeSlices);\n const formattedTimeSlices = timeSlices.filter(timeSlice => {\n return timeSlice.effects && array(timeSlice.effects).filter(effect => effect.channel || effect.type).length;\n });\n\n if (formattedTimeSlices.length) {\n // fill up default animation config\n return {\n startTime: (animationConfig as IAnimationTimeline).startTime ?? DefaultAnimationStartTime,\n totalTime: (animationConfig as IAnimationTimeline).totalTime,\n oneByOne: (animationConfig as IAnimationTimeline).oneByOne ?? DefaultAnimationOneByOne,\n loop: (animationConfig as IAnimationTimeline).loop ?? DefaultAnimationLoop,\n controlOptions: merge({}, DefaultAnimationControlOptions, animationConfig.controlOptions ?? {}),\n timeSlices: formattedTimeSlices.map(timeSlice => {\n return {\n duration: timeSlice.duration,\n delay: timeSlice.delay ?? DefaultAnimationDelay,\n effects: array(timeSlice.effects)\n .filter(effect => effect.channel || effect.type)\n .map(effect => {\n return {\n type: effect.type,\n channel: effect.channel,\n custom: effect.custom,\n easing: effect.easing ?? DefaultAnimationEasing,\n customParameters: effect.customParameters,\n options: effect.options\n };\n })\n };\n }),\n partitioner: (animationConfig as IAnimationTimeline).partitioner,\n sort: (animationConfig as IAnimationTimeline).sort\n };\n }\n\n return;\n}\n\nexport function normalizeAnimationConfig(\n config: Record<string, IAnimationConfig | IAnimationConfig[]>\n): Array<IParsedAnimationConfig> {\n let normalizedConfig: Array<IParsedAnimationConfig> = [];\n\n Object.keys(config).forEach(state => {\n normalizedConfig = normalizedConfig.concat(normalizeStateAnimationConfig(state, config[state]));\n });\n return normalizedConfig;\n}\n\nexport function normalizeStateAnimationConfig(\n state: string,\n config: IAnimationConfig | IAnimationConfig[],\n initialIndex: number = 0\n): Array<IParsedAnimationConfig> {\n const normalizedConfig: Array<IParsedAnimationConfig> = [];\n let index = initialIndex;\n array(config).forEach(animationConfig => {\n const timelineConfig = transformToTimelineConfig(animationConfig);\n if (timelineConfig) {\n normalizedConfig.push({\n state,\n id: timelineConfig.id ?? `${state}-${index}`,\n timeline: timelineConfig,\n originConfig: animationConfig\n });\n index += 1;\n }\n });\n return normalizedConfig;\n}\n\nexport function invokeAnimateSpec<T>(spec: MarkFunctionValueType<T>, element: IElement, parameters: any): T {\n if (isFunction(spec)) {\n return spec.call(null, element.getDatum(), element, parameters);\n }\n return spec;\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import type { IGrammarBase, IMark, IRunningConfig } from '../../types';
2
+ import type { DiffResult } from '../../types/base';
3
+ import type { IMorph } from '../../types/morph';
4
+ export declare class Morph implements IMorph {
5
+ diffGrammar<U extends IGrammarBase>(prevGrammars: U[], nextGrammars: U[]): DiffResult<U, U>;
6
+ diffMark(prevMarks: IMark[], nextMarks: IMark[], runningConfig: IRunningConfig): DiffResult<IMark[], IMark[]>;
7
+ private _appendMorphKeyToElements;
8
+ morph(prevMarks: IMark[], nextMarks: IMark[], runningConfig: IRunningConfig): void;
9
+ private diffUpdateByGroup;
10
+ private doMorph;
11
+ private divideElements;
12
+ }
@@ -0,0 +1,171 @@
1
+ import { morphPath, multiToOneMorph, oneToMultiMorph } from "@visactor/vrender";
2
+
3
+ import { isNil, isNumber, isValidNumber } from "@visactor/vutils";
4
+
5
+ import { invokeFunctionType, parseField } from "../../parse/util";
6
+
7
+ import { diffMultiple, diffSingle, groupData } from "../mark/differ";
8
+
9
+ import { GrammarMarkType } from "../enums";
10
+
11
+ const EmptyKey = Symbol.for("key");
12
+
13
+ export class Morph {
14
+ diffGrammar(prevGrammars, nextGrammars) {
15
+ return diffSingle(prevGrammars, nextGrammars, (grammar => {
16
+ var _a;
17
+ return null !== (_a = grammar.id()) && void 0 !== _a ? _a : Symbol();
18
+ }));
19
+ }
20
+ diffMark(prevMarks, nextMarks, runningConfig) {
21
+ const diffResult = {
22
+ enter: [],
23
+ exit: [],
24
+ update: []
25
+ };
26
+ let prevDiffMarks = [], nextDiffMarks = [];
27
+ prevMarks.forEach((mark => {
28
+ mark.markType !== GrammarMarkType.group && (runningConfig.morph && mark.getMorphConfig().morph || runningConfig.morphAll || runningConfig.reuse) ? prevDiffMarks.push(mark) : diffResult.exit.push({
29
+ prev: [ mark ]
30
+ });
31
+ })), nextMarks.forEach((mark => {
32
+ mark.markType !== GrammarMarkType.group && (runningConfig.morph && mark.getMorphConfig().morph || runningConfig.morphAll || runningConfig.reuse) ? nextDiffMarks.push(mark) : diffResult.enter.push({
33
+ next: [ mark ]
34
+ });
35
+ }));
36
+ const keyDiffResult = this.diffUpdateByGroup(prevDiffMarks, nextDiffMarks, (mark => mark.getMorphConfig().morphKey), (mark => mark.getMorphConfig().morphKey));
37
+ prevDiffMarks = keyDiffResult.prev, nextDiffMarks = keyDiffResult.next, diffResult.update = diffResult.update.concat(keyDiffResult.update);
38
+ const nameDiffResult = this.diffUpdateByGroup(prevDiffMarks, nextDiffMarks, (mark => mark.id()), (mark => mark.id()));
39
+ prevDiffMarks = nameDiffResult.prev, nextDiffMarks = nameDiffResult.next, diffResult.update = diffResult.update.concat(nameDiffResult.update);
40
+ const prevParentGroup = groupData(prevDiffMarks, (mark => {
41
+ var _a, _b;
42
+ return null === (_b = null === (_a = mark.group) || void 0 === _a ? void 0 : _a.id) || void 0 === _b ? void 0 : _b.call(_a);
43
+ })), nextParentGroup = groupData(nextDiffMarks, (mark => {
44
+ var _a, _b;
45
+ return null === (_b = null === (_a = mark.group) || void 0 === _a ? void 0 : _a.id) || void 0 === _b ? void 0 : _b.call(_a);
46
+ }));
47
+ return Object.keys(nextParentGroup).forEach((groupName => {
48
+ const prevChildren = prevParentGroup.data.get(groupName), nextChildren = nextParentGroup.data.get(groupName);
49
+ if (prevChildren && nextChildren) {
50
+ for (let i = 0; i < Math.max(prevChildren.length, nextChildren.length); i += 1) {
51
+ const prevChild = prevChildren[i], nextChild = nextChildren[i];
52
+ prevChild && nextChild ? diffResult.update.push({
53
+ prev: [ prevChild ],
54
+ next: [ nextChild ]
55
+ }) : prevChild ? diffResult.exit.push({
56
+ prev: [ prevChild ]
57
+ }) : nextChild && diffResult.enter.push({
58
+ next: [ nextChild ]
59
+ });
60
+ }
61
+ prevDiffMarks = prevDiffMarks.filter((mark => !prevChildren.includes(mark))), nextDiffMarks = nextDiffMarks.filter((mark => !nextChildren.includes(mark)));
62
+ }
63
+ })), prevDiffMarks.forEach((mark => diffResult.exit.push({
64
+ prev: [ mark ]
65
+ }))), nextDiffMarks.forEach((mark => diffResult.enter.push({
66
+ next: [ mark ]
67
+ }))), diffResult;
68
+ }
69
+ _appendMorphKeyToElements(mark) {
70
+ const config = mark.getMorphConfig();
71
+ if (!isNil(config.morphElementKey)) {
72
+ const getter = parseField(config.morphElementKey);
73
+ mark.elements && mark.elements.forEach((el => {
74
+ el.morphKey = getter(el.getDatum());
75
+ }));
76
+ }
77
+ }
78
+ morph(prevMarks, nextMarks, runningConfig) {
79
+ const prevElements = prevMarks.reduce(((elements, mark) => (this._appendMorphKeyToElements(mark),
80
+ elements.concat(mark.elements))), []), nextElements = nextMarks.reduce(((elements, mark) => (this._appendMorphKeyToElements(mark),
81
+ elements.concat(mark.elements))), []), diffResult = diffMultiple(prevElements, nextElements, (element => {
82
+ var _a;
83
+ return null !== (_a = element.morphKey) && void 0 !== _a ? _a : element.key;
84
+ }));
85
+ prevMarks.forEach((mark => {
86
+ var _a, _b;
87
+ return null === (_b = null === (_a = mark.animate) || void 0 === _a ? void 0 : _a.disable) || void 0 === _b ? void 0 : _b.call(_a);
88
+ })), nextMarks.forEach((mark => {
89
+ var _a, _b;
90
+ return null === (_b = null === (_a = mark.animate) || void 0 === _a ? void 0 : _a.disable) || void 0 === _b ? void 0 : _b.call(_a);
91
+ }));
92
+ const parameters = prevMarks.concat(nextMarks).reduce(((parameters, mark) => (Object.assign(parameters, mark.parameters()),
93
+ parameters)), {});
94
+ let morphCount = 0;
95
+ const onMorphEnd = () => {
96
+ morphCount -= 1, 0 === morphCount && nextMarks.forEach((mark => {
97
+ var _a, _b;
98
+ null === (_b = null === (_a = mark.animate) || void 0 === _a ? void 0 : _a.enable) || void 0 === _b || _b.call(_a);
99
+ }));
100
+ };
101
+ diffResult.enter.forEach((diff => {
102
+ diff.next.forEach((element => {
103
+ this.doMorph([], [ element ], runningConfig, onMorphEnd, parameters);
104
+ })), morphCount += 1;
105
+ })), diffResult.update.forEach((diff => {
106
+ const divideCount = Math.min(diff.prev.length, diff.next.length), prevDivide = this.divideElements(diff.prev, divideCount), nextDivide = this.divideElements(diff.next, divideCount);
107
+ for (let i = 0; i < divideCount; i++) this.doMorph(prevDivide[i], nextDivide[i], runningConfig, onMorphEnd, parameters),
108
+ morphCount += 1;
109
+ }));
110
+ }
111
+ diffUpdateByGroup(prev, next, prevKey, nextKey) {
112
+ const prevGroup = groupData(prev, (datum => {
113
+ var _a;
114
+ return null !== (_a = prevKey(datum)) && void 0 !== _a ? _a : EmptyKey;
115
+ })), nextGroup = groupData(next, (datum => {
116
+ var _a;
117
+ return null !== (_a = nextKey(datum)) && void 0 !== _a ? _a : EmptyKey;
118
+ }));
119
+ let prevAfterDiff = prev, nextAfterDiff = next;
120
+ const update = [];
121
+ return nextGroup.keys.forEach((key => {
122
+ if (key !== EmptyKey) {
123
+ const prevKeyData = prevGroup.data.get(key), nextKeyData = nextGroup.data.get(key);
124
+ prevKeyData && nextKeyData && (update.push({
125
+ prev: prevKeyData,
126
+ next: nextKeyData
127
+ }), prevAfterDiff = prevAfterDiff.filter((datum => !prevKeyData.includes(datum))),
128
+ nextAfterDiff = nextAfterDiff.filter((datum => !nextKeyData.includes(datum))));
129
+ }
130
+ })), {
131
+ prev: prevAfterDiff,
132
+ next: nextAfterDiff,
133
+ update: update
134
+ };
135
+ }
136
+ doMorph(prev, next, runningConfig, onEnd, parameters) {
137
+ var _a, _b;
138
+ const morphData = {
139
+ prev: prev.map((element => element.getDatum())),
140
+ next: next.map((element => element.getDatum()))
141
+ }, morphElements = {
142
+ prev: prev.slice(),
143
+ next: next.slice()
144
+ }, easing = runningConfig.animation.easing, delay = invokeFunctionType(runningConfig.animation.delay, parameters, morphData, morphElements), duration = invokeFunctionType(runningConfig.animation.duration, parameters, morphData, morphElements), oneByOne = invokeFunctionType(runningConfig.animation.oneByOne, parameters, morphData, morphElements), splitPath = invokeFunctionType(runningConfig.animation.splitPath, parameters, morphData, morphElements), individualDelay = isValidNumber(oneByOne) && oneByOne > 0 ? index => isNumber(oneByOne) ? index * oneByOne : !0 === oneByOne ? index * duration : 0 : void 0;
145
+ 1 !== prev.length && 0 !== prev.length || 1 !== next.length ? 1 === prev.length && next.length > 1 ? oneToMultiMorph(prev[0].getGraphicItem(), next.map((element => element.getGraphicItem())), {
146
+ delay: delay,
147
+ duration: duration,
148
+ easing: easing,
149
+ onEnd: onEnd,
150
+ individualDelay: individualDelay,
151
+ splitPath: splitPath
152
+ }) : prev.length > 1 && 1 === next.length && multiToOneMorph(prev.map((element => element.getGraphicItem())), next[0].getGraphicItem(), {
153
+ delay: delay,
154
+ duration: duration,
155
+ easing: easing,
156
+ onEnd: onEnd,
157
+ individualDelay: individualDelay,
158
+ splitPath: splitPath
159
+ }) : morphPath(null === (_b = null === (_a = prev[0]) || void 0 === _a ? void 0 : _a.getGraphicItem) || void 0 === _b ? void 0 : _b.call(_a), next[0].getGraphicItem(), {
160
+ delay: delay,
161
+ duration: duration,
162
+ easing: easing,
163
+ onEnd: onEnd
164
+ });
165
+ }
166
+ divideElements(elements, count) {
167
+ const divideLength = Math.floor(elements.length / count);
168
+ return new Array(count).fill(0).map(((i, index) => elements.slice(divideLength * index, index === count - 1 ? elements.length : divideLength * (index + 1))));
169
+ }
170
+ }
171
+ //# sourceMappingURL=morph.js.map