@visactor/vgrammar-core 0.7.7 → 0.8.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (547) hide show
  1. package/cjs/component/axis.js.map +1 -1
  2. package/cjs/component/datazoom.d.ts +7 -4
  3. package/cjs/component/datazoom.js +21 -43
  4. package/cjs/component/datazoom.js.map +1 -1
  5. package/cjs/component/grid.js.map +1 -1
  6. package/cjs/component/index.d.ts +0 -2
  7. package/cjs/component/index.js +1 -19
  8. package/cjs/component/index.js.map +1 -1
  9. package/cjs/component/label.js.map +1 -1
  10. package/cjs/component/legend.d.ts +1 -3
  11. package/cjs/component/legend.js +5 -26
  12. package/cjs/component/legend.js.map +1 -1
  13. package/cjs/component/player.d.ts +1 -2
  14. package/cjs/component/player.js +15 -31
  15. package/cjs/component/player.js.map +1 -1
  16. package/cjs/component/scale.d.ts +1 -0
  17. package/cjs/component/scale.js +3 -0
  18. package/cjs/component/scale.js.map +1 -1
  19. package/cjs/component/scrollbar.d.ts +3 -4
  20. package/cjs/component/scrollbar.js +12 -54
  21. package/cjs/component/scrollbar.js.map +1 -1
  22. package/cjs/component/slider.d.ts +2 -5
  23. package/cjs/component/slider.js +4 -26
  24. package/cjs/component/slider.js.map +1 -1
  25. package/cjs/component/title.js.map +1 -1
  26. package/cjs/core/factory.d.ts +6 -3
  27. package/cjs/core/factory.js +9 -2
  28. package/cjs/core/factory.js.map +1 -1
  29. package/cjs/env.d.ts +1 -0
  30. package/cjs/env.js +20 -0
  31. package/cjs/env.js.map +1 -0
  32. package/cjs/glyph/index.js +2 -1
  33. package/cjs/glyph/link-path.js +1 -2
  34. package/cjs/graph/animation/animate.js +25 -19
  35. package/cjs/graph/animation/animate.js.map +1 -1
  36. package/cjs/graph/animation/animation/grow-cartesian.js.map +1 -1
  37. package/cjs/graph/animation/animator.js +4 -4
  38. package/cjs/graph/animation/animator.js.map +1 -1
  39. package/cjs/graph/animation/attribute.d.ts +2 -2
  40. package/cjs/graph/animation/attribute.js +12 -12
  41. package/cjs/graph/animation/attribute.js.map +1 -1
  42. package/cjs/graph/animation/morph.js +4 -4
  43. package/cjs/graph/animation/morph.js.map +1 -1
  44. package/cjs/graph/attributes/index.js +1 -1
  45. package/cjs/graph/attributes/index.js.map +1 -1
  46. package/cjs/graph/canvas-renderer.d.ts +1 -1
  47. package/cjs/graph/canvas-renderer.js +5 -5
  48. package/cjs/graph/canvas-renderer.js.map +1 -1
  49. package/cjs/graph/element.d.ts +1 -1
  50. package/cjs/graph/element.js +4 -4
  51. package/cjs/graph/element.js.map +1 -1
  52. package/cjs/graph/enums.d.ts +25 -8
  53. package/cjs/graph/enums.js +23 -14
  54. package/cjs/graph/enums.js.map +1 -1
  55. package/cjs/graph/glyph-element.d.ts +1 -1
  56. package/cjs/graph/glyph-element.js.map +1 -1
  57. package/cjs/graph/mark/encode.d.ts +0 -3
  58. package/cjs/graph/mark/encode.js +3 -12
  59. package/cjs/graph/mark/encode.js.map +1 -1
  60. package/cjs/graph/mark/large-rects.d.ts +2 -2
  61. package/cjs/graph/mark/large-rects.js +3 -3
  62. package/cjs/graph/mark/large-rects.js.map +1 -1
  63. package/cjs/graph/mark/large-symbols.d.ts +2 -2
  64. package/cjs/graph/mark/large-symbols.js +3 -3
  65. package/cjs/graph/mark/large-symbols.js.map +1 -1
  66. package/cjs/graph/util/env.js +2 -2
  67. package/cjs/graph/util/env.js.map +1 -1
  68. package/cjs/graph/util/events-extend.d.ts +1 -1
  69. package/cjs/graph/util/events-extend.js +1 -1
  70. package/cjs/graph/util/events-extend.js.map +1 -1
  71. package/cjs/graph/util/graphic.d.ts +3 -3
  72. package/cjs/graph/util/graphic.js +21 -21
  73. package/cjs/graph/util/graphic.js.map +1 -1
  74. package/cjs/index.d.ts +5 -1
  75. package/cjs/index.js +13 -3
  76. package/cjs/index.js.map +1 -1
  77. package/cjs/interactions/base-tooltip.d.ts +29 -0
  78. package/cjs/interactions/base-tooltip.js +74 -0
  79. package/cjs/interactions/base-tooltip.js.map +1 -0
  80. package/cjs/interactions/base.d.ts +14 -0
  81. package/cjs/interactions/base.js +41 -0
  82. package/cjs/interactions/base.js.map +1 -0
  83. package/cjs/interactions/brush-active.d.ts +17 -0
  84. package/cjs/interactions/brush-active.js +27 -0
  85. package/cjs/interactions/brush-active.js.map +1 -0
  86. package/cjs/interactions/brush-base.d.ts +43 -0
  87. package/cjs/interactions/brush-base.js +106 -0
  88. package/cjs/interactions/brush-base.js.map +1 -0
  89. package/cjs/interactions/brush-filter.d.ts +24 -0
  90. package/cjs/interactions/brush-filter.js +34 -0
  91. package/cjs/interactions/brush-filter.js.map +1 -0
  92. package/cjs/interactions/brush-highlight.d.ts +17 -0
  93. package/cjs/interactions/brush-highlight.js +34 -0
  94. package/cjs/interactions/brush-highlight.js.map +1 -0
  95. package/cjs/interactions/crosshair.d.ts +53 -0
  96. package/cjs/{component → interactions}/crosshair.js +80 -79
  97. package/cjs/interactions/crosshair.js.map +1 -0
  98. package/cjs/interactions/datazoom-filter.d.ts +13 -0
  99. package/cjs/interactions/datazoom-filter.js +42 -0
  100. package/cjs/interactions/datazoom-filter.js.map +1 -0
  101. package/cjs/interactions/dimension-tooltip.d.ts +18 -0
  102. package/cjs/interactions/dimension-tooltip.js +99 -0
  103. package/cjs/interactions/dimension-tooltip.js.map +1 -0
  104. package/cjs/interactions/drill-down.d.ts +25 -0
  105. package/cjs/interactions/drill-down.js +48 -0
  106. package/cjs/interactions/drill-down.js.map +1 -0
  107. package/cjs/interactions/element-active-by-legend.d.ts +17 -0
  108. package/cjs/interactions/element-active-by-legend.js +44 -0
  109. package/cjs/interactions/element-active-by-legend.js.map +1 -0
  110. package/cjs/interactions/element-active.d.ts +16 -0
  111. package/cjs/interactions/element-active.js +33 -0
  112. package/cjs/interactions/element-active.js.map +1 -0
  113. package/cjs/interactions/element-highlight-by-group.d.ts +17 -0
  114. package/cjs/interactions/element-highlight-by-group.js +53 -0
  115. package/cjs/interactions/element-highlight-by-group.js.map +1 -0
  116. package/cjs/interactions/element-highlight-by-key.d.ts +17 -0
  117. package/cjs/interactions/element-highlight-by-key.js +53 -0
  118. package/cjs/interactions/element-highlight-by-key.js.map +1 -0
  119. package/cjs/interactions/element-highlight-by-legend.d.ts +17 -0
  120. package/cjs/interactions/element-highlight-by-legend.js +47 -0
  121. package/cjs/interactions/element-highlight-by-legend.js.map +1 -0
  122. package/cjs/interactions/element-highlight-by-name.d.ts +18 -0
  123. package/cjs/interactions/element-highlight-by-name.js +59 -0
  124. package/cjs/interactions/element-highlight-by-name.js.map +1 -0
  125. package/cjs/interactions/element-highlight.d.ts +17 -0
  126. package/cjs/interactions/element-highlight.js +48 -0
  127. package/cjs/interactions/element-highlight.js.map +1 -0
  128. package/cjs/interactions/element-select.d.ts +18 -0
  129. package/cjs/interactions/element-select.js +42 -0
  130. package/cjs/interactions/element-select.js.map +1 -0
  131. package/cjs/interactions/filter.d.ts +20 -0
  132. package/cjs/interactions/filter.js +37 -0
  133. package/cjs/interactions/filter.js.map +1 -0
  134. package/cjs/interactions/fish-eye.d.ts +38 -0
  135. package/cjs/interactions/fish-eye.js +109 -0
  136. package/cjs/interactions/fish-eye.js.map +1 -0
  137. package/cjs/interactions/index.d.ts +50 -0
  138. package/cjs/interactions/index.js +386 -0
  139. package/cjs/interactions/index.js.map +1 -0
  140. package/cjs/interactions/legend-filter.d.ts +13 -0
  141. package/cjs/interactions/legend-filter.js +33 -0
  142. package/cjs/interactions/legend-filter.js.map +1 -0
  143. package/cjs/interactions/player-filter.d.ts +14 -0
  144. package/cjs/interactions/player-filter.js +32 -0
  145. package/cjs/interactions/player-filter.js.map +1 -0
  146. package/cjs/interactions/roll-up.d.ts +16 -0
  147. package/cjs/interactions/roll-up.js +47 -0
  148. package/cjs/interactions/roll-up.js.map +1 -0
  149. package/cjs/interactions/scrollbar-filter.d.ts +13 -0
  150. package/cjs/interactions/scrollbar-filter.js +54 -0
  151. package/cjs/interactions/scrollbar-filter.js.map +1 -0
  152. package/cjs/interactions/slider-filter.d.ts +13 -0
  153. package/cjs/interactions/slider-filter.js +32 -0
  154. package/cjs/interactions/slider-filter.js.map +1 -0
  155. package/cjs/interactions/tooltip.d.ts +15 -0
  156. package/cjs/interactions/tooltip.js +62 -0
  157. package/cjs/interactions/tooltip.js.map +1 -0
  158. package/cjs/interactions/view-drag-mixin.d.ts +22 -0
  159. package/cjs/interactions/view-drag-mixin.js +52 -0
  160. package/cjs/interactions/view-drag-mixin.js.map +1 -0
  161. package/cjs/interactions/view-drag.d.ts +19 -0
  162. package/cjs/interactions/view-drag.js +49 -0
  163. package/cjs/interactions/view-drag.js.map +1 -0
  164. package/cjs/interactions/view-navigation-base.d.ts +17 -0
  165. package/cjs/interactions/view-navigation-base.js +81 -0
  166. package/cjs/interactions/view-navigation-base.js.map +1 -0
  167. package/cjs/interactions/view-roam.d.ts +30 -0
  168. package/cjs/interactions/view-roam.js +93 -0
  169. package/cjs/interactions/view-roam.js.map +1 -0
  170. package/cjs/interactions/view-scroll-mixin.d.ts +10 -0
  171. package/cjs/interactions/view-scroll-mixin.js +45 -0
  172. package/cjs/interactions/view-scroll-mixin.js.map +1 -0
  173. package/cjs/interactions/view-scroll.d.ts +17 -0
  174. package/cjs/interactions/view-scroll.js +37 -0
  175. package/cjs/interactions/view-scroll.js.map +1 -0
  176. package/cjs/interactions/view-utils.d.ts +14 -0
  177. package/cjs/interactions/view-utils.js +73 -0
  178. package/cjs/interactions/view-utils.js.map +1 -0
  179. package/cjs/interactions/view-zoom-mixin.d.ts +29 -0
  180. package/cjs/interactions/view-zoom-mixin.js +77 -0
  181. package/cjs/interactions/view-zoom-mixin.js.map +1 -0
  182. package/cjs/interactions/view-zoom.d.ts +23 -0
  183. package/cjs/interactions/view-zoom.js +53 -0
  184. package/cjs/interactions/view-zoom.js.map +1 -0
  185. package/cjs/parse/coordinate.js +1 -1
  186. package/cjs/parse/event.d.ts +2 -0
  187. package/cjs/parse/event.js +8 -4
  188. package/cjs/parse/event.js.map +1 -1
  189. package/cjs/parse/mark.js +1 -1
  190. package/cjs/parse/option.js +2 -1
  191. package/cjs/parse/scale.js +1 -1
  192. package/cjs/parse/transform.js +1 -1
  193. package/cjs/parse/util.js +1 -1
  194. package/cjs/parse/view.js +1 -1
  195. package/cjs/semantic-marks/cell.d.ts +1 -1
  196. package/cjs/semantic-marks/cell.js +4 -4
  197. package/cjs/semantic-marks/cell.js.map +1 -1
  198. package/cjs/semantic-marks/interval.d.ts +1 -1
  199. package/cjs/semantic-marks/interval.js +1 -1
  200. package/cjs/semantic-marks/text.js +1 -1
  201. package/cjs/theme/dark.js +1 -1
  202. package/cjs/theme/default.js +1 -1
  203. package/cjs/theme/theme-manager.js +1 -1
  204. package/cjs/transforms/index.js +1 -1
  205. package/cjs/transforms/mark/dodge.js +4 -4
  206. package/cjs/transforms/mark/dodge.js.map +1 -1
  207. package/cjs/transforms/mark/jitter.js +2 -2
  208. package/cjs/transforms/mark/jitter.js.map +1 -1
  209. package/cjs/types/animate.d.ts +1 -1
  210. package/cjs/types/animate.js +1 -1
  211. package/cjs/types/animate.js.map +1 -1
  212. package/cjs/types/base.js +1 -1
  213. package/cjs/types/component.d.ts +16 -88
  214. package/cjs/types/component.js +1 -1
  215. package/cjs/types/component.js.map +1 -1
  216. package/cjs/types/coordinate.js +1 -1
  217. package/cjs/types/data.js +2 -1
  218. package/cjs/types/dataflow.js +1 -1
  219. package/cjs/types/element.d.ts +1 -1
  220. package/cjs/types/element.js +1 -1
  221. package/cjs/types/element.js.map +1 -1
  222. package/cjs/types/event.d.ts +11 -4
  223. package/cjs/types/event.js +1 -1
  224. package/cjs/types/event.js.map +1 -1
  225. package/cjs/types/glyph.js +1 -1
  226. package/cjs/types/grammar.d.ts +6 -2
  227. package/cjs/types/grammar.js +1 -1
  228. package/cjs/types/grammar.js.map +1 -1
  229. package/cjs/types/hooks.js +1 -1
  230. package/cjs/types/index.d.ts +1 -0
  231. package/cjs/types/index.js +3 -2
  232. package/cjs/types/index.js.map +1 -1
  233. package/cjs/types/interaction.d.ts +353 -0
  234. package/cjs/types/interaction.js +6 -0
  235. package/cjs/types/interaction.js.map +1 -0
  236. package/cjs/types/mark.d.ts +2 -3
  237. package/cjs/types/mark.js.map +1 -1
  238. package/cjs/types/morph.d.ts +1 -1
  239. package/cjs/types/morph.js.map +1 -1
  240. package/cjs/types/plot.d.ts +1 -1
  241. package/cjs/types/plot.js.map +1 -1
  242. package/cjs/types/renderer.d.ts +1 -1
  243. package/cjs/types/renderer.js.map +1 -1
  244. package/cjs/types/theme.d.ts +1 -1
  245. package/cjs/types/theme.js.map +1 -1
  246. package/cjs/types/view.d.ts +13 -14
  247. package/cjs/types/view.js.map +1 -1
  248. package/cjs/util/scale.d.ts +4 -0
  249. package/cjs/util/scale.js +24 -0
  250. package/cjs/util/scale.js.map +1 -0
  251. package/cjs/util/text.d.ts +1 -1
  252. package/cjs/util/text.js +3 -3
  253. package/cjs/util/text.js.map +1 -1
  254. package/cjs/view/View.d.ts +9 -13
  255. package/cjs/view/View.js +49 -74
  256. package/cjs/view/View.js.map +1 -1
  257. package/cjs/view/component.d.ts +2 -6
  258. package/cjs/view/component.js +1 -19
  259. package/cjs/view/component.js.map +1 -1
  260. package/cjs/view/dataflow.js +1 -1
  261. package/cjs/view/dataflow.js.map +1 -1
  262. package/cjs/view/events.d.ts +1 -1
  263. package/cjs/view/mark.d.ts +2 -2
  264. package/cjs/view/mark.js +12 -10
  265. package/cjs/view/mark.js.map +1 -1
  266. package/cjs/view/scale.d.ts +7 -1
  267. package/cjs/view/scale.js +17 -3
  268. package/cjs/view/scale.js.map +1 -1
  269. package/es/component/axis.js.map +1 -1
  270. package/es/component/datazoom.d.ts +7 -4
  271. package/es/component/datazoom.js +26 -42
  272. package/es/component/datazoom.js.map +1 -1
  273. package/es/component/grid.js.map +1 -1
  274. package/es/component/index.d.ts +0 -2
  275. package/es/component/index.js +0 -4
  276. package/es/component/index.js.map +1 -1
  277. package/es/component/label.js.map +1 -1
  278. package/es/component/legend.d.ts +1 -3
  279. package/es/component/legend.js +11 -26
  280. package/es/component/legend.js.map +1 -1
  281. package/es/component/player.d.ts +1 -2
  282. package/es/component/player.js +17 -30
  283. package/es/component/player.js.map +1 -1
  284. package/es/component/scale.d.ts +1 -0
  285. package/es/component/scale.js +3 -0
  286. package/es/component/scale.js.map +1 -1
  287. package/es/component/scrollbar.d.ts +3 -4
  288. package/es/component/scrollbar.js +17 -53
  289. package/es/component/scrollbar.js.map +1 -1
  290. package/es/component/slider.d.ts +2 -5
  291. package/es/component/slider.js +9 -25
  292. package/es/component/slider.js.map +1 -1
  293. package/es/component/title.js.map +1 -1
  294. package/es/core/factory.d.ts +6 -3
  295. package/es/core/factory.js +9 -2
  296. package/es/core/factory.js.map +1 -1
  297. package/es/env.d.ts +1 -0
  298. package/es/env.js +1 -0
  299. package/es/env.js.map +1 -0
  300. package/es/glyph/index.js +2 -1
  301. package/es/glyph/link-path.js +1 -2
  302. package/es/graph/animation/animate.js +24 -19
  303. package/es/graph/animation/animate.js.map +1 -1
  304. package/es/graph/animation/animation/grow-cartesian.js.map +1 -1
  305. package/es/graph/animation/animator.js +1 -1
  306. package/es/graph/animation/animator.js.map +1 -1
  307. package/es/graph/animation/attribute.d.ts +2 -2
  308. package/es/graph/animation/attribute.js +7 -7
  309. package/es/graph/animation/attribute.js.map +1 -1
  310. package/es/graph/animation/morph.js +1 -1
  311. package/es/graph/animation/morph.js.map +1 -1
  312. package/es/graph/attributes/index.js +1 -1
  313. package/es/graph/attributes/index.js.map +1 -1
  314. package/es/graph/canvas-renderer.d.ts +1 -1
  315. package/es/graph/canvas-renderer.js +3 -1
  316. package/es/graph/canvas-renderer.js.map +1 -1
  317. package/es/graph/element.d.ts +1 -1
  318. package/es/graph/element.js +3 -3
  319. package/es/graph/element.js.map +1 -1
  320. package/es/graph/enums.d.ts +25 -8
  321. package/es/graph/enums.js +27 -11
  322. package/es/graph/enums.js.map +1 -1
  323. package/es/graph/glyph-element.d.ts +1 -1
  324. package/es/graph/glyph-element.js.map +1 -1
  325. package/es/graph/mark/encode.d.ts +0 -3
  326. package/es/graph/mark/encode.js +0 -10
  327. package/es/graph/mark/encode.js.map +1 -1
  328. package/es/graph/mark/large-rects.d.ts +2 -2
  329. package/es/graph/mark/large-rects.js +1 -1
  330. package/es/graph/mark/large-rects.js.map +1 -1
  331. package/es/graph/mark/large-symbols.d.ts +2 -2
  332. package/es/graph/mark/large-symbols.js +1 -1
  333. package/es/graph/mark/large-symbols.js.map +1 -1
  334. package/es/graph/util/env.js +1 -1
  335. package/es/graph/util/env.js.map +1 -1
  336. package/es/graph/util/events-extend.d.ts +1 -1
  337. package/es/graph/util/events-extend.js +1 -1
  338. package/es/graph/util/events-extend.js.map +1 -1
  339. package/es/graph/util/graphic.d.ts +3 -3
  340. package/es/graph/util/graphic.js +1 -1
  341. package/es/graph/util/graphic.js.map +1 -1
  342. package/es/index.d.ts +5 -1
  343. package/es/index.js +11 -2
  344. package/es/index.js.map +1 -1
  345. package/es/interactions/base-tooltip.d.ts +29 -0
  346. package/es/interactions/base-tooltip.js +73 -0
  347. package/es/interactions/base-tooltip.js.map +1 -0
  348. package/es/interactions/base.d.ts +14 -0
  349. package/es/interactions/base.js +32 -0
  350. package/es/interactions/base.js.map +1 -0
  351. package/es/interactions/brush-active.d.ts +17 -0
  352. package/es/interactions/brush-active.js +23 -0
  353. package/es/interactions/brush-active.js.map +1 -0
  354. package/es/interactions/brush-base.d.ts +43 -0
  355. package/es/interactions/brush-base.js +103 -0
  356. package/es/interactions/brush-base.js.map +1 -0
  357. package/es/interactions/brush-filter.d.ts +24 -0
  358. package/es/interactions/brush-filter.js +32 -0
  359. package/es/interactions/brush-filter.js.map +1 -0
  360. package/es/interactions/brush-highlight.d.ts +17 -0
  361. package/es/interactions/brush-highlight.js +31 -0
  362. package/es/interactions/brush-highlight.js.map +1 -0
  363. package/es/interactions/crosshair.d.ts +53 -0
  364. package/es/{component → interactions}/crosshair.js +82 -81
  365. package/es/interactions/crosshair.js.map +1 -0
  366. package/es/interactions/datazoom-filter.d.ts +13 -0
  367. package/es/interactions/datazoom-filter.js +40 -0
  368. package/es/interactions/datazoom-filter.js.map +1 -0
  369. package/es/interactions/dimension-tooltip.d.ts +18 -0
  370. package/es/interactions/dimension-tooltip.js +99 -0
  371. package/es/interactions/dimension-tooltip.js.map +1 -0
  372. package/es/interactions/drill-down.d.ts +25 -0
  373. package/es/interactions/drill-down.js +46 -0
  374. package/es/interactions/drill-down.js.map +1 -0
  375. package/es/interactions/element-active-by-legend.d.ts +17 -0
  376. package/es/interactions/element-active-by-legend.js +43 -0
  377. package/es/interactions/element-active-by-legend.js.map +1 -0
  378. package/es/interactions/element-active.d.ts +16 -0
  379. package/es/interactions/element-active.js +29 -0
  380. package/es/interactions/element-active.js.map +1 -0
  381. package/es/interactions/element-highlight-by-group.d.ts +17 -0
  382. package/es/interactions/element-highlight-by-group.js +50 -0
  383. package/es/interactions/element-highlight-by-group.js.map +1 -0
  384. package/es/interactions/element-highlight-by-key.d.ts +17 -0
  385. package/es/interactions/element-highlight-by-key.js +50 -0
  386. package/es/interactions/element-highlight-by-key.js.map +1 -0
  387. package/es/interactions/element-highlight-by-legend.d.ts +17 -0
  388. package/es/interactions/element-highlight-by-legend.js +46 -0
  389. package/es/interactions/element-highlight-by-legend.js.map +1 -0
  390. package/es/interactions/element-highlight-by-name.d.ts +18 -0
  391. package/es/interactions/element-highlight-by-name.js +56 -0
  392. package/es/interactions/element-highlight-by-name.js.map +1 -0
  393. package/es/interactions/element-highlight.d.ts +17 -0
  394. package/es/interactions/element-highlight.js +43 -0
  395. package/es/interactions/element-highlight.js.map +1 -0
  396. package/es/interactions/element-select.d.ts +18 -0
  397. package/es/interactions/element-select.js +38 -0
  398. package/es/interactions/element-select.js.map +1 -0
  399. package/es/interactions/filter.d.ts +20 -0
  400. package/es/interactions/filter.js +31 -0
  401. package/es/interactions/filter.js.map +1 -0
  402. package/es/interactions/fish-eye.d.ts +38 -0
  403. package/es/interactions/fish-eye.js +105 -0
  404. package/es/interactions/fish-eye.js.map +1 -0
  405. package/es/interactions/index.d.ts +50 -0
  406. package/es/interactions/index.js +148 -0
  407. package/es/interactions/index.js.map +1 -0
  408. package/es/interactions/legend-filter.d.ts +13 -0
  409. package/es/interactions/legend-filter.js +32 -0
  410. package/es/interactions/legend-filter.js.map +1 -0
  411. package/es/interactions/player-filter.d.ts +14 -0
  412. package/es/interactions/player-filter.js +32 -0
  413. package/es/interactions/player-filter.js.map +1 -0
  414. package/es/interactions/roll-up.d.ts +16 -0
  415. package/es/interactions/roll-up.js +45 -0
  416. package/es/interactions/roll-up.js.map +1 -0
  417. package/es/interactions/scrollbar-filter.d.ts +13 -0
  418. package/es/interactions/scrollbar-filter.js +50 -0
  419. package/es/interactions/scrollbar-filter.js.map +1 -0
  420. package/es/interactions/slider-filter.d.ts +13 -0
  421. package/es/interactions/slider-filter.js +29 -0
  422. package/es/interactions/slider-filter.js.map +1 -0
  423. package/es/interactions/tooltip.d.ts +15 -0
  424. package/es/interactions/tooltip.js +58 -0
  425. package/es/interactions/tooltip.js.map +1 -0
  426. package/es/interactions/view-drag-mixin.d.ts +22 -0
  427. package/es/interactions/view-drag-mixin.js +46 -0
  428. package/es/interactions/view-drag-mixin.js.map +1 -0
  429. package/es/interactions/view-drag.d.ts +19 -0
  430. package/es/interactions/view-drag.js +47 -0
  431. package/es/interactions/view-drag.js.map +1 -0
  432. package/es/interactions/view-navigation-base.d.ts +17 -0
  433. package/es/interactions/view-navigation-base.js +78 -0
  434. package/es/interactions/view-navigation-base.js.map +1 -0
  435. package/es/interactions/view-roam.d.ts +30 -0
  436. package/es/interactions/view-roam.js +91 -0
  437. package/es/interactions/view-roam.js.map +1 -0
  438. package/es/interactions/view-scroll-mixin.d.ts +10 -0
  439. package/es/interactions/view-scroll-mixin.js +37 -0
  440. package/es/interactions/view-scroll-mixin.js.map +1 -0
  441. package/es/interactions/view-scroll.d.ts +17 -0
  442. package/es/interactions/view-scroll.js +35 -0
  443. package/es/interactions/view-scroll.js.map +1 -0
  444. package/es/interactions/view-utils.d.ts +14 -0
  445. package/es/interactions/view-utils.js +60 -0
  446. package/es/interactions/view-utils.js.map +1 -0
  447. package/es/interactions/view-zoom-mixin.d.ts +29 -0
  448. package/es/interactions/view-zoom-mixin.js +68 -0
  449. package/es/interactions/view-zoom-mixin.js.map +1 -0
  450. package/es/interactions/view-zoom.d.ts +23 -0
  451. package/es/interactions/view-zoom.js +51 -0
  452. package/es/interactions/view-zoom.js.map +1 -0
  453. package/es/parse/coordinate.js +1 -1
  454. package/es/parse/event.d.ts +2 -0
  455. package/es/parse/event.js +6 -2
  456. package/es/parse/event.js.map +1 -1
  457. package/es/parse/mark.js +1 -1
  458. package/es/parse/option.js +2 -1
  459. package/es/parse/scale.js +1 -1
  460. package/es/parse/transform.js +1 -1
  461. package/es/parse/util.js +1 -1
  462. package/es/parse/view.js +1 -1
  463. package/es/semantic-marks/cell.d.ts +1 -1
  464. package/es/semantic-marks/cell.js +4 -2
  465. package/es/semantic-marks/cell.js.map +1 -1
  466. package/es/semantic-marks/interval.d.ts +1 -1
  467. package/es/semantic-marks/interval.js +1 -1
  468. package/es/semantic-marks/text.js +1 -1
  469. package/es/theme/dark.js +1 -1
  470. package/es/theme/default.js +1 -1
  471. package/es/theme/theme-manager.js +1 -1
  472. package/es/transforms/index.js +1 -1
  473. package/es/transforms/mark/dodge.js +2 -2
  474. package/es/transforms/mark/dodge.js.map +1 -1
  475. package/es/transforms/mark/jitter.js +2 -2
  476. package/es/transforms/mark/jitter.js.map +1 -1
  477. package/es/types/animate.d.ts +1 -1
  478. package/es/types/animate.js +1 -1
  479. package/es/types/animate.js.map +1 -1
  480. package/es/types/base.js +1 -1
  481. package/es/types/component.d.ts +16 -88
  482. package/es/types/component.js +1 -1
  483. package/es/types/component.js.map +1 -1
  484. package/es/types/coordinate.js +1 -1
  485. package/es/types/data.js +2 -1
  486. package/es/types/dataflow.js +1 -1
  487. package/es/types/element.d.ts +1 -1
  488. package/es/types/element.js +1 -1
  489. package/es/types/element.js.map +1 -1
  490. package/es/types/event.d.ts +11 -4
  491. package/es/types/event.js +1 -1
  492. package/es/types/event.js.map +1 -1
  493. package/es/types/glyph.js +1 -1
  494. package/es/types/grammar.d.ts +6 -2
  495. package/es/types/grammar.js +1 -1
  496. package/es/types/grammar.js.map +1 -1
  497. package/es/types/hooks.js +1 -1
  498. package/es/types/index.d.ts +1 -0
  499. package/es/types/index.js +3 -1
  500. package/es/types/index.js.map +1 -1
  501. package/es/types/interaction.d.ts +353 -0
  502. package/es/types/interaction.js +2 -0
  503. package/es/types/interaction.js.map +1 -0
  504. package/es/types/mark.d.ts +2 -3
  505. package/es/types/mark.js.map +1 -1
  506. package/es/types/morph.d.ts +1 -1
  507. package/es/types/morph.js.map +1 -1
  508. package/es/types/plot.d.ts +1 -1
  509. package/es/types/plot.js.map +1 -1
  510. package/es/types/renderer.d.ts +1 -1
  511. package/es/types/renderer.js.map +1 -1
  512. package/es/types/theme.d.ts +1 -1
  513. package/es/types/theme.js.map +1 -1
  514. package/es/types/view.d.ts +13 -14
  515. package/es/types/view.js.map +1 -1
  516. package/es/util/scale.d.ts +4 -0
  517. package/es/util/scale.js +15 -0
  518. package/es/util/scale.js.map +1 -0
  519. package/es/util/text.d.ts +1 -1
  520. package/es/util/text.js +1 -1
  521. package/es/util/text.js.map +1 -1
  522. package/es/view/View.d.ts +9 -13
  523. package/es/view/View.js +49 -69
  524. package/es/view/View.js.map +1 -1
  525. package/es/view/component.d.ts +2 -6
  526. package/es/view/component.js +0 -20
  527. package/es/view/component.js.map +1 -1
  528. package/es/view/dataflow.js +1 -1
  529. package/es/view/dataflow.js.map +1 -1
  530. package/es/view/events.d.ts +1 -1
  531. package/es/view/mark.d.ts +2 -2
  532. package/es/view/mark.js +12 -10
  533. package/es/view/mark.js.map +1 -1
  534. package/es/view/scale.d.ts +7 -1
  535. package/es/view/scale.js +17 -2
  536. package/es/view/scale.js.map +1 -1
  537. package/package.json +10 -9
  538. package/cjs/component/crosshair.d.ts +0 -50
  539. package/cjs/component/crosshair.js.map +0 -1
  540. package/cjs/component/tooltip.d.ts +0 -62
  541. package/cjs/component/tooltip.js +0 -305
  542. package/cjs/component/tooltip.js.map +0 -1
  543. package/es/component/crosshair.d.ts +0 -50
  544. package/es/component/crosshair.js.map +0 -1
  545. package/es/component/tooltip.d.ts +0 -62
  546. package/es/component/tooltip.js +0 -303
  547. package/es/component/tooltip.js.map +0 -1
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.BaseTooltip = exports.generateTooltipAttributes = void 0;
6
+
7
+ const vrender_components_1 = require("@visactor/vrender-components"), vutils_1 = require("@visactor/vutils"), vgrammar_util_1 = require("@visactor/vgrammar-util"), base_1 = require("./base"), mark_1 = require("../parse/mark"), util_1 = require("../parse/util"), generateTooltipAttributes = (point, title, content, bounds, theme, addition) => {
8
+ var _a;
9
+ const tooltipTheme = null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.tooltip;
10
+ return (0, vutils_1.merge)({}, tooltipTheme, {
11
+ visible: !0,
12
+ pointerX: point.x,
13
+ pointerY: point.y,
14
+ title: title,
15
+ content: content,
16
+ parentBounds: bounds
17
+ }, null != addition ? addition : {});
18
+ };
19
+
20
+ exports.generateTooltipAttributes = generateTooltipAttributes;
21
+
22
+ class BaseTooltip extends base_1.BaseInteraction {
23
+ constructor(view, options) {
24
+ super(view, options), this._marks = view.getMarksBySelector(options.selector);
25
+ }
26
+ bind() {
27
+ super.bind();
28
+ const stage = this.view.renderer.stage();
29
+ !this._tooltipComponent && stage && (this._tooltipComponent = new vrender_components_1.Tooltip({}),
30
+ stage.defaultLayer.appendChild(this._tooltipComponent));
31
+ }
32
+ unbind() {
33
+ super.unbind(), this._tooltipComponent && (this._tooltipComponent.release(), this._tooltipComponent = null);
34
+ }
35
+ _computeTooltipRow(row, datum) {
36
+ let key, value, symbol, visible = (0, util_1.invokeFunctionType)(row.visible, this.parameters(), datum);
37
+ if (visible = !!(0, vutils_1.isNil)(visible) || !!visible, (0, mark_1.isFieldEncode)(row.key)) {
38
+ key = (0, vgrammar_util_1.field)(row.key.field)(datum);
39
+ } else key = (0, util_1.invokeFunctionType)(row.key, this.parameters(), datum);
40
+ if (key = (0, vutils_1.isNil)(key) ? void 0 : (0, vutils_1.isObjectLike)(key) ? key : {
41
+ text: key
42
+ }, (0, mark_1.isFieldEncode)(row.value)) {
43
+ value = (0, vgrammar_util_1.field)(row.value.field)(datum);
44
+ } else value = (0, util_1.invokeFunctionType)(row.value, this.parameters(), datum);
45
+ if (value = (0, vutils_1.isNil)(value) ? void 0 : (0, vutils_1.isObjectLike)(value) ? value : {
46
+ text: value
47
+ }, (0, mark_1.isFieldEncode)(row.symbol)) {
48
+ symbol = (0, vgrammar_util_1.field)(row.symbol.field)(datum);
49
+ } else symbol = (0, util_1.invokeFunctionType)(row.symbol, this.parameters(), datum);
50
+ return symbol = (0, vutils_1.isNil)(symbol) ? void 0 : (0, vutils_1.isObjectLike)(symbol) ? symbol : {
51
+ symbolType: symbol
52
+ }, {
53
+ visible: visible,
54
+ key: key,
55
+ value: value,
56
+ shape: symbol
57
+ };
58
+ }
59
+ _computeTitleContent(datum) {
60
+ const title = (0, vutils_1.isValid)(this.options.title) ? (0, vutils_1.isFunction)(this.options.title) ? this.options.title.call(null, datum, null, {}) : this._computeTooltipRow((0,
61
+ vutils_1.isString)(this.options.title) ? {
62
+ value: this.options.title
63
+ } : this.options.title, datum) : void 0, content = (0, vutils_1.isValid)(this.options.content) ? (0,
64
+ vutils_1.isFunction)(this.options.content) ? (0, vutils_1.array)(this.options.content.call(null, datum, null, {})) : (0,
65
+ vutils_1.array)(datum).reduce(((content, datumRow) => content.concat((0, vutils_1.array)(this.options.content).map((row => this._computeTooltipRow(row, datumRow))))), []) : void 0;
66
+ return {
67
+ title: (0, vutils_1.isArray)(title) ? title[0] : title,
68
+ content: content
69
+ };
70
+ }
71
+ }
72
+
73
+ exports.BaseTooltip = BaseTooltip;
74
+ //# sourceMappingURL=base-tooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/interactions/base-tooltip.ts"],"names":[],"mappings":";;;AAEA,qEAA2E;AAG3E,6CAA6G;AAC7G,2DAAoE;AACpE,iCAAyC;AAEzC,wCAA8C;AAC9C,wCAAmD;AAE5C,MAAM,yBAAyB,GAAG,CACvC,KAAiB,EACjB,KAAsB,EACtB,OAA0B,EAC1B,MAAe,EACf,KAAc,EACd,QAA8C,EAC3B,EAAE;;IACrB,MAAM,YAAY,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,0CAAE,OAAO,CAAC;IAEhD,OAAO,IAAA,cAAK,EACV,EAAE,EACF,YAAY,EACZ;QACE,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,KAAK,CAAC,CAAC;QACjB,QAAQ,EAAE,KAAK,CAAC,CAAC;QACjB,KAAK;QACL,OAAO;QACP,YAAY,EAAE,MAAM;KACrB,EACD,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,CACf,CAAC;AACJ,CAAC,CAAC;AAvBW,QAAA,yBAAyB,6BAuBpC;AAEF,MAAsB,WAAsC,SAAQ,sBAAkB;IAKpF,YAAY,IAAW,EAAE,OAAW;QAClC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC1D,CAAC;IAED,IAAI;QACF,KAAK,CAAC,IAAI,EAAE,CAAC;QAEb,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACzC,IAAI,IAAI,CAAC,iBAAiB,IAAI,CAAC,KAAK,EAAE;YACpC,OAAO;SACR;QACD,IAAI,CAAC,iBAAiB,GAAG,IAAI,4BAAgB,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AE,CAAC;IAC/D,CAAC;CACF;AA3FD,kCA2FC","file":"base-tooltip.js","sourcesContent":["import type { TooltipAttributes, TooltipRowAttrs } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { Tooltip as TooltipComponent } from '@visactor/vrender-components';\nimport type { IBounds, IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { array, isArray, isFunction, isNil, isObjectLike, isString, isValid, merge } from '@visactor/vutils';\nimport { field as getFieldAccessor } from '@visactor/vgrammar-util';\nimport { BaseInteraction } from './base';\nimport type { IMark, ITheme, ITooltipRow, IView, RecursivePartial, TooltipOptions } from '../types';\nimport { isFieldEncode } from '../parse/mark';\nimport { invokeFunctionType } from '../parse/util';\n\nexport const generateTooltipAttributes = (\n point: IPointLike,\n title: TooltipRowAttrs,\n content: TooltipRowAttrs[],\n bounds: IBounds,\n theme?: ITheme,\n addition?: RecursivePartial<TooltipAttributes>\n): TooltipAttributes => {\n const tooltipTheme = theme?.components?.tooltip;\n\n return merge(\n {},\n tooltipTheme,\n {\n visible: true,\n pointerX: point.x,\n pointerY: point.y,\n title,\n content,\n parentBounds: bounds\n },\n addition ?? {}\n );\n};\n\nexport abstract class BaseTooltip<T extends TooltipOptions> extends BaseInteraction<T> {\n options: T;\n protected _tooltipComponent?: TooltipComponent;\n protected _marks?: IMark[];\n\n constructor(view: IView, options?: T) {\n super(view, options);\n this._marks = view.getMarksBySelector(options.selector);\n }\n\n bind(): void {\n super.bind();\n\n const stage = this.view.renderer.stage();\n if (this._tooltipComponent || !stage) {\n return;\n }\n this._tooltipComponent = new TooltipComponent({});\n\n (stage.defaultLayer as any).appendChild(this._tooltipComponent);\n }\n\n unbind(): void {\n super.unbind();\n\n if (this._tooltipComponent) {\n this._tooltipComponent.release();\n this._tooltipComponent = null;\n }\n }\n\n protected _computeTooltipRow(row: ITooltipRow, datum: any) {\n // compute visible\n let visible = invokeFunctionType(row.visible, this.parameters(), datum);\n visible = isNil(visible) ? true : !!visible;\n\n // compute key\n let key;\n if (isFieldEncode(row.key)) {\n const fieldAccessor = getFieldAccessor(row.key.field);\n key = fieldAccessor(datum);\n } else {\n key = invokeFunctionType(row.key, this.parameters(), datum);\n }\n key = isNil(key) ? undefined : isObjectLike(key) ? key : { text: key };\n\n // compute value\n let value;\n if (isFieldEncode(row.value)) {\n const fieldAccessor = getFieldAccessor(row.value.field);\n value = fieldAccessor(datum);\n } else {\n value = invokeFunctionType(row.value, this.parameters(), datum);\n }\n value = isNil(value) ? undefined : isObjectLike(value) ? value : { text: value };\n\n // compute symbol\n let symbol;\n if (isFieldEncode(row.symbol)) {\n const fieldAccessor = getFieldAccessor(row.symbol.field);\n symbol = fieldAccessor(datum);\n } else {\n symbol = invokeFunctionType(row.symbol, this.parameters(), datum);\n }\n symbol = isNil(symbol) ? undefined : isObjectLike(symbol) ? symbol : { symbolType: symbol };\n\n return { visible, key, value, shape: symbol };\n }\n\n protected _computeTitleContent(datum: any) {\n const title = isValid(this.options.title)\n ? isFunction(this.options.title)\n ? this.options.title.call(null, datum, null, {})\n : this._computeTooltipRow(\n isString(this.options.title) ? { value: this.options.title } : this.options.title,\n datum\n )\n : undefined;\n const content = isValid(this.options.content)\n ? isFunction(this.options.content)\n ? array(this.options.content.call(null, datum, null, {}))\n : array(datum).reduce((content, datumRow) => {\n return content.concat(\n array(this.options.content).map(row => this._computeTooltipRow(row as ITooltipRow, datumRow))\n );\n }, [])\n : undefined;\n\n // only display one single row in title\n return { title: isArray(title) ? title[0] : title, content };\n }\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import type { IBaseInteractionOptions, IGrammarBase, IView, InteractionEventHandler } from '../types';
2
+ export declare abstract class BaseInteraction<T extends IBaseInteractionOptions> {
3
+ readonly view: IView;
4
+ constructor(view: IView, options: T);
5
+ references: Map<IGrammarBase, number>;
6
+ protected abstract getEvents(): Array<{
7
+ type: string;
8
+ handler: InteractionEventHandler;
9
+ }>;
10
+ depend(grammar: IGrammarBase[] | IGrammarBase | string[] | string): void;
11
+ parameters(): any;
12
+ bind(): void;
13
+ unbind(): void;
14
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.BaseInteraction = void 0;
6
+
7
+ const vutils_1 = require("@visactor/vutils");
8
+
9
+ class BaseInteraction {
10
+ constructor(view, options) {
11
+ this.references = new Map, this.view = view, this.depend(null == options ? void 0 : options.dependencies);
12
+ }
13
+ depend(grammar) {
14
+ this.references.clear(), (0, vutils_1.array)(grammar).map((grammar => (0, vutils_1.isString)(grammar) ? this.view.getGrammarById(grammar) : grammar)).filter((ref => !(0,
15
+ vutils_1.isNil)(ref))).forEach((ref => {
16
+ var _a;
17
+ this.references.set(ref, (null !== (_a = this.references.get(ref)) && void 0 !== _a ? _a : 0) + 1);
18
+ }));
19
+ }
20
+ parameters() {
21
+ const params = {};
22
+ return this.references.forEach(((count, ref) => {
23
+ (0, vutils_1.isValid)(ref.id()) && (params[ref.id()] = ref.output());
24
+ })), params;
25
+ }
26
+ bind() {
27
+ const events = this.getEvents();
28
+ (null != events ? events : []).forEach((evt => {
29
+ evt.type && evt.handler && this.view.addEventListener(evt.type, evt.handler);
30
+ }));
31
+ }
32
+ unbind() {
33
+ const events = this.getEvents();
34
+ (null != events ? events : []).forEach((evt => {
35
+ evt.type && evt.handler && this.view.removeEventListener(evt.type, evt.handler);
36
+ }));
37
+ }
38
+ }
39
+
40
+ exports.BaseInteraction = BaseInteraction;
41
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/interactions/base.ts"],"names":[],"mappings":";;;AAAA,6CAA4E;AAG5E,MAAsB,eAAe;IAGnC,YAAY,IAAW,EAAE,OAAU;QAKnC,eAAU,GAA8B,IAAI,GAAG,EAAE,CAAC;QAJhD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,CAAC,OAAO,aAAP,OAAO,uBAA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AAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;aACnD;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM;QAEJ,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAEhC,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC3B,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,OAAO,EAAE;gBAC3B,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;aACtD;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AArDD,0CAqDC","file":"base.js","sourcesContent":["import { array, isArray, isNil, isString, isValid } from '@visactor/vutils';\nimport type { IBaseInteractionOptions, IGrammarBase, IView, InteractionEventHandler } from '../types';\n\nexport abstract class BaseInteraction<T extends IBaseInteractionOptions> {\n readonly view: IView;\n\n constructor(view: IView, options: T) {\n this.view = view;\n this.depend(options?.dependencies);\n }\n\n references: Map<IGrammarBase, number> = new Map();\n\n protected abstract getEvents(): Array<{ type: string; handler: InteractionEventHandler }>;\n\n depend(grammar: IGrammarBase[] | IGrammarBase | string[] | string) {\n this.references.clear();\n array(grammar)\n .map(grammar => (isString(grammar) ? this.view.getGrammarById(grammar) : grammar))\n .filter(ref => !isNil(ref))\n .forEach(ref => {\n this.references.set(ref, (this.references.get(ref) ?? 0) + 1);\n });\n }\n\n parameters() {\n const params: any = {};\n this.references.forEach((count, ref) => {\n // upstream reference with no valid id will not be recorded in parameters\n if (isValid(ref.id())) {\n params[ref.id() as string] = ref.output();\n }\n });\n return params;\n }\n\n bind() {\n const events = this.getEvents();\n\n (events ?? []).forEach(evt => {\n if (evt.type && evt.handler) {\n this.view.addEventListener(evt.type, evt.handler);\n }\n });\n }\n\n unbind() {\n // unbind events\n const events = this.getEvents();\n\n (events ?? []).forEach(evt => {\n if (evt.type && evt.handler) {\n this.view.removeEventListener(evt.type, evt.handler);\n }\n });\n }\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import type { IPolygon } from '@visactor/vrender-core';
2
+ import type { BrushActiveOptions, IView } from '../types';
3
+ import { BrushBase } from './brush-base';
4
+ import { type IBounds } from '@visactor/vutils';
5
+ export declare class BrushActive extends BrushBase<BrushActiveOptions> {
6
+ static type: string;
7
+ type: string;
8
+ static defaultOptions: BrushActiveOptions;
9
+ constructor(view: IView, option?: BrushActiveOptions);
10
+ handleBrushUpdate: (options: {
11
+ operateType: string;
12
+ operateMask: IPolygon;
13
+ operatedMaskAABBBounds: {
14
+ [name: string]: IBounds;
15
+ };
16
+ }) => void;
17
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.BrushActive = void 0;
6
+
7
+ const enums_1 = require("../graph/enums"), brush_base_1 = require("./brush-base");
8
+
9
+ class BrushActive extends brush_base_1.BrushBase {
10
+ constructor(view, option) {
11
+ super(view, Object.assign({}, BrushActive.defaultOptions, option)), this.type = BrushActive.type,
12
+ this.handleBrushUpdate = options => {
13
+ const elements = [];
14
+ this._marks.forEach((mark => {
15
+ mark.elements.forEach((el => {
16
+ this.isBrushContainGraphicItem(options.operateMask, el.getGraphicItem()) ? (elements.push(el),
17
+ el.addState(this.options.state)) : el.removeState(this.options.state);
18
+ }));
19
+ })), this.dispatchEvent(options, elements);
20
+ };
21
+ }
22
+ }
23
+
24
+ exports.BrushActive = BrushActive, BrushActive.type = "brush-active", BrushActive.defaultOptions = {
25
+ state: enums_1.InteractionStateEnum.active
26
+ };
27
+ //# sourceMappingURL=brush-active.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/interactions/brush-active.ts"],"names":[],"mappings":";;;AACA,0CAAsD;AAEtD,6CAAyC;AAGzC,MAAa,WAAY,SAAQ,sBAA6B;IAQ5D,YAAY,IAAW,EAAE,MAA2B;QAClD,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,WAAW,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;QAPrE,SAAI,GAAW,WAAW,CAAC,IAAI,CAAC;QAUhC,sBAAiB,GAAG,CAAC,OAIpB,EAAE,EAAE;YACH,MAAM,QAAQ,GAAiC,EAAE,CAAC;YAElD,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACzB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;oBACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,cAAc,EAAE,CAAC,CAAC;oBAE1F,IAAI,QAAQ,EAAE;wBACZ,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;wBAClB,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;qBACjC;yBAAM;wBACL,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;qBACpC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACxC,CAAC,CAAC;IAvBF,CAAC;;AAVH,kCAkCC;AAjCQ,gBAAI,GAAW,cAAc,CAAC;AAG9B,0BAAc,GAAuB;IAC1C,KAAK,EAAE,4BAAoB,CAAC,MAAM;CACnC,CAAC","file":"brush-active.js","sourcesContent":["import type { IPolygon } from '@visactor/vrender-core';\nimport { InteractionStateEnum } from '../graph/enums';\nimport type { BrushActiveOptions, IElement, IGlyphElement, IView } from '../types';\nimport { BrushBase } from './brush-base';\nimport { type IBounds } from '@visactor/vutils';\n\nexport class BrushActive extends BrushBase<BrushActiveOptions> {\n static type: string = 'brush-active';\n type: string = BrushActive.type;\n\n static defaultOptions: BrushActiveOptions = {\n state: InteractionStateEnum.active\n };\n\n constructor(view: IView, option?: BrushActiveOptions) {\n super(view, Object.assign({}, BrushActive.defaultOptions, option));\n }\n\n handleBrushUpdate = (options: {\n operateType: string;\n operateMask: IPolygon;\n operatedMaskAABBBounds: { [name: string]: IBounds };\n }) => {\n const elements: (IElement | IGlyphElement)[] = [];\n\n this._marks.forEach(mark => {\n mark.elements.forEach(el => {\n const isActive = this.isBrushContainGraphicItem(options.operateMask, el.getGraphicItem());\n\n if (isActive) {\n elements.push(el);\n el.addState(this.options.state);\n } else {\n el.removeState(this.options.state);\n }\n });\n });\n\n this.dispatchEvent(options, elements);\n };\n}\n"]}
@@ -0,0 +1,43 @@
1
+ import { Brush } from '@visactor/vrender-components';
2
+ import type { BrushOptions, IElement, IGlyphElement, IMark, IView, InteractionEventHandler } from '../types';
3
+ import { BaseInteraction } from './base';
4
+ import type { IGraphic, IPolygon } from '@visactor/vrender-core';
5
+ import { type IBounds } from '@visactor/vutils';
6
+ export declare abstract class BrushBase<T extends BrushOptions> extends BaseInteraction<T> {
7
+ options: T;
8
+ protected _brushComp?: Brush;
9
+ protected _marks?: IMark[];
10
+ constructor(view: IView, options?: T);
11
+ protected getEvents(): Array<{
12
+ type: string;
13
+ handler: InteractionEventHandler;
14
+ }>;
15
+ protected isPolygonBrushContainGraphicItem(brushMask: IPolygon, graphicItem: IGraphic, offset?: {
16
+ x: number;
17
+ y: number;
18
+ }): boolean;
19
+ protected isRectBrushContainGraphicItem(brushMask: IPolygon, graphicItem: IGraphic, offset?: {
20
+ x: number;
21
+ y: number;
22
+ }): boolean;
23
+ protected isBrushContainGraphicItem(brushMask: IPolygon, graphicItem: IGraphic, offset?: {
24
+ x: number;
25
+ y: number;
26
+ }): boolean;
27
+ handleAfterDraw: () => void;
28
+ abstract handleBrushUpdate: (options: {
29
+ operateType: string;
30
+ operateMask: IPolygon;
31
+ operatedMaskAABBBounds: {
32
+ [name: string]: IBounds;
33
+ };
34
+ }) => void;
35
+ unbind(): void;
36
+ protected dispatchEvent(options: {
37
+ operateType: string;
38
+ operateMask: IPolygon;
39
+ operatedMaskAABBBounds: {
40
+ [name: string]: IBounds;
41
+ };
42
+ }, activeElements: (IElement | IGlyphElement)[]): void;
43
+ }
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.BrushBase = void 0;
6
+
7
+ const vrender_components_1 = require("@visactor/vrender-components"), base_1 = require("./base"), vutils_1 = require("@visactor/vutils"), graph_1 = require("../graph");
8
+
9
+ class BrushBase extends base_1.BaseInteraction {
10
+ constructor(view, options) {
11
+ super(view, options), this.handleAfterDraw = () => {
12
+ var _a, _b, _c, _d;
13
+ const stage = this.view.renderer.stage();
14
+ if (this._brushComp || !stage) return;
15
+ const viewBox = this.view.getViewBox();
16
+ this._brushComp = new vrender_components_1.Brush({
17
+ interactiveRange: null !== (_a = this.options.interactiveRange) && void 0 !== _a ? _a : {
18
+ minX: viewBox.x1,
19
+ maxX: viewBox.x2,
20
+ minY: viewBox.y1,
21
+ maxY: viewBox.y2
22
+ },
23
+ xRange: null !== (_b = this.options.xRange) && void 0 !== _b ? _b : [ viewBox.x1, viewBox.x2 ],
24
+ yRange: null !== (_c = this.options.yRange) && void 0 !== _c ? _c : [ viewBox.y1, viewBox.y2 ],
25
+ brushMode: null !== (_d = this.options.brushMode) && void 0 !== _d ? _d : "single",
26
+ brushType: this.options.brushType,
27
+ brushStyle: this.options.brushStyle,
28
+ brushMoved: this.options.brushMoved,
29
+ removeOnClick: this.options.removeOnClick,
30
+ sizeThreshold: this.options.sizeThreshold,
31
+ delayType: this.options.delayType,
32
+ delayTime: this.options.delayTime
33
+ }), this._brushComp.setUpdateDragMaskCallback(this.handleBrushUpdate), stage.defaultLayer.appendChild(this._brushComp);
34
+ }, this.options = options, this._marks = view.getMarksBySelector(this.options.selector);
35
+ }
36
+ getEvents() {
37
+ return [ {
38
+ type: graph_1.HOOK_EVENT.BEFORE_DO_RENDER,
39
+ handler: this.handleAfterDraw
40
+ } ];
41
+ }
42
+ isPolygonBrushContainGraphicItem(brushMask, graphicItem, offset) {
43
+ var _a, _b;
44
+ const points = brushMask.attribute.points, {a: a, b: b, c: c, d: d, e: e, f: f} = brushMask.globalTransMatrix, dx = null !== (_a = null == offset ? void 0 : offset.x) && void 0 !== _a ? _a : 0, dy = null !== (_b = null == offset ? void 0 : offset.y) && void 0 !== _b ? _b : 0, pointsCoord = points.map((p => ({
45
+ x: a * p.x + c * p.y + e + dx,
46
+ y: b * p.x + d * p.y + f + dy
47
+ }))), globalAABBBoundsOffset = brushMask.globalAABBBounds.clone().set(brushMask.globalAABBBounds.x1 + dx, brushMask.globalAABBBounds.y1 + dy, brushMask.globalAABBBounds.x2 + dx, brushMask.globalAABBBounds.y2 + dy), x = graphicItem.globalTransMatrix.e, y = graphicItem.globalTransMatrix.f;
48
+ if ("symbol" === graphicItem.type || "circle" === graphicItem.type) return globalAABBBoundsOffset.contains(x, y) && (0,
49
+ vutils_1.polygonContainPoint)(pointsCoord, x, y);
50
+ if ("rect" === graphicItem.type) {
51
+ const {width: width = 0, height: height = 0} = null == graphicItem ? void 0 : graphicItem.attribute, pointsRect = [ {
52
+ x: x,
53
+ y: y
54
+ }, {
55
+ x: x + width,
56
+ y: y
57
+ }, {
58
+ x: x + width,
59
+ y: y + height
60
+ }, {
61
+ x: x,
62
+ y: y + height
63
+ } ];
64
+ return (0, vutils_1.polygonIntersectPolygon)(pointsCoord, pointsRect);
65
+ }
66
+ return brushMask.globalAABBBounds.intersects(graphicItem.globalAABBBounds);
67
+ }
68
+ isRectBrushContainGraphicItem(brushMask, graphicItem, offset) {
69
+ var _a, _b;
70
+ const dx = null !== (_a = null == offset ? void 0 : offset.x) && void 0 !== _a ? _a : 0, dy = null !== (_b = null == offset ? void 0 : offset.y) && void 0 !== _b ? _b : 0, globalAABBBoundsOffset = brushMask.globalAABBBounds.clone().set(brushMask.globalAABBBounds.x1 + dx, brushMask.globalAABBBounds.y1 + dy, brushMask.globalAABBBounds.x2 + dx, brushMask.globalAABBBounds.y2 + dy), x = graphicItem.globalTransMatrix.e, y = graphicItem.globalTransMatrix.f;
71
+ if ("symbol" === graphicItem.type || "circle" === graphicItem.type) return globalAABBBoundsOffset.contains(x, y);
72
+ if ("rect" === graphicItem.type) {
73
+ const {width: width = 0, height: height = 0} = null == graphicItem ? void 0 : graphicItem.attribute;
74
+ return (0, vutils_1.isRectIntersect)(globalAABBBoundsOffset, {
75
+ x1: x,
76
+ y1: y,
77
+ x2: x + width,
78
+ y2: y + height
79
+ }, !1);
80
+ }
81
+ return brushMask.globalAABBBounds.intersects(graphicItem.globalAABBBounds);
82
+ }
83
+ isBrushContainGraphicItem(brushMask, graphicItem, offset) {
84
+ var _a;
85
+ return !(!((null == brushMask ? void 0 : brushMask.globalTransMatrix) && brushMask.globalAABBBounds && !brushMask.globalAABBBounds.empty() && graphicItem && (null === (_a = null == brushMask ? void 0 : brushMask.attribute) || void 0 === _a ? void 0 : _a.points)) || brushMask.attribute.points.length <= 1) && ("polygon" === this.options.brushType ? this.isPolygonBrushContainGraphicItem(brushMask, graphicItem, offset) : this.isRectBrushContainGraphicItem(brushMask, graphicItem, offset));
86
+ }
87
+ unbind() {
88
+ super.unbind(), this._brushComp && (this._brushComp.releaseBrushEvents(), this._brushComp.release(),
89
+ this._brushComp = null);
90
+ }
91
+ dispatchEvent(options, activeElements) {
92
+ const params = {
93
+ operateType: options.operateType,
94
+ operateMask: options.operateMask,
95
+ activeElements: activeElements
96
+ };
97
+ options.operateType === vrender_components_1.IOperateType.drawStart || options.operateType === vrender_components_1.IOperateType.moveStart ? (this.view.emit("brushStart", params),
98
+ this.options.onStart && this.options.onStart(params)) : options.operateType === vrender_components_1.IOperateType.drawing || options.operateType === vrender_components_1.IOperateType.moving ? (this.view.emit("brushUpdate", params),
99
+ this.options.onUpdate && this.options.onEnd(params)) : options.operateType === vrender_components_1.IOperateType.drawEnd || options.operateType === vrender_components_1.IOperateType.moveEnd ? (this.view.emit("brushEnd", params),
100
+ this.options.onEnd && this.options.onEnd(params)) : (this.view.emit("brushReset", params),
101
+ this.options.onReset && this.options.onReset(params));
102
+ }
103
+ }
104
+
105
+ exports.BrushBase = BrushBase;
106
+ //# sourceMappingURL=brush-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/interactions/brush-base.ts"],"names":[],"mappings":";;;AAAA,qEAAmE;AAEnE,iCAAyC;AAEzC,6CAM0B;AAC1B,oCAAsC;AAEtC,MAAsB,SAAkC,SAAQ,sBAAkB;IAKhF,YAAY,IAAW,EAAE,OAAW;QAClC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QA0HvB,oBAAe,GAAG,GAAG,EAAE;;YACrB,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;YACzC,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,KAAK,EAAE;gBAC7B,OAAO;aACR;YAED,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YAEvC,IAAI,CAAC,UAAU,GAAG,IAAI,0BAAK,CAAC;gBAC1B,gBAAgB,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,gBAAgB,mCAAI;oBACjD,IAAI,EAAE,OAAO,CAAC,EAAE;oBAChB,IAAI,EAAE,OAAO,CAAC,EAAE;oBAChB,IAAI,EAAE,OAAO,CAAC,EAAE;oBAChB,IAAI,EAAE,OAAO,CAAC,EAAE;iBACjB;gBACD,MAAM,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,MAAM,mCAAI,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,CAAC;gBACvD,MAAM,EAAE,MAAA,IAAI,CAAC,OAAO,CAAC,MAAM,mCAAI,CAAC,OAAO,CAAC,EAAE,EAAE,O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K,EAAE;gBACtB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aAC5B;SACF;aAAM;YACL,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;YACrC,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;gBACxB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;aAC9B;SACF;IACH,CAAC;CACF;AA9MD,8BA8MC","file":"brush-base.js","sourcesContent":["import { Brush, IOperateType } from '@visactor/vrender-components';\nimport type { BrushOptions, IElement, IGlyphElement, IMark, IView, InteractionEventHandler } from '../types';\nimport { BaseInteraction } from './base';\nimport type { IGraphic, IPolygon, IRectGraphicAttribute } from '@visactor/vrender-core';\nimport {\n polygonContainPoint,\n type IBounds,\n type IPointLike,\n polygonIntersectPolygon,\n isRectIntersect\n} from '@visactor/vutils';\nimport { HOOK_EVENT } from '../graph';\n\nexport abstract class BrushBase<T extends BrushOptions> extends BaseInteraction<T> {\n options: T;\n protected _brushComp?: Brush;\n protected _marks?: IMark[];\n\n constructor(view: IView, options?: T) {\n super(view, options);\n this.options = options;\n this._marks = view.getMarksBySelector(this.options.selector);\n }\n\n protected getEvents(): Array<{ type: string; handler: InteractionEventHandler }> {\n return [\n {\n type: HOOK_EVENT.BEFORE_DO_RENDER,\n handler: this.handleAfterDraw\n }\n ];\n }\n\n protected isPolygonBrushContainGraphicItem(\n brushMask: IPolygon,\n graphicItem: IGraphic,\n offset?: { x: number; y: number }\n ) {\n // 根据变换矩阵得到brushMask的实际坐标\n const points = brushMask.attribute.points;\n const { a, b, c, d, e, f } = brushMask.globalTransMatrix;\n\n const dx = offset?.x ?? 0;\n const dy = offset?.y ?? 0;\n\n const pointsCoord = points.map((p: IPointLike) => {\n return {\n x: a * p.x + c * p.y + e + dx,\n y: b * p.x + d * p.y + f + dy\n };\n });\n\n const globalAABBBoundsOffset = brushMask.globalAABBBounds\n .clone()\n .set(\n brushMask.globalAABBBounds.x1 + dx,\n brushMask.globalAABBBounds.y1 + dy,\n brushMask.globalAABBBounds.x2 + dx,\n brushMask.globalAABBBounds.y2 + dy\n );\n\n // 根据变换矩阵得到item的实际坐标\n const x = graphicItem.globalTransMatrix.e;\n const y = graphicItem.globalTransMatrix.f;\n\n // brush与图表图元进行相交 或 包含判断\n if (graphicItem.type === 'symbol' || graphicItem.type === 'circle') {\n return globalAABBBoundsOffset.contains(x, y) && polygonContainPoint(pointsCoord, x, y);\n } else if (graphicItem.type === 'rect') {\n const { width = 0, height = 0 } = graphicItem?.attribute as IRectGraphicAttribute;\n const pointsRect = [\n {\n x: x,\n y: y\n },\n {\n x: x + width,\n y: y\n },\n {\n x: x + width,\n y: y + height\n },\n {\n x: x,\n y: y + height\n }\n ];\n return polygonIntersectPolygon(pointsCoord, pointsRect);\n }\n return brushMask.globalAABBBounds.intersects(graphicItem.globalAABBBounds);\n }\n\n protected isRectBrushContainGraphicItem(\n brushMask: IPolygon,\n graphicItem: IGraphic,\n offset?: { x: number; y: number }\n ) {\n const dx = offset?.x ?? 0;\n const dy = offset?.y ?? 0;\n\n const globalAABBBoundsOffset = brushMask.globalAABBBounds\n .clone()\n .set(\n brushMask.globalAABBBounds.x1 + dx,\n brushMask.globalAABBBounds.y1 + dy,\n brushMask.globalAABBBounds.x2 + dx,\n brushMask.globalAABBBounds.y2 + dy\n );\n\n // 根据变换矩阵得到item的实际坐标\n const x = graphicItem.globalTransMatrix.e;\n const y = graphicItem.globalTransMatrix.f;\n\n // brush与图表图元进行相交 或 包含判断\n if (graphicItem.type === 'symbol' || graphicItem.type === 'circle') {\n return globalAABBBoundsOffset.contains(x, y);\n } else if (graphicItem.type === 'rect') {\n const { width = 0, height = 0 } = graphicItem?.attribute as IRectGraphicAttribute;\n return isRectIntersect(globalAABBBoundsOffset, { x1: x, y1: y, x2: x + width, y2: y + height }, false);\n }\n return brushMask.globalAABBBounds.intersects(graphicItem.globalAABBBounds);\n }\n\n protected isBrushContainGraphicItem(brushMask: IPolygon, graphicItem: IGraphic, offset?: { x: number; y: number }) {\n if (\n !brushMask?.globalTransMatrix ||\n !brushMask.globalAABBBounds ||\n brushMask.globalAABBBounds.empty() ||\n !graphicItem ||\n !brushMask?.attribute?.points ||\n brushMask.attribute.points.length <= 1\n ) {\n return false;\n }\n\n return this.options.brushType === 'polygon'\n ? this.isPolygonBrushContainGraphicItem(brushMask, graphicItem, offset)\n : this.isRectBrushContainGraphicItem(brushMask, graphicItem, offset);\n }\n\n handleAfterDraw = () => {\n const stage = this.view.renderer.stage();\n if (this._brushComp || !stage) {\n return;\n }\n\n const viewBox = this.view.getViewBox();\n\n this._brushComp = new Brush({\n interactiveRange: this.options.interactiveRange ?? {\n minX: viewBox.x1,\n maxX: viewBox.x2,\n minY: viewBox.y1,\n maxY: viewBox.y2\n },\n xRange: this.options.xRange ?? [viewBox.x1, viewBox.x2],\n yRange: this.options.yRange ?? [viewBox.y1, viewBox.y2],\n brushMode: this.options.brushMode ?? 'single',\n brushType: this.options.brushType,\n brushStyle: this.options.brushStyle,\n brushMoved: this.options.brushMoved,\n removeOnClick: this.options.removeOnClick,\n sizeThreshold: this.options.sizeThreshold,\n delayType: this.options.delayType,\n delayTime: this.options.delayTime\n });\n this._brushComp.setUpdateDragMaskCallback(this.handleBrushUpdate);\n\n (stage.defaultLayer as any).appendChild(this._brushComp);\n };\n\n abstract handleBrushUpdate: (options: {\n operateType: string;\n operateMask: IPolygon;\n operatedMaskAABBBounds: { [name: string]: IBounds };\n }) => void;\n\n unbind(): void {\n super.unbind();\n\n if (this._brushComp) {\n this._brushComp.releaseBrushEvents();\n this._brushComp.release();\n this._brushComp = null;\n }\n }\n\n protected dispatchEvent(\n options: {\n operateType: string;\n operateMask: IPolygon;\n operatedMaskAABBBounds: { [name: string]: IBounds };\n },\n activeElements: (IElement | IGlyphElement)[]\n ) {\n const params = { operateType: options.operateType, operateMask: options.operateMask, activeElements };\n if (options.operateType === IOperateType.drawStart || options.operateType === IOperateType.moveStart) {\n this.view.emit('brushStart', params);\n if (this.options.onStart) {\n this.options.onStart(params);\n }\n } else if (options.operateType === IOperateType.drawing || options.operateType === IOperateType.moving) {\n this.view.emit('brushUpdate', params);\n if (this.options.onUpdate) {\n this.options.onEnd(params);\n }\n } else if (options.operateType === IOperateType.drawEnd || options.operateType === IOperateType.moveEnd) {\n this.view.emit('brushEnd', params);\n if (this.options.onEnd) {\n this.options.onEnd(params);\n }\n } else {\n this.view.emit('brushReset', params);\n if (this.options.onReset) {\n this.options.onReset(params);\n }\n }\n }\n}\n"]}
@@ -0,0 +1,24 @@
1
+ import type { IPolygon } from '@visactor/vrender-core';
2
+ import type { BrushFilterOptions, IView } from '../types';
3
+ import { BrushBase } from './brush-base';
4
+ import { type IBounds } from '@visactor/vutils';
5
+ import type { FilterMixin } from './filter';
6
+ export interface BrushFilter extends Pick<FilterMixin, '_data' | '_filterValue' | '_dataFilter' | 'handleFilter' | '_filterData'>, BrushBase<BrushFilterOptions> {
7
+ }
8
+ export declare class BrushFilter extends BrushBase<BrushFilterOptions> {
9
+ static type: string;
10
+ type: string;
11
+ static defaultOptions: Omit<BrushFilterOptions, 'target'>;
12
+ constructor(view: IView, option?: BrushFilterOptions);
13
+ protected getEvents(): {
14
+ type: string;
15
+ handler: import("../types").InteractionEventHandler;
16
+ }[];
17
+ handleBrushUpdate: (options: {
18
+ operateType: string;
19
+ operateMask: IPolygon;
20
+ operatedMaskAABBBounds: {
21
+ [name: string]: IBounds;
22
+ };
23
+ }) => void;
24
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.BrushFilter = void 0;
6
+
7
+ const brush_base_1 = require("./brush-base"), vutils_1 = require("@visactor/vutils"), graph_1 = require("../graph");
8
+
9
+ class BrushFilter extends brush_base_1.BrushBase {
10
+ constructor(view, option) {
11
+ super(view, Object.assign({}, BrushFilter.defaultOptions, option)), this.type = BrushFilter.type,
12
+ this.handleBrushUpdate = options => {
13
+ const elements = [];
14
+ let filterValue = [];
15
+ this._marks.forEach((mark => {
16
+ mark.elements.forEach((el => {
17
+ this.isBrushContainGraphicItem(options.operateMask, el.getGraphicItem()) && (elements.push(el),
18
+ filterValue = filterValue.concat((0, vutils_1.array)(el.getDatum())));
19
+ }));
20
+ })), this._data && (filterValue = Array.from(new Set(filterValue)), this._filterValue && filterValue.length === this._filterValue.length && !filterValue.some((datum => !this._filterValue.includes(datum))) || (this._filterValue = filterValue,
21
+ this.handleFilter())), this.dispatchEvent(options, elements);
22
+ }, this._data = (0, vutils_1.isString)(this.options.target.data) ? view.getDataById(this.options.target.data) : this.options.target.data;
23
+ }
24
+ getEvents() {
25
+ if (!this._data) return [];
26
+ const transform = this.options.target.transform;
27
+ return this._filterData(this._data, null, graph_1.DataFilterRank.brush, null, void 0, ((data, filterValue) => {
28
+ const nextData = filterValue || data;
29
+ return transform ? transform(data, filterValue) : nextData;
30
+ })), super.getEvents();
31
+ }
32
+ }
33
+
34
+ exports.BrushFilter = BrushFilter, BrushFilter.type = "brush-filter", BrushFilter.defaultOptions = {};
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/interactions/brush-filter.ts"],"names":[],"mappings":";;;AAEA,6CAAyC;AACzC,6CAAiE;AACjE,oCAA0C;AAO1C,MAAa,WAAY,SAAQ,sBAA6B;IAM5D,YAAY,IAAW,EAAE,MAA2B;QAClD,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,WAAW,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;QALrE,SAAI,GAAW,WAAW,CAAC,IAAI,CAAC;QA2BhC,sBAAiB,GAAG,CAAC,OAIpB,EAAE,EAAE;YACH,MAAM,QAAQ,GAAiC,EAAE,CAAC;YAElD,IAAI,WAAW,GAAU,EAAE,CAAC;YAE5B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACzB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C,KAAK,EAAE;YACf,OAAO,EAAE,CAAC;SACX;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC;QAChD,MAAM,aAAa,GAAG,CAAC,IAAW,EAAE,WAAgB,EAAE,EAAE;YACtD,MAAM,QAAQ,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC;YACnD,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC7D,CAAC,CAAC;QAEF,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,sBAAc,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;QAEzF,OAAO,KAAK,CAAC,SAAS,EAAE,CAAC;IAC3B,CAAC;;AA3BH,kCAkEC;AAjEQ,gBAAI,GAAW,cAAc,CAAC;AAG9B,0BAAc,GAAuC,EAAE,CAAC","file":"brush-filter.js","sourcesContent":["import type { IPolygon } from '@visactor/vrender-core';\nimport type { BrushFilterOptions, IElement, IGlyphElement, IView } from '../types';\nimport { BrushBase } from './brush-base';\nimport { isString, type IBounds, array } from '@visactor/vutils';\nimport { DataFilterRank } from '../graph';\nimport type { FilterMixin } from './filter';\n\nexport interface BrushFilter\n extends Pick<FilterMixin, '_data' | '_filterValue' | '_dataFilter' | 'handleFilter' | '_filterData'>,\n BrushBase<BrushFilterOptions> {}\n\nexport class BrushFilter extends BrushBase<BrushFilterOptions> {\n static type: string = 'brush-filter';\n type: string = BrushFilter.type;\n\n static defaultOptions: Omit<BrushFilterOptions, 'target'> = {};\n\n constructor(view: IView, option?: BrushFilterOptions) {\n super(view, Object.assign({}, BrushFilter.defaultOptions, option));\n this._data = isString(this.options.target.data)\n ? view.getDataById(this.options.target.data)\n : this.options.target.data;\n }\n\n protected getEvents() {\n if (!this._data) {\n return [];\n }\n\n const transform = this.options.target.transform;\n const dataTransform = (data: any[], filterValue: any) => {\n const nextData = !filterValue ? data : filterValue;\n return transform ? transform(data, filterValue) : nextData;\n };\n\n this._filterData(this._data, null, DataFilterRank.brush, null, undefined, dataTransform);\n\n return super.getEvents();\n }\n\n handleBrushUpdate = (options: {\n operateType: string;\n operateMask: IPolygon;\n operatedMaskAABBBounds: { [name: string]: IBounds };\n }) => {\n const elements: (IElement | IGlyphElement)[] = [];\n\n let filterValue: any[] = [];\n\n this._marks.forEach(mark => {\n mark.elements.forEach(el => {\n const isActive = this.isBrushContainGraphicItem(options.operateMask, el.getGraphicItem());\n\n if (isActive) {\n elements.push(el);\n filterValue = filterValue.concat(array(el.getDatum()));\n }\n });\n });\n\n if (this._data) {\n // remove repeated datum\n filterValue = Array.from(new Set(filterValue));\n\n // shallow compare\n if (\n !this._filterValue ||\n filterValue.length !== this._filterValue.length ||\n filterValue.some(datum => !this._filterValue.includes(datum))\n ) {\n this._filterValue = filterValue;\n this.handleFilter();\n }\n }\n\n this.dispatchEvent(options, elements);\n };\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import type { IPolygon } from '@visactor/vrender-core';
2
+ import type { BrushHighlightOptions, IView } from '../types';
3
+ import { BrushBase } from './brush-base';
4
+ import { type IBounds } from '@visactor/vutils';
5
+ export declare class BrushHighlight extends BrushBase<BrushHighlightOptions> {
6
+ static type: string;
7
+ type: string;
8
+ static defaultOptions: BrushHighlightOptions;
9
+ constructor(view: IView, option?: BrushHighlightOptions);
10
+ handleBrushUpdate: (options: {
11
+ operateType: string;
12
+ operateMask: IPolygon;
13
+ operatedMaskAABBBounds: {
14
+ [name: string]: IBounds;
15
+ };
16
+ }) => void;
17
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.BrushHighlight = void 0;
6
+
7
+ const enums_1 = require("../graph/enums"), brush_base_1 = require("./brush-base"), vrender_components_1 = require("@visactor/vrender-components");
8
+
9
+ class BrushHighlight extends brush_base_1.BrushBase {
10
+ constructor(view, option) {
11
+ super(view, Object.assign({}, BrushHighlight.defaultOptions, option)), this.type = BrushHighlight.type,
12
+ this.handleBrushUpdate = options => {
13
+ const elements = [];
14
+ options.operateType === vrender_components_1.IOperateType.brushClear ? this._marks.forEach((mark => {
15
+ mark.elements.forEach((el => {
16
+ el.removeState(this.options.blurState), el.removeState(this.options.highlightState);
17
+ }));
18
+ })) : this._marks.forEach((mark => {
19
+ mark.elements.forEach((el => {
20
+ this.isBrushContainGraphicItem(options.operateMask, el.getGraphicItem()) ? (elements.push(el),
21
+ el.removeState(this.options.blurState), el.addState(this.options.highlightState)) : (el.removeState(this.options.highlightState),
22
+ el.addState(this.options.blurState));
23
+ }));
24
+ })), this.dispatchEvent(options, elements);
25
+ };
26
+ }
27
+ }
28
+
29
+ exports.BrushHighlight = BrushHighlight, BrushHighlight.type = "brush-highlight",
30
+ BrushHighlight.defaultOptions = {
31
+ highlightState: enums_1.InteractionStateEnum.highlight,
32
+ blurState: enums_1.InteractionStateEnum.blur
33
+ };
34
+ //# sourceMappingURL=brush-highlight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/interactions/brush-highlight.ts"],"names":[],"mappings":";;;AACA,0CAAsD;AAEtD,6CAAyC;AAEzC,qEAA4D;AAE5D,MAAa,cAAe,SAAQ,sBAAgC;IASlE,YAAY,IAAW,EAAE,MAA8B;QACrD,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,cAAc,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;QARxE,SAAI,GAAW,cAAc,CAAC,IAAI,CAAC;QAWnC,sBAAiB,GAAG,CAAC,OAIpB,EAAE,EAAE;YACH,MAAM,QAAQ,GAAiC,EAAE,CAAC;YAElD,IAAI,OAAO,CAAC,WAAW,KAAK,iCAAY,CAAC,UAAU,EAAE;gBACnD,IAAI,CAAC,MAAM,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AAI;CACrC,CAAC","file":"brush-highlight.js","sourcesContent":["import type { IPolygon } from '@visactor/vrender-core';\nimport { InteractionStateEnum } from '../graph/enums';\nimport type { BrushHighlightOptions, IElement, IGlyphElement, IView } from '../types';\nimport { BrushBase } from './brush-base';\nimport { type IBounds } from '@visactor/vutils';\nimport { IOperateType } from '@visactor/vrender-components';\n\nexport class BrushHighlight extends BrushBase<BrushHighlightOptions> {\n static type: string = 'brush-highlight';\n type: string = BrushHighlight.type;\n\n static defaultOptions: BrushHighlightOptions = {\n highlightState: InteractionStateEnum.highlight,\n blurState: InteractionStateEnum.blur\n };\n\n constructor(view: IView, option?: BrushHighlightOptions) {\n super(view, Object.assign({}, BrushHighlight.defaultOptions, option));\n }\n\n handleBrushUpdate = (options: {\n operateType: string;\n operateMask: IPolygon;\n operatedMaskAABBBounds: { [name: string]: IBounds };\n }) => {\n const elements: (IElement | IGlyphElement)[] = [];\n\n if (options.operateType === IOperateType.brushClear) {\n this._marks.forEach(mark => {\n mark.elements.forEach(el => {\n el.removeState(this.options.blurState);\n el.removeState(this.options.highlightState);\n });\n });\n } else {\n this._marks.forEach(mark => {\n mark.elements.forEach(el => {\n const isHighlight = this.isBrushContainGraphicItem(options.operateMask, el.getGraphicItem());\n\n if (isHighlight) {\n elements.push(el);\n el.removeState(this.options.blurState);\n el.addState(this.options.highlightState);\n } else {\n el.removeState(this.options.highlightState);\n el.addState(this.options.blurState);\n }\n });\n });\n }\n\n this.dispatchEvent(options, elements);\n };\n}\n"]}
@@ -0,0 +1,53 @@
1
+ import type { IPointLike } from '@visactor/vutils';
2
+ import type { CircleCrosshairAttrs, LineCrosshairAttrs, PolygonCrosshairAttrs, RectCrosshairAttrs, SectorCrosshairAttrs } from '@visactor/vrender-components';
3
+ import { CircleCrosshair, LineCrosshair, PolygonCrosshair, RectCrosshair, SectorCrosshair } from '@visactor/vrender-components';
4
+ import type { CrosshairOptions, CrosshairType, IGroupMark, ITheme, IView, InteractionEvent, RecursivePartial } from '../types';
5
+ import { BaseInteraction } from './base';
6
+ import { CrosshairEnum } from '../graph';
7
+ import type { IBaseScale } from '@visactor/vscale';
8
+ type CrosshairComponent = CircleCrosshair | LineCrosshair | PolygonCrosshair | RectCrosshair | SectorCrosshair;
9
+ export declare const generateLineCrosshairAttributes: (point: IPointLike, scale: IBaseScale, type: CrosshairType, groupSize: {
10
+ width: number;
11
+ height: number;
12
+ }, config: any, theme?: ITheme, addition?: RecursivePartial<LineCrosshairAttrs> & any) => LineCrosshairAttrs;
13
+ export declare const generateRectCrosshairAttributes: (point: IPointLike, scale: IBaseScale, type: CrosshairType, groupSize: {
14
+ width: number;
15
+ height: number;
16
+ }, config: any, theme?: ITheme, addition?: RecursivePartial<RectCrosshairAttrs>) => RectCrosshairAttrs;
17
+ export declare const generateRingCrosshairAttributes: (point: IPointLike, scale: IBaseScale, type: CrosshairType, groupSize: {
18
+ width: number;
19
+ height: number;
20
+ }, config: any, theme?: ITheme, addition?: RecursivePartial<SectorCrosshairAttrs>) => SectorCrosshairAttrs;
21
+ export declare const generateSectorCrosshairAttributes: (point: IPointLike, scale: IBaseScale, type: CrosshairType, groupSize: {
22
+ width: number;
23
+ height: number;
24
+ }, config: any, theme?: ITheme, addition?: RecursivePartial<SectorCrosshairAttrs>) => SectorCrosshairAttrs;
25
+ export declare const generateCircleCrosshairAttributes: (point: IPointLike, scale: IBaseScale, type: CrosshairType, groupSize: {
26
+ width: number;
27
+ height: number;
28
+ }, config: any, theme?: ITheme, addition?: RecursivePartial<CircleCrosshairAttrs>) => CircleCrosshairAttrs;
29
+ export declare const generatePolygonCrosshairAttributes: (point: IPointLike, scale: IBaseScale, type: CrosshairType, groupSize: {
30
+ width: number;
31
+ height: number;
32
+ }, config: any, theme?: ITheme, addition?: RecursivePartial<PolygonCrosshairAttrs>) => PolygonCrosshairAttrs;
33
+ export declare class Crosshair extends BaseInteraction<CrosshairOptions> {
34
+ static type: string;
35
+ type: string;
36
+ options: CrosshairOptions;
37
+ static defaultOptions: Omit<CrosshairOptions, 'target'>;
38
+ protected _crosshairComponent?: CrosshairComponent;
39
+ protected _crosshairComponentType?: keyof typeof CrosshairEnum;
40
+ protected _container: IGroupMark;
41
+ constructor(view: IView, options?: CrosshairOptions);
42
+ protected getEvents(): {
43
+ type: import("../types").EventType;
44
+ handler: (event: InteractionEvent) => void;
45
+ }[];
46
+ protected handleCrosshairShow: (event: InteractionEvent) => void;
47
+ protected handleCrosshairHide: () => void;
48
+ protected getCrosshairComponentType(): "lineCrosshair" | "rectCrosshair" | "sectorCrosshair" | "circleCrosshair" | "polygonCrosshair" | "ringCrosshair";
49
+ protected getDefaultCrosshairAttribute(): any;
50
+ bind(): void;
51
+ unbind(): void;
52
+ }
53
+ export {};