@visactor/vgrammar-core 0.10.0-alpha.2 → 0.10.0-alpha.3

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 (306) hide show
  1. package/cjs/component/axis.js.map +1 -1
  2. package/cjs/component/datazoom.js.map +1 -1
  3. package/cjs/component/grid.js.map +1 -1
  4. package/cjs/component/label.js +1 -0
  5. package/cjs/component/label.js.map +1 -1
  6. package/cjs/component/legend.js.map +1 -1
  7. package/cjs/component/player.js.map +1 -1
  8. package/cjs/component/scrollbar.js.map +1 -1
  9. package/cjs/component/slider.js.map +1 -1
  10. package/cjs/component/title.d.ts +4 -3
  11. package/cjs/component/title.js.map +1 -1
  12. package/cjs/core/factory.d.ts +8 -4
  13. package/cjs/core/factory.js +9 -3
  14. package/cjs/core/factory.js.map +1 -1
  15. package/cjs/env.d.ts +1 -1
  16. package/cjs/env.js +6 -6
  17. package/cjs/env.js.map +1 -1
  18. package/cjs/glyph/boxplot.js +4 -2
  19. package/cjs/glyph/boxplot.js.map +1 -1
  20. package/cjs/glyph/link-path.js +3 -2
  21. package/cjs/glyph/link-path.js.map +1 -1
  22. package/cjs/glyph/ripple.js +2 -2
  23. package/cjs/glyph/ripple.js.map +1 -1
  24. package/cjs/glyph/tree-path.js +3 -2
  25. package/cjs/glyph/tree-path.js.map +1 -1
  26. package/cjs/glyph/violin.js +4 -2
  27. package/cjs/glyph/violin.js.map +1 -1
  28. package/cjs/glyph/wave.js +2 -2
  29. package/cjs/glyph/wave.js.map +1 -1
  30. package/cjs/graph/animation/animate.js +5 -3
  31. package/cjs/graph/animation/animate.js.map +1 -1
  32. package/cjs/graph/animation/animation/grow-cartesian.js.map +1 -1
  33. package/cjs/graph/animation/animator.js +6 -5
  34. package/cjs/graph/animation/animator.js.map +1 -1
  35. package/cjs/graph/animation/attribute.d.ts +2 -2
  36. package/cjs/graph/animation/attribute.js +6 -6
  37. package/cjs/graph/animation/attribute.js.map +1 -1
  38. package/cjs/graph/animation/config.js +9 -7
  39. package/cjs/graph/animation/config.js.map +1 -1
  40. package/cjs/graph/animation/morph.js +4 -4
  41. package/cjs/graph/animation/morph.js.map +1 -1
  42. package/cjs/graph/attributes/line.d.ts +1 -0
  43. package/cjs/graph/attributes/line.js +11 -3
  44. package/cjs/graph/attributes/line.js.map +1 -1
  45. package/cjs/graph/attributes/transform.js +0 -24
  46. package/cjs/graph/attributes/transform.js.map +1 -1
  47. package/cjs/graph/canvas-renderer.d.ts +1 -1
  48. package/cjs/graph/canvas-renderer.js +5 -5
  49. package/cjs/graph/canvas-renderer.js.map +1 -1
  50. package/cjs/graph/constants.d.ts +1 -0
  51. package/cjs/graph/constants.js +3 -3
  52. package/cjs/graph/constants.js.map +1 -1
  53. package/cjs/graph/element.d.ts +2 -2
  54. package/cjs/graph/element.js +9 -10
  55. package/cjs/graph/element.js.map +1 -1
  56. package/cjs/graph/glyph-element.d.ts +1 -1
  57. package/cjs/graph/glyph-element.js.map +1 -1
  58. package/cjs/graph/mark/graphic.d.ts +22 -0
  59. package/cjs/graph/mark/graphic.js +138 -0
  60. package/cjs/graph/mark/graphic.js.map +1 -0
  61. package/cjs/graph/mark/large-rects.d.ts +2 -2
  62. package/cjs/graph/mark/large-rects.js +3 -3
  63. package/cjs/graph/mark/large-rects.js.map +1 -1
  64. package/cjs/graph/mark/large-symbols.d.ts +2 -2
  65. package/cjs/graph/mark/large-symbols.js +3 -3
  66. package/cjs/graph/mark/large-symbols.js.map +1 -1
  67. package/cjs/graph/util/env.js +2 -2
  68. package/cjs/graph/util/env.js.map +1 -1
  69. package/cjs/graph/util/events-extend.d.ts +1 -1
  70. package/cjs/graph/util/events-extend.js.map +1 -1
  71. package/cjs/graph/util/graphic.d.ts +3 -5
  72. package/cjs/graph/util/graphic.js +12 -28
  73. package/cjs/graph/util/graphic.js.map +1 -1
  74. package/cjs/index.d.ts +5 -2
  75. package/cjs/index.js +34 -5
  76. package/cjs/index.js.map +1 -1
  77. package/cjs/interactions/brush-active.d.ts +1 -1
  78. package/cjs/interactions/brush-active.js.map +1 -1
  79. package/cjs/interactions/brush-base.d.ts +1 -1
  80. package/cjs/interactions/brush-base.js.map +1 -1
  81. package/cjs/interactions/brush-filter.d.ts +1 -1
  82. package/cjs/interactions/brush-filter.js.map +1 -1
  83. package/cjs/interactions/brush-highlight.d.ts +1 -1
  84. package/cjs/interactions/brush-highlight.js.map +1 -1
  85. package/cjs/interactions/crosshair.js.map +1 -1
  86. package/cjs/interactions/drill-down.d.ts +1 -1
  87. package/cjs/interactions/drill-down.js.map +1 -1
  88. package/cjs/parse/scale.js +1 -1
  89. package/cjs/parse/scale.js.map +1 -1
  90. package/cjs/semantic-marks/cell.d.ts +1 -1
  91. package/cjs/semantic-marks/interval.d.ts +1 -1
  92. package/cjs/semantic-marks/interval.js +4 -2
  93. package/cjs/semantic-marks/interval.js.map +1 -1
  94. package/cjs/transforms/data/contour.js +2 -1
  95. package/cjs/transforms/data/contour.js.map +1 -1
  96. package/cjs/transforms/data/sampling.js +3 -3
  97. package/cjs/transforms/data/sampling.js.map +1 -1
  98. package/cjs/transforms/data/unfold.js +2 -2
  99. package/cjs/transforms/data/unfold.js.map +1 -1
  100. package/cjs/transforms/mark/symmetry.js +2 -1
  101. package/cjs/transforms/mark/symmetry.js.map +1 -1
  102. package/cjs/transforms/util/util.d.ts +0 -2
  103. package/cjs/transforms/util/util.js +2 -11
  104. package/cjs/transforms/util/util.js.map +1 -1
  105. package/cjs/types/animate.d.ts +3 -1
  106. package/cjs/types/animate.js.map +1 -1
  107. package/cjs/types/component.d.ts +5 -5
  108. package/cjs/types/component.js.map +1 -1
  109. package/cjs/types/element.d.ts +1 -1
  110. package/cjs/types/element.js.map +1 -1
  111. package/cjs/types/event.d.ts +1 -1
  112. package/cjs/types/event.js.map +1 -1
  113. package/cjs/types/grammar.d.ts +5 -5
  114. package/cjs/types/grammar.js.map +1 -1
  115. package/cjs/types/interaction.d.ts +1 -1
  116. package/cjs/types/interaction.js.map +1 -1
  117. package/cjs/types/mark.d.ts +1 -1
  118. package/cjs/types/mark.js.map +1 -1
  119. package/cjs/types/morph.d.ts +1 -1
  120. package/cjs/types/morph.js.map +1 -1
  121. package/cjs/types/plot.d.ts +1 -1
  122. package/cjs/types/plot.js.map +1 -1
  123. package/cjs/types/renderer.d.ts +1 -1
  124. package/cjs/types/renderer.js.map +1 -1
  125. package/cjs/types/theme.d.ts +1 -1
  126. package/cjs/types/theme.js.map +1 -1
  127. package/cjs/types/view.d.ts +1 -1
  128. package/cjs/types/view.js.map +1 -1
  129. package/cjs/util/text.d.ts +1 -1
  130. package/cjs/util/text.js +3 -3
  131. package/cjs/util/text.js.map +1 -1
  132. package/cjs/view/View.d.ts +1 -1
  133. package/cjs/view/View.js +17 -14
  134. package/cjs/view/View.js.map +1 -1
  135. package/cjs/view/component.d.ts +1 -1
  136. package/cjs/view/coordinate.d.ts +1 -0
  137. package/cjs/view/coordinate.js +8 -2
  138. package/cjs/view/coordinate.js.map +1 -1
  139. package/cjs/view/mark.d.ts +4 -4
  140. package/cjs/view/mark.js +12 -8
  141. package/cjs/view/mark.js.map +1 -1
  142. package/cjs/view/scale.d.ts +1 -0
  143. package/cjs/view/scale.js +8 -2
  144. package/cjs/view/scale.js.map +1 -1
  145. package/es/component/axis.js.map +1 -1
  146. package/es/component/datazoom.js.map +1 -1
  147. package/es/component/grid.js.map +1 -1
  148. package/es/component/label.js +1 -0
  149. package/es/component/label.js.map +1 -1
  150. package/es/component/legend.js.map +1 -1
  151. package/es/component/player.js.map +1 -1
  152. package/es/component/scrollbar.js.map +1 -1
  153. package/es/component/slider.js.map +1 -1
  154. package/es/component/title.d.ts +4 -3
  155. package/es/component/title.js.map +1 -1
  156. package/es/core/factory.d.ts +8 -4
  157. package/es/core/factory.js +8 -3
  158. package/es/core/factory.js.map +1 -1
  159. package/es/env.d.ts +1 -1
  160. package/es/env.js +2 -2
  161. package/es/env.js.map +1 -1
  162. package/es/glyph/boxplot.js +4 -1
  163. package/es/glyph/boxplot.js.map +1 -1
  164. package/es/glyph/link-path.js +4 -1
  165. package/es/glyph/link-path.js.map +1 -1
  166. package/es/glyph/ripple.js +3 -1
  167. package/es/glyph/ripple.js.map +1 -1
  168. package/es/glyph/tree-path.js +4 -1
  169. package/es/glyph/tree-path.js.map +1 -1
  170. package/es/glyph/violin.js +4 -1
  171. package/es/glyph/violin.js.map +1 -1
  172. package/es/glyph/wave.js +3 -1
  173. package/es/glyph/wave.js.map +1 -1
  174. package/es/graph/animation/animate.js +4 -3
  175. package/es/graph/animation/animate.js.map +1 -1
  176. package/es/graph/animation/animation/grow-cartesian.js.map +1 -1
  177. package/es/graph/animation/animator.js +3 -2
  178. package/es/graph/animation/animator.js.map +1 -1
  179. package/es/graph/animation/attribute.d.ts +2 -2
  180. package/es/graph/animation/attribute.js +1 -1
  181. package/es/graph/animation/attribute.js.map +1 -1
  182. package/es/graph/animation/config.js +10 -8
  183. package/es/graph/animation/config.js.map +1 -1
  184. package/es/graph/animation/morph.js +1 -1
  185. package/es/graph/animation/morph.js.map +1 -1
  186. package/es/graph/attributes/line.d.ts +1 -0
  187. package/es/graph/attributes/line.js +8 -1
  188. package/es/graph/attributes/line.js.map +1 -1
  189. package/es/graph/attributes/transform.js +0 -24
  190. package/es/graph/attributes/transform.js.map +1 -1
  191. package/es/graph/canvas-renderer.d.ts +1 -1
  192. package/es/graph/canvas-renderer.js +2 -2
  193. package/es/graph/canvas-renderer.js.map +1 -1
  194. package/es/graph/constants.d.ts +1 -0
  195. package/es/graph/constants.js +2 -0
  196. package/es/graph/constants.js.map +1 -1
  197. package/es/graph/element.d.ts +2 -2
  198. package/es/graph/element.js +9 -10
  199. package/es/graph/element.js.map +1 -1
  200. package/es/graph/glyph-element.d.ts +1 -1
  201. package/es/graph/glyph-element.js.map +1 -1
  202. package/es/graph/mark/graphic.d.ts +22 -0
  203. package/es/graph/mark/graphic.js +98 -0
  204. package/es/graph/mark/graphic.js.map +1 -0
  205. package/es/graph/mark/large-rects.d.ts +2 -2
  206. package/es/graph/mark/large-rects.js +1 -1
  207. package/es/graph/mark/large-rects.js.map +1 -1
  208. package/es/graph/mark/large-symbols.d.ts +2 -2
  209. package/es/graph/mark/large-symbols.js +1 -1
  210. package/es/graph/mark/large-symbols.js.map +1 -1
  211. package/es/graph/util/env.js +1 -1
  212. package/es/graph/util/env.js.map +1 -1
  213. package/es/graph/util/events-extend.d.ts +1 -1
  214. package/es/graph/util/events-extend.js.map +1 -1
  215. package/es/graph/util/graphic.d.ts +3 -5
  216. package/es/graph/util/graphic.js +13 -35
  217. package/es/graph/util/graphic.js.map +1 -1
  218. package/es/index.d.ts +5 -2
  219. package/es/index.js +8 -2
  220. package/es/index.js.map +1 -1
  221. package/es/interactions/brush-active.d.ts +1 -1
  222. package/es/interactions/brush-active.js.map +1 -1
  223. package/es/interactions/brush-base.d.ts +1 -1
  224. package/es/interactions/brush-base.js.map +1 -1
  225. package/es/interactions/brush-filter.d.ts +1 -1
  226. package/es/interactions/brush-filter.js +2 -1
  227. package/es/interactions/brush-filter.js.map +1 -1
  228. package/es/interactions/brush-highlight.d.ts +1 -1
  229. package/es/interactions/brush-highlight.js.map +1 -1
  230. package/es/interactions/crosshair.js.map +1 -1
  231. package/es/interactions/drill-down.d.ts +1 -1
  232. package/es/interactions/drill-down.js.map +1 -1
  233. package/es/interactions/element-highlight-by-group.js +1 -2
  234. package/es/interactions/index.js +2 -1
  235. package/es/interactions/legend-filter.js +1 -1
  236. package/es/interactions/player-filter.js +1 -1
  237. package/es/interactions/roll-up.js +1 -1
  238. package/es/interactions/scrollbar-filter.js +1 -1
  239. package/es/interactions/slider-filter.js +1 -1
  240. package/es/interactions/tooltip.js +1 -1
  241. package/es/interactions/view-drag-mixin.js +1 -1
  242. package/es/parse/coordinate.js +1 -1
  243. package/es/parse/event.js +1 -1
  244. package/es/parse/mark.js +1 -1
  245. package/es/parse/option.js +1 -1
  246. package/es/parse/scale.js +3 -4
  247. package/es/parse/scale.js.map +1 -1
  248. package/es/parse/transform.js +1 -1
  249. package/es/parse/util.js +1 -1
  250. package/es/parse/view.js +1 -1
  251. package/es/semantic-marks/cell.d.ts +1 -1
  252. package/es/semantic-marks/interval.d.ts +1 -1
  253. package/es/semantic-marks/interval.js +3 -3
  254. package/es/semantic-marks/interval.js.map +1 -1
  255. package/es/transforms/data/contour.js +2 -2
  256. package/es/transforms/data/contour.js.map +1 -1
  257. package/es/transforms/data/sampling.js +5 -3
  258. package/es/transforms/data/sampling.js.map +1 -1
  259. package/es/transforms/data/unfold.js +3 -3
  260. package/es/transforms/data/unfold.js.map +1 -1
  261. package/es/transforms/mark/symmetry.js +2 -2
  262. package/es/transforms/mark/symmetry.js.map +1 -1
  263. package/es/transforms/util/util.d.ts +0 -2
  264. package/es/transforms/util/util.js +0 -8
  265. package/es/transforms/util/util.js.map +1 -1
  266. package/es/types/animate.d.ts +3 -1
  267. package/es/types/animate.js.map +1 -1
  268. package/es/types/component.d.ts +5 -5
  269. package/es/types/component.js.map +1 -1
  270. package/es/types/element.d.ts +1 -1
  271. package/es/types/element.js.map +1 -1
  272. package/es/types/event.d.ts +1 -1
  273. package/es/types/event.js.map +1 -1
  274. package/es/types/grammar.d.ts +5 -5
  275. package/es/types/grammar.js.map +1 -1
  276. package/es/types/interaction.d.ts +1 -1
  277. package/es/types/interaction.js.map +1 -1
  278. package/es/types/mark.d.ts +1 -1
  279. package/es/types/mark.js.map +1 -1
  280. package/es/types/morph.d.ts +1 -1
  281. package/es/types/morph.js.map +1 -1
  282. package/es/types/plot.d.ts +1 -1
  283. package/es/types/plot.js.map +1 -1
  284. package/es/types/renderer.d.ts +1 -1
  285. package/es/types/renderer.js.map +1 -1
  286. package/es/types/theme.d.ts +1 -1
  287. package/es/types/theme.js.map +1 -1
  288. package/es/types/view.d.ts +1 -1
  289. package/es/types/view.js.map +1 -1
  290. package/es/util/text.d.ts +1 -1
  291. package/es/util/text.js +1 -1
  292. package/es/util/text.js.map +1 -1
  293. package/es/view/View.d.ts +1 -1
  294. package/es/view/View.js +11 -12
  295. package/es/view/View.js.map +1 -1
  296. package/es/view/component.d.ts +1 -1
  297. package/es/view/coordinate.d.ts +1 -0
  298. package/es/view/coordinate.js +6 -0
  299. package/es/view/coordinate.js.map +1 -1
  300. package/es/view/mark.d.ts +4 -4
  301. package/es/view/mark.js +12 -7
  302. package/es/view/mark.js.map +1 -1
  303. package/es/view/scale.d.ts +1 -0
  304. package/es/view/scale.js +6 -0
  305. package/es/view/scale.js.map +1 -1
  306. package/package.json +11 -12
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/transforms/util/util.ts"],"names":[],"mappings":";;;AASA,6CAAmD;AAEnD,2DAAuD;AAGvD,SAAgB,UAAU,CAAC,MAAwC,EAAE,EAAa;IAChF,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IACD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;;QACzB,OAAO,MAAA,EAAE,CAAC,CAAC,CAAC,mCAAI,CAAC,IAAA,iBAAQ,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,4BAAY,EAAC,CAAC,CAAC,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC;AAPD,gCAOC;AAED,SAAgB,SAAS,CAAC,IAAY,EAAE,OAA+B,EAAE,KAA2B;IAElG,IAAI,IAAA,cAAK,EAAC,OAAO,CAAC,EAAE;QAClB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;KAC1B;IAED,MAAM,MAAM,GAAU,EAAE,CAAC;IACzB,MAAM,GAAG,GAAwB,EAAE,CAAC;IACpC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAU,EAAE,EAAE;QAC1B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,SAA4B,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QAE5F,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YAClB,MAAM,SAAS,GAAU,EAAE,CAAC;YAC3B,SAAiB,CAAC,IAAI,GAAG,QAAQ,CAAC;YACnC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACvB,GAAG,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;SAC3B;aAAM;YACL,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;SAClC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAtBD,8BAsBC;AAED,SAAgB,cAAc,CAAC,KAAa;IAC1C,OAAO,KAAK,GAAG,CAAC,EAAE;QAChB,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;KACtB;IACD,OAAO,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE;QAC3B,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;KACtB;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AARD,wCAQC;AAED,SAAgB,eAAe,CAAC,KAAa;IAC3C,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IAC9B,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE;QACrC,OAAO,CAAC,CAAC;KACV;SAAM,IAAI,KAAK,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,EAAE,EAAE;QAClD,OAAO,CAAC,CAAC;KACV;SAAM,IAAI,KAAK,GAAG,IAAI,CAAC,EAAE,IAAI,KAAK,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE;QACxD,OAAO,CAAC,CAAC;KACV;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAVD,0CAUC;AAED,SAAgB,GAAG,CAAC,GAAU;IAC5B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,YAAY,EAAE,EAAE,CAAC,WAAW,GAAG,YAAY,EAAE,CAAC,CAAC,CAAC;AAClF,CAAC;AAFD,kBAEC;AAED,SAAgB,OAAO,CAAC,GAAU;IAChC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;QACpB,OAAO,CAAC,CAAC;KACV;IACD,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,OAAO,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC;AAC5B,CAAC;AAND,0BAMC;AAED,SAAgB,GAAG,CAAC,GAAU;IAC5B,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;AAC1B,CAAC;AAFD,kBAEC;AAED,SAAgB,GAAG,CAAC,GAAU;IAC5B,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;AAC1B,CAAC;AAFD,kBAEC","file":"util.js","sourcesContent":["/* Adapted from vega by University of Washington Interactive Data Lab\n * https://vega.github.io/vega/\n * Licensed under the BSD-3-Clause\n\n * url: https://github.com/vega/vega/blob/main/packages/vega-transforms/src/util/util.js\n * License: https://github.com/vega/vega/blob/main/LICENSE\n * @license\n */\n\nimport { isNil, isString } from '@visactor/vutils';\nimport type { FieldGetterFunction } from '@visactor/vgrammar-util';\nimport { accessorName } from '@visactor/vgrammar-util';\n\n// use either provided alias or accessor field name\nexport function fieldNames(fields: string[] | FieldGetterFunction[], as?: string[]) {\n if (!fields) {\n return null;\n }\n return fields.map((f, i) => {\n return as[i] ?? (isString(f) ? f : accessorName(f));\n });\n}\n\nexport function partition(data?: any[], groupBy?: FieldGetterFunction[], field?: FieldGetterFunction) {\n // partition data points into groups\n if (isNil(groupBy)) {\n return [data.map(field)];\n }\n\n const groups: any[] = [];\n const map: Record<string, any> = {};\n data.forEach((entry: any) => {\n const groupKey = groupBy.map((groupFunc: (arg: any) => any) => groupFunc(entry)).toString();\n\n if (!map[groupKey]) {\n const groupItem: any[] = [];\n (groupItem as any).dims = groupKey;\n groups.push(groupItem);\n map[groupKey] = groupItem;\n } else {\n map[groupKey].push(field(entry));\n }\n });\n\n return groups;\n}\n\nexport function normalizeAngle(angle: number): number {\n while (angle < 0) {\n angle += Math.PI * 2;\n }\n while (angle >= Math.PI * 2) {\n angle -= Math.PI * 2;\n }\n return angle;\n}\n\nexport function computeQuadrant(angle: number): 1 | 2 | 3 | 4 {\n angle = normalizeAngle(angle);\n if (angle > 0 && angle <= Math.PI / 2) {\n return 2;\n } else if (angle > Math.PI / 2 && angle <= Math.PI) {\n return 3;\n } else if (angle > Math.PI && angle <= (3 * Math.PI) / 2) {\n return 4;\n }\n return 1;\n}\n\nexport function sum(arr: any[]) {\n return arr.reduce((accumulator, currentValue) => accumulator + currentValue, 0);\n}\n\nexport function average(arr: any[]) {\n if (arr.length === 0) {\n return 0;\n }\n const total = sum(arr);\n return total / arr.length;\n}\n\nexport function min(arr: any[]) {\n return Math.min(...arr);\n}\n\nexport function max(arr: any[]) {\n return Math.max(...arr);\n}\n"]}
1
+ {"version":3,"sources":["../src/transforms/util/util.ts"],"names":[],"mappings":";;;AASA,6CAAmD;AAEnD,2DAAuD;AAGvD,SAAgB,UAAU,CAAC,MAAwC,EAAE,EAAa;IAChF,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IACD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;;QACzB,OAAO,MAAA,EAAE,CAAC,CAAC,CAAC,mCAAI,CAAC,IAAA,iBAAQ,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,4BAAY,EAAC,CAAC,CAAC,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC;AAPD,gCAOC;AAED,SAAgB,SAAS,CAAC,IAAY,EAAE,OAA+B,EAAE,KAA2B;IAElG,IAAI,IAAA,cAAK,EAAC,OAAO,CAAC,EAAE;QAClB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;KAC1B;IAED,MAAM,MAAM,GAAU,EAAE,CAAC;IACzB,MAAM,GAAG,GAAwB,EAAE,CAAC;IACpC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAU,EAAE,EAAE;QAC1B,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,SAA4B,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QAE5F,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YAClB,MAAM,SAAS,GAAU,EAAE,CAAC;YAC3B,SAAiB,CAAC,IAAI,GAAG,QAAQ,CAAC;YACnC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACvB,GAAG,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;SAC3B;aAAM;YACL,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;SAClC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAtBD,8BAsBC;AAED,SAAgB,cAAc,CAAC,KAAa;IAC1C,OAAO,KAAK,GAAG,CAAC,EAAE;QAChB,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;KACtB;IACD,OAAO,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE;QAC3B,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;KACtB;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AARD,wCAQC;AAED,SAAgB,eAAe,CAAC,KAAa;IAC3C,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IAC9B,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE;QACrC,OAAO,CAAC,CAAC;KACV;SAAM,IAAI,KAAK,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,EAAE,EAAE;QAClD,OAAO,CAAC,CAAC;KACV;SAAM,IAAI,KAAK,GAAG,IAAI,CAAC,EAAE,IAAI,KAAK,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE;QACxD,OAAO,CAAC,CAAC;KACV;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAVD,0CAUC;AAED,SAAgB,GAAG,CAAC,GAAU;IAC5B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,YAAY,EAAE,EAAE,CAAC,WAAW,GAAG,YAAY,EAAE,CAAC,CAAC,CAAC;AAClF,CAAC;AAFD,kBAEC;AAED,SAAgB,OAAO,CAAC,GAAU;IAChC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;QACpB,OAAO,CAAC,CAAC;KACV;IACD,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,OAAO,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC;AAC5B,CAAC;AAND,0BAMC","file":"util.js","sourcesContent":["/* Adapted from vega by University of Washington Interactive Data Lab\n * https://vega.github.io/vega/\n * Licensed under the BSD-3-Clause\n\n * url: https://github.com/vega/vega/blob/main/packages/vega-transforms/src/util/util.js\n * License: https://github.com/vega/vega/blob/main/LICENSE\n * @license\n */\n\nimport { isNil, isString } from '@visactor/vutils';\nimport type { FieldGetterFunction } from '@visactor/vgrammar-util';\nimport { accessorName } from '@visactor/vgrammar-util';\n\n// use either provided alias or accessor field name\nexport function fieldNames(fields: string[] | FieldGetterFunction[], as?: string[]) {\n if (!fields) {\n return null;\n }\n return fields.map((f, i) => {\n return as[i] ?? (isString(f) ? f : accessorName(f));\n });\n}\n\nexport function partition(data?: any[], groupBy?: FieldGetterFunction[], field?: FieldGetterFunction) {\n // partition data points into groups\n if (isNil(groupBy)) {\n return [data.map(field)];\n }\n\n const groups: any[] = [];\n const map: Record<string, any> = {};\n data.forEach((entry: any) => {\n const groupKey = groupBy.map((groupFunc: (arg: any) => any) => groupFunc(entry)).toString();\n\n if (!map[groupKey]) {\n const groupItem: any[] = [];\n (groupItem as any).dims = groupKey;\n groups.push(groupItem);\n map[groupKey] = groupItem;\n } else {\n map[groupKey].push(field(entry));\n }\n });\n\n return groups;\n}\n\nexport function normalizeAngle(angle: number): number {\n while (angle < 0) {\n angle += Math.PI * 2;\n }\n while (angle >= Math.PI * 2) {\n angle -= Math.PI * 2;\n }\n return angle;\n}\n\nexport function computeQuadrant(angle: number): 1 | 2 | 3 | 4 {\n angle = normalizeAngle(angle);\n if (angle > 0 && angle <= Math.PI / 2) {\n return 2;\n } else if (angle > Math.PI / 2 && angle <= Math.PI) {\n return 3;\n } else if (angle > Math.PI && angle <= (3 * Math.PI) / 2) {\n return 4;\n }\n return 1;\n}\n\nexport function sum(arr: any[]) {\n return arr.reduce((accumulator, currentValue) => accumulator + currentValue, 0);\n}\n\nexport function average(arr: any[]) {\n if (arr.length === 0) {\n return 0;\n }\n const total = sum(arr);\n return total / arr.length;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { IGraphic, ACustomAnimate, EasingType } from '@visactor/vrender-core';
1
+ import type { IGraphic, ACustomAnimate, EasingType } from '@visactor/vrender/es/core';
2
2
  import type { IPointLike } from '@visactor/vutils';
3
3
  import type { MarkFunctionCallback, MarkFunctionType } from './mark';
4
4
  import type { IMark } from './grammar';
@@ -81,6 +81,7 @@ export interface IAnimationTypeConfig {
81
81
  customParameters?: MarkFunctionValueType<any>;
82
82
  easing?: EasingType;
83
83
  delay?: MarkFunctionValueType<number>;
84
+ delayAfter?: MarkFunctionValueType<number>;
84
85
  duration?: MarkFunctionValueType<number>;
85
86
  oneByOne?: MarkFunctionValueType<boolean | number>;
86
87
  startTime?: MarkFunctionValueType<number>;
@@ -104,6 +105,7 @@ export interface IAnimationTimeSlice {
104
105
  effects: IAnimationEffect | IAnimationEffect[];
105
106
  duration?: MarkFunctionValueType<number>;
106
107
  delay?: MarkFunctionValueType<number>;
108
+ delayAfter?: MarkFunctionValueType<number>;
107
109
  }
108
110
  export type IAnimationChannelFunction = (datum: any, element: IElement, parameters: IAnimationParameters) => any;
109
111
  export type IAnimationChannelAttrs = Record<string, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/animate.ts"],"names":[],"mappings":"","file":"animate.js","sourcesContent":["import type { IGraphic, ACustomAnimate, EasingType } from '@visactor/vrender-core';\nimport type { IPointLike } from '@visactor/vutils';\nimport type { MarkFunctionCallback, MarkFunctionType } from './mark';\nimport type { IMark } from './grammar';\nimport type { IElement } from './element';\nimport type { FunctionCallback } from './signal';\n\nexport type TypeAnimation<T extends IElement> = (\n element: T,\n options: any,\n animationParameters: IAnimationParameters\n) => { from?: { [channel: string]: any }; to?: { [channel: string]: any } };\n\nexport interface IClipAnimationOptions {\n clipDimension?: 'x' | 'y' | 'auto' | 'default';\n}\n\nexport interface IGrowCartesianAnimationOptions {\n orient?: 'positive' | 'negative';\n overall?: boolean | number;\n direction?: 'x' | 'y' | 'xy';\n}\n\nexport interface IGrowAngleAnimationOptions {\n orient?: 'clockwise' | 'anticlockwise';\n overall?: boolean | number;\n}\n\nexport interface IGrowRadiusAnimationOptions {\n orient?: 'inside' | 'outside';\n overall?: boolean | number;\n}\n\nexport interface IGrowPointsAnimationOptions {\n orient?: 'positive' | 'negative';\n}\n\nexport interface IGrowPointsOverallAnimationOptions extends IGrowPointsAnimationOptions {\n center?: IPointLike;\n}\n\nexport interface IScaleAnimationOptions {\n direction?: 'x' | 'y' | 'xy';\n}\n\nexport interface IMoveAnimationOptions {\n direction?: 'x' | 'y' | 'xy';\n orient?: 'positive' | 'negative';\n offset?: number;\n point?: { x?: number; y?: number } | FunctionCallback<{ x?: number; y?: number }>;\n}\n\nexport interface IRotateAnimationOptions {\n orient?: 'clockwise' | 'anticlockwise';\n angle?: number;\n}\n\n/** VGrammar 层提供的图元text上的图形属性,现在暂时会和VRender不一致 */\nexport interface TextItemAttributes {\n fontSize?: number;\n lineHeight?: number;\n font?: string;\n fontStyle?: string;\n fontVariant?: string;\n fontWeight?: string | number;\n lineBreak?: string;\n text?: string | string[];\n limit?: number;\n align?: string;\n baseline?: string;\n ellipsis?: string | boolean;\n dir?: string;\n}\n\n/** animation */\nexport type MarkFunctionValueType<T> = MarkFunctionCallback<T> | T;\n\nexport type IAnimationConfig = IAnimationTimeline | IAnimationTypeConfig;\n\n/**\n * state动画,暂时只支持简单配置\n */\nexport interface IStateAnimationConfig {\n duration?: number;\n easing?: EasingType;\n}\n\n/**\n * 动画 config 简化配置\n */\nexport interface IAnimationTypeConfig {\n type?: string;\n channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n customParameters?: MarkFunctionValueType<any>;\n easing?: EasingType;\n delay?: MarkFunctionValueType<number>;\n duration?: MarkFunctionValueType<number>;\n oneByOne?: MarkFunctionValueType<boolean | number>;\n startTime?: MarkFunctionValueType<number>;\n totalTime?: MarkFunctionValueType<number>;\n /** loop: true 无限循环; loop: 正整数,表示循环的次数 */\n loop?: boolean | number;\n /** 动画 effect 配置项 */\n options?: MarkFunctionValueType<any>;\n /** 动画执行相关控制配置项 */\n controlOptions?: IAnimationControlOptions;\n}\n\n/**\n * 动画 timeline 完整配置,一条时间线内的动画单元只能串行\n * 多个timeline是可以并行的\n * 考虑到同一图元不能在多个timeline上,所以timeline不应该提供数组配置的能力\n */\nexport interface IAnimationTimeline {\n /** 为了方便动画编排,用户可以设置 id 用于识别时间线 */\n id?: string;\n /** 时间切片 */\n timeSlices: IAnimationTimeSlice | IAnimationTimeSlice[];\n /** 动画开始的相对时间,可以为负数 */\n startTime?: MarkFunctionValueType<number>;\n /** 动画时长 */\n totalTime?: MarkFunctionValueType<number>;\n /** 动画依次执行的延迟 */\n oneByOne?: MarkFunctionValueType<number | boolean>;\n /** loop: true 无限循环; loop: 正整数,表示循环的次数 */\n loop?: MarkFunctionValueType<number | boolean>;\n /** 对图元元素进行划分,和过滤类似,但是不同时间线不能同时作用在相同的元素上 */\n partitioner?: MarkFunctionCallback<boolean>;\n /** 对同一时间线上的元素进行排序 */\n sort?: (datumA: any, datumB: any, elementA: IElement, elementB: IElement, parameters: any) => number;\n /** 动画执行相关控制配置项 */\n controlOptions?: IAnimationControlOptions;\n}\n\nexport interface IAnimationTimeSlice {\n effects: IAnimationEffect | IAnimationEffect[];\n duration?: MarkFunctionValueType<number>;\n delay?: MarkFunctionValueType<number>;\n}\n\nexport type IAnimationChannelFunction = (datum: any, element: IElement, parameters: IAnimationParameters) => any;\nexport type IAnimationChannelAttrs = Record<\n string,\n {\n from?: any | IAnimationChannelFunction;\n to?: any | IAnimationChannelFunction;\n }\n>;\nexport type IAnimationChannelAttributes = string[];\nexport type IAnimationChannelInterpolator = (\n ratio: number,\n from: any,\n to: any,\n nextAttributes: any,\n datum: any,\n element: IElement,\n parameters: IAnimationParameters\n) => boolean | void;\n\n// TODO: fix ACustomAnimate<any>\nexport interface IAnimationCustomConstructor {\n new (from: any, to: any, duration: number, ease: EasingType, parameters?: any): ACustomAnimate<any>;\n}\n\nexport interface IAnimationEffect {\n type?: string;\n channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n customParameters?: MarkFunctionValueType<any>;\n easing?: EasingType;\n /** options暂时没有处理 */\n options?: MarkFunctionValueType<any>;\n}\n\nexport interface IAnimationControlOptions {\n /** 当动画状态变更时清空动画 */\n stopWhenStateChange?: boolean;\n /** 是否立即应用动画初始状态 */\n immediatelyApply?: boolean;\n}\n\n/**\n * Animation timeline should be parsed into animation units,\n * which record all necessary configs for animator to execute animation.\n *\n * animation unit time:\n * |<--initialDelay-->| |<--loopDelay--><--Slices--><--looDelayAfter-->| |<--loopDuration-->|\n * |<-----------------loopDuration--------------->|\n */\nexport interface IAnimationUnit {\n /**\n * initial delay time before any animation loop\n */\n initialDelay: number;\n /**\n * total time for one animation loop\n */\n loopDuration: number;\n /**\n * delay time before time slices\n */\n loopDelay: number;\n /**\n * delay time after time slices\n */\n loopDelayAfter: number;\n /**\n * animating time in one animation loop\n */\n loopAnimateDuration: number;\n loopCount: number;\n totalTime: number;\n timeSlices: IAnimationTimeSlice[];\n}\n\nexport interface IAnimationRecord {\n start: IGraphic;\n end: IGraphic;\n changes: any[];\n}\n\nexport interface IAnimationParameters {\n width: number;\n height: number;\n mark: IMark;\n group: IMark | null;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\nexport interface IParsedAnimationConfig {\n state: string;\n timeline: IAnimationTimeline;\n originConfig: IAnimationConfig;\n id: string;\n}\n\nexport interface IParsedAnimationAttrs {\n from?: any;\n to?: any;\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n customParameters?: any;\n}\n\n// animate structure\n\nexport interface IAnimatorOptions {\n state: string;\n timeline: IAnimationTimeline;\n id: string;\n}\n\nexport interface IAnimator {\n id: number;\n element: IElement;\n animationOptions: IAnimatorOptions;\n isAnimating: boolean;\n\n /** execute animation */\n animate: (animationParameters: IAnimationParameters, parameters: any) => this;\n /** set animation callback */\n callback: (callbackFunction: (...args: any[]) => void) => this;\n\n // animation control\n stop: (stopState?: 'start' | 'end', invokeCallback?: boolean) => this;\n pause: () => this;\n resume: () => this;\n\n /** set additional initial animation delay */\n startAt: (startTime: number) => this;\n /** get total animation execution time */\n getTotalAnimationTime: () => number;\n\n getEndAttributes: () => Record<string, any>;\n}\n\nexport interface IAnimateArranger {\n // animation control api\n parallel: (arranger: IAnimateArranger) => this;\n after: (arranger: IAnimateArranger) => this;\n\n // internal properties\n afterArranger: IAnimateArranger;\n parallelArrangers: IAnimateArranger[];\n animators: IAnimator[];\n totalTime: number;\n startTime: number;\n endTime: number;\n arrangeTime: () => void;\n}\n\nexport interface IBaseAnimate {\n // animation control\n stop: () => this;\n pause: () => this;\n resume: () => this;\n\n // internal animation process api\n animate: () => this;\n enable: () => this;\n disable: () => this;\n enableAnimationState: (state: string | string[]) => this;\n disableAnimationState: (state: string | string[]) => this;\n isAnimating: () => boolean;\n\n release: () => void;\n}\n\nexport interface IViewAnimate extends IBaseAnimate {\n animateAddition: (mark: IMark) => this;\n}\n\nexport interface IAnimate extends IBaseAnimate {\n mark: IMark;\n\n // additional animation control\n run: (config: IAnimationConfig | IAnimationConfig[]) => IAnimateArranger;\n runAnimationByState: (animationState: string) => IAnimateArranger;\n stopAnimationByState: (animationState: string) => this;\n pauseAnimationByState: (animationState: string) => this;\n resumeAnimationByState: (animationState: string) => this;\n reverse: () => this;\n restart: () => this;\n record: () => this;\n recordEnd: () => this;\n\n // internal animation process api\n getAnimationConfigs: (animationState: string) => IParsedAnimationConfig[];\n updateConfig: (config: Record<string, IAnimationConfig | IAnimationConfig[]>) => void;\n updateState: (state: MarkFunctionType<string> | null) => void;\n isElementAnimating: (element: IElement) => boolean;\n getAnimatorCount: () => number;\n getElementAnimators: (element: IElement | IElement[], animationState?: string) => IAnimator[];\n release: () => void;\n}\n"]}
1
+ {"version":3,"sources":["../src/types/animate.ts"],"names":[],"mappings":"","file":"animate.js","sourcesContent":["import type { IGraphic, ACustomAnimate, EasingType } from '@visactor/vrender/es/core';\nimport type { IPointLike } from '@visactor/vutils';\nimport type { MarkFunctionCallback, MarkFunctionType } from './mark';\nimport type { IMark } from './grammar';\nimport type { IElement } from './element';\nimport type { FunctionCallback } from './signal';\n\nexport type TypeAnimation<T extends IElement> = (\n element: T,\n options: any,\n animationParameters: IAnimationParameters\n) => { from?: { [channel: string]: any }; to?: { [channel: string]: any } };\n\nexport interface IClipAnimationOptions {\n clipDimension?: 'x' | 'y' | 'auto' | 'default';\n}\n\nexport interface IGrowCartesianAnimationOptions {\n orient?: 'positive' | 'negative';\n overall?: boolean | number;\n direction?: 'x' | 'y' | 'xy';\n}\n\nexport interface IGrowAngleAnimationOptions {\n orient?: 'clockwise' | 'anticlockwise';\n overall?: boolean | number;\n}\n\nexport interface IGrowRadiusAnimationOptions {\n orient?: 'inside' | 'outside';\n overall?: boolean | number;\n}\n\nexport interface IGrowPointsAnimationOptions {\n orient?: 'positive' | 'negative';\n}\n\nexport interface IGrowPointsOverallAnimationOptions extends IGrowPointsAnimationOptions {\n center?: IPointLike;\n}\n\nexport interface IScaleAnimationOptions {\n direction?: 'x' | 'y' | 'xy';\n}\n\nexport interface IMoveAnimationOptions {\n direction?: 'x' | 'y' | 'xy';\n orient?: 'positive' | 'negative';\n offset?: number;\n point?: { x?: number; y?: number } | FunctionCallback<{ x?: number; y?: number }>;\n}\n\nexport interface IRotateAnimationOptions {\n orient?: 'clockwise' | 'anticlockwise';\n angle?: number;\n}\n\n/** VGrammar 层提供的图元text上的图形属性,现在暂时会和VRender不一致 */\nexport interface TextItemAttributes {\n fontSize?: number;\n lineHeight?: number;\n font?: string;\n fontStyle?: string;\n fontVariant?: string;\n fontWeight?: string | number;\n lineBreak?: string;\n text?: string | string[];\n limit?: number;\n align?: string;\n baseline?: string;\n ellipsis?: string | boolean;\n dir?: string;\n}\n\n/** animation */\nexport type MarkFunctionValueType<T> = MarkFunctionCallback<T> | T;\n\nexport type IAnimationConfig = IAnimationTimeline | IAnimationTypeConfig;\n\n/**\n * state动画,暂时只支持简单配置\n */\nexport interface IStateAnimationConfig {\n duration?: number;\n easing?: EasingType;\n}\n\n/**\n * 动画 config 简化配置\n */\nexport interface IAnimationTypeConfig {\n type?: string;\n channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n customParameters?: MarkFunctionValueType<any>;\n easing?: EasingType;\n delay?: MarkFunctionValueType<number>;\n delayAfter?: MarkFunctionValueType<number>;\n duration?: MarkFunctionValueType<number>;\n oneByOne?: MarkFunctionValueType<boolean | number>;\n startTime?: MarkFunctionValueType<number>;\n totalTime?: MarkFunctionValueType<number>;\n /** loop: true 无限循环; loop: 正整数,表示循环的次数 */\n loop?: boolean | number;\n /** 动画 effect 配置项 */\n options?: MarkFunctionValueType<any>;\n /** 动画执行相关控制配置项 */\n controlOptions?: IAnimationControlOptions;\n}\n\n/**\n * 动画 timeline 完整配置,一条时间线内的动画单元只能串行\n * 多个timeline是可以并行的\n * 考虑到同一图元不能在多个timeline上,所以timeline不应该提供数组配置的能力\n */\nexport interface IAnimationTimeline {\n /** 为了方便动画编排,用户可以设置 id 用于识别时间线 */\n id?: string;\n /** 时间切片 */\n timeSlices: IAnimationTimeSlice | IAnimationTimeSlice[];\n /** 动画开始的相对时间,可以为负数 */\n startTime?: MarkFunctionValueType<number>;\n /** 动画时长 */\n totalTime?: MarkFunctionValueType<number>;\n /** 动画依次执行的延迟 */\n oneByOne?: MarkFunctionValueType<number | boolean>;\n /** loop: true 无限循环; loop: 正整数,表示循环的次数 */\n loop?: MarkFunctionValueType<number | boolean>;\n /** 对图元元素进行划分,和过滤类似,但是不同时间线不能同时作用在相同的元素上 */\n partitioner?: MarkFunctionCallback<boolean>;\n /** 对同一时间线上的元素进行排序 */\n sort?: (datumA: any, datumB: any, elementA: IElement, elementB: IElement, parameters: any) => number;\n /** 动画执行相关控制配置项 */\n controlOptions?: IAnimationControlOptions;\n}\n\nexport interface IAnimationTimeSlice {\n effects: IAnimationEffect | IAnimationEffect[];\n duration?: MarkFunctionValueType<number>;\n delay?: MarkFunctionValueType<number>;\n delayAfter?: MarkFunctionValueType<number>;\n}\n\nexport type IAnimationChannelFunction = (datum: any, element: IElement, parameters: IAnimationParameters) => any;\nexport type IAnimationChannelAttrs = Record<\n string,\n {\n from?: any | IAnimationChannelFunction;\n to?: any | IAnimationChannelFunction;\n }\n>;\nexport type IAnimationChannelAttributes = string[];\nexport type IAnimationChannelInterpolator = (\n ratio: number,\n from: any,\n to: any,\n nextAttributes: any,\n datum: any,\n element: IElement,\n parameters: IAnimationParameters\n) => boolean | void;\n\n// TODO: fix ACustomAnimate<any>\nexport interface IAnimationCustomConstructor {\n new (from: any, to: any, duration: number, ease: EasingType, parameters?: any): ACustomAnimate<any>;\n}\n\nexport interface IAnimationEffect {\n type?: string;\n channel?: IAnimationChannelAttrs | IAnimationChannelAttributes;\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n customParameters?: MarkFunctionValueType<any>;\n easing?: EasingType;\n /** options暂时没有处理 */\n options?: MarkFunctionValueType<any>;\n}\n\nexport interface IAnimationControlOptions {\n /** 当动画状态变更时清空动画 */\n stopWhenStateChange?: boolean;\n /** 是否立即应用动画初始状态 */\n immediatelyApply?: boolean;\n}\n\n/**\n * Animation timeline should be parsed into animation units,\n * which record all necessary configs for animator to execute animation.\n *\n * animation unit time:\n * |<--initialDelay-->| |<--loopDelay--><--Slices--><--looDelayAfter-->| |<--loopDuration-->|\n * |<-----------------loopDuration--------------->|\n */\nexport interface IAnimationUnit {\n /**\n * initial delay time before any animation loop\n */\n initialDelay: number;\n /**\n * total time for one animation loop\n */\n loopDuration: number;\n /**\n * delay time before time slices\n */\n loopDelay: number;\n /**\n * delay time after time slices\n */\n loopDelayAfter: number;\n /**\n * animating time in one animation loop\n */\n loopAnimateDuration: number;\n loopCount: number;\n totalTime: number;\n timeSlices: IAnimationTimeSlice[];\n}\n\nexport interface IAnimationRecord {\n start: IGraphic;\n end: IGraphic;\n changes: any[];\n}\n\nexport interface IAnimationParameters {\n width: number;\n height: number;\n mark: IMark;\n group: IMark | null;\n elementIndex: number;\n elementCount: number;\n view: any;\n}\n\nexport interface IParsedAnimationConfig {\n state: string;\n timeline: IAnimationTimeline;\n originConfig: IAnimationConfig;\n id: string;\n}\n\nexport interface IParsedAnimationAttrs {\n from?: any;\n to?: any;\n custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor;\n customParameters?: any;\n}\n\n// animate structure\n\nexport interface IAnimatorOptions {\n state: string;\n timeline: IAnimationTimeline;\n id: string;\n}\n\nexport interface IAnimator {\n id: number;\n element: IElement;\n animationOptions: IAnimatorOptions;\n isAnimating: boolean;\n\n /** execute animation */\n animate: (animationParameters: IAnimationParameters, parameters: any) => this;\n /** set animation callback */\n callback: (callbackFunction: (...args: any[]) => void) => this;\n\n // animation control\n stop: (stopState?: 'start' | 'end', invokeCallback?: boolean) => this;\n pause: () => this;\n resume: () => this;\n\n /** set additional initial animation delay */\n startAt: (startTime: number) => this;\n /** get total animation execution time */\n getTotalAnimationTime: () => number;\n\n getEndAttributes: () => Record<string, any>;\n}\n\nexport interface IAnimateArranger {\n // animation control api\n parallel: (arranger: IAnimateArranger) => this;\n after: (arranger: IAnimateArranger) => this;\n\n // internal properties\n afterArranger: IAnimateArranger;\n parallelArrangers: IAnimateArranger[];\n animators: IAnimator[];\n totalTime: number;\n startTime: number;\n endTime: number;\n arrangeTime: () => void;\n}\n\nexport interface IBaseAnimate {\n // animation control\n stop: () => this;\n pause: () => this;\n resume: () => this;\n\n // internal animation process api\n animate: () => this;\n enable: () => this;\n disable: () => this;\n enableAnimationState: (state: string | string[]) => this;\n disableAnimationState: (state: string | string[]) => this;\n isAnimating: () => boolean;\n\n release: () => void;\n}\n\nexport interface IViewAnimate extends IBaseAnimate {\n animateAddition: (mark: IMark) => this;\n}\n\nexport interface IAnimate extends IBaseAnimate {\n mark: IMark;\n\n // additional animation control\n run: (config: IAnimationConfig | IAnimationConfig[]) => IAnimateArranger;\n runAnimationByState: (animationState: string) => IAnimateArranger;\n stopAnimationByState: (animationState: string) => this;\n pauseAnimationByState: (animationState: string) => this;\n resumeAnimationByState: (animationState: string) => this;\n reverse: () => this;\n restart: () => this;\n record: () => this;\n recordEnd: () => this;\n\n // internal animation process api\n getAnimationConfigs: (animationState: string) => IParsedAnimationConfig[];\n updateConfig: (config: Record<string, IAnimationConfig | IAnimationConfig[]>) => void;\n updateState: (state: MarkFunctionType<string> | null) => void;\n isElementAnimating: (element: IElement) => boolean;\n getAnimatorCount: () => number;\n getElementAnimators: (element: IElement | IElement[], animationState?: string) => IAnimator[];\n release: () => void;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { IGraphicAttribute, ITextAttribute } from '@visactor/vrender-core';
1
+ import type { IGraphicAttribute, ITextAttribute, IRichTextCharacter } from '@visactor/vrender/es/core';
2
2
  import type { AxisBaseAttributes, BaseLabelAttrs, DataLabelAttrs, DataZoomAttributes, Direction, GridBaseAttributes, LegendBaseAttributes, OrientType, PlayerAttributes, ScrollBarAttributes, SliderAttributes, TitleAttrs } from '@visactor/vrender-components';
3
3
  import type { AxisEnum, ComponentEnum } from '../graph';
4
4
  import type { Nil } from './base';
@@ -135,13 +135,13 @@ export interface PlayerSpec extends ComponentSpec<Partial<PlayerAttributes>> {
135
135
  source?: IData | string | any[];
136
136
  }
137
137
  export interface ITitle extends IComponent {
138
- title: (text: MarkFunctionType<string | number | number[] | string[]> | Nil) => this;
139
- subTitle: (text: MarkFunctionType<string | number | number[] | string[]> | Nil) => this;
138
+ title: (text: MarkFunctionType<string | number | number[] | string[] | IRichTextCharacter[]> | Nil) => this;
139
+ subTitle: (text: MarkFunctionType<string | number | number[] | string[] | IRichTextCharacter[]> | Nil) => this;
140
140
  }
141
141
  export interface TitleSpec extends ComponentSpec<Partial<TitleAttrs>> {
142
142
  componentType: ComponentEnum.title;
143
- title?: MarkFunctionType<string | number | number[] | string[]>;
144
- subTitle?: MarkFunctionType<string | number | number[] | string[]>;
143
+ title?: MarkFunctionType<string | number | number[] | string[] | IRichTextCharacter[]>;
144
+ subTitle?: MarkFunctionType<string | number | number[] | string[] | IRichTextCharacter[]>;
145
145
  }
146
146
  export type ScrollbarFilterValue = {
147
147
  start?: number;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/component.ts"],"names":[],"mappings":"","file":"component.js","sourcesContent":["import type { IGraphicAttribute, ITextAttribute } from '@visactor/vrender-core';\nimport type {\n AxisBaseAttributes,\n BaseLabelAttrs,\n DataLabelAttrs,\n DataZoomAttributes,\n Direction,\n GridBaseAttributes,\n LegendBaseAttributes,\n OrientType,\n PlayerAttributes,\n ScrollBarAttributes,\n SliderAttributes,\n TitleAttrs\n} from '@visactor/vrender-components';\nimport type { AxisEnum, ComponentEnum } from '../graph';\nimport type { Nil } from './base';\nimport type { IComponent, IData, IGroupMark, IMark, IScale } from './grammar';\nimport type {\n ChannelEncodeType,\n ComponentSpec,\n GenerateBasicEncoderSpec,\n MarkFunctionType,\n ScaleEncodeType\n} from './mark';\nimport type { IView } from './view';\nimport type { IBaseScale } from '@visactor/vscale';\nimport type { SimpleSignalType } from './signal';\n\n// scale component\n\nexport interface IScaleComponent extends IComponent {\n scale: (scale?: IScale | string | Nil) => this;\n\n // internal interface\n getScale: () => IScale;\n}\n\nexport interface ScaleComponentSpec<\n BasicEncoderSpec extends GenerateBasicEncoderSpec<IGraphicAttribute> = GenerateBasicEncoderSpec<IGraphicAttribute>\n> extends ComponentSpec<BasicEncoderSpec> {\n scale?: IScale | string;\n}\n\n// axis component\n\nexport type AxisType = 'line' | 'circle';\n\nexport interface IAxis extends IScaleComponent {\n axisType: (axisType: AxisType | Nil) => this;\n tickCount: (tickCount: SimpleSignalType<number> | Nil) => this;\n inside: (inside: MarkFunctionType<boolean> | Nil) => this;\n baseValue: (baseValue: MarkFunctionType<number> | Nil) => this;\n\n // internal interface\n getAxisComponentType: () => keyof typeof AxisEnum;\n}\n\nexport interface AxisSpec extends ScaleComponentSpec<Partial<AxisBaseAttributes>> {\n componentType: ComponentEnum.axis;\n axisType?: AxisType;\n tickCount?: SimpleSignalType<number>;\n inside?: MarkFunctionType<boolean>;\n baseValue?: MarkFunctionType<number>;\n}\n\n// grid component\n\nexport type GridShape = 'line' | 'circle' | 'polygon';\n\nexport interface IGrid extends IScaleComponent {\n gridType: (gridType: AxisType | Nil) => this;\n gridShape: (gridShape: GridShape | Nil) => this;\n target: (axis: IAxis | string | Nil) => this;\n tickCount: (tickCount: SimpleSignalType<number> | Nil) => this;\n inside: (inside: MarkFunctionType<boolean> | Nil) => this;\n baseValue: (baseValue: MarkFunctionType<number> | Nil) => this;\n}\n\nexport interface GridSpec extends ScaleComponentSpec<Partial<GridBaseAttributes>> {\n componentType: ComponentEnum.grid;\n gridType?: AxisType;\n gridShape?: GridShape;\n target?: IAxis | string;\n tickCount?: MarkFunctionType<number>;\n inside?: MarkFunctionType<boolean>;\n baseValue?: MarkFunctionType<number>;\n}\n\n// legend component\n\nexport type LegendType = 'auto' | 'discrete' | 'color' | 'size';\n\nexport interface ILegend extends IScaleComponent {\n legendType: (legendType: LegendType | Nil) => this;\n\n // immediate functions\n setSelected: (selectedValues: any[]) => this;\n\n // internal interface\n isContinuousLegend: () => boolean;\n}\n\nexport interface LegendSpec extends ScaleComponentSpec<LegendBaseAttributes> {\n componentType: ComponentEnum.legend;\n legendType?: LegendType;\n shapeScale?: IScale | string;\n}\n\n// slider component\n\nexport type SliderFilterValue = { start: number; end: number };\n\nexport interface ISlider extends IComponent {\n min: (min: MarkFunctionType<number> | Nil) => this;\n max: (max: MarkFunctionType<number> | Nil) => this;\n\n // immediate functions\n setStartEndValue: (start?: number, end?: number) => this;\n}\n\nexport interface SliderSpec extends ComponentSpec<Partial<SliderAttributes>> {\n componentType: ComponentEnum.slider;\n min?: MarkFunctionType<number>;\n max?: MarkFunctionType<number>;\n}\n\n// datazoom component\n\nexport type DatazoomFilterValue = { start: number; end: number; startRatio: number; endRatio: number };\n\nexport interface IDatazoom extends IComponent {\n preview: (\n data: IData | string | Nil,\n x: ScaleEncodeType | Nil,\n y: ScaleEncodeType | Nil,\n x1?: ChannelEncodeType | Nil,\n y1?: ChannelEncodeType | Nil\n ) => this;\n\n // immediate functions\n setStartEndValue: (start?: number, end?: number) => this;\n getStartEndValue: () => { start: number; end: number } | Nil;\n\n // internal interface\n invertDatazoomRatio: (ratio: number) => any;\n getDatazoomMainScale: () => IBaseScale;\n}\n\nexport type DataZoomEncoderSpec = GenerateBasicEncoderSpec<Partial<DataZoomAttributes> & { x1?: number; y1?: number }>;\nexport interface DatazoomSpec extends ComponentSpec<DataZoomEncoderSpec> {\n componentType: ComponentEnum.datazoom;\n preview?: {\n data: IData | string;\n x?: ScaleEncodeType;\n y?: ScaleEncodeType;\n x1?: ChannelEncodeType;\n y1?: ChannelEncodeType;\n };\n}\n\n// label component\n\nexport interface ILabel extends IComponent {\n labelStyle: (attributes: MarkFunctionType<Partial<BaseLabelAttrs>>) => this;\n size: (attributes: MarkFunctionType<DataLabelAttrs['size']>) => this;\n target: (mark: IMark | IMark[] | string | string[] | Nil) => this;\n}\n\nexport type LabelEncoderSpec = GenerateBasicEncoderSpec<Partial<BaseLabelAttrs> & { text?: ITextAttribute['text'] }>;\nexport interface LabelSpec extends ComponentSpec<LabelEncoderSpec> {\n componentType: ComponentEnum.label;\n labelStyle?: MarkFunctionType<Partial<BaseLabelAttrs>>;\n size?: MarkFunctionType<DataLabelAttrs['size']>;\n target?: IMark | IMark[] | string | string[];\n}\n\n// player component\n\nexport type PlayerType = 'auto' | 'discrete' | 'continuous';\n\nexport type PlayerFilterValue = { index: number; value: any };\n\nexport interface IPlayer extends IComponent {\n playerType: (playerType: PlayerType) => this;\n source: (source: IData | string | any[] | Nil) => this;\n\n // immediate functions\n play: () => this;\n pause: () => this;\n backward: () => this;\n forward: () => this;\n}\n\nexport interface PlayerSpec extends ComponentSpec<Partial<PlayerAttributes>> {\n componentType: ComponentEnum.player;\n playerType?: PlayerType;\n source?: IData | string | any[];\n}\n\n// title component\n\nexport interface ITitle extends IComponent {\n title: (text: MarkFunctionType<string | number | number[] | string[]> | Nil) => this;\n subTitle: (text: MarkFunctionType<string | number | number[] | string[]> | Nil) => this;\n}\n\nexport interface TitleSpec extends ComponentSpec<Partial<TitleAttrs>> {\n componentType: ComponentEnum.title;\n title?: MarkFunctionType<string | number | number[] | string[]>;\n subTitle?: MarkFunctionType<string | number | number[] | string[]>;\n}\n\n// scrollbar component\n\nexport type ScrollbarFilterValue = { start?: number; end?: number; startRatio: number; endRatio: number };\n\nexport interface IScrollbar extends IScaleComponent {\n container: (container: IGroupMark | string | Nil) => this;\n direction: (direction: MarkFunctionType<Direction> | Nil) => this;\n position: (position: MarkFunctionType<OrientType> | Nil) => this;\n\n // immediate functions\n setScrollStart: (start: number) => this;\n getScrollRange: () => [number, number] | Nil;\n}\n\nexport interface ScrollbarSpec extends ScaleComponentSpec<Partial<ScrollBarAttributes>> {\n componentType: ComponentEnum.scrollbar;\n container?: IGroupMark | string;\n direction?: MarkFunctionType<Direction>;\n position?: MarkFunctionType<OrientType>;\n}\n\n// built-in components\n\nexport type BuiltInComponentSpec =\n | AxisSpec\n | LegendSpec\n | SliderSpec\n | DatazoomSpec\n | LabelSpec\n | PlayerSpec\n | TitleSpec\n | ScrollbarSpec;\n\nexport interface IComponentConstructor {\n readonly componentType: string;\n\n new (view: IView, group?: IGroupMark, mode?: '2d' | '3d'): IComponent;\n}\n"]}
1
+ {"version":3,"sources":["../src/types/component.ts"],"names":[],"mappings":"","file":"component.js","sourcesContent":["import type { IGraphicAttribute, ITextAttribute, IRichTextCharacter } from '@visactor/vrender/es/core';\nimport type {\n AxisBaseAttributes,\n BaseLabelAttrs,\n DataLabelAttrs,\n DataZoomAttributes,\n Direction,\n GridBaseAttributes,\n LegendBaseAttributes,\n OrientType,\n PlayerAttributes,\n ScrollBarAttributes,\n SliderAttributes,\n TitleAttrs\n} from '@visactor/vrender-components';\nimport type { AxisEnum, ComponentEnum } from '../graph';\nimport type { Nil } from './base';\nimport type { IComponent, IData, IGroupMark, IMark, IScale } from './grammar';\nimport type {\n ChannelEncodeType,\n ComponentSpec,\n GenerateBasicEncoderSpec,\n MarkFunctionType,\n ScaleEncodeType\n} from './mark';\nimport type { IView } from './view';\nimport type { IBaseScale } from '@visactor/vscale';\nimport type { SimpleSignalType } from './signal';\n\n// scale component\n\nexport interface IScaleComponent extends IComponent {\n scale: (scale?: IScale | string | Nil) => this;\n\n // internal interface\n getScale: () => IScale;\n}\n\nexport interface ScaleComponentSpec<\n BasicEncoderSpec extends GenerateBasicEncoderSpec<IGraphicAttribute> = GenerateBasicEncoderSpec<IGraphicAttribute>\n> extends ComponentSpec<BasicEncoderSpec> {\n scale?: IScale | string;\n}\n\n// axis component\n\nexport type AxisType = 'line' | 'circle';\n\nexport interface IAxis extends IScaleComponent {\n axisType: (axisType: AxisType | Nil) => this;\n tickCount: (tickCount: SimpleSignalType<number> | Nil) => this;\n inside: (inside: MarkFunctionType<boolean> | Nil) => this;\n baseValue: (baseValue: MarkFunctionType<number> | Nil) => this;\n\n // internal interface\n getAxisComponentType: () => keyof typeof AxisEnum;\n}\n\nexport interface AxisSpec extends ScaleComponentSpec<Partial<AxisBaseAttributes>> {\n componentType: ComponentEnum.axis;\n axisType?: AxisType;\n tickCount?: SimpleSignalType<number>;\n inside?: MarkFunctionType<boolean>;\n baseValue?: MarkFunctionType<number>;\n}\n\n// grid component\n\nexport type GridShape = 'line' | 'circle' | 'polygon';\n\nexport interface IGrid extends IScaleComponent {\n gridType: (gridType: AxisType | Nil) => this;\n gridShape: (gridShape: GridShape | Nil) => this;\n target: (axis: IAxis | string | Nil) => this;\n tickCount: (tickCount: SimpleSignalType<number> | Nil) => this;\n inside: (inside: MarkFunctionType<boolean> | Nil) => this;\n baseValue: (baseValue: MarkFunctionType<number> | Nil) => this;\n}\n\nexport interface GridSpec extends ScaleComponentSpec<Partial<GridBaseAttributes>> {\n componentType: ComponentEnum.grid;\n gridType?: AxisType;\n gridShape?: GridShape;\n target?: IAxis | string;\n tickCount?: MarkFunctionType<number>;\n inside?: MarkFunctionType<boolean>;\n baseValue?: MarkFunctionType<number>;\n}\n\n// legend component\n\nexport type LegendType = 'auto' | 'discrete' | 'color' | 'size';\n\nexport interface ILegend extends IScaleComponent {\n legendType: (legendType: LegendType | Nil) => this;\n\n // immediate functions\n setSelected: (selectedValues: any[]) => this;\n\n // internal interface\n isContinuousLegend: () => boolean;\n}\n\nexport interface LegendSpec extends ScaleComponentSpec<LegendBaseAttributes> {\n componentType: ComponentEnum.legend;\n legendType?: LegendType;\n shapeScale?: IScale | string;\n}\n\n// slider component\n\nexport type SliderFilterValue = { start: number; end: number };\n\nexport interface ISlider extends IComponent {\n min: (min: MarkFunctionType<number> | Nil) => this;\n max: (max: MarkFunctionType<number> | Nil) => this;\n\n // immediate functions\n setStartEndValue: (start?: number, end?: number) => this;\n}\n\nexport interface SliderSpec extends ComponentSpec<Partial<SliderAttributes>> {\n componentType: ComponentEnum.slider;\n min?: MarkFunctionType<number>;\n max?: MarkFunctionType<number>;\n}\n\n// datazoom component\n\nexport type DatazoomFilterValue = { start: number; end: number; startRatio: number; endRatio: number };\n\nexport interface IDatazoom extends IComponent {\n preview: (\n data: IData | string | Nil,\n x: ScaleEncodeType | Nil,\n y: ScaleEncodeType | Nil,\n x1?: ChannelEncodeType | Nil,\n y1?: ChannelEncodeType | Nil\n ) => this;\n\n // immediate functions\n setStartEndValue: (start?: number, end?: number) => this;\n getStartEndValue: () => { start: number; end: number } | Nil;\n\n // internal interface\n invertDatazoomRatio: (ratio: number) => any;\n getDatazoomMainScale: () => IBaseScale;\n}\n\nexport type DataZoomEncoderSpec = GenerateBasicEncoderSpec<Partial<DataZoomAttributes> & { x1?: number; y1?: number }>;\nexport interface DatazoomSpec extends ComponentSpec<DataZoomEncoderSpec> {\n componentType: ComponentEnum.datazoom;\n preview?: {\n data: IData | string;\n x?: ScaleEncodeType;\n y?: ScaleEncodeType;\n x1?: ChannelEncodeType;\n y1?: ChannelEncodeType;\n };\n}\n\n// label component\n\nexport interface ILabel extends IComponent {\n labelStyle: (attributes: MarkFunctionType<Partial<BaseLabelAttrs>>) => this;\n size: (attributes: MarkFunctionType<DataLabelAttrs['size']>) => this;\n target: (mark: IMark | IMark[] | string | string[] | Nil) => this;\n}\n\nexport type LabelEncoderSpec = GenerateBasicEncoderSpec<Partial<BaseLabelAttrs> & { text?: ITextAttribute['text'] }>;\nexport interface LabelSpec extends ComponentSpec<LabelEncoderSpec> {\n componentType: ComponentEnum.label;\n labelStyle?: MarkFunctionType<Partial<BaseLabelAttrs>>;\n size?: MarkFunctionType<DataLabelAttrs['size']>;\n target?: IMark | IMark[] | string | string[];\n}\n\n// player component\n\nexport type PlayerType = 'auto' | 'discrete' | 'continuous';\n\nexport type PlayerFilterValue = { index: number; value: any };\n\nexport interface IPlayer extends IComponent {\n playerType: (playerType: PlayerType) => this;\n source: (source: IData | string | any[] | Nil) => this;\n\n // immediate functions\n play: () => this;\n pause: () => this;\n backward: () => this;\n forward: () => this;\n}\n\nexport interface PlayerSpec extends ComponentSpec<Partial<PlayerAttributes>> {\n componentType: ComponentEnum.player;\n playerType?: PlayerType;\n source?: IData | string | any[];\n}\n\n// title component\n\nexport interface ITitle extends IComponent {\n title: (text: MarkFunctionType<string | number | number[] | string[] | IRichTextCharacter[]> | Nil) => this;\n subTitle: (text: MarkFunctionType<string | number | number[] | string[] | IRichTextCharacter[]> | Nil) => this;\n}\n\nexport interface TitleSpec extends ComponentSpec<Partial<TitleAttrs>> {\n componentType: ComponentEnum.title;\n title?: MarkFunctionType<string | number | number[] | string[] | IRichTextCharacter[]>;\n subTitle?: MarkFunctionType<string | number | number[] | string[] | IRichTextCharacter[]>;\n}\n\n// scrollbar component\n\nexport type ScrollbarFilterValue = { start?: number; end?: number; startRatio: number; endRatio: number };\n\nexport interface IScrollbar extends IScaleComponent {\n container: (container: IGroupMark | string | Nil) => this;\n direction: (direction: MarkFunctionType<Direction> | Nil) => this;\n position: (position: MarkFunctionType<OrientType> | Nil) => this;\n\n // immediate functions\n setScrollStart: (start: number) => this;\n getScrollRange: () => [number, number] | Nil;\n}\n\nexport interface ScrollbarSpec extends ScaleComponentSpec<Partial<ScrollBarAttributes>> {\n componentType: ComponentEnum.scrollbar;\n container?: IGroupMark | string;\n direction?: MarkFunctionType<Direction>;\n position?: MarkFunctionType<OrientType>;\n}\n\n// built-in components\n\nexport type BuiltInComponentSpec =\n | AxisSpec\n | LegendSpec\n | SliderSpec\n | DatazoomSpec\n | LabelSpec\n | PlayerSpec\n | TitleSpec\n | ScrollbarSpec;\n\nexport interface IComponentConstructor {\n readonly componentType: string;\n\n new (view: IView, group?: IGroupMark, mode?: '2d' | '3d'): IComponent;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { IArc, IArc3d, IArea, ICircle, IGlyph, IGraphic, IGroup, IImage, ILine, IPath, IPolygon, IPyramid3d, IRect, IRect3d, IRichText, ISymbol, IText } from '@visactor/vrender-core';
1
+ import type { IArc, IArc3d, IArea, ICircle, IGlyph, IGraphic, IGroup, IImage, ILine, IPath, IPolygon, IPyramid3d, IRect, IRect3d, IRichText, ISymbol, IText } from '@visactor/vrender/es/core';
2
2
  import type { DiffState } from '../graph/enums';
3
3
  import type { IMark, IGlyphMark } from './grammar';
4
4
  import type { BaseEncodeSpec, IMarkConfig, MarkFunctionType, MarkKeySpec, MarkType } from './mark';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/element.ts"],"names":[],"mappings":"","file":"element.js","sourcesContent":["import type {\n IArc,\n IArc3d,\n IArea,\n ICircle,\n IGlyph,\n IGraphic,\n IGroup,\n IImage,\n ILine,\n IPath,\n IPolygon,\n IPyramid3d,\n IRect,\n IRect3d,\n IRichText,\n ISymbol,\n IText\n} from '@visactor/vrender-core';\nimport type { DiffState } from '../graph/enums';\nimport type { IMark, IGlyphMark } from './grammar';\nimport type { BaseEncodeSpec, IMarkConfig, MarkFunctionType, MarkKeySpec, MarkType } from './mark';\n\nexport interface ElementGraphicMap {\n circle: ICircle;\n arc: IArc;\n area: IArea;\n image: IImage;\n line: ILine;\n path: IPath;\n rule: ILine;\n shape: IPath;\n symbol: ISymbol;\n text: IText;\n richtext: IRichText;\n polygon: IPolygon;\n cell: ISymbol;\n interval: IGraphic;\n rect: IRect;\n rect3d: IRect3d;\n arc3d: IArc3d;\n pyramid3d: IPyramid3d;\n group: IGroup;\n glyph: IGlyph;\n linkPath: IGlyph;\n treePath: IGlyph;\n wave: IGlyph;\n ripplePoint: IGlyph;\n barBoxplot: IGlyph;\n boxPlot: IGlyph;\n component: IGroup;\n axis: IGroup;\n legend: IGroup;\n corsshair: IGroup;\n slider: IGroup;\n datazoom: IGroup;\n label: IGroup;\n player: IGroup;\n}\n\nexport type GetGraphicByType<T> = T extends keyof ElementGraphicMap ? ElementGraphicMap[T] : IGraphic;\n\n/**\n * 保存graphicItem状态\n */\nexport interface MarkElementItem {\n /** 唯一key */\n key: string;\n /** 原始数据 */\n datum: any;\n /** VGrammar view */\n view: any;\n /** 当前渲染帧下graphicItem对应的最新属性 */\n nextAttrs?: any;\n /** 是否初始化过,用于解决collection mark对应的item,可能跳过enter状态的问题 */\n // hasEntered: boolean;\n}\nexport interface IElement {\n mark: IMark;\n isReserved: boolean;\n diffState: DiffState;\n key: string;\n groupKey?: string;\n data?: any[];\n /**\n * 不推荐使用,但是collection图元暂时可能回涉及到相关修改\n */\n items: MarkElementItem[];\n\n initGraphicItem: (attrs?: any) => void;\n updateGraphicItem: (config: IMarkConfig) => void;\n\n getDatum: () => any;\n getBounds: () => any;\n getGraphicItem: () => IGraphic;\n removeGraphicItem: () => void;\n resetGraphicItem: () => void;\n\n /**\n * 获取 graphic 视觉通道属性\n * @param channel 视觉通道\n * @param prev 是否从之前的 graphic 属性上获取,默认为 false\n * @returns 视觉通道值\n */\n getGraphicAttribute: (channel: string, prev?: boolean) => any;\n /**\n * 设置 graphic 视觉通道属性\n * @param channel 视觉通道\n * @param value 视觉通道属性\n * @param final 是否更新 graphic 最终变更的视觉通道结果,默认为 false\n */\n setGraphicAttribute: (channel: string, value: any, final?: boolean) => void;\n /**\n * 设置一系列 graphic 视觉通道属性\n * @param attributes 视觉通道键值对\n * @param final 是否更新 graphic 最终变更的视觉通道结果,默认为 false\n */\n setGraphicAttributes: (attributes: { [channel: string]: any }, final?: boolean) => void;\n\n /**\n * 【慎重使用】获取 VGrammar 自身的视觉通道属性\n * 只有在 'afterEncodeItems' 时机的mark transform中才能调用\n */\n getItemAttribute: (channel?: string) => any;\n /**\n * 【慎重使用】设置 VGrammar 自身的视觉通道\n * 只有在 'afterEncodeItems' 时机的mark transform中才能调用\n * @param attributes\n * @returns\n */\n setItemAttributes: (attributes: { [channel: string]: any } | any[]) => void;\n\n // element 执行流程相关接口\n updateData: (groupKey: string, data: any[], keyGenerator: MarkKeySpec, view: any) => void;\n state: (markState: MarkFunctionType<string | string[]>, parameters?: any) => void;\n encodeItems: (items: MarkElementItem[], encoders: BaseEncodeSpec, isReentered?: boolean, parameters?: any) => void;\n encodeGraphic: (attributes?: any) => void;\n transformElementItems: (items: MarkElementItem[], markType: MarkType, computePoints?: boolean) => Record<string, any>;\n remove: () => void;\n release: () => void;\n\n // 动画相关接口\n\n getFinalGraphicAttributes: () => { [key: string]: any };\n getPrevGraphicAttributes: () => { [key: string]: any };\n getNextGraphicAttributes: () => { [key: string]: any };\n clearChangedGraphicAttributes: () => void;\n clearGraphicAttributes: () => void;\n\n // state相关接口\n getStates: () => string[];\n hasState: (state: string) => boolean;\n clearStates: (noAnimation?: boolean) => void;\n addState: (state: string | string[], attrs?: any) => void;\n removeState: (state: string | string[]) => void;\n useStates: (states: string[], noAnimation?: boolean) => void;\n}\n\nexport interface IGlyphElement<P = any> extends IElement {\n mark: IGlyphMark;\n\n getGlyphGraphicItems: () => { [markName: string]: any };\n\n getGraphicAttribute: (channel: string, prev?: boolean, markName?: any) => any;\n setGraphicAttribute: (channel: string, value: any, final?: boolean, markName?: any) => void;\n setGraphicAttributes: (attributes: { [channel: string]: any }, final?: boolean, markName?: any) => void;\n\n getFinalGraphicAttributes: (markName?: string) => { [key: string]: any };\n getPrevGraphicAttributes: (markName?: string) => { [key: string]: any };\n getNextGraphicAttributes: (markName?: string) => { [key: string]: any };\n\n encodeCustom: (nextAttrs?: any) => { [markName: string]: any };\n}\n"]}
1
+ {"version":3,"sources":["../src/types/element.ts"],"names":[],"mappings":"","file":"element.js","sourcesContent":["import type {\n IArc,\n IArc3d,\n IArea,\n ICircle,\n IGlyph,\n IGraphic,\n IGroup,\n IImage,\n ILine,\n IPath,\n IPolygon,\n IPyramid3d,\n IRect,\n IRect3d,\n IRichText,\n ISymbol,\n IText\n} from '@visactor/vrender/es/core';\nimport type { DiffState } from '../graph/enums';\nimport type { IMark, IGlyphMark } from './grammar';\nimport type { BaseEncodeSpec, IMarkConfig, MarkFunctionType, MarkKeySpec, MarkType } from './mark';\n\nexport interface ElementGraphicMap {\n circle: ICircle;\n arc: IArc;\n area: IArea;\n image: IImage;\n line: ILine;\n path: IPath;\n rule: ILine;\n shape: IPath;\n symbol: ISymbol;\n text: IText;\n richtext: IRichText;\n polygon: IPolygon;\n cell: ISymbol;\n interval: IGraphic;\n rect: IRect;\n rect3d: IRect3d;\n arc3d: IArc3d;\n pyramid3d: IPyramid3d;\n group: IGroup;\n glyph: IGlyph;\n linkPath: IGlyph;\n treePath: IGlyph;\n wave: IGlyph;\n ripplePoint: IGlyph;\n barBoxplot: IGlyph;\n boxPlot: IGlyph;\n component: IGroup;\n axis: IGroup;\n legend: IGroup;\n corsshair: IGroup;\n slider: IGroup;\n datazoom: IGroup;\n label: IGroup;\n player: IGroup;\n}\n\nexport type GetGraphicByType<T> = T extends keyof ElementGraphicMap ? ElementGraphicMap[T] : IGraphic;\n\n/**\n * 保存graphicItem状态\n */\nexport interface MarkElementItem {\n /** 唯一key */\n key: string;\n /** 原始数据 */\n datum: any;\n /** VGrammar view */\n view: any;\n /** 当前渲染帧下graphicItem对应的最新属性 */\n nextAttrs?: any;\n /** 是否初始化过,用于解决collection mark对应的item,可能跳过enter状态的问题 */\n // hasEntered: boolean;\n}\nexport interface IElement {\n mark: IMark;\n isReserved: boolean;\n diffState: DiffState;\n key: string;\n groupKey?: string;\n data?: any[];\n /**\n * 不推荐使用,但是collection图元暂时可能回涉及到相关修改\n */\n items: MarkElementItem[];\n\n initGraphicItem: (attrs?: any) => void;\n updateGraphicItem: (config: IMarkConfig) => void;\n\n getDatum: () => any;\n getBounds: () => any;\n getGraphicItem: () => IGraphic;\n removeGraphicItem: () => void;\n resetGraphicItem: () => void;\n\n /**\n * 获取 graphic 视觉通道属性\n * @param channel 视觉通道\n * @param prev 是否从之前的 graphic 属性上获取,默认为 false\n * @returns 视觉通道值\n */\n getGraphicAttribute: (channel: string, prev?: boolean) => any;\n /**\n * 设置 graphic 视觉通道属性\n * @param channel 视觉通道\n * @param value 视觉通道属性\n * @param final 是否更新 graphic 最终变更的视觉通道结果,默认为 false\n */\n setGraphicAttribute: (channel: string, value: any, final?: boolean) => void;\n /**\n * 设置一系列 graphic 视觉通道属性\n * @param attributes 视觉通道键值对\n * @param final 是否更新 graphic 最终变更的视觉通道结果,默认为 false\n */\n setGraphicAttributes: (attributes: { [channel: string]: any }, final?: boolean) => void;\n\n /**\n * 【慎重使用】获取 VGrammar 自身的视觉通道属性\n * 只有在 'afterEncodeItems' 时机的mark transform中才能调用\n */\n getItemAttribute: (channel?: string) => any;\n /**\n * 【慎重使用】设置 VGrammar 自身的视觉通道\n * 只有在 'afterEncodeItems' 时机的mark transform中才能调用\n * @param attributes\n * @returns\n */\n setItemAttributes: (attributes: { [channel: string]: any } | any[]) => void;\n\n // element 执行流程相关接口\n updateData: (groupKey: string, data: any[], keyGenerator: MarkKeySpec, view: any) => void;\n state: (markState: MarkFunctionType<string | string[]>, parameters?: any) => void;\n encodeItems: (items: MarkElementItem[], encoders: BaseEncodeSpec, isReentered?: boolean, parameters?: any) => void;\n encodeGraphic: (attributes?: any) => void;\n transformElementItems: (items: MarkElementItem[], markType: MarkType, computePoints?: boolean) => Record<string, any>;\n remove: () => void;\n release: () => void;\n\n // 动画相关接口\n\n getFinalGraphicAttributes: () => { [key: string]: any };\n getPrevGraphicAttributes: () => { [key: string]: any };\n getNextGraphicAttributes: () => { [key: string]: any };\n clearChangedGraphicAttributes: () => void;\n clearGraphicAttributes: () => void;\n\n // state相关接口\n getStates: () => string[];\n hasState: (state: string) => boolean;\n clearStates: (noAnimation?: boolean) => void;\n addState: (state: string | string[], attrs?: any) => void;\n removeState: (state: string | string[]) => void;\n useStates: (states: string[], noAnimation?: boolean) => void;\n}\n\nexport interface IGlyphElement<P = any> extends IElement {\n mark: IGlyphMark;\n\n getGlyphGraphicItems: () => { [markName: string]: any };\n\n getGraphicAttribute: (channel: string, prev?: boolean, markName?: any) => any;\n setGraphicAttribute: (channel: string, value: any, final?: boolean, markName?: any) => void;\n setGraphicAttributes: (attributes: { [channel: string]: any }, final?: boolean, markName?: any) => void;\n\n getFinalGraphicAttributes: (markName?: string) => { [key: string]: any };\n getPrevGraphicAttributes: (markName?: string) => { [key: string]: any };\n getNextGraphicAttributes: (markName?: string) => { [key: string]: any };\n\n encodeCustom: (nextAttrs?: any) => { [markName: string]: any };\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { CustomEvent, FederatedEvent } from '@visactor/vrender-core';
1
+ import type { CustomEvent, FederatedEvent } from '@visactor/vrender/es/core';
2
2
  import type { IAnimationConfig, IElement, IGlyphElement, IMark } from '.';
3
3
  import type { MarkType } from './mark';
4
4
  import type { SignalDependency } from './signal';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/event.ts"],"names":[],"mappings":"","file":"event.js","sourcesContent":["import type { CustomEvent, FederatedEvent } from '@visactor/vrender-core';\nimport type { IAnimationConfig, IElement, IGlyphElement, IMark } from '.';\nimport type { MarkType } from './mark';\nimport type { SignalDependency } from './signal';\n\nexport type AnimationEvent = {\n mark: IMark;\n animationState: string;\n animationConfig: IAnimationConfig;\n};\n\nexport type InteractionEvent = (FederatedEvent | CustomEvent) & { element?: IElement | IGlyphElement };\nexport type GrammarEvent = InteractionEvent | AnimationEvent;\n\nexport type EventHandler<T> = (event?: GrammarEvent, value?: T) => void;\nexport type BaseEventHandler = AnimationEventHandler | InteractionEventHandler;\nexport type AnimationEventHandler = (event?: AnimationEvent) => void;\nexport type InteractionEventHandler = (event?: InteractionEvent, element?: IElement | IGlyphElement) => void;\nexport type ResizeHandler = EventHandler<{ width?: number; height?: number }>;\n\nexport type AnimationEventType = 'animationStart' | 'animationEnd' | 'elementAnimationStart' | 'elementAnimationEnd';\n\nexport type AnimationListenerHandler = (event?: AnimationEvent, el?: IElement) => void;\n\nexport type ViewEventType =\n | 'view:pointerdown'\n | 'view:pointerup'\n | 'view:pointerupoutside'\n | 'view:pointertap'\n | 'view:pointerover'\n | 'view:pointerenter'\n | 'view:pointerleave'\n | 'view:pointerout'\n | 'view:mousedown'\n | 'view:mouseup'\n | 'view:mouseupoutside'\n // 右键操作\n | 'view:rightdown'\n | 'view:rightup'\n | 'view:rightupoutside'\n | 'view:click'\n // 双击\n | 'view:dblclick'\n | 'view:mousemove'\n | 'view:mouseover'\n | 'view:mouseout'\n // 不会冒泡\n | 'view:mouseenter'\n // 不会冒泡\n | 'view:mouseleave'\n | 'view:wheel'\n | 'view:tap'\n | 'view:touchstart'\n | 'view:touchend'\n | 'view:touchendoutside'\n | 'view:touchmove'\n | 'view:touchcancel'\n // dragNdrop\n | 'view:dragstart'\n | 'view:drag'\n | 'view:dragenter'\n | 'view:dragleave'\n | 'view:dragover'\n | 'view:dragend'\n | 'view:drop'\n // gesture\n | 'view:pan'\n | 'view:panstart'\n | 'view:panend'\n | 'view:press'\n | 'view:pressup'\n | 'view:pressend'\n | 'view:pinch'\n | 'view:pinchstart'\n | 'view:pinchend'\n | 'view:swipe';\n\nexport type EventType =\n | 'pointerdown'\n | 'pointerup'\n | 'pointermove'\n // 指针抬起与按下的图形不同时触发\n | 'pointerupoutside'\n | 'pointertap'\n | 'pointerover'\n | 'pointermove'\n | 'pointerenter'\n | 'pointerleave'\n | 'pointerout'\n | 'mousedown'\n | 'mouseup'\n | 'mouseupoutside'\n // 右键操作\n | 'rightdown'\n | 'rightup'\n | 'rightupoutside'\n | 'click'\n // 双击\n | 'dblclick'\n | 'mousemove'\n | 'mouseover'\n | 'mouseout'\n // 不会冒泡\n | 'mouseenter'\n // 不会冒泡\n | 'mouseleave'\n | 'wheel'\n | 'tap'\n | 'touchstart'\n | 'touchend'\n | 'touchendoutside'\n | 'touchmove'\n | 'touchcancel'\n // dragNdrop\n | 'dragstart'\n | 'drag'\n | 'dragenter'\n | 'dragleave'\n | 'dragover'\n | 'dragend'\n | 'drop'\n // gesture\n | 'pan'\n | 'panstart'\n | 'panend'\n | 'press'\n | 'pressup'\n | 'pressend'\n | 'pinch'\n | 'pinchstart'\n | 'pinchend'\n | 'swipe'\n // resize\n | 'resize';\n\nexport type WindowEventType = string;\n\nexport interface EventCallbackContext extends Event {\n element?: any;\n datum?: any;\n}\n\nexport type EventCallback = (context: EventCallbackContext, params?: any) => any;\nexport interface BaseEventSpec {\n type: string;\n filter?: (context: EventCallbackContext) => boolean;\n throttle?: number;\n debounce?: number;\n /** 阻止事件的执行和传播 */\n consume?: boolean;\n callback?: EventCallback;\n dependency?: SignalDependency | SignalDependency[];\n target?:\n | string\n | Array<{\n target: string;\n callback: EventCallback;\n }>;\n}\n\nexport type MergeEventSpec = Omit<BaseEventSpec, 'type'> & { merge: string[] | BaseEventSpec[] };\n\nexport interface ParsedViewEventSpec extends BaseEventSpec {\n source?: 'view';\n type: EventType;\n markId?: string;\n markName?: string;\n markType?: string;\n}\n\nexport interface ParsedWindowEventSpec extends BaseEventSpec {\n source: 'window';\n type: WindowEventType;\n markId?: string;\n markName?: string;\n markType?: MarkType;\n}\n\nexport type EventSpec =\n | BaseEventSpec\n | ({\n between: [BaseEventSpec, BaseEventSpec];\n } & BaseEventSpec)\n | MergeEventSpec;\n\nexport type EventSourceType = 'window' | 'view';\n"]}
1
+ {"version":3,"sources":["../src/types/event.ts"],"names":[],"mappings":"","file":"event.js","sourcesContent":["import type { CustomEvent, FederatedEvent } from '@visactor/vrender/es/core';\nimport type { IAnimationConfig, IElement, IGlyphElement, IMark } from '.';\nimport type { MarkType } from './mark';\nimport type { SignalDependency } from './signal';\n\nexport type AnimationEvent = {\n mark: IMark;\n animationState: string;\n animationConfig: IAnimationConfig;\n};\n\nexport type InteractionEvent = (FederatedEvent | CustomEvent) & { element?: IElement | IGlyphElement };\nexport type GrammarEvent = InteractionEvent | AnimationEvent;\n\nexport type EventHandler<T> = (event?: GrammarEvent, value?: T) => void;\nexport type BaseEventHandler = AnimationEventHandler | InteractionEventHandler;\nexport type AnimationEventHandler = (event?: AnimationEvent) => void;\nexport type InteractionEventHandler = (event?: InteractionEvent, element?: IElement | IGlyphElement) => void;\nexport type ResizeHandler = EventHandler<{ width?: number; height?: number }>;\n\nexport type AnimationEventType = 'animationStart' | 'animationEnd' | 'elementAnimationStart' | 'elementAnimationEnd';\n\nexport type AnimationListenerHandler = (event?: AnimationEvent, el?: IElement) => void;\n\nexport type ViewEventType =\n | 'view:pointerdown'\n | 'view:pointerup'\n | 'view:pointerupoutside'\n | 'view:pointertap'\n | 'view:pointerover'\n | 'view:pointerenter'\n | 'view:pointerleave'\n | 'view:pointerout'\n | 'view:mousedown'\n | 'view:mouseup'\n | 'view:mouseupoutside'\n // 右键操作\n | 'view:rightdown'\n | 'view:rightup'\n | 'view:rightupoutside'\n | 'view:click'\n // 双击\n | 'view:dblclick'\n | 'view:mousemove'\n | 'view:mouseover'\n | 'view:mouseout'\n // 不会冒泡\n | 'view:mouseenter'\n // 不会冒泡\n | 'view:mouseleave'\n | 'view:wheel'\n | 'view:tap'\n | 'view:touchstart'\n | 'view:touchend'\n | 'view:touchendoutside'\n | 'view:touchmove'\n | 'view:touchcancel'\n // dragNdrop\n | 'view:dragstart'\n | 'view:drag'\n | 'view:dragenter'\n | 'view:dragleave'\n | 'view:dragover'\n | 'view:dragend'\n | 'view:drop'\n // gesture\n | 'view:pan'\n | 'view:panstart'\n | 'view:panend'\n | 'view:press'\n | 'view:pressup'\n | 'view:pressend'\n | 'view:pinch'\n | 'view:pinchstart'\n | 'view:pinchend'\n | 'view:swipe';\n\nexport type EventType =\n | 'pointerdown'\n | 'pointerup'\n | 'pointermove'\n // 指针抬起与按下的图形不同时触发\n | 'pointerupoutside'\n | 'pointertap'\n | 'pointerover'\n | 'pointermove'\n | 'pointerenter'\n | 'pointerleave'\n | 'pointerout'\n | 'mousedown'\n | 'mouseup'\n | 'mouseupoutside'\n // 右键操作\n | 'rightdown'\n | 'rightup'\n | 'rightupoutside'\n | 'click'\n // 双击\n | 'dblclick'\n | 'mousemove'\n | 'mouseover'\n | 'mouseout'\n // 不会冒泡\n | 'mouseenter'\n // 不会冒泡\n | 'mouseleave'\n | 'wheel'\n | 'tap'\n | 'touchstart'\n | 'touchend'\n | 'touchendoutside'\n | 'touchmove'\n | 'touchcancel'\n // dragNdrop\n | 'dragstart'\n | 'drag'\n | 'dragenter'\n | 'dragleave'\n | 'dragover'\n | 'dragend'\n | 'drop'\n // gesture\n | 'pan'\n | 'panstart'\n | 'panend'\n | 'press'\n | 'pressup'\n | 'pressend'\n | 'pinch'\n | 'pinchstart'\n | 'pinchend'\n | 'swipe'\n // resize\n | 'resize';\n\nexport type WindowEventType = string;\n\nexport interface EventCallbackContext extends Event {\n element?: any;\n datum?: any;\n}\n\nexport type EventCallback = (context: EventCallbackContext, params?: any) => any;\nexport interface BaseEventSpec {\n type: string;\n filter?: (context: EventCallbackContext) => boolean;\n throttle?: number;\n debounce?: number;\n /** 阻止事件的执行和传播 */\n consume?: boolean;\n callback?: EventCallback;\n dependency?: SignalDependency | SignalDependency[];\n target?:\n | string\n | Array<{\n target: string;\n callback: EventCallback;\n }>;\n}\n\nexport type MergeEventSpec = Omit<BaseEventSpec, 'type'> & { merge: string[] | BaseEventSpec[] };\n\nexport interface ParsedViewEventSpec extends BaseEventSpec {\n source?: 'view';\n type: EventType;\n markId?: string;\n markName?: string;\n markType?: string;\n}\n\nexport interface ParsedWindowEventSpec extends BaseEventSpec {\n source: 'window';\n type: WindowEventType;\n markId?: string;\n markName?: string;\n markType?: MarkType;\n}\n\nexport type EventSpec =\n | BaseEventSpec\n | ({\n between: [BaseEventSpec, BaseEventSpec];\n } & BaseEventSpec)\n | MergeEventSpec;\n\nexport type EventSourceType = 'window' | 'view';\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { EventEmitter, IBounds, IPointLike } from '@visactor/vutils';
2
- import type { IGraphic, IGroup } from '@visactor/vrender-core';
2
+ import type { IGraphic, IGroup } from '@visactor/vrender/es/core';
3
3
  import type { IBaseScale, ScaleFishEyeOptions, TickData } from '@visactor/vscale';
4
4
  import type { ITransform, TransformSpec } from './transform';
5
5
  import type { DataFormatSpec, IDataFilter } from './data';
@@ -138,8 +138,8 @@ export interface IMark extends IGrammarBase, IProgressiveGrammar {
138
138
  join: (data: IData | string | Nil, key?: MarkKeySpec, sort?: MarkSortSpec, groupBy?: MarkKeySpec, groupSort?: MarkSortSpec) => this;
139
139
  coordinate: (coordinate: ICoordinate | string | Nil) => this;
140
140
  state: (state: MarkFunctionType<string | string[]> | Nil) => this;
141
- encode: ((encoders: BaseSignleEncodeSpec) => this) & ((channel: string, value: ChannelEncodeType) => this);
142
- encodeState: ((state: string, channel: string, value: ChannelEncodeType) => this) & ((state: string, encoders: BaseSignleEncodeSpec) => this);
141
+ encode: ((encoders: BaseSignleEncodeSpec, clear?: boolean) => this) & ((channel: string, value: ChannelEncodeType, clear?: boolean) => this);
142
+ encodeState: ((state: string, channel: string, value: ChannelEncodeType, clear?: boolean) => this) & ((state: string, encoders: BaseSignleEncodeSpec, clear?: boolean) => this);
143
143
  animation: (animationConfig: MarkAnimationSpec | Nil) => this;
144
144
  animationState: (animationState: MarkFunctionType<string> | Nil) => this;
145
145
  layout: (layout: MarkLayoutSpec | MarkLayoutCallback | Nil) => this;
@@ -177,8 +177,8 @@ export interface IMark extends IGrammarBase, IProgressiveGrammar {
177
177
  getFieldsByChannel: () => Record<string, string> | undefined;
178
178
  getScales: () => Record<string, IBaseScale> | undefined;
179
179
  }
180
- export interface IGrammarBaseConstructor {
181
- new (view: IView): IGrammarBase;
180
+ export interface IGrammarBaseConstructor<T extends string = any> {
181
+ new (view: IView, grammarType: T): IGrammarBase;
182
182
  }
183
183
  export interface ProgressiveContext {
184
184
  currentIndex: number;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/grammar.ts"],"names":[],"mappings":"","file":"grammar.js","sourcesContent":["import type { EventEmitter, IBounds, IPointLike } from '@visactor/vutils';\nimport type { IGraphic, IGroup } from '@visactor/vrender-core';\nimport type { IBaseScale, ScaleFishEyeOptions, TickData } from '@visactor/vscale';\nimport type { ITransform, TransformSpec } from './transform';\nimport type { DataFormatSpec, IDataFilter } from './data';\nimport type { ParameterFunctionType, SignalFunctionType } from './signal';\nimport type { IAnimate } from './animate';\nimport type { IGlyphMeta } from './glyph';\nimport type { GrammarTypeEnum } from '../graph/enums';\nimport type { Nil } from './base';\nimport type { CoordinateFunctionType } from './coordinate';\nimport type { IElement } from './element';\nimport type {\n MarkFunctionType,\n MarkAnimationSpec,\n MarkType,\n MarkLayoutSpec,\n MarkLayoutCallback,\n MarkSortSpec,\n MarkKeySpec,\n IMarkConfig,\n ChannelEncodeType,\n AttributeTransform,\n BaseSignleEncodeSpec\n} from './mark';\nimport type { ScaleConfigureSpec, ScaleData, ScaleFunctionType, GrammarScaleType, MultiScaleData } from './scale';\nimport type { IView } from './view';\nimport type { BaseEventHandler } from './event';\nimport type { ICartesianCoordinate, IPolarCoordinate } from '@visactor/vgrammar-coordinate';\n\nexport type BuiltInGrammarType = keyof typeof GrammarTypeEnum;\nexport type GrammarType = BuiltInGrammarType | string;\n\n/** 语法元素内置运行的任务 */\nexport interface IGrammarTask extends ITransform {\n /**\n * 参数依赖\n * 只做一级解析\n */\n options?: Record<string, any | IGrammarBase> | (IGrammarBase | any)[];\n /**\n * 依赖的语法元素\n */\n references?: IGrammarBase[];\n /**\n * 是否只支持简单的options配置,不支持在options引用语法元素\n */\n isRawOptions?: boolean;\n}\n\nexport interface GrammarSpec {\n id?: string;\n dependency?: IGrammarBase[] | IGrammarBase | string[] | string;\n}\n\nexport interface IGrammarBase {\n readonly grammarType: GrammarType;\n readonly view: IView;\n readonly uid: number;\n /**\n * 执行的上游节点\n */\n grammarSource: IGrammarBase;\n /**\n * 影响的下游节点\n */\n targets: IGrammarBase[];\n /**\n * 依赖的上游节点,由于不同 spec 配置项中可能引用同一个节点,需要进行计数\n */\n references: Map<IGrammarBase, number>;\n\n depend: (grammar: IGrammarBase[] | IGrammarBase | string[] | string) => this;\n\n addEventListener: (type: string, handler: BaseEventHandler, options?: any) => this;\n removeEventListener: (type: string, handler: BaseEventHandler) => this;\n\n // extended from EventEmitter\n emit: <T extends EventEmitter.EventNames<string | symbol>>(\n event: T,\n ...args: EventEmitter.EventArgs<string | symbol, T>\n ) => boolean;\n emitGrammarEvent: <T extends EventEmitter.EventNames<string | symbol>>(\n event: T,\n ...args: EventEmitter.EventArgs<string | symbol, T>\n ) => boolean;\n\n tasks?: IGrammarTask[];\n // value?: any;\n /** FIXME: operator执行顺序,改造后,dataflow执行元素,应该抽象出来 */\n rank?: number;\n // todo\n set: (value: any) => boolean;\n id: (() => string) & ((id: string) => this);\n name: (() => string) & ((name: string) => this);\n attach: (reference: IGrammarBase | IGrammarBase[], count?: number) => this;\n detach: (reference: IGrammarBase | IGrammarBase[], count?: number) => this;\n detachAll: () => void;\n commit: () => void;\n output: () => any;\n parse: (spec: any) => this;\n parameters: () => { [key: string]: any };\n evaluateSync?: (upstream: any, parameters: any) => this;\n getSpec: () => any;\n reuse: (grammar: IGrammarBase) => this;\n /** clear references */\n clear: () => void;\n /** release all memory storage */\n release: () => void;\n}\n\nexport interface IData extends IGrammarBase {\n values: (values: any | Nil, format?: ParameterFunctionType<DataFormatSpec>, load?: boolean) => this;\n url: (\n url: ParameterFunctionType<string> | Nil,\n format?: ParameterFunctionType<DataFormatSpec>,\n load?: boolean\n ) => this;\n source: (\n source: string | string[] | IData | IData[],\n format?: ParameterFunctionType<DataFormatSpec>,\n load?: boolean\n ) => this;\n transform: (transform: TransformSpec[] | Nil) => this;\n\n // only used in VGrammar\n addDataFilter: (filter: IDataFilter | IDataFilter[]) => this;\n removeDataFilter: (filter: IDataFilter | IDataFilter[]) => this;\n\n // data util methods\n field: (field: string) => any[];\n getValue: () => any[];\n getInput: () => any[];\n getDataIDKey: () => string;\n}\n\n/** 语法元素,TODO */\nexport interface ISignal<T> extends IGrammarBase {\n value: (value: T | Nil) => this;\n update: (update: SignalFunctionType<T> | Nil) => this;\n\n getValue: () => T;\n}\n\n/** 语法元素,TODO */\nexport interface IScale extends IGrammarBase {\n domain: (domain: ScaleFunctionType<any[]> | ScaleData | MultiScaleData | Nil) => this;\n range: (range: ScaleFunctionType<any[]> | ScaleData | MultiScaleData | Nil) => this;\n configure: (config: ScaleConfigureSpec | Nil) => this;\n tickCount: (tickCount: ScaleFunctionType<number> | Nil) => this;\n\n // only used in VGrammar\n getRangeFactor: () => [number, number] | Nil;\n setRangeFactor: (range?: [number, number]) => this;\n getFishEye: () => ScaleFishEyeOptions | Nil;\n setFishEye: (option?: ScaleFishEyeOptions) => this;\n\n // scale util methods\n getScaleType: () => GrammarScaleType;\n getScale: () => IBaseScale;\n ticks: (count?: number) => TickData[];\n getCoordinateAxisPoints: (baseValue?: number) => [IPointLike, IPointLike];\n getCoordinate: () => IPolarCoordinate | ICartesianCoordinate;\n getCoordinateAxisPosition: () => 'top' | 'bottom' | 'left' | 'right' | 'inside' | 'outside' | 'start' | 'end';\n}\n\nexport interface ICoordinate extends IGrammarBase {\n start: (start: CoordinateFunctionType<[number, number]> | Nil) => this;\n end: (end: CoordinateFunctionType<[number, number]> | Nil) => this;\n origin: (origin: CoordinateFunctionType<[number, number]> | Nil) => this;\n\n translate: (offset: CoordinateFunctionType<[number, number]> | Nil) => this;\n rotate: (angle: CoordinateFunctionType<number> | Nil) => this;\n scale: (ratio: CoordinateFunctionType<[number, number]> | Nil) => this;\n transpose: (isTransposed: CoordinateFunctionType<boolean> | Nil) => this;\n\n // coordinate util methods\n}\n\n/** 语法元素,TODO */\n\n/** group mark */\nexport interface IGroupMark extends IMark {\n children: (IMark | IGroupMark | IGlyphMark)[];\n\n layoutChildren?: (IMark | IGroupMark | IGlyphMark)[];\n\n appendChild: (mark: IMark | IGroupMark | IGlyphMark) => this;\n removeChild: (mark: IMark | IGroupMark | IGlyphMark) => this;\n includesChild: (mark: IMark, descendant?: boolean) => boolean;\n\n updateLayoutChildren: () => this;\n}\n\nexport interface IGlyphMark extends IMark {\n glyphType: string;\n getGlyphMeta: () => IGlyphMeta;\n configureGlyph: (config: any) => this;\n getGlyphConfig: () => any;\n}\n\nexport interface IComponent extends IMark {\n componentType: string;\n configureComponent: (config: any) => this;\n}\n\nexport interface IProgressiveGrammar {\n /** 是否启动了增量渲染模式 */\n isProgressive: () => boolean;\n /** 是否正在执行增量渲染 */\n isDoingProgressive: () => boolean;\n /** 清除增量渲染相关状态 */\n clearProgressive: () => void;\n /** 从第一帧开始增量计算 */\n restartProgressive: () => void;\n /** 分片执行 */\n evaluateProgressive: () => void;\n}\n\nexport interface IMark extends IGrammarBase, IProgressiveGrammar {\n group?: IGroupMark;\n\n markType: MarkType;\n coord: ICoordinate;\n /**\n * disable coordinate transform when need\n */\n disableCoordinateTransform?: boolean;\n elements: IElement[];\n elementMap: Map<string, IElement>;\n graphicIndex: number;\n graphicItem?: IGroup;\n animate?: IAnimate;\n\n join: (\n data: IData | string | Nil,\n key?: MarkKeySpec,\n sort?: MarkSortSpec,\n groupBy?: MarkKeySpec,\n groupSort?: MarkSortSpec\n ) => this;\n coordinate: (coordinate: ICoordinate | string | Nil) => this;\n state: (state: MarkFunctionType<string | string[]> | Nil) => this;\n encode: ((encoders: BaseSignleEncodeSpec) => this) & ((channel: string, value: ChannelEncodeType) => this);\n encodeState: ((state: string, channel: string, value: ChannelEncodeType) => this) &\n ((state: string, encoders: BaseSignleEncodeSpec) => this);\n animation: (animationConfig: MarkAnimationSpec | Nil) => this;\n animationState: (animationState: MarkFunctionType<string> | Nil) => this;\n layout: (layout: MarkLayoutSpec | MarkLayoutCallback | Nil) => this;\n configure: (config: IMarkConfig | Nil) => this;\n context: (context: any) => this;\n transform: (transform: TransformSpec[] | Nil) => this;\n\n needAnimate: () => boolean;\n getBounds: () => IBounds;\n isCollectionMark: () => boolean;\n getAllElements: () => IElement[];\n getContext: () => any;\n\n // position: () => this;\n // color: () => this;\n // shape: () => this;\n\n // mark 执行流程相关接口\n\n isUpdated: boolean;\n getGroupGraphicItem: () => any;\n cleanExitElements: () => void;\n addGraphicItem: (attrs: any, groupKey?: string) => IGraphic;\n getMorphConfig: () => { morph: boolean; morphKey: string | undefined; morphElementKey: string | undefined };\n prepareRelease: () => void;\n\n layoutBounds?: IBounds;\n relativePosition?: { top?: number; bottom?: number; left?: number; right?: number };\n needLayout: () => boolean;\n handleLayoutEnd: () => void;\n handleRenderEnd: () => void;\n isLargeMode: () => boolean;\n getAttributeTransforms: () => AttributeTransform[];\n\n getScalesByChannel: () => Record<string, IBaseScale> | undefined;\n getFieldsByChannel: () => Record<string, string> | undefined;\n getScales: () => Record<string, IBaseScale> | undefined;\n}\n\nexport interface IGrammarBaseConstructor {\n new (view: IView): IGrammarBase;\n}\n\nexport interface ProgressiveContext {\n currentIndex: number;\n totalStep: number;\n step: number;\n data: any[];\n groupKeys?: string[];\n groupedData?: Map<string, any[]>;\n}\n"]}
1
+ {"version":3,"sources":["../src/types/grammar.ts"],"names":[],"mappings":"","file":"grammar.js","sourcesContent":["import type { EventEmitter, IBounds, IPointLike } from '@visactor/vutils';\nimport type { IGraphic, IGroup } from '@visactor/vrender/es/core';\nimport type { IBaseScale, ScaleFishEyeOptions, TickData } from '@visactor/vscale';\nimport type { ITransform, TransformSpec } from './transform';\nimport type { DataFormatSpec, IDataFilter } from './data';\nimport type { ParameterFunctionType, SignalFunctionType } from './signal';\nimport type { IAnimate } from './animate';\nimport type { IGlyphMeta } from './glyph';\nimport type { GrammarTypeEnum } from '../graph/enums';\nimport type { Nil } from './base';\nimport type { CoordinateFunctionType } from './coordinate';\nimport type { IElement } from './element';\nimport type {\n MarkFunctionType,\n MarkAnimationSpec,\n MarkType,\n MarkLayoutSpec,\n MarkLayoutCallback,\n MarkSortSpec,\n MarkKeySpec,\n IMarkConfig,\n ChannelEncodeType,\n AttributeTransform,\n BaseSignleEncodeSpec\n} from './mark';\nimport type { ScaleConfigureSpec, ScaleData, ScaleFunctionType, GrammarScaleType, MultiScaleData } from './scale';\nimport type { IView } from './view';\nimport type { BaseEventHandler } from './event';\nimport type { ICartesianCoordinate, IPolarCoordinate } from '@visactor/vgrammar-coordinate';\n\nexport type BuiltInGrammarType = keyof typeof GrammarTypeEnum;\nexport type GrammarType = BuiltInGrammarType | string;\n\n/** 语法元素内置运行的任务 */\nexport interface IGrammarTask extends ITransform {\n /**\n * 参数依赖\n * 只做一级解析\n */\n options?: Record<string, any | IGrammarBase> | (IGrammarBase | any)[];\n /**\n * 依赖的语法元素\n */\n references?: IGrammarBase[];\n /**\n * 是否只支持简单的options配置,不支持在options引用语法元素\n */\n isRawOptions?: boolean;\n}\n\nexport interface GrammarSpec {\n id?: string;\n dependency?: IGrammarBase[] | IGrammarBase | string[] | string;\n}\n\nexport interface IGrammarBase {\n readonly grammarType: GrammarType;\n readonly view: IView;\n readonly uid: number;\n /**\n * 执行的上游节点\n */\n grammarSource: IGrammarBase;\n /**\n * 影响的下游节点\n */\n targets: IGrammarBase[];\n /**\n * 依赖的上游节点,由于不同 spec 配置项中可能引用同一个节点,需要进行计数\n */\n references: Map<IGrammarBase, number>;\n\n depend: (grammar: IGrammarBase[] | IGrammarBase | string[] | string) => this;\n\n addEventListener: (type: string, handler: BaseEventHandler, options?: any) => this;\n removeEventListener: (type: string, handler: BaseEventHandler) => this;\n\n // extended from EventEmitter\n emit: <T extends EventEmitter.EventNames<string | symbol>>(\n event: T,\n ...args: EventEmitter.EventArgs<string | symbol, T>\n ) => boolean;\n emitGrammarEvent: <T extends EventEmitter.EventNames<string | symbol>>(\n event: T,\n ...args: EventEmitter.EventArgs<string | symbol, T>\n ) => boolean;\n\n tasks?: IGrammarTask[];\n // value?: any;\n /** FIXME: operator执行顺序,改造后,dataflow执行元素,应该抽象出来 */\n rank?: number;\n // todo\n set: (value: any) => boolean;\n id: (() => string) & ((id: string) => this);\n name: (() => string) & ((name: string) => this);\n attach: (reference: IGrammarBase | IGrammarBase[], count?: number) => this;\n detach: (reference: IGrammarBase | IGrammarBase[], count?: number) => this;\n detachAll: () => void;\n commit: () => void;\n output: () => any;\n parse: (spec: any) => this;\n parameters: () => { [key: string]: any };\n evaluateSync?: (upstream: any, parameters: any) => this;\n getSpec: () => any;\n reuse: (grammar: IGrammarBase) => this;\n /** clear references */\n clear: () => void;\n /** release all memory storage */\n release: () => void;\n}\n\nexport interface IData extends IGrammarBase {\n values: (values: any | Nil, format?: ParameterFunctionType<DataFormatSpec>, load?: boolean) => this;\n url: (\n url: ParameterFunctionType<string> | Nil,\n format?: ParameterFunctionType<DataFormatSpec>,\n load?: boolean\n ) => this;\n source: (\n source: string | string[] | IData | IData[],\n format?: ParameterFunctionType<DataFormatSpec>,\n load?: boolean\n ) => this;\n transform: (transform: TransformSpec[] | Nil) => this;\n\n // only used in VGrammar\n addDataFilter: (filter: IDataFilter | IDataFilter[]) => this;\n removeDataFilter: (filter: IDataFilter | IDataFilter[]) => this;\n\n // data util methods\n field: (field: string) => any[];\n getValue: () => any[];\n getInput: () => any[];\n getDataIDKey: () => string;\n}\n\n/** 语法元素,TODO */\nexport interface ISignal<T> extends IGrammarBase {\n value: (value: T | Nil) => this;\n update: (update: SignalFunctionType<T> | Nil) => this;\n\n getValue: () => T;\n}\n\n/** 语法元素,TODO */\nexport interface IScale extends IGrammarBase {\n domain: (domain: ScaleFunctionType<any[]> | ScaleData | MultiScaleData | Nil) => this;\n range: (range: ScaleFunctionType<any[]> | ScaleData | MultiScaleData | Nil) => this;\n configure: (config: ScaleConfigureSpec | Nil) => this;\n tickCount: (tickCount: ScaleFunctionType<number> | Nil) => this;\n\n // only used in VGrammar\n getRangeFactor: () => [number, number] | Nil;\n setRangeFactor: (range?: [number, number]) => this;\n getFishEye: () => ScaleFishEyeOptions | Nil;\n setFishEye: (option?: ScaleFishEyeOptions) => this;\n\n // scale util methods\n getScaleType: () => GrammarScaleType;\n getScale: () => IBaseScale;\n ticks: (count?: number) => TickData[];\n getCoordinateAxisPoints: (baseValue?: number) => [IPointLike, IPointLike];\n getCoordinate: () => IPolarCoordinate | ICartesianCoordinate;\n getCoordinateAxisPosition: () => 'top' | 'bottom' | 'left' | 'right' | 'inside' | 'outside' | 'start' | 'end';\n}\n\nexport interface ICoordinate extends IGrammarBase {\n start: (start: CoordinateFunctionType<[number, number]> | Nil) => this;\n end: (end: CoordinateFunctionType<[number, number]> | Nil) => this;\n origin: (origin: CoordinateFunctionType<[number, number]> | Nil) => this;\n\n translate: (offset: CoordinateFunctionType<[number, number]> | Nil) => this;\n rotate: (angle: CoordinateFunctionType<number> | Nil) => this;\n scale: (ratio: CoordinateFunctionType<[number, number]> | Nil) => this;\n transpose: (isTransposed: CoordinateFunctionType<boolean> | Nil) => this;\n\n // coordinate util methods\n}\n\n/** 语法元素,TODO */\n\n/** group mark */\nexport interface IGroupMark extends IMark {\n children: (IMark | IGroupMark | IGlyphMark)[];\n\n layoutChildren?: (IMark | IGroupMark | IGlyphMark)[];\n\n appendChild: (mark: IMark | IGroupMark | IGlyphMark) => this;\n removeChild: (mark: IMark | IGroupMark | IGlyphMark) => this;\n includesChild: (mark: IMark, descendant?: boolean) => boolean;\n\n updateLayoutChildren: () => this;\n}\n\nexport interface IGlyphMark extends IMark {\n glyphType: string;\n getGlyphMeta: () => IGlyphMeta;\n configureGlyph: (config: any) => this;\n getGlyphConfig: () => any;\n}\n\nexport interface IComponent extends IMark {\n componentType: string;\n configureComponent: (config: any) => this;\n}\n\nexport interface IProgressiveGrammar {\n /** 是否启动了增量渲染模式 */\n isProgressive: () => boolean;\n /** 是否正在执行增量渲染 */\n isDoingProgressive: () => boolean;\n /** 清除增量渲染相关状态 */\n clearProgressive: () => void;\n /** 从第一帧开始增量计算 */\n restartProgressive: () => void;\n /** 分片执行 */\n evaluateProgressive: () => void;\n}\n\nexport interface IMark extends IGrammarBase, IProgressiveGrammar {\n group?: IGroupMark;\n\n markType: MarkType;\n coord: ICoordinate;\n /**\n * disable coordinate transform when need\n */\n disableCoordinateTransform?: boolean;\n elements: IElement[];\n elementMap: Map<string, IElement>;\n graphicIndex: number;\n graphicItem?: IGroup;\n animate?: IAnimate;\n\n join: (\n data: IData | string | Nil,\n key?: MarkKeySpec,\n sort?: MarkSortSpec,\n groupBy?: MarkKeySpec,\n groupSort?: MarkSortSpec\n ) => this;\n coordinate: (coordinate: ICoordinate | string | Nil) => this;\n state: (state: MarkFunctionType<string | string[]> | Nil) => this;\n encode: ((encoders: BaseSignleEncodeSpec, clear?: boolean) => this) &\n ((channel: string, value: ChannelEncodeType, clear?: boolean) => this);\n encodeState: ((state: string, channel: string, value: ChannelEncodeType, clear?: boolean) => this) &\n ((state: string, encoders: BaseSignleEncodeSpec, clear?: boolean) => this);\n animation: (animationConfig: MarkAnimationSpec | Nil) => this;\n animationState: (animationState: MarkFunctionType<string> | Nil) => this;\n layout: (layout: MarkLayoutSpec | MarkLayoutCallback | Nil) => this;\n configure: (config: IMarkConfig | Nil) => this;\n context: (context: any) => this;\n transform: (transform: TransformSpec[] | Nil) => this;\n\n needAnimate: () => boolean;\n getBounds: () => IBounds;\n isCollectionMark: () => boolean;\n getAllElements: () => IElement[];\n getContext: () => any;\n\n // position: () => this;\n // color: () => this;\n // shape: () => this;\n\n // mark 执行流程相关接口\n\n isUpdated: boolean;\n getGroupGraphicItem: () => any;\n cleanExitElements: () => void;\n addGraphicItem: (attrs: any, groupKey?: string) => IGraphic;\n getMorphConfig: () => { morph: boolean; morphKey: string | undefined; morphElementKey: string | undefined };\n prepareRelease: () => void;\n\n layoutBounds?: IBounds;\n relativePosition?: { top?: number; bottom?: number; left?: number; right?: number };\n needLayout: () => boolean;\n handleLayoutEnd: () => void;\n handleRenderEnd: () => void;\n isLargeMode: () => boolean;\n getAttributeTransforms: () => AttributeTransform[];\n\n getScalesByChannel: () => Record<string, IBaseScale> | undefined;\n getFieldsByChannel: () => Record<string, string> | undefined;\n getScales: () => Record<string, IBaseScale> | undefined;\n}\n\nexport interface IGrammarBaseConstructor<T extends string = any> {\n new (view: IView, grammarType: T): IGrammarBase;\n}\n\nexport interface ProgressiveContext {\n currentIndex: number;\n totalStep: number;\n step: number;\n data: any[];\n groupKeys?: string[];\n groupedData?: Map<string, any[]>;\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import type { IView } from './view';
2
2
  import type { EventType, InteractionEvent, ViewEventType } from './event';
3
3
  import type { BaseCrosshairAttrs, BrushAttributes, TooltipAttributes, TooltipRowAttrs } from '@visactor/vrender-components';
4
- import type { IPolygon, ISymbolGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender-core';
4
+ import type { IPolygon, ISymbolGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender/es/core';
5
5
  import type { IElement, IGlyphElement } from './element';
6
6
  import type { IData, IGrammarBase, IMark, IScale } from './grammar';
7
7
  import type { IPointLike } from '@visactor/vutils';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/interaction.ts"],"names":[],"mappings":"","file":"interaction.js","sourcesContent":["import type { IView } from './view';\nimport type { EventType, InteractionEvent, ViewEventType } from './event';\nimport type {\n BaseCrosshairAttrs,\n BrushAttributes,\n TooltipAttributes,\n TooltipRowAttrs\n} from '@visactor/vrender-components';\nimport type { IPolygon, ISymbolGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender-core';\nimport type { IElement, IGlyphElement } from './element';\nimport type { IData, IGrammarBase, IMark, IScale } from './grammar';\nimport type { IPointLike } from '@visactor/vutils';\nimport type { IBaseScale } from '@visactor/vscale';\nimport type { IDatazoom, IScrollbar } from './component';\nimport type { FieldEncodeType, MarkFunctionType } from './mark';\n\nexport interface FilterDataTarget {\n data: string | IData;\n filter: string | ((datum: any, filterValues: any[]) => boolean);\n transform?: (data: any[], filterValues: any[]) => any[];\n}\n\nexport interface IBaseInteractionOptions {\n dependencies?: string | string[] | IGrammarBase | IGrammarBase[];\n\n shouldStart?: (e: any) => boolean;\n\n shouldUpdate?: (e: any) => boolean;\n\n shouldEnd?: (e: any) => boolean;\n\n shouldReset?: (e: any) => boolean;\n\n onStart?: (e: any) => boolean;\n\n onUpdate?: (e: any) => boolean;\n\n onEnd?: (e: any) => boolean;\n\n onReset?: (e: any) => boolean;\n}\n\nexport interface IInteraction {\n readonly type: string;\n depend: (grammar: IGrammarBase[] | IGrammarBase | string[] | string) => void;\n bind: () => void;\n unbind: () => void;\n}\n\nexport interface IInteractionConstructor {\n readonly type: string;\n\n new (view: IView, options?: any): IInteraction;\n}\n\n/**\n * the interaction to set the active state of specified marks\n */\nexport interface ElementActiveOptions extends IBaseInteractionOptions {\n /**\n * the selector of marks\n */\n selector?: string | string[] | IMark | IMark[];\n /**\n * the trigger event name\n */\n trigger?: EventType;\n /**\n * the reset trigger event name\n */\n resetTrigger?: EventType;\n /**\n * the active state name\n */\n state?: string;\n}\n\n/**\n * the interaction to set the seleted state of specified marks\n */\nexport interface ElementSelectOptions extends IBaseInteractionOptions {\n /**\n * the selector of marks\n */\n selector?: string | string[] | IMark | IMark[];\n /**\n * the trigger event name\n */\n trigger?: EventType;\n /**\n * the selected state name\n */\n state?: string;\n /**\n * the reset trigger event name\n */\n resetTrigger?: EventType | ViewEventType | 'empty';\n /**\n * whether or not support multiple selected\n */\n isMultiple?: boolean;\n}\n\n/**\n * the interaction to set the highlight state of specified marks\n */\nexport interface ElementHighlightOptions extends IBaseInteractionOptions {\n /**\n * the selector of marks\n */\n selector?: string | string[] | IMark | IMark[];\n /**\n * the trigger event name\n */\n trigger?: EventType;\n /**\n * the reset trigger event name\n */\n resetTrigger?: EventType;\n /**\n * the highlight state name\n */\n highlightState?: string;\n /**\n * the blur state name\n */\n blurState?: string;\n}\n\n/**\n * the interaction to set the active state of specified marks trigger by legend\n */\nexport interface ElementActiveByLegendOptions extends IBaseInteractionOptions {\n /**\n * the selector of marks\n */\n selector?: string | string[] | IMark | IMark[];\n /**\n * the active state name\n */\n state?: string;\n /**\n * the highlight state name\n */\n filterType?: 'key' | 'groupKey';\n}\n\n/**\n * the interaction to set the active state of specified marks trigger by legend\n */\nexport interface ElementHighlightByLegendOptions extends IBaseInteractionOptions {\n /**\n * the selector of marks\n */\n selector?: string | string[] | IMark | IMark[];\n /**\n * the highlight state name\n */\n highlightState?: string;\n /**\n * the blur state name\n */\n blurState?: string;\n /**\n * the highlight state name\n */\n filterType?: 'key' | 'groupKey';\n}\n\nexport interface ElementHighlightByNameOptions extends ElementHighlightByLegendOptions {\n name?: string | string[];\n /**\n * the trigger event name\n */\n trigger?: EventType;\n /**\n * the reset trigger event name\n */\n resetTrigger?: EventType;\n\n parseData?: (e: InteractionEvent) => any;\n}\n\nexport interface BrushEventParams {\n operateType: string;\n operateMask: IPolygon;\n activeElements?: (IElement | IGlyphElement)[];\n}\n\nexport interface BrushOptions extends IBaseInteractionOptions, BrushAttributes {\n /**\n * the selector of marks\n */\n selector?: string | string[] | IMark | IMark[];\n\n onStart?: (params: BrushEventParams) => boolean;\n\n onUpdate?: (params: BrushEventParams) => boolean;\n\n onEnd?: (params: BrushEventParams) => boolean;\n\n onReset?: (params: BrushEventParams) => boolean;\n}\n\nexport interface BrushHighlightOptions extends BrushOptions {\n /**\n * the highlight state name\n */\n highlightState?: string;\n /**\n * the blur state name\n */\n blurState?: string;\n}\n\nexport interface BrushActiveOptions extends BrushOptions {\n /**\n * the active state name\n */\n state?: string;\n}\n\nexport interface BrushFilterOptions extends BrushOptions {\n target: {\n data: IData | string;\n transform?: (data: any[], filterValue: any) => any[];\n };\n}\n\nexport interface DataFilterOptions extends IBaseInteractionOptions {\n /**\n * the selector of marks\n */\n source?: string | string[] | IMark | IMark[];\n\n /**\n * data target\n */\n target: {\n data: IData | string;\n filter?: string | ((datum: any, filterValue: any) => boolean);\n transform?: (data: any[], filterValue: any) => any[];\n };\n}\n\nexport interface DrillDownOptions extends BrushOptions {\n /**\n * enable brush\n */\n brush?: boolean;\n // trigger attribute is included in brush attributes\n target: {\n data: IData | string;\n transform?: (data: any[], filterValue: any) => any[];\n };\n}\n\nexport interface RollUpOptions extends DataFilterOptions {\n /**\n * the trigger event name\n */\n trigger?: EventType;\n /**\n * the reset trigger event name\n */\n resetTrigger?: EventType | ViewEventType | 'empty';\n}\n\nexport type CustomTooltipCallback = (\n datum: any,\n element: IElement,\n parameters: any\n) => TooltipRowAttrs | TooltipRowAttrs[];\n\nexport interface ITooltipRow {\n visible?: boolean;\n key?: MarkFunctionType<string | Partial<ITextGraphicAttribute>> | FieldEncodeType;\n value?: MarkFunctionType<string | Partial<ITextGraphicAttribute>> | FieldEncodeType;\n symbol?: MarkFunctionType<string | Partial<ISymbolGraphicAttribute>> | FieldEncodeType;\n}\n\nexport type TooltipType = 'x' | 'y' | 'angle' | 'radius';\n\nexport interface TooltipOptions extends IBaseInteractionOptions {\n /**\n * the selector of marks\n */\n selector?: string | string[] | IMark | IMark[];\n /**\n * the trigger event name\n */\n trigger?: EventType;\n /**\n * the reset trigger event name\n */\n resetTrigger?: EventType;\n\n title?: ITooltipRow | string | CustomTooltipCallback;\n content?: ITooltipRow | ITooltipRow[] | CustomTooltipCallback;\n attributes?: MarkFunctionType<TooltipAttributes>;\n}\n\nexport interface DimensionTooltipOptions extends TooltipOptions {\n scale?: IScale | string;\n tooltipType?: TooltipType;\n target?: {\n data: IData | string;\n filter: string | ((datum: any, tooltipValue: any) => boolean);\n };\n avoidMark?: string | string[];\n container?: string | IMark;\n center?: IPointLike;\n}\n\nexport type CrosshairType = 'x' | 'y' | 'angle' | 'radius' | 'radius-polygon';\n\nexport type CrosshairShape = 'line' | 'rect';\n\nexport interface CrosshairOptions extends IBaseInteractionOptions {\n /**\n * the trigger event name\n */\n trigger?: EventType;\n /**\n * the reset trigger event name\n */\n resetTrigger?: EventType;\n scale?: IScale | string;\n crosshairType?: CrosshairType;\n crosshairShape?: CrosshairShape;\n container?: string | IMark;\n radius?: number;\n center?: IPointLike;\n attributes?: MarkFunctionType<BaseCrosshairAttrs>;\n}\nexport interface ViewNavigationBaseOptions {\n enableX?: boolean;\n enableY?: boolean;\n scaleX?: string | IScale;\n scaleY?: string | IScale;\n dataTargetX?: FilterDataTarget;\n dataTargetY?: FilterDataTarget;\n throttle?: number;\n linkedComponentX?: string | IDatazoom | IScrollbar;\n linkedComponentY?: string | IDatazoom | IScrollbar;\n}\n\nexport interface ViewZoomSimpleOptions {\n realtime?: boolean;\n rate?: number;\n focus?: boolean;\n trigger?: EventType;\n endTrigger?: EventType;\n resetTrigger?: EventType;\n}\n\nexport type ViewZoomOptions = ViewZoomSimpleOptions & IBaseInteractionOptions & ViewNavigationBaseOptions;\n\nexport interface ViewScrollSimpleOptions {\n realtime?: boolean;\n reversed?: boolean;\n trigger?: EventType;\n endTrigger?: EventType;\n}\nexport type ViewScrollOptions = ViewScrollSimpleOptions & IBaseInteractionOptions & ViewNavigationBaseOptions;\n\nexport interface ViewDragSimpleOptions {\n realtime?: boolean;\n reversed?: boolean;\n trigger?: EventType;\n endTrigger?: EventType;\n updateTrigger?: EventType;\n}\n\nexport type ViewDragOptions = ViewDragSimpleOptions & IBaseInteractionOptions & ViewNavigationBaseOptions;\n\nexport interface ViewRoamOptions extends IBaseInteractionOptions, ViewNavigationBaseOptions {\n zoom?: ViewZoomSimpleOptions & { enable?: boolean };\n scroll?: ViewScrollSimpleOptions & { enable?: boolean };\n drag?: ViewDragSimpleOptions & { enable?: boolean };\n}\n\n/**\n * the interaction to set the highlight state of specified marks\n */\nexport interface SankeyHighlightOptions extends IBaseInteractionOptions {\n /**\n * the selector of node mark\n */\n nodeSelector?: string | IMark;\n /**\n * the selector of link mark\n */\n linkSelector?: string | IMark;\n /**\n * the trigger event name\n */\n trigger?: EventType;\n /**\n * the reset trigger event name\n */\n resetTrigger?: EventType;\n /**\n * the highlight state name\n */\n highlightState?: string;\n /**\n * the blur state name\n */\n blurState?: string;\n /** set higlight state to different type of nodes */\n effect?: 'adjacency' | 'related';\n}\n\nexport interface FishEyeOptions extends IBaseInteractionOptions {\n selector?: string | string[] | IMark | IMark[];\n /** the radius of x-direction */\n radiusX?: number;\n /** the radius of y-direction */\n radiusY?: number;\n /** the radiusRatio of x-direction */\n radiusRatioX?: number;\n /** the radiusRatio of y-direction */\n radiusRatioY?: number;\n /** x方向的扰动 */\n distortionX?: number;\n /** y方向的扰动 */\n distortionY?: number;\n /** 禁用 x方向的变形 */\n enableX?: boolean;\n /** 禁用y方向的变形 */\n enableY?: boolean;\n /** x方向的scale */\n scaleX?: string | IScale;\n /** y方向的scale */\n scaleY?: string | IScale;\n /** 节流的时长,单位为ms */\n throttle?: number;\n /**\n * the trigger event name\n */\n trigger?: EventType;\n /**\n * the trigger event of end\n */\n endTrigger?: EventType;\n /**\n * the trigger event of updating\n */\n updateTrigger?: EventType;\n /**\n * the trigger event of reset\n */\n resetTrigger?: string;\n}\n\nexport interface ElementActiveSpec extends ElementActiveOptions {\n type: 'element-active';\n}\nexport interface ElementSelectSpec extends ElementSelectOptions {\n type: 'element-select';\n}\nexport interface ElementHighlightSpec extends ElementHighlightOptions {\n type: 'element-highlight';\n}\nexport interface ElementHighlightByKeySpec extends ElementHighlightOptions {\n type: 'element-highlight-by-key';\n}\nexport interface ElementHighlightByGroupSpec extends ElementHighlightOptions {\n type: 'element-highlight-by-group';\n}\nexport interface ElementActiveByLegendSpec extends ElementActiveByLegendOptions {\n type: 'element-active-by-legend';\n}\n\nexport interface ElementHighlightByLegendSpec extends ElementHighlightByLegendOptions {\n type: 'element-highlight-by-legend';\n}\n\nexport interface ElementHighlightByNameSpec extends ElementHighlightByNameOptions {\n type: 'element-highlight-by-name';\n}\n\nexport interface BrushHighlightSpec extends BrushHighlightOptions {\n type: 'brush-highlight';\n}\n\nexport interface BrushActiveSpec extends BrushActiveOptions {\n type: 'brush-active';\n}\n\nexport interface BrushFilterSpec extends BrushFilterOptions {\n type: 'brush-filter';\n}\n\nexport interface LegendFilterSpec extends DataFilterOptions {\n type: 'legend-filter';\n}\n\nexport interface DatazoomFilterSpec extends DataFilterOptions {\n type: 'datazoom-filter';\n}\n\nexport interface SliderFilterSpec extends DataFilterOptions {\n type: 'slider-filter';\n}\n\nexport interface PlayerFilterSpec extends DataFilterOptions {\n type: 'player-filter';\n}\n\nexport interface ScrollbarFilterSpec extends DataFilterOptions {\n type: 'scrollbar-filter';\n}\n\nexport interface DrillDownSpec extends DrillDownOptions {\n type: 'drill-down';\n}\n\nexport interface RollUpSpec extends RollUpOptions {\n type: 'roll-up';\n}\n\nexport interface TooltipSpec extends TooltipOptions {\n type: 'tooltip';\n}\n\nexport interface DimensionTooltipSpec extends DimensionTooltipOptions {\n type: 'dimension-tooltip';\n}\n\nexport interface CrosshairSpec extends CrosshairOptions {\n type: 'crosshair';\n}\nexport interface ViewRoamSpec extends ViewRoamOptions {\n type: 'view-roam';\n}\n\nexport interface ViewZoomSpec extends ViewZoomOptions {\n type: 'view-zoom';\n}\n\nexport interface ViewScrollSpec extends ViewScrollOptions {\n type: 'view-scroll';\n}\n\nexport interface ViewDragSpec extends ViewDragOptions {\n type: 'view-drag';\n}\n\nexport interface SankeyHighlightSpec extends SankeyHighlightOptions {\n type: 'sankey-highlight';\n}\n\nexport interface FishEyeSpec extends FishEyeOptions {\n type: 'fish-eye';\n}\n\nexport type InteractionSpec =\n | ElementActiveSpec\n | ElementSelectSpec\n | ElementHighlightSpec\n | ElementHighlightByKeySpec\n | ElementHighlightByGroupSpec\n | ElementActiveByLegendSpec\n | ElementHighlightByLegendSpec\n | ElementHighlightByNameSpec\n | BrushHighlightSpec\n | BrushActiveSpec\n | BrushFilterSpec\n | LegendFilterSpec\n | DatazoomFilterSpec\n | SliderFilterSpec\n | PlayerFilterSpec\n | ScrollbarFilterSpec\n | DrillDownSpec\n | RollUpSpec\n | TooltipSpec\n | DimensionTooltipSpec\n | CrosshairSpec\n | ViewRoamSpec\n | ViewZoomSpec\n | ViewScrollSpec\n | ViewDragSpec\n | SankeyHighlightSpec\n | FishEyeSpec;\n\nexport interface ViewNavigationRange {\n needUpdate?: boolean;\n x?: [number, number];\n y?: [number, number];\n}\n\nexport interface IViewZoomMixin {\n updateZoomRange: (\n rangeFactor: [number, number],\n range: [number, number],\n zoomEvent: { zoomDelta: number; zoomX: number; zoomY: number },\n zoomOptions?: ViewZoomSimpleOptions\n ) => [number, number];\n formatZoomEvent: (e: InteractionEvent) => InteractionEvent & { zoomDelta?: number; zoomX?: number; zoomY?: number };\n handleZoomStart: (\n e: InteractionEvent,\n navState: Partial<Record<'x' | 'y', ViewStateByDim>>,\n zoomOptions?: ViewZoomSimpleOptions\n ) => ViewNavigationRange;\n handleZoomEnd: (\n e: InteractionEvent,\n navState: Partial<Record<'x' | 'y', ViewStateByDim>>,\n zoomOptions?: ViewZoomSimpleOptions\n ) => ViewNavigationRange;\n handleZoomReset: (\n e: InteractionEvent,\n navState: Partial<Record<'x' | 'y', ViewStateByDim>>,\n zoomOptions?: ViewZoomSimpleOptions\n ) => ViewNavigationRange;\n}\n\nexport interface IViewScrollMixin {\n formatScrollEvent: (e: InteractionEvent) => InteractionEvent & { scrollX?: number; scrollY?: number };\n handleScrollStart: (\n e: InteractionEvent,\n navState: Partial<Record<'x' | 'y', ViewStateByDim>>,\n scrollOptions?: ViewScrollSimpleOptions\n ) => ViewNavigationRange;\n handleScrollEnd: (\n e: InteractionEvent,\n navState: Partial<Record<'x' | 'y', ViewStateByDim>>,\n scrollOptions?: ViewScrollSimpleOptions\n ) => ViewNavigationRange;\n}\n\nexport interface IViewDragMixin {\n handleDragStart: (\n e: InteractionEvent,\n navState: Partial<Record<'x' | 'y', ViewStateByDim>>,\n dragOptions?: ViewDragSimpleOptions\n ) => ViewNavigationRange;\n handleDragUpdate: (\n e: InteractionEvent,\n navState: Partial<Record<'x' | 'y', ViewStateByDim>>,\n dragOptions?: ViewDragSimpleOptions\n ) => ViewNavigationRange;\n handleDragEnd: (\n e: InteractionEvent,\n navState: Partial<Record<'x' | 'y', ViewStateByDim>>,\n dragOptions?: ViewDragSimpleOptions\n ) => ViewNavigationRange;\n}\n\nexport interface ViewStateByDim {\n scale?: IScale;\n data?: IData;\n linkedComponent?: IDatazoom | IScrollbar;\n filterValue?: any[];\n wholeScale?: IBaseScale;\n rangeFactor?: [number, number];\n}\n"]}
1
+ {"version":3,"sources":["../src/types/interaction.ts"],"names":[],"mappings":"","file":"interaction.js","sourcesContent":["import type { IView } from './view';\nimport type { EventType, InteractionEvent, ViewEventType } from './event';\nimport type {\n BaseCrosshairAttrs,\n BrushAttributes,\n TooltipAttributes,\n TooltipRowAttrs\n} from '@visactor/vrender-components';\nimport type { IPolygon, ISymbolGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender/es/core';\nimport type { IElement, IGlyphElement } from './element';\nimport type { IData, IGrammarBase, IMark, IScale } from './grammar';\nimport type { IPointLike } from '@visactor/vutils';\nimport type { IBaseScale } from '@visactor/vscale';\nimport type { IDatazoom, IScrollbar } from './component';\nimport type { FieldEncodeType, MarkFunctionType } from './mark';\n\nexport interface FilterDataTarget {\n data: string | IData;\n filter: string | ((datum: any, filterValues: any[]) => boolean);\n transform?: (data: any[], filterValues: any[]) => any[];\n}\n\nexport interface IBaseInteractionOptions {\n dependencies?: string | string[] | IGrammarBase | IGrammarBase[];\n\n shouldStart?: (e: any) => boolean;\n\n shouldUpdate?: (e: any) => boolean;\n\n shouldEnd?: (e: any) => boolean;\n\n shouldReset?: (e: any) => boolean;\n\n onStart?: (e: any) => boolean;\n\n onUpdate?: (e: any) => boolean;\n\n onEnd?: (e: any) => boolean;\n\n onReset?: (e: any) => boolean;\n}\n\nexport interface IInteraction {\n readonly type: string;\n depend: (grammar: IGrammarBase[] | IGrammarBase | string[] | string) => void;\n bind: () => void;\n unbind: () => void;\n}\n\nexport interface IInteractionConstructor {\n readonly type: string;\n\n new (view: IView, options?: any): IInteraction;\n}\n\n/**\n * the interaction to set the active state of specified marks\n */\nexport interface ElementActiveOptions extends IBaseInteractionOptions {\n /**\n * the selector of marks\n */\n selector?: string | string[] | IMark | IMark[];\n /**\n * the trigger event name\n */\n trigger?: EventType;\n /**\n * the reset trigger event name\n */\n resetTrigger?: EventType;\n /**\n * the active state name\n */\n state?: string;\n}\n\n/**\n * the interaction to set the seleted state of specified marks\n */\nexport interface ElementSelectOptions extends IBaseInteractionOptions {\n /**\n * the selector of marks\n */\n selector?: string | string[] | IMark | IMark[];\n /**\n * the trigger event name\n */\n trigger?: EventType;\n /**\n * the selected state name\n */\n state?: string;\n /**\n * the reset trigger event name\n */\n resetTrigger?: EventType | ViewEventType | 'empty';\n /**\n * whether or not support multiple selected\n */\n isMultiple?: boolean;\n}\n\n/**\n * the interaction to set the highlight state of specified marks\n */\nexport interface ElementHighlightOptions extends IBaseInteractionOptions {\n /**\n * the selector of marks\n */\n selector?: string | string[] | IMark | IMark[];\n /**\n * the trigger event name\n */\n trigger?: EventType;\n /**\n * the reset trigger event name\n */\n resetTrigger?: EventType;\n /**\n * the highlight state name\n */\n highlightState?: string;\n /**\n * the blur state name\n */\n blurState?: string;\n}\n\n/**\n * the interaction to set the active state of specified marks trigger by legend\n */\nexport interface ElementActiveByLegendOptions extends IBaseInteractionOptions {\n /**\n * the selector of marks\n */\n selector?: string | string[] | IMark | IMark[];\n /**\n * the active state name\n */\n state?: string;\n /**\n * the highlight state name\n */\n filterType?: 'key' | 'groupKey';\n}\n\n/**\n * the interaction to set the active state of specified marks trigger by legend\n */\nexport interface ElementHighlightByLegendOptions extends IBaseInteractionOptions {\n /**\n * the selector of marks\n */\n selector?: string | string[] | IMark | IMark[];\n /**\n * the highlight state name\n */\n highlightState?: string;\n /**\n * the blur state name\n */\n blurState?: string;\n /**\n * the highlight state name\n */\n filterType?: 'key' | 'groupKey';\n}\n\nexport interface ElementHighlightByNameOptions extends ElementHighlightByLegendOptions {\n name?: string | string[];\n /**\n * the trigger event name\n */\n trigger?: EventType;\n /**\n * the reset trigger event name\n */\n resetTrigger?: EventType;\n\n parseData?: (e: InteractionEvent) => any;\n}\n\nexport interface BrushEventParams {\n operateType: string;\n operateMask: IPolygon;\n activeElements?: (IElement | IGlyphElement)[];\n}\n\nexport interface BrushOptions extends IBaseInteractionOptions, BrushAttributes {\n /**\n * the selector of marks\n */\n selector?: string | string[] | IMark | IMark[];\n\n onStart?: (params: BrushEventParams) => boolean;\n\n onUpdate?: (params: BrushEventParams) => boolean;\n\n onEnd?: (params: BrushEventParams) => boolean;\n\n onReset?: (params: BrushEventParams) => boolean;\n}\n\nexport interface BrushHighlightOptions extends BrushOptions {\n /**\n * the highlight state name\n */\n highlightState?: string;\n /**\n * the blur state name\n */\n blurState?: string;\n}\n\nexport interface BrushActiveOptions extends BrushOptions {\n /**\n * the active state name\n */\n state?: string;\n}\n\nexport interface BrushFilterOptions extends BrushOptions {\n target: {\n data: IData | string;\n transform?: (data: any[], filterValue: any) => any[];\n };\n}\n\nexport interface DataFilterOptions extends IBaseInteractionOptions {\n /**\n * the selector of marks\n */\n source?: string | string[] | IMark | IMark[];\n\n /**\n * data target\n */\n target: {\n data: IData | string;\n filter?: string | ((datum: any, filterValue: any) => boolean);\n transform?: (data: any[], filterValue: any) => any[];\n };\n}\n\nexport interface DrillDownOptions extends BrushOptions {\n /**\n * enable brush\n */\n brush?: boolean;\n // trigger attribute is included in brush attributes\n target: {\n data: IData | string;\n transform?: (data: any[], filterValue: any) => any[];\n };\n}\n\nexport interface RollUpOptions extends DataFilterOptions {\n /**\n * the trigger event name\n */\n trigger?: EventType;\n /**\n * the reset trigger event name\n */\n resetTrigger?: EventType | ViewEventType | 'empty';\n}\n\nexport type CustomTooltipCallback = (\n datum: any,\n element: IElement,\n parameters: any\n) => TooltipRowAttrs | TooltipRowAttrs[];\n\nexport interface ITooltipRow {\n visible?: boolean;\n key?: MarkFunctionType<string | Partial<ITextGraphicAttribute>> | FieldEncodeType;\n value?: MarkFunctionType<string | Partial<ITextGraphicAttribute>> | FieldEncodeType;\n symbol?: MarkFunctionType<string | Partial<ISymbolGraphicAttribute>> | FieldEncodeType;\n}\n\nexport type TooltipType = 'x' | 'y' | 'angle' | 'radius';\n\nexport interface TooltipOptions extends IBaseInteractionOptions {\n /**\n * the selector of marks\n */\n selector?: string | string[] | IMark | IMark[];\n /**\n * the trigger event name\n */\n trigger?: EventType;\n /**\n * the reset trigger event name\n */\n resetTrigger?: EventType;\n\n title?: ITooltipRow | string | CustomTooltipCallback;\n content?: ITooltipRow | ITooltipRow[] | CustomTooltipCallback;\n attributes?: MarkFunctionType<TooltipAttributes>;\n}\n\nexport interface DimensionTooltipOptions extends TooltipOptions {\n scale?: IScale | string;\n tooltipType?: TooltipType;\n target?: {\n data: IData | string;\n filter: string | ((datum: any, tooltipValue: any) => boolean);\n };\n avoidMark?: string | string[];\n container?: string | IMark;\n center?: IPointLike;\n}\n\nexport type CrosshairType = 'x' | 'y' | 'angle' | 'radius' | 'radius-polygon';\n\nexport type CrosshairShape = 'line' | 'rect';\n\nexport interface CrosshairOptions extends IBaseInteractionOptions {\n /**\n * the trigger event name\n */\n trigger?: EventType;\n /**\n * the reset trigger event name\n */\n resetTrigger?: EventType;\n scale?: IScale | string;\n crosshairType?: CrosshairType;\n crosshairShape?: CrosshairShape;\n container?: string | IMark;\n radius?: number;\n center?: IPointLike;\n attributes?: MarkFunctionType<BaseCrosshairAttrs>;\n}\nexport interface ViewNavigationBaseOptions {\n enableX?: boolean;\n enableY?: boolean;\n scaleX?: string | IScale;\n scaleY?: string | IScale;\n dataTargetX?: FilterDataTarget;\n dataTargetY?: FilterDataTarget;\n throttle?: number;\n linkedComponentX?: string | IDatazoom | IScrollbar;\n linkedComponentY?: string | IDatazoom | IScrollbar;\n}\n\nexport interface ViewZoomSimpleOptions {\n realtime?: boolean;\n rate?: number;\n focus?: boolean;\n trigger?: EventType;\n endTrigger?: EventType;\n resetTrigger?: EventType;\n}\n\nexport type ViewZoomOptions = ViewZoomSimpleOptions & IBaseInteractionOptions & ViewNavigationBaseOptions;\n\nexport interface ViewScrollSimpleOptions {\n realtime?: boolean;\n reversed?: boolean;\n trigger?: EventType;\n endTrigger?: EventType;\n}\nexport type ViewScrollOptions = ViewScrollSimpleOptions & IBaseInteractionOptions & ViewNavigationBaseOptions;\n\nexport interface ViewDragSimpleOptions {\n realtime?: boolean;\n reversed?: boolean;\n trigger?: EventType;\n endTrigger?: EventType;\n updateTrigger?: EventType;\n}\n\nexport type ViewDragOptions = ViewDragSimpleOptions & IBaseInteractionOptions & ViewNavigationBaseOptions;\n\nexport interface ViewRoamOptions extends IBaseInteractionOptions, ViewNavigationBaseOptions {\n zoom?: ViewZoomSimpleOptions & { enable?: boolean };\n scroll?: ViewScrollSimpleOptions & { enable?: boolean };\n drag?: ViewDragSimpleOptions & { enable?: boolean };\n}\n\n/**\n * the interaction to set the highlight state of specified marks\n */\nexport interface SankeyHighlightOptions extends IBaseInteractionOptions {\n /**\n * the selector of node mark\n */\n nodeSelector?: string | IMark;\n /**\n * the selector of link mark\n */\n linkSelector?: string | IMark;\n /**\n * the trigger event name\n */\n trigger?: EventType;\n /**\n * the reset trigger event name\n */\n resetTrigger?: EventType;\n /**\n * the highlight state name\n */\n highlightState?: string;\n /**\n * the blur state name\n */\n blurState?: string;\n /** set higlight state to different type of nodes */\n effect?: 'adjacency' | 'related';\n}\n\nexport interface FishEyeOptions extends IBaseInteractionOptions {\n selector?: string | string[] | IMark | IMark[];\n /** the radius of x-direction */\n radiusX?: number;\n /** the radius of y-direction */\n radiusY?: number;\n /** the radiusRatio of x-direction */\n radiusRatioX?: number;\n /** the radiusRatio of y-direction */\n radiusRatioY?: number;\n /** x方向的扰动 */\n distortionX?: number;\n /** y方向的扰动 */\n distortionY?: number;\n /** 禁用 x方向的变形 */\n enableX?: boolean;\n /** 禁用y方向的变形 */\n enableY?: boolean;\n /** x方向的scale */\n scaleX?: string | IScale;\n /** y方向的scale */\n scaleY?: string | IScale;\n /** 节流的时长,单位为ms */\n throttle?: number;\n /**\n * the trigger event name\n */\n trigger?: EventType;\n /**\n * the trigger event of end\n */\n endTrigger?: EventType;\n /**\n * the trigger event of updating\n */\n updateTrigger?: EventType;\n /**\n * the trigger event of reset\n */\n resetTrigger?: string;\n}\n\nexport interface ElementActiveSpec extends ElementActiveOptions {\n type: 'element-active';\n}\nexport interface ElementSelectSpec extends ElementSelectOptions {\n type: 'element-select';\n}\nexport interface ElementHighlightSpec extends ElementHighlightOptions {\n type: 'element-highlight';\n}\nexport interface ElementHighlightByKeySpec extends ElementHighlightOptions {\n type: 'element-highlight-by-key';\n}\nexport interface ElementHighlightByGroupSpec extends ElementHighlightOptions {\n type: 'element-highlight-by-group';\n}\nexport interface ElementActiveByLegendSpec extends ElementActiveByLegendOptions {\n type: 'element-active-by-legend';\n}\n\nexport interface ElementHighlightByLegendSpec extends ElementHighlightByLegendOptions {\n type: 'element-highlight-by-legend';\n}\n\nexport interface ElementHighlightByNameSpec extends ElementHighlightByNameOptions {\n type: 'element-highlight-by-name';\n}\n\nexport interface BrushHighlightSpec extends BrushHighlightOptions {\n type: 'brush-highlight';\n}\n\nexport interface BrushActiveSpec extends BrushActiveOptions {\n type: 'brush-active';\n}\n\nexport interface BrushFilterSpec extends BrushFilterOptions {\n type: 'brush-filter';\n}\n\nexport interface LegendFilterSpec extends DataFilterOptions {\n type: 'legend-filter';\n}\n\nexport interface DatazoomFilterSpec extends DataFilterOptions {\n type: 'datazoom-filter';\n}\n\nexport interface SliderFilterSpec extends DataFilterOptions {\n type: 'slider-filter';\n}\n\nexport interface PlayerFilterSpec extends DataFilterOptions {\n type: 'player-filter';\n}\n\nexport interface ScrollbarFilterSpec extends DataFilterOptions {\n type: 'scrollbar-filter';\n}\n\nexport interface DrillDownSpec extends DrillDownOptions {\n type: 'drill-down';\n}\n\nexport interface RollUpSpec extends RollUpOptions {\n type: 'roll-up';\n}\n\nexport interface TooltipSpec extends TooltipOptions {\n type: 'tooltip';\n}\n\nexport interface DimensionTooltipSpec extends DimensionTooltipOptions {\n type: 'dimension-tooltip';\n}\n\nexport interface CrosshairSpec extends CrosshairOptions {\n type: 'crosshair';\n}\nexport interface ViewRoamSpec extends ViewRoamOptions {\n type: 'view-roam';\n}\n\nexport interface ViewZoomSpec extends ViewZoomOptions {\n type: 'view-zoom';\n}\n\nexport interface ViewScrollSpec extends ViewScrollOptions {\n type: 'view-scroll';\n}\n\nexport interface ViewDragSpec extends ViewDragOptions {\n type: 'view-drag';\n}\n\nexport interface SankeyHighlightSpec extends SankeyHighlightOptions {\n type: 'sankey-highlight';\n}\n\nexport interface FishEyeSpec extends FishEyeOptions {\n type: 'fish-eye';\n}\n\nexport type InteractionSpec =\n | ElementActiveSpec\n | ElementSelectSpec\n | ElementHighlightSpec\n | ElementHighlightByKeySpec\n | ElementHighlightByGroupSpec\n | ElementActiveByLegendSpec\n | ElementHighlightByLegendSpec\n | ElementHighlightByNameSpec\n | BrushHighlightSpec\n | BrushActiveSpec\n | BrushFilterSpec\n | LegendFilterSpec\n | DatazoomFilterSpec\n | SliderFilterSpec\n | PlayerFilterSpec\n | ScrollbarFilterSpec\n | DrillDownSpec\n | RollUpSpec\n | TooltipSpec\n | DimensionTooltipSpec\n | CrosshairSpec\n | ViewRoamSpec\n | ViewZoomSpec\n | ViewScrollSpec\n | ViewDragSpec\n | SankeyHighlightSpec\n | FishEyeSpec;\n\nexport interface ViewNavigationRange {\n needUpdate?: boolean;\n x?: [number, number];\n y?: [number, number];\n}\n\nexport interface IViewZoomMixin {\n updateZoomRange: (\n rangeFactor: [number, number],\n range: [number, number],\n zoomEvent: { zoomDelta: number; zoomX: number; zoomY: number },\n zoomOptions?: ViewZoomSimpleOptions\n ) => [number, number];\n formatZoomEvent: (e: InteractionEvent) => InteractionEvent & { zoomDelta?: number; zoomX?: number; zoomY?: number };\n handleZoomStart: (\n e: InteractionEvent,\n navState: Partial<Record<'x' | 'y', ViewStateByDim>>,\n zoomOptions?: ViewZoomSimpleOptions\n ) => ViewNavigationRange;\n handleZoomEnd: (\n e: InteractionEvent,\n navState: Partial<Record<'x' | 'y', ViewStateByDim>>,\n zoomOptions?: ViewZoomSimpleOptions\n ) => ViewNavigationRange;\n handleZoomReset: (\n e: InteractionEvent,\n navState: Partial<Record<'x' | 'y', ViewStateByDim>>,\n zoomOptions?: ViewZoomSimpleOptions\n ) => ViewNavigationRange;\n}\n\nexport interface IViewScrollMixin {\n formatScrollEvent: (e: InteractionEvent) => InteractionEvent & { scrollX?: number; scrollY?: number };\n handleScrollStart: (\n e: InteractionEvent,\n navState: Partial<Record<'x' | 'y', ViewStateByDim>>,\n scrollOptions?: ViewScrollSimpleOptions\n ) => ViewNavigationRange;\n handleScrollEnd: (\n e: InteractionEvent,\n navState: Partial<Record<'x' | 'y', ViewStateByDim>>,\n scrollOptions?: ViewScrollSimpleOptions\n ) => ViewNavigationRange;\n}\n\nexport interface IViewDragMixin {\n handleDragStart: (\n e: InteractionEvent,\n navState: Partial<Record<'x' | 'y', ViewStateByDim>>,\n dragOptions?: ViewDragSimpleOptions\n ) => ViewNavigationRange;\n handleDragUpdate: (\n e: InteractionEvent,\n navState: Partial<Record<'x' | 'y', ViewStateByDim>>,\n dragOptions?: ViewDragSimpleOptions\n ) => ViewNavigationRange;\n handleDragEnd: (\n e: InteractionEvent,\n navState: Partial<Record<'x' | 'y', ViewStateByDim>>,\n dragOptions?: ViewDragSimpleOptions\n ) => ViewNavigationRange;\n}\n\nexport interface ViewStateByDim {\n scale?: IScale;\n data?: IData;\n linkedComponent?: IDatazoom | IScrollbar;\n filterValue?: any[];\n wholeScale?: IBaseScale;\n rangeFactor?: [number, number];\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { ICustomPath2D, IPyramid3dGraphicAttribute, IArc3dGraphicAttribute, IRect3dGraphicAttribute, ISymbolAttribute, IRectGraphicAttribute, ILineGraphicAttribute, ICircleGraphicAttribute, IArcGraphicAttribute, IPolygonGraphicAttribute, IAreaGraphicAttribute, IGlyphGraphicAttribute, IImageGraphicAttribute, IPathGraphicAttribute, ISymbolGraphicAttribute, ITextGraphicAttribute, IGraphicAttribute, IGroupGraphicAttribute, IRichTextGraphicAttribute } from '@visactor/vrender-core';
1
+ import type { ICustomPath2D, IPyramid3dGraphicAttribute, IArc3dGraphicAttribute, IRect3dGraphicAttribute, ISymbolAttribute, IRectGraphicAttribute, ILineGraphicAttribute, ICircleGraphicAttribute, IArcGraphicAttribute, IPolygonGraphicAttribute, IAreaGraphicAttribute, IGlyphGraphicAttribute, IImageGraphicAttribute, IPathGraphicAttribute, ISymbolGraphicAttribute, ITextGraphicAttribute, IGraphicAttribute, IGroupGraphicAttribute, IRichTextGraphicAttribute } from '@visactor/vrender/es/core';
2
2
  import type { Bounds, IPointLike } from '@visactor/vutils';
3
3
  import type { IAnimationConfig, IStateAnimationConfig } from './animate';
4
4
  import type { IElement } from './element';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/mark.ts"],"names":[],"mappings":"","file":"mark.js","sourcesContent":["import type {\n ICustomPath2D,\n IPyramid3dGraphicAttribute,\n IArc3dGraphicAttribute,\n IRect3dGraphicAttribute,\n ISymbolAttribute,\n IRectGraphicAttribute,\n ILineGraphicAttribute,\n ICircleGraphicAttribute,\n IArcGraphicAttribute,\n IPolygonGraphicAttribute,\n IAreaGraphicAttribute,\n IGlyphGraphicAttribute,\n IImageGraphicAttribute,\n IPathGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute,\n IGraphicAttribute,\n IGroupGraphicAttribute,\n IRichTextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { Bounds, IPointLike } from '@visactor/vutils';\nimport type { IAnimationConfig, IStateAnimationConfig } from './animate';\nimport type { IElement } from './element';\nimport type { IMark, IScale, IGroupMark, ICoordinate, GrammarSpec, IData } from './grammar';\nimport type { GenericFunctionType } from './signal';\nimport type { TransformSpec } from './transform';\nimport type { CommonPaddingSpec } from './base';\nimport type { ILayoutOptions, IView } from './view';\nimport type {\n AxisSpec,\n BuiltInComponentSpec,\n DatazoomSpec,\n LabelSpec,\n LegendSpec,\n PlayerSpec,\n SliderSpec\n} from './component';\nimport type { GrammarMarkType } from '../graph/enums';\n\nexport type MarkFunctionCallback<T> = (datum: any, element: IElement, parameters: any) => T;\n\nexport type MarkFunctionType<T> = GenericFunctionType<MarkFunctionCallback<T>, T>;\n\nexport type MarkType = keyof typeof GrammarMarkType | string;\n\nexport interface MarkFromSpec {\n data: string | IData;\n transform?: {\n name: string;\n transform?: TransformSpec[];\n };\n}\n\nexport type MarkStateSpec = MarkFunctionType<string | string[]>;\n\nexport type ScaleEncodeType = {\n scale: IScale | string;\n field?: string | ((datum: any) => any) | string[] | ((datum: any) => any)[];\n value?: any;\n band?: number;\n offset?: number;\n};\n\nexport type FieldEncodeType = {\n field: string | ((datum: any) => any) | string[] | ((datum: any) => any)[];\n};\n\nexport type ChannelEncodeType<T = any> = MarkFunctionType<T> | ScaleEncodeType | FieldEncodeType;\n\nexport type GenerateEncoderSpec<T> = {\n [Key in keyof T]?: ChannelEncodeType<T[Key]>;\n};\n\n/**\n * the common channel supported by graphic marks\n */\nexport type GenerateBasicEncoderSpec<T> = Partial<\n Omit<\n T,\n | 'strokeSeg'\n | 'boundsPadding'\n | 'pickMode'\n | 'boundsMode'\n | 'customPickShape'\n | 'pickable'\n | 'childrenPickable'\n | 'visible'\n | 'zIndex'\n | 'layout'\n | 'keepDirIn3d'\n | 'postMatrix'\n | 'anchor'\n | 'anchor3d'\n >\n>;\n\nexport type BasicEncoderSpecMap = {\n rect: GenerateBasicEncoderSpec<IRectGraphicAttribute & { y1?: number; x1?: number }>;\n line: Omit<GenerateBasicEncoderSpec<ILineGraphicAttribute>, 'points' | 'segments'>;\n circle: GenerateBasicEncoderSpec<ICircleGraphicAttribute>;\n arc: GenerateBasicEncoderSpec<IArcGraphicAttribute>;\n polygon: GenerateBasicEncoderSpec<IPolygonGraphicAttribute>;\n arc3d: GenerateBasicEncoderSpec<IArc3dGraphicAttribute>;\n pyramid3d: GenerateBasicEncoderSpec<IPyramid3dGraphicAttribute>;\n area: Omit<GenerateBasicEncoderSpec<IAreaGraphicAttribute>, 'points' | 'segments'>;\n group: GenerateBasicEncoderSpec<IGroupGraphicAttribute>;\n glyph: GenerateBasicEncoderSpec<IGlyphGraphicAttribute & any>;\n image: GenerateBasicEncoderSpec<IImageGraphicAttribute>;\n rect3d: GenerateBasicEncoderSpec<IRect3dGraphicAttribute>;\n path: GenerateBasicEncoderSpec<IPathGraphicAttribute>;\n rule: Omit<GenerateBasicEncoderSpec<ILineGraphicAttribute>, 'points' | 'segments'> & { x1?: number; y1?: number };\n shape: GenerateBasicEncoderSpec<IPathGraphicAttribute>;\n symbol: GenerateBasicEncoderSpec<ISymbolGraphicAttribute> & {\n shape?: ISymbolGraphicAttribute['symbolType'];\n image?: ISymbolGraphicAttribute['background'];\n };\n text: GenerateBasicEncoderSpec<ITextGraphicAttribute> & {\n limit?: number;\n autoLimit?: number;\n };\n richtext: GenerateBasicEncoderSpec<IRichTextGraphicAttribute>;\n interval: Omit<GenerateBasicEncoderSpec<IRectGraphicAttribute>, 'width' | 'height'> & {\n /**\n * the gap for two graphic elements\n */\n innerGap?: number | string;\n /**\n * only used for rect / interval mark\n */\n maxWidth?: number;\n minWidth?: number;\n /** the gap between two category */\n categoryGap?: number | string;\n };\n cell: GenerateBasicEncoderSpec<ISymbolGraphicAttribute> & {\n padding?: number | [number, number];\n shape?: ISymbolAttribute['symbolType'];\n };\n};\nexport type GenerateBaseEncodeSpec<BasicSpec = GenerateBasicEncoderSpec<IGraphicAttribute>> =\n | GenerateEncoderSpec<BasicSpec>\n | MarkFunctionCallback<BasicSpec>;\n\nexport type StateProxyEncodeSpec<T = any> = (datum: any, element: IElement, state: string, nextStates: string[]) => T;\n\nexport type StateEncodeSpec<BasicSpec = GenerateBasicEncoderSpec<IGraphicAttribute>> =\n | {\n enter?: GenerateBaseEncodeSpec<BasicSpec>;\n update?: GenerateBaseEncodeSpec<BasicSpec>;\n exit?: GenerateBaseEncodeSpec<BasicSpec>;\n }\n | {\n [state: string]: GenerateEncoderSpec<BasicSpec> | StateProxyEncodeSpec<BasicSpec>;\n };\n\nexport type MarkAnimationSpec = Record<string, IAnimationConfig | IAnimationConfig[]> & {\n state?: IStateAnimationConfig;\n};\n\n// TODO: support string[]\nexport type MarkKeySpec = string | ((datum: any) => string);\n\nexport type MarkSortSpec = (datumA: any, datumB: any) => number;\n\nexport type MarkStateSortSpec = (stateA: string, stateB: string) => number;\n\nexport interface MarkGridContainerSpec extends MarkBaseLayoutSpec {\n display: 'grid';\n gridTemplateRows?: (number | string | 'auto')[];\n gridTemplateColumns?: (number | string | 'auto')[];\n gridRowGap?: number;\n gridColumnGap?: number;\n}\n\nexport interface MarkGridItemSpec extends MarkBaseLayoutSpec {\n gridRowStart?: number;\n gridRowEnd?: number;\n gridColumnStart?: number;\n gridColumnEnd?: number;\n}\n\nexport interface MarkBaseLayoutSpec {\n callback?: MarkLayoutCallback;\n skipBeforeLayouted?: boolean;\n updateViewSignals?: boolean;\n}\n\nexport interface MarkRelativeItemSpec extends MarkBaseLayoutSpec {\n position?: 'top' | 'bottom' | 'left' | 'right' | 'content' | 'auto' | string;\n padding?: CommonPaddingSpec;\n align?: 'left' | 'right' | 'center' | 'top' | 'bottom' | 'middle';\n order?: number;\n}\n\nexport interface MarkRelativeContainerSpec extends MarkBaseLayoutSpec {\n display: 'relative';\n maxChildWidth?: string | number;\n maxChildHeight?: string | number;\n}\n\nexport type MarkLayoutSpec =\n | MarkGridContainerSpec\n | MarkGridItemSpec\n | MarkRelativeContainerSpec\n | MarkRelativeItemSpec;\n\nexport type MarkLayoutCallback = (\n group: IGroupMark,\n children: IMark[],\n parentLayoutBounds: Bounds,\n options?: ILayoutOptions\n) => void;\n\nexport interface IMarkConfig {\n clip?: boolean;\n zIndex?: number;\n interactive?: boolean;\n context?: any;\n skipTheme?: boolean;\n /**\n * set customized shape\n */\n setCustomizedShape?: (datum: any[], attrs: any, path: ICustomPath2D) => ICustomPath2D;\n /** 是否开启大数据渲染模式 */\n large?: boolean;\n /** 开启大数据渲染优化的阀值,对应的是data的长度 */\n largeThreshold?: number;\n /** 分片长度 */\n progressiveStep?: number;\n /** 开启分片渲染的阀值,对应的是单系列data的长度 */\n progressiveThreshold?: number;\n /**\n * use 'sequential' for symbol chart\n * use 'mod' for bar/line chart\n */\n // largeChunkMode?: 'sequential' | 'mod';\n support3d?: boolean;\n /**\n * enable global morphing animation of the mark\n */\n morph?: boolean;\n /**\n * this key will be used to match the mark to morph\n */\n morphKey?: string;\n /**\n * this key will be used to match the element of two marks to morph\n * If not specified, we'll use the \"key\" of the mark by default\n */\n morphElementKey?: string;\n /** transforms of attributes */\n attributeTransforms?: AttributeTransform[];\n /**\n * only used in line/area mark\n * TODO\n */\n enableSegments?: boolean;\n}\n\n/**\n * Base mark specification type\n */\nexport interface GenerateMarkSpec<T extends MarkType = string, P = any> extends IMarkConfig, GrammarSpec {\n type: T;\n name?: string;\n group?: string | IGroupMark;\n // data attributes\n from?: MarkFromSpec;\n key?: MarkKeySpec;\n /**\n * sort all the elements in the mark\n */\n sort?: MarkSortSpec;\n /**\n * set the group key of the mark\n */\n groupBy?: MarkKeySpec;\n /**\n * sort the data of each group\n */\n groupSort?: MarkSortSpec;\n context?: any;\n // coordinate attributes\n coordinate?: string | ICoordinate;\n // encode attributes\n state?: MarkStateSpec;\n stateSort?: MarkStateSortSpec;\n encode?: GetEncoderSpecByType<T, P>;\n // animation attributes\n animationState?: MarkFunctionType<string>;\n animation?: MarkAnimationSpec;\n transform?: TransformSpec[];\n layout?: MarkLayoutSpec | MarkLayoutCallback;\n}\n\nexport type CircleMarkSpec = GenerateMarkSpec<'circle'>;\nexport type ArcMarkSpec = GenerateMarkSpec<'arc'>;\nexport type AreaMarkSpec = GenerateMarkSpec<'area'>;\nexport type LineMarkSpec = GenerateMarkSpec<'line'>;\nexport type RectMarkSpec = GenerateMarkSpec<'rect'>;\nexport type ImageMarkSpec = GenerateMarkSpec<'image'>;\nexport type PathMarkSpec = GenerateMarkSpec<'path'>;\nexport type RuleMarkSpec = GenerateMarkSpec<'rule'>;\nexport type ShapeMarkSpec = GenerateMarkSpec<'shape'>;\nexport type SymbolMarkSpec = GenerateMarkSpec<'symbol'>;\nexport type TextMarkSpec = GenerateMarkSpec<'text'>;\nexport type RichTextMarkSpec = GenerateMarkSpec<'richtext'>;\nexport type PolygonMarkSpec = GenerateMarkSpec<'polygon'>;\nexport type CellMarkSpec = GenerateMarkSpec<'cell'>;\nexport type IntervalMarkSpec = GenerateMarkSpec<'interval'>;\nexport type Arc3dMarkSpec = GenerateMarkSpec<'arc3d'>;\nexport type Pyramid3dMarkSpec = GenerateMarkSpec<'pyramid3d'>;\nexport type Rect3dMarkSpec = GenerateMarkSpec<'rect3d'>;\n\nexport type BasicGlyphEncoderSpec = BasicEncoderSpecMap['glyph'];\nexport type BasicGroupEncoderSpec = BasicEncoderSpecMap['group'];\nexport interface GroupMarkSpec extends GenerateMarkSpec<'group'> {\n marks?: MarkSpec[];\n}\n\nexport interface GlyphMarkSpec<CustomizedEncoderSpec = any> extends GenerateMarkSpec<'glyph', CustomizedEncoderSpec> {\n glyphType: string;\n glyphConfig?: any;\n}\n\nexport interface BoxPlotEncoderSpec extends BasicGlyphEncoderSpec {\n boxWidth?: number;\n boxHeight?: number;\n ruleWidth?: number;\n ruleHeight?: number;\n q1?: number;\n q3?: number;\n min?: number;\n max?: number;\n median?: number;\n angle?: number;\n anchor?: [number, number];\n}\n\nexport interface BarBoxPlotEncoderSpec extends BasicGlyphEncoderSpec {\n minMaxWidth?: number;\n q1q3Width?: number;\n minMaxHeight?: number;\n q1q3Height?: number;\n q1?: number;\n q3?: number;\n min?: number;\n max?: number;\n median?: number;\n angle?: number;\n lineWidth?: number;\n minMaxFillOpacity?: number;\n anchor?: [number, number];\n}\n\nexport interface LinkPathEncoderSpec extends BasicGlyphEncoderSpec {\n x0: number;\n y0: number;\n x1: number;\n y1: number;\n thickness: number;\n curvature?: number;\n /** round all the coordinates */\n round?: boolean;\n /** the ratio of normal style path */\n ratio?: number;\n align?: 'start' | 'end' | 'center';\n pathType?: 'line' | 'smooth' | 'polyline';\n endArrow?: boolean;\n startArrow?: boolean;\n backgroundStyle?: any;\n direction?: 'horizontal' | 'vertical' | 'LR' | 'RL' | 'TB' | 'BL' | 'radial';\n}\nexport interface TreePathEncoderSpec extends BasicGlyphEncoderSpec {\n x0: number;\n y0: number;\n x1: number;\n y1: number;\n curvature?: number;\n /** round all the coordinates */\n round?: boolean;\n /** the ratio of normal style path */\n align?: 'start' | 'end' | 'center';\n pathType?: 'line' | 'smooth' | 'polyline';\n startArrowStyle?: Partial<IGraphicAttribute>;\n endArrowStyle?: Partial<IGraphicAttribute>;\n endArrow?: boolean;\n startArrow?: boolean;\n arrowSize?: number;\n backgroundStyle?: any;\n direction?: 'horizontal' | 'vertical' | 'LR' | 'RL' | 'TB' | 'BL' | 'radial';\n}\n\nexport interface RipplePointEncoderSpec extends BasicGlyphEncoderSpec {\n ripple?: number;\n size?: number;\n}\n\nexport interface ViolinEncoderSpec extends BasicGlyphEncoderSpec {\n violinFill: string;\n violinStroke: string;\n medianFill?: string;\n density?: IPointLike[];\n boxWidth?: number;\n q1?: number;\n q3?: number;\n min?: number;\n max?: number;\n median?: number;\n angle?: number;\n anchor?: [number, number];\n}\n\nexport interface WaveEncoderSpec extends BasicGlyphEncoderSpec {\n wave?: number;\n}\nexport interface BoxPlotGlyphSpec extends GlyphMarkSpec<BoxPlotEncoderSpec> {\n glyphType: 'boxplot';\n}\nexport interface BarBoxPlotGlyphSpec extends GlyphMarkSpec<BarBoxPlotEncoderSpec> {\n glyphType: 'barBoxplot';\n}\nexport interface LinkPathGlyphSpec extends GlyphMarkSpec<LinkPathEncoderSpec> {\n glyphType: 'linkPath';\n}\nexport interface TreePathGlyphSpec extends GlyphMarkSpec<TreePathEncoderSpec> {\n glyphType: 'treePath';\n}\nexport interface RipplePointGlyphSpec extends GlyphMarkSpec<RipplePointEncoderSpec> {\n glyphType: 'ripplePoint';\n}\nexport interface ViolinGlyphSpec extends GlyphMarkSpec<ViolinEncoderSpec> {\n glyphType: 'violin';\n}\nexport interface WaveGlyphSpec extends GlyphMarkSpec<WaveEncoderSpec> {\n glyphType: 'wave';\n}\n\nexport interface ComponentSpec<\n BasicEncoderSpec extends GenerateBasicEncoderSpec<IGraphicAttribute> = GenerateBasicEncoderSpec<IGraphicAttribute>\n> extends GenerateMarkSpec<'component', BasicEncoderSpec> {\n componentType: string;\n componentConfig?: any;\n mode?: '2d' | '3d';\n}\n\nexport type BaseMarkSpec = GenerateMarkSpec<MarkType>;\nexport type MarkSpecMap = {\n circle: CircleMarkSpec;\n arc: ArcMarkSpec;\n area: AreaMarkSpec;\n image: ImageMarkSpec;\n line: LineMarkSpec;\n path: PathMarkSpec;\n rule: RuleMarkSpec;\n shape: ShapeMarkSpec;\n symbol: SymbolMarkSpec;\n text: TextMarkSpec;\n richtext: RichTextMarkSpec;\n polygon: PolygonMarkSpec;\n cell: CellMarkSpec;\n interval: IntervalMarkSpec;\n rect: RectMarkSpec;\n rect3d: Rect3dMarkSpec;\n arc3d: Arc3dMarkSpec;\n pyramid3d: Pyramid3dMarkSpec;\n group: GroupMarkSpec;\n glyph: GlyphMarkSpec;\n linkPath: LinkPathGlyphSpec;\n treePath: TreePathGlyphSpec;\n wave: WaveEncoderSpec;\n ripplePoint: RipplePointGlyphSpec;\n barBoxplot: BarBoxPlotGlyphSpec;\n boxPlot: BoxPlotGlyphSpec;\n component: ComponentSpec;\n axis: AxisSpec;\n legend: LegendSpec;\n slider: SliderSpec;\n datazoom: DatazoomSpec;\n label: LabelSpec;\n player: PlayerSpec;\n};\n\nexport type GetMarkSpecByType<T, P = any> = T extends keyof MarkSpecMap ? MarkSpecMap[T] : GenerateMarkSpec<string, P>;\nexport type GetBasicEncoderSpecByType<T, P = any> = T extends keyof BasicEncoderSpecMap\n ? BasicEncoderSpecMap[T]\n : GenerateBasicEncoderSpec<IGraphicAttribute & P>;\nexport type GetEncoderSpecByType<T, P = any> = T extends keyof BasicEncoderSpecMap\n ? StateEncodeSpec<BasicEncoderSpecMap[T]>\n : StateEncodeSpec<GenerateBasicEncoderSpec<IGraphicAttribute> & P>;\n\nexport type BaseEncodeSpec<P = any> = StateEncodeSpec<GenerateBasicEncoderSpec<IGraphicAttribute & P>>;\nexport type BaseSignleEncodeSpec<P = any> =\n | GenerateEncoderSpec<GenerateBasicEncoderSpec<IGraphicAttribute & P>>\n | StateProxyEncodeSpec<GenerateBasicEncoderSpec<IGraphicAttribute & P>>;\n\nexport type GetSignleEncodeSpecByType<T, P = any> = T extends keyof BasicEncoderSpecMap\n ? GenerateEncoderSpec<BasicEncoderSpecMap[T]> | StateProxyEncodeSpec<BasicEncoderSpecMap[T]>\n : BaseSignleEncodeSpec<P>;\n\nexport type MarkSpec =\n | GenerateMarkSpec<string, any>\n | CircleMarkSpec\n | ArcMarkSpec\n | AreaMarkSpec\n | ImageMarkSpec\n | LineMarkSpec\n | PathMarkSpec\n | RuleMarkSpec\n | ShapeMarkSpec\n | SymbolMarkSpec\n | TextMarkSpec\n | RichTextMarkSpec\n | PolygonMarkSpec\n | CellMarkSpec\n | IntervalMarkSpec\n | RectMarkSpec\n | Rect3dMarkSpec\n | Arc3dMarkSpec\n | Pyramid3dMarkSpec\n | GroupMarkSpec\n | GlyphMarkSpec\n | LinkPathGlyphSpec\n | TreePathGlyphSpec\n | WaveGlyphSpec\n | RipplePointGlyphSpec\n | BarBoxPlotGlyphSpec\n | BoxPlotGlyphSpec\n | ViolinGlyphSpec\n | ComponentSpec\n | BuiltInComponentSpec;\n\nexport interface AttributeTransform {\n channels: string[];\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => void;\n storedAttrs?: string;\n}\n\nexport interface IMarkConstructor {\n readonly markType: string;\n\n new (view: IView, markType: MarkType, group?: IGroupMark): IMark;\n}\n"]}
1
+ {"version":3,"sources":["../src/types/mark.ts"],"names":[],"mappings":"","file":"mark.js","sourcesContent":["import type {\n ICustomPath2D,\n IPyramid3dGraphicAttribute,\n IArc3dGraphicAttribute,\n IRect3dGraphicAttribute,\n ISymbolAttribute,\n IRectGraphicAttribute,\n ILineGraphicAttribute,\n ICircleGraphicAttribute,\n IArcGraphicAttribute,\n IPolygonGraphicAttribute,\n IAreaGraphicAttribute,\n IGlyphGraphicAttribute,\n IImageGraphicAttribute,\n IPathGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute,\n IGraphicAttribute,\n IGroupGraphicAttribute,\n IRichTextGraphicAttribute\n} from '@visactor/vrender/es/core';\nimport type { Bounds, IPointLike } from '@visactor/vutils';\nimport type { IAnimationConfig, IStateAnimationConfig } from './animate';\nimport type { IElement } from './element';\nimport type { IMark, IScale, IGroupMark, ICoordinate, GrammarSpec, IData } from './grammar';\nimport type { GenericFunctionType } from './signal';\nimport type { TransformSpec } from './transform';\nimport type { CommonPaddingSpec } from './base';\nimport type { ILayoutOptions, IView } from './view';\nimport type {\n AxisSpec,\n BuiltInComponentSpec,\n DatazoomSpec,\n LabelSpec,\n LegendSpec,\n PlayerSpec,\n SliderSpec\n} from './component';\nimport type { GrammarMarkType } from '../graph/enums';\n\nexport type MarkFunctionCallback<T> = (datum: any, element: IElement, parameters: any) => T;\n\nexport type MarkFunctionType<T> = GenericFunctionType<MarkFunctionCallback<T>, T>;\n\nexport type MarkType = keyof typeof GrammarMarkType | string;\n\nexport interface MarkFromSpec {\n data: string | IData;\n transform?: {\n name: string;\n transform?: TransformSpec[];\n };\n}\n\nexport type MarkStateSpec = MarkFunctionType<string | string[]>;\n\nexport type ScaleEncodeType = {\n scale: IScale | string;\n field?: string | ((datum: any) => any) | string[] | ((datum: any) => any)[];\n value?: any;\n band?: number;\n offset?: number;\n};\n\nexport type FieldEncodeType = {\n field: string | ((datum: any) => any) | string[] | ((datum: any) => any)[];\n};\n\nexport type ChannelEncodeType<T = any> = MarkFunctionType<T> | ScaleEncodeType | FieldEncodeType;\n\nexport type GenerateEncoderSpec<T> = {\n [Key in keyof T]?: ChannelEncodeType<T[Key]>;\n};\n\n/**\n * the common channel supported by graphic marks\n */\nexport type GenerateBasicEncoderSpec<T> = Partial<\n Omit<\n T,\n | 'strokeSeg'\n | 'boundsPadding'\n | 'pickMode'\n | 'boundsMode'\n | 'customPickShape'\n | 'pickable'\n | 'childrenPickable'\n | 'visible'\n | 'zIndex'\n | 'layout'\n | 'keepDirIn3d'\n | 'postMatrix'\n | 'anchor'\n | 'anchor3d'\n >\n>;\n\nexport type BasicEncoderSpecMap = {\n rect: GenerateBasicEncoderSpec<IRectGraphicAttribute & { y1?: number; x1?: number }>;\n line: Omit<GenerateBasicEncoderSpec<ILineGraphicAttribute>, 'points' | 'segments'>;\n circle: GenerateBasicEncoderSpec<ICircleGraphicAttribute>;\n arc: GenerateBasicEncoderSpec<IArcGraphicAttribute>;\n polygon: GenerateBasicEncoderSpec<IPolygonGraphicAttribute>;\n arc3d: GenerateBasicEncoderSpec<IArc3dGraphicAttribute>;\n pyramid3d: GenerateBasicEncoderSpec<IPyramid3dGraphicAttribute>;\n area: Omit<GenerateBasicEncoderSpec<IAreaGraphicAttribute>, 'points' | 'segments'>;\n group: GenerateBasicEncoderSpec<IGroupGraphicAttribute>;\n glyph: GenerateBasicEncoderSpec<IGlyphGraphicAttribute & any>;\n image: GenerateBasicEncoderSpec<IImageGraphicAttribute>;\n rect3d: GenerateBasicEncoderSpec<IRect3dGraphicAttribute>;\n path: GenerateBasicEncoderSpec<IPathGraphicAttribute>;\n rule: Omit<GenerateBasicEncoderSpec<ILineGraphicAttribute>, 'points' | 'segments'> & { x1?: number; y1?: number };\n shape: GenerateBasicEncoderSpec<IPathGraphicAttribute>;\n symbol: GenerateBasicEncoderSpec<ISymbolGraphicAttribute> & {\n shape?: ISymbolGraphicAttribute['symbolType'];\n image?: ISymbolGraphicAttribute['background'];\n };\n text: GenerateBasicEncoderSpec<ITextGraphicAttribute> & {\n limit?: number;\n autoLimit?: number;\n };\n richtext: GenerateBasicEncoderSpec<IRichTextGraphicAttribute>;\n interval: Omit<GenerateBasicEncoderSpec<IRectGraphicAttribute>, 'width' | 'height'> & {\n /**\n * the gap for two graphic elements\n */\n innerGap?: number | string;\n /**\n * only used for rect / interval mark\n */\n maxWidth?: number;\n minWidth?: number;\n /** the gap between two category */\n categoryGap?: number | string;\n };\n cell: GenerateBasicEncoderSpec<ISymbolGraphicAttribute> & {\n padding?: number | [number, number];\n shape?: ISymbolAttribute['symbolType'];\n };\n};\nexport type GenerateBaseEncodeSpec<BasicSpec = GenerateBasicEncoderSpec<IGraphicAttribute>> =\n | GenerateEncoderSpec<BasicSpec>\n | MarkFunctionCallback<BasicSpec>;\n\nexport type StateProxyEncodeSpec<T = any> = (datum: any, element: IElement, state: string, nextStates: string[]) => T;\n\nexport type StateEncodeSpec<BasicSpec = GenerateBasicEncoderSpec<IGraphicAttribute>> =\n | {\n enter?: GenerateBaseEncodeSpec<BasicSpec>;\n update?: GenerateBaseEncodeSpec<BasicSpec>;\n exit?: GenerateBaseEncodeSpec<BasicSpec>;\n }\n | {\n [state: string]: GenerateEncoderSpec<BasicSpec> | StateProxyEncodeSpec<BasicSpec>;\n };\n\nexport type MarkAnimationSpec = Record<string, IAnimationConfig | IAnimationConfig[]> & {\n state?: IStateAnimationConfig;\n};\n\n// TODO: support string[]\nexport type MarkKeySpec = string | ((datum: any) => string);\n\nexport type MarkSortSpec = (datumA: any, datumB: any) => number;\n\nexport type MarkStateSortSpec = (stateA: string, stateB: string) => number;\n\nexport interface MarkGridContainerSpec extends MarkBaseLayoutSpec {\n display: 'grid';\n gridTemplateRows?: (number | string | 'auto')[];\n gridTemplateColumns?: (number | string | 'auto')[];\n gridRowGap?: number;\n gridColumnGap?: number;\n}\n\nexport interface MarkGridItemSpec extends MarkBaseLayoutSpec {\n gridRowStart?: number;\n gridRowEnd?: number;\n gridColumnStart?: number;\n gridColumnEnd?: number;\n}\n\nexport interface MarkBaseLayoutSpec {\n callback?: MarkLayoutCallback;\n skipBeforeLayouted?: boolean;\n updateViewSignals?: boolean;\n}\n\nexport interface MarkRelativeItemSpec extends MarkBaseLayoutSpec {\n position?: 'top' | 'bottom' | 'left' | 'right' | 'content' | 'auto' | string;\n padding?: CommonPaddingSpec;\n align?: 'left' | 'right' | 'center' | 'top' | 'bottom' | 'middle';\n order?: number;\n}\n\nexport interface MarkRelativeContainerSpec extends MarkBaseLayoutSpec {\n display: 'relative';\n maxChildWidth?: string | number;\n maxChildHeight?: string | number;\n}\n\nexport type MarkLayoutSpec =\n | MarkGridContainerSpec\n | MarkGridItemSpec\n | MarkRelativeContainerSpec\n | MarkRelativeItemSpec;\n\nexport type MarkLayoutCallback = (\n group: IGroupMark,\n children: IMark[],\n parentLayoutBounds: Bounds,\n options?: ILayoutOptions\n) => void;\n\nexport interface IMarkConfig {\n clip?: boolean;\n zIndex?: number;\n interactive?: boolean;\n context?: any;\n skipTheme?: boolean;\n /**\n * set customized shape\n */\n setCustomizedShape?: (datum: any[], attrs: any, path: ICustomPath2D) => ICustomPath2D;\n /** 是否开启大数据渲染模式 */\n large?: boolean;\n /** 开启大数据渲染优化的阀值,对应的是data的长度 */\n largeThreshold?: number;\n /** 分片长度 */\n progressiveStep?: number;\n /** 开启分片渲染的阀值,对应的是单系列data的长度 */\n progressiveThreshold?: number;\n /**\n * use 'sequential' for symbol chart\n * use 'mod' for bar/line chart\n */\n // largeChunkMode?: 'sequential' | 'mod';\n support3d?: boolean;\n /**\n * enable global morphing animation of the mark\n */\n morph?: boolean;\n /**\n * this key will be used to match the mark to morph\n */\n morphKey?: string;\n /**\n * this key will be used to match the element of two marks to morph\n * If not specified, we'll use the \"key\" of the mark by default\n */\n morphElementKey?: string;\n /** transforms of attributes */\n attributeTransforms?: AttributeTransform[];\n /**\n * only used in line/area mark\n * TODO\n */\n enableSegments?: boolean;\n}\n\n/**\n * Base mark specification type\n */\nexport interface GenerateMarkSpec<T extends MarkType = string, P = any> extends IMarkConfig, GrammarSpec {\n type: T;\n name?: string;\n group?: string | IGroupMark;\n // data attributes\n from?: MarkFromSpec;\n key?: MarkKeySpec;\n /**\n * sort all the elements in the mark\n */\n sort?: MarkSortSpec;\n /**\n * set the group key of the mark\n */\n groupBy?: MarkKeySpec;\n /**\n * sort the data of each group\n */\n groupSort?: MarkSortSpec;\n context?: any;\n // coordinate attributes\n coordinate?: string | ICoordinate;\n // encode attributes\n state?: MarkStateSpec;\n stateSort?: MarkStateSortSpec;\n encode?: GetEncoderSpecByType<T, P>;\n // animation attributes\n animationState?: MarkFunctionType<string>;\n animation?: MarkAnimationSpec;\n transform?: TransformSpec[];\n layout?: MarkLayoutSpec | MarkLayoutCallback;\n}\n\nexport type CircleMarkSpec = GenerateMarkSpec<'circle'>;\nexport type ArcMarkSpec = GenerateMarkSpec<'arc'>;\nexport type AreaMarkSpec = GenerateMarkSpec<'area'>;\nexport type LineMarkSpec = GenerateMarkSpec<'line'>;\nexport type RectMarkSpec = GenerateMarkSpec<'rect'>;\nexport type ImageMarkSpec = GenerateMarkSpec<'image'>;\nexport type PathMarkSpec = GenerateMarkSpec<'path'>;\nexport type RuleMarkSpec = GenerateMarkSpec<'rule'>;\nexport type ShapeMarkSpec = GenerateMarkSpec<'shape'>;\nexport type SymbolMarkSpec = GenerateMarkSpec<'symbol'>;\nexport type TextMarkSpec = GenerateMarkSpec<'text'>;\nexport type RichTextMarkSpec = GenerateMarkSpec<'richtext'>;\nexport type PolygonMarkSpec = GenerateMarkSpec<'polygon'>;\nexport type CellMarkSpec = GenerateMarkSpec<'cell'>;\nexport type IntervalMarkSpec = GenerateMarkSpec<'interval'>;\nexport type Arc3dMarkSpec = GenerateMarkSpec<'arc3d'>;\nexport type Pyramid3dMarkSpec = GenerateMarkSpec<'pyramid3d'>;\nexport type Rect3dMarkSpec = GenerateMarkSpec<'rect3d'>;\n\nexport type BasicGlyphEncoderSpec = BasicEncoderSpecMap['glyph'];\nexport type BasicGroupEncoderSpec = BasicEncoderSpecMap['group'];\nexport interface GroupMarkSpec extends GenerateMarkSpec<'group'> {\n marks?: MarkSpec[];\n}\n\nexport interface GlyphMarkSpec<CustomizedEncoderSpec = any> extends GenerateMarkSpec<'glyph', CustomizedEncoderSpec> {\n glyphType: string;\n glyphConfig?: any;\n}\n\nexport interface BoxPlotEncoderSpec extends BasicGlyphEncoderSpec {\n boxWidth?: number;\n boxHeight?: number;\n ruleWidth?: number;\n ruleHeight?: number;\n q1?: number;\n q3?: number;\n min?: number;\n max?: number;\n median?: number;\n angle?: number;\n anchor?: [number, number];\n}\n\nexport interface BarBoxPlotEncoderSpec extends BasicGlyphEncoderSpec {\n minMaxWidth?: number;\n q1q3Width?: number;\n minMaxHeight?: number;\n q1q3Height?: number;\n q1?: number;\n q3?: number;\n min?: number;\n max?: number;\n median?: number;\n angle?: number;\n lineWidth?: number;\n minMaxFillOpacity?: number;\n anchor?: [number, number];\n}\n\nexport interface LinkPathEncoderSpec extends BasicGlyphEncoderSpec {\n x0: number;\n y0: number;\n x1: number;\n y1: number;\n thickness: number;\n curvature?: number;\n /** round all the coordinates */\n round?: boolean;\n /** the ratio of normal style path */\n ratio?: number;\n align?: 'start' | 'end' | 'center';\n pathType?: 'line' | 'smooth' | 'polyline';\n endArrow?: boolean;\n startArrow?: boolean;\n backgroundStyle?: any;\n direction?: 'horizontal' | 'vertical' | 'LR' | 'RL' | 'TB' | 'BL' | 'radial';\n}\nexport interface TreePathEncoderSpec extends BasicGlyphEncoderSpec {\n x0: number;\n y0: number;\n x1: number;\n y1: number;\n curvature?: number;\n /** round all the coordinates */\n round?: boolean;\n /** the ratio of normal style path */\n align?: 'start' | 'end' | 'center';\n pathType?: 'line' | 'smooth' | 'polyline';\n startArrowStyle?: Partial<IGraphicAttribute>;\n endArrowStyle?: Partial<IGraphicAttribute>;\n endArrow?: boolean;\n startArrow?: boolean;\n arrowSize?: number;\n backgroundStyle?: any;\n direction?: 'horizontal' | 'vertical' | 'LR' | 'RL' | 'TB' | 'BL' | 'radial';\n}\n\nexport interface RipplePointEncoderSpec extends BasicGlyphEncoderSpec {\n ripple?: number;\n size?: number;\n}\n\nexport interface ViolinEncoderSpec extends BasicGlyphEncoderSpec {\n violinFill: string;\n violinStroke: string;\n medianFill?: string;\n density?: IPointLike[];\n boxWidth?: number;\n q1?: number;\n q3?: number;\n min?: number;\n max?: number;\n median?: number;\n angle?: number;\n anchor?: [number, number];\n}\n\nexport interface WaveEncoderSpec extends BasicGlyphEncoderSpec {\n wave?: number;\n}\nexport interface BoxPlotGlyphSpec extends GlyphMarkSpec<BoxPlotEncoderSpec> {\n glyphType: 'boxplot';\n}\nexport interface BarBoxPlotGlyphSpec extends GlyphMarkSpec<BarBoxPlotEncoderSpec> {\n glyphType: 'barBoxplot';\n}\nexport interface LinkPathGlyphSpec extends GlyphMarkSpec<LinkPathEncoderSpec> {\n glyphType: 'linkPath';\n}\nexport interface TreePathGlyphSpec extends GlyphMarkSpec<TreePathEncoderSpec> {\n glyphType: 'treePath';\n}\nexport interface RipplePointGlyphSpec extends GlyphMarkSpec<RipplePointEncoderSpec> {\n glyphType: 'ripplePoint';\n}\nexport interface ViolinGlyphSpec extends GlyphMarkSpec<ViolinEncoderSpec> {\n glyphType: 'violin';\n}\nexport interface WaveGlyphSpec extends GlyphMarkSpec<WaveEncoderSpec> {\n glyphType: 'wave';\n}\n\nexport interface ComponentSpec<\n BasicEncoderSpec extends GenerateBasicEncoderSpec<IGraphicAttribute> = GenerateBasicEncoderSpec<IGraphicAttribute>\n> extends GenerateMarkSpec<'component', BasicEncoderSpec> {\n componentType: string;\n componentConfig?: any;\n mode?: '2d' | '3d';\n}\n\nexport type BaseMarkSpec = GenerateMarkSpec<MarkType>;\nexport type MarkSpecMap = {\n circle: CircleMarkSpec;\n arc: ArcMarkSpec;\n area: AreaMarkSpec;\n image: ImageMarkSpec;\n line: LineMarkSpec;\n path: PathMarkSpec;\n rule: RuleMarkSpec;\n shape: ShapeMarkSpec;\n symbol: SymbolMarkSpec;\n text: TextMarkSpec;\n richtext: RichTextMarkSpec;\n polygon: PolygonMarkSpec;\n cell: CellMarkSpec;\n interval: IntervalMarkSpec;\n rect: RectMarkSpec;\n rect3d: Rect3dMarkSpec;\n arc3d: Arc3dMarkSpec;\n pyramid3d: Pyramid3dMarkSpec;\n group: GroupMarkSpec;\n glyph: GlyphMarkSpec;\n linkPath: LinkPathGlyphSpec;\n treePath: TreePathGlyphSpec;\n wave: WaveEncoderSpec;\n ripplePoint: RipplePointGlyphSpec;\n barBoxplot: BarBoxPlotGlyphSpec;\n boxPlot: BoxPlotGlyphSpec;\n component: ComponentSpec;\n axis: AxisSpec;\n legend: LegendSpec;\n slider: SliderSpec;\n datazoom: DatazoomSpec;\n label: LabelSpec;\n player: PlayerSpec;\n};\n\nexport type GetMarkSpecByType<T, P = any> = T extends keyof MarkSpecMap ? MarkSpecMap[T] : GenerateMarkSpec<string, P>;\nexport type GetBasicEncoderSpecByType<T, P = any> = T extends keyof BasicEncoderSpecMap\n ? BasicEncoderSpecMap[T]\n : GenerateBasicEncoderSpec<IGraphicAttribute & P>;\nexport type GetEncoderSpecByType<T, P = any> = T extends keyof BasicEncoderSpecMap\n ? StateEncodeSpec<BasicEncoderSpecMap[T]>\n : StateEncodeSpec<GenerateBasicEncoderSpec<IGraphicAttribute> & P>;\n\nexport type BaseEncodeSpec<P = any> = StateEncodeSpec<GenerateBasicEncoderSpec<IGraphicAttribute & P>>;\nexport type BaseSignleEncodeSpec<P = any> =\n | GenerateEncoderSpec<GenerateBasicEncoderSpec<IGraphicAttribute & P>>\n | StateProxyEncodeSpec<GenerateBasicEncoderSpec<IGraphicAttribute & P>>;\n\nexport type GetSignleEncodeSpecByType<T, P = any> = T extends keyof BasicEncoderSpecMap\n ? GenerateEncoderSpec<BasicEncoderSpecMap[T]> | StateProxyEncodeSpec<BasicEncoderSpecMap[T]>\n : BaseSignleEncodeSpec<P>;\n\nexport type MarkSpec =\n | GenerateMarkSpec<string, any>\n | CircleMarkSpec\n | ArcMarkSpec\n | AreaMarkSpec\n | ImageMarkSpec\n | LineMarkSpec\n | PathMarkSpec\n | RuleMarkSpec\n | ShapeMarkSpec\n | SymbolMarkSpec\n | TextMarkSpec\n | RichTextMarkSpec\n | PolygonMarkSpec\n | CellMarkSpec\n | IntervalMarkSpec\n | RectMarkSpec\n | Rect3dMarkSpec\n | Arc3dMarkSpec\n | Pyramid3dMarkSpec\n | GroupMarkSpec\n | GlyphMarkSpec\n | LinkPathGlyphSpec\n | TreePathGlyphSpec\n | WaveGlyphSpec\n | RipplePointGlyphSpec\n | BarBoxPlotGlyphSpec\n | BoxPlotGlyphSpec\n | ViolinGlyphSpec\n | ComponentSpec\n | BuiltInComponentSpec;\n\nexport interface AttributeTransform {\n channels: string[];\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => void;\n storedAttrs?: string;\n}\n\nexport interface IMarkConstructor {\n readonly markType: string;\n\n new (view: IView, markType: MarkType, group?: IGroupMark): IMark;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { EasingType } from '@visactor/vrender-core';
1
+ import type { EasingType } from '@visactor/vrender/es/core';
2
2
  import type { DiffResult, Nil } from './base';
3
3
  import type { IElement } from './element';
4
4
  import type { IGrammarBase, IMark } from './grammar';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/morph.ts"],"names":[],"mappings":"","file":"morph.js","sourcesContent":["import type { EasingType } from '@visactor/vrender-core';\nimport type { DiffResult, Nil } from './base';\nimport type { IElement } from './element';\nimport type { IGrammarBase, IMark } from './grammar';\nimport type { GenericFunctionType } from './signal';\nimport type { IRunningConfig } from './view';\n\nexport type MorphData = { prev: any[]; next: any[] };\nexport type MorphElements = { prev: IElement[]; next: IElement[] };\n\nexport type MorphFunctionCallback<T> = (datum: MorphData, element: MorphElements, parameters: any) => T;\n\nexport type MorphFunctionType<T> = GenericFunctionType<MorphFunctionCallback<T>, T>;\n\nexport type MorphFunctionValueType<T> = MorphFunctionType<T> | T;\n\nexport interface IMorphAnimationConfig {\n easing?: EasingType;\n delay?: MorphFunctionValueType<number>;\n duration?: MorphFunctionValueType<number>;\n oneByOne?: MorphFunctionValueType<boolean | number>;\n splitPath?: MorphFunctionValueType<'clone' | Nil>;\n}\n\nexport interface IMorph {\n diffGrammar: <U extends IGrammarBase>(prevGrammars: U[], nextGrammars: U[]) => DiffResult<U, U>;\n diffMark: (prevMarks: IMark[], nextMarks: IMark[], runningConfig: IRunningConfig) => DiffResult<IMark[], IMark[]>;\n\n morph: (prevMarks: IMark[], nextMarks: IMark[], runningConfig: IRunningConfig) => void;\n}\n"]}
1
+ {"version":3,"sources":["../src/types/morph.ts"],"names":[],"mappings":"","file":"morph.js","sourcesContent":["import type { EasingType } from '@visactor/vrender/es/core';\nimport type { DiffResult, Nil } from './base';\nimport type { IElement } from './element';\nimport type { IGrammarBase, IMark } from './grammar';\nimport type { GenericFunctionType } from './signal';\nimport type { IRunningConfig } from './view';\n\nexport type MorphData = { prev: any[]; next: any[] };\nexport type MorphElements = { prev: IElement[]; next: IElement[] };\n\nexport type MorphFunctionCallback<T> = (datum: MorphData, element: MorphElements, parameters: any) => T;\n\nexport type MorphFunctionType<T> = GenericFunctionType<MorphFunctionCallback<T>, T>;\n\nexport type MorphFunctionValueType<T> = MorphFunctionType<T> | T;\n\nexport interface IMorphAnimationConfig {\n easing?: EasingType;\n delay?: MorphFunctionValueType<number>;\n duration?: MorphFunctionValueType<number>;\n oneByOne?: MorphFunctionValueType<boolean | number>;\n splitPath?: MorphFunctionValueType<'clone' | Nil>;\n}\n\nexport interface IMorph {\n diffGrammar: <U extends IGrammarBase>(prevGrammars: U[], nextGrammars: U[]) => DiffResult<U, U>;\n diffMark: (prevMarks: IMark[], nextMarks: IMark[], runningConfig: IRunningConfig) => DiffResult<IMark[], IMark[]>;\n\n morph: (prevMarks: IMark[], nextMarks: IMark[], runningConfig: IRunningConfig) => void;\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import type { AxisBaseAttributes, BaseCrosshairAttrs, BaseLabelAttrs, ColorLegendAttributes, DataZoomAttributes, DiscreteLegendAttrs, GridBaseAttributes, PlayerAttributes, SizeLegendAttributes, SliderAttributes, TitleAttrs } from '@visactor/vrender-components';
3
3
  import type { CoordinateType } from '@visactor/vgrammar-coordinate';
4
- import type { IColor } from '@visactor/vrender-core';
4
+ import type { IColor } from '@visactor/vrender/es/core';
5
5
  import type { IEnvironmentOptions, IRendererOptions, IRunningConfig, ViewSpec, srIOption3DType, IView } from './view';
6
6
  import type { CommonPaddingSpec, ValueOf } from './base';
7
7
  import type { BasicEncoderSpecMap, LinkPathEncoderSpec, MarkRelativeItemSpec } from './mark';