@visactor/vgrammar-core 0.7.7 → 0.8.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 (542) 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 +33 -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 +49 -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 +149 -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/event.d.ts +2 -0
  454. package/es/parse/event.js +5 -1
  455. package/es/parse/event.js.map +1 -1
  456. package/es/parse/option.js +2 -1
  457. package/es/parse/scale.js +1 -2
  458. package/es/semantic-marks/cell.d.ts +1 -1
  459. package/es/semantic-marks/cell.js +4 -2
  460. package/es/semantic-marks/cell.js.map +1 -1
  461. package/es/semantic-marks/interval.d.ts +1 -1
  462. package/es/semantic-marks/interval.js +1 -1
  463. package/es/semantic-marks/text.js +1 -1
  464. package/es/theme/dark.js +1 -1
  465. package/es/theme/default.js +1 -1
  466. package/es/theme/theme-manager.js +1 -1
  467. package/es/transforms/index.js +1 -1
  468. package/es/transforms/mark/dodge.js +2 -2
  469. package/es/transforms/mark/dodge.js.map +1 -1
  470. package/es/transforms/mark/jitter.js +2 -2
  471. package/es/transforms/mark/jitter.js.map +1 -1
  472. package/es/types/animate.d.ts +1 -1
  473. package/es/types/animate.js +1 -1
  474. package/es/types/animate.js.map +1 -1
  475. package/es/types/base.js +1 -1
  476. package/es/types/component.d.ts +16 -88
  477. package/es/types/component.js +1 -1
  478. package/es/types/component.js.map +1 -1
  479. package/es/types/coordinate.js +1 -1
  480. package/es/types/data.js +2 -1
  481. package/es/types/dataflow.js +1 -1
  482. package/es/types/element.d.ts +1 -1
  483. package/es/types/element.js +1 -1
  484. package/es/types/element.js.map +1 -1
  485. package/es/types/event.d.ts +11 -4
  486. package/es/types/event.js +1 -1
  487. package/es/types/event.js.map +1 -1
  488. package/es/types/glyph.js +1 -1
  489. package/es/types/grammar.d.ts +6 -2
  490. package/es/types/grammar.js +1 -1
  491. package/es/types/grammar.js.map +1 -1
  492. package/es/types/hooks.js +1 -1
  493. package/es/types/index.d.ts +1 -0
  494. package/es/types/index.js +3 -1
  495. package/es/types/index.js.map +1 -1
  496. package/es/types/interaction.d.ts +353 -0
  497. package/es/types/interaction.js +2 -0
  498. package/es/types/interaction.js.map +1 -0
  499. package/es/types/mark.d.ts +2 -3
  500. package/es/types/mark.js.map +1 -1
  501. package/es/types/morph.d.ts +1 -1
  502. package/es/types/morph.js.map +1 -1
  503. package/es/types/plot.d.ts +1 -1
  504. package/es/types/plot.js.map +1 -1
  505. package/es/types/renderer.d.ts +1 -1
  506. package/es/types/renderer.js.map +1 -1
  507. package/es/types/theme.d.ts +1 -1
  508. package/es/types/theme.js.map +1 -1
  509. package/es/types/view.d.ts +13 -14
  510. package/es/types/view.js.map +1 -1
  511. package/es/util/scale.d.ts +4 -0
  512. package/es/util/scale.js +15 -0
  513. package/es/util/scale.js.map +1 -0
  514. package/es/util/text.d.ts +1 -1
  515. package/es/util/text.js +1 -1
  516. package/es/util/text.js.map +1 -1
  517. package/es/view/View.d.ts +9 -13
  518. package/es/view/View.js +49 -69
  519. package/es/view/View.js.map +1 -1
  520. package/es/view/component.d.ts +2 -6
  521. package/es/view/component.js +0 -20
  522. package/es/view/component.js.map +1 -1
  523. package/es/view/dataflow.js +1 -1
  524. package/es/view/dataflow.js.map +1 -1
  525. package/es/view/events.d.ts +1 -1
  526. package/es/view/mark.d.ts +2 -2
  527. package/es/view/mark.js +12 -10
  528. package/es/view/mark.js.map +1 -1
  529. package/es/view/scale.d.ts +7 -1
  530. package/es/view/scale.js +17 -2
  531. package/es/view/scale.js.map +1 -1
  532. package/package.json +9 -8
  533. package/cjs/component/crosshair.d.ts +0 -50
  534. package/cjs/component/crosshair.js.map +0 -1
  535. package/cjs/component/tooltip.d.ts +0 -62
  536. package/cjs/component/tooltip.js +0 -305
  537. package/cjs/component/tooltip.js.map +0 -1
  538. package/es/component/crosshair.d.ts +0 -50
  539. package/es/component/crosshair.js.map +0 -1
  540. package/es/component/tooltip.d.ts +0 -62
  541. package/es/component/tooltip.js +0 -303
  542. package/es/component/tooltip.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import type { IBoundsLike } from '@visactor/vutils';
2
- import type { IColor, Stage } from '@visactor/vrender';
2
+ import type { IColor, Stage } from '@visactor/vrender-core';
3
3
  import type { IViewEventConfig, IViewOptions } from './view';
4
4
  export interface IRenderer {
5
5
  initialize: (width: number, height: number, options: IViewOptions, eventConfig: IViewEventConfig) => this;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/renderer.ts"],"names":[],"mappings":"","file":"renderer.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\nimport type { IColor, Stage } from '@visactor/vrender';\nimport type { IViewEventConfig, IViewOptions } from './view';\n\nexport interface IRenderer {\n initialize: (width: number, height: number, options: IViewOptions, eventConfig: IViewEventConfig) => this;\n\n render: (immediately?: boolean) => this;\n renderNextFrame: () => this;\n resize: (width: number, height: number) => this;\n shouldResize: (width: number, height: number) => boolean;\n combineIncrementalLayers: () => this;\n\n setDpr: (resolution: number, redraw: boolean) => this;\n background: (color: IColor) => this;\n setViewBox: (viewBox: IBoundsLike, rerender: boolean) => this;\n\n stage: () => Stage;\n canvas: () => HTMLCanvasElement;\n context: () => CanvasRenderingContext2D;\n\n toCanvas: () => HTMLCanvasElement;\n // toImageData: () => Promise<ImageData | undefined>;\n\n release: () => void;\n}\n"]}
1
+ {"version":3,"sources":["../src/types/renderer.ts"],"names":[],"mappings":"","file":"renderer.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\nimport type { IColor, Stage } from '@visactor/vrender-core';\nimport type { IViewEventConfig, IViewOptions } from './view';\n\nexport interface IRenderer {\n initialize: (width: number, height: number, options: IViewOptions, eventConfig: IViewEventConfig) => this;\n\n render: (immediately?: boolean) => this;\n renderNextFrame: () => this;\n resize: (width: number, height: number) => this;\n shouldResize: (width: number, height: number) => boolean;\n combineIncrementalLayers: () => this;\n\n setDpr: (resolution: number, redraw: boolean) => this;\n background: (color: IColor) => this;\n setViewBox: (viewBox: IBoundsLike, rerender: boolean) => this;\n\n stage: () => Stage;\n canvas: () => HTMLCanvasElement;\n context: () => CanvasRenderingContext2D;\n\n toCanvas: () => HTMLCanvasElement;\n // toImageData: () => Promise<ImageData | undefined>;\n\n release: () => void;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { IColor } from '@visactor/vrender';
1
+ import type { IColor } from '@visactor/vrender-core';
2
2
  import type { ArcLabelAttrs, BaseLabelAttrs, CircleAxisAttributes, CircleAxisGridAttributes, CircleCrosshairAttrs, ColorLegendAttributes, ContinuousPlayerAttributes, DataLabelAttrs, DataZoomAttributes, DiscreteLegendAttrs, DiscretePlayerAttributes, LineAxisAttributes, LineAxisGridAttributes, LineCrosshairAttrs, LineLabelAttrs, PolygonCrosshairAttrs, RectCrosshairAttrs, RectLabelAttrs, ScrollBarAttributes, SectorCrosshairAttrs, SizeLegendAttributes, SliderAttributes, SymbolLabelAttrs, TitleAttrs, TooltipAttributes } from '@visactor/vrender-components';
3
3
  import type { IPadding } from '@visactor/vutils';
4
4
  import type { RecursivePartial } from './base';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/theme.ts"],"names":[],"mappings":"","file":"theme.js","sourcesContent":["import type { IColor } from '@visactor/vrender';\nimport type {\n ArcLabelAttrs,\n BaseLabelAttrs,\n CircleAxisAttributes,\n CircleAxisGridAttributes,\n CircleCrosshairAttrs,\n ColorLegendAttributes,\n ContinuousPlayerAttributes,\n DataLabelAttrs,\n DataZoomAttributes,\n DiscreteLegendAttrs,\n DiscretePlayerAttributes,\n LineAxisAttributes,\n LineAxisGridAttributes,\n LineCrosshairAttrs,\n LineLabelAttrs,\n PolygonCrosshairAttrs,\n RectCrosshairAttrs,\n RectLabelAttrs,\n ScrollBarAttributes,\n SectorCrosshairAttrs,\n SizeLegendAttributes,\n SliderAttributes,\n SymbolLabelAttrs,\n TitleAttrs,\n TooltipAttributes\n} from '@visactor/vrender-components';\nimport type { IPadding } from '@visactor/vutils';\nimport type { RecursivePartial } from './base';\nimport type { BasicEncoderSpecMap } from './mark';\n\n// glyph mark includes multiple types, not support theme for glyph for now\nexport type IMarkTheme = Partial<Omit<BasicEncoderSpecMap, 'glyph'>>;\n\nexport interface IComponentTheme {\n axis?: RecursivePartial<LineAxisAttributes>;\n circleAxis?: RecursivePartial<CircleAxisAttributes>;\n\n grid?: RecursivePartial<LineAxisGridAttributes>;\n circleGrid?: RecursivePartial<CircleAxisGridAttributes>;\n\n discreteLegend?: RecursivePartial<DiscreteLegendAttrs>;\n colorLegend?: RecursivePartial<ColorLegendAttributes>;\n sizeLegend?: RecursivePartial<SizeLegendAttributes>;\n\n lineCrosshair?: RecursivePartial<LineCrosshairAttrs>;\n rectCrosshair?: RecursivePartial<RectCrosshairAttrs>;\n sectorCrosshair?: RecursivePartial<SectorCrosshairAttrs>;\n circleCrosshair?: RecursivePartial<CircleCrosshairAttrs>;\n polygonCrosshair?: RecursivePartial<PolygonCrosshairAttrs>;\n\n slider?: RecursivePartial<SliderAttributes>;\n\n dataLabel?: RecursivePartial<DataLabelAttrs>;\n lineLabel?: RecursivePartial<LineLabelAttrs>;\n rectLabel?: RecursivePartial<RectLabelAttrs>;\n arcLabel?: RecursivePartial<ArcLabelAttrs>;\n symbolLabel?: RecursivePartial<SymbolLabelAttrs>;\n pointLabel?: RecursivePartial<BaseLabelAttrs>;\n\n datazoom?: RecursivePartial<DataZoomAttributes>;\n\n continuousPlayer?: RecursivePartial<ContinuousPlayerAttributes>;\n discretePlayer?: RecursivePartial<DiscretePlayerAttributes>;\n\n tooltip?: RecursivePartial<TooltipAttributes>;\n\n title?: RecursivePartial<TitleAttrs>;\n\n scrollbar?: RecursivePartial<ScrollBarAttributes>;\n}\n\nexport interface ITheme {\n name?: string;\n background?: IColor;\n padding?: IPadding | number;\n palette?: Record<string, IColor[]>;\n marks?: IMarkTheme;\n components?: IComponentTheme;\n}\n"]}
1
+ {"version":3,"sources":["../src/types/theme.ts"],"names":[],"mappings":"","file":"theme.js","sourcesContent":["import type { IColor } from '@visactor/vrender-core';\nimport type {\n ArcLabelAttrs,\n BaseLabelAttrs,\n CircleAxisAttributes,\n CircleAxisGridAttributes,\n CircleCrosshairAttrs,\n ColorLegendAttributes,\n ContinuousPlayerAttributes,\n DataLabelAttrs,\n DataZoomAttributes,\n DiscreteLegendAttrs,\n DiscretePlayerAttributes,\n LineAxisAttributes,\n LineAxisGridAttributes,\n LineCrosshairAttrs,\n LineLabelAttrs,\n PolygonCrosshairAttrs,\n RectCrosshairAttrs,\n RectLabelAttrs,\n ScrollBarAttributes,\n SectorCrosshairAttrs,\n SizeLegendAttributes,\n SliderAttributes,\n SymbolLabelAttrs,\n TitleAttrs,\n TooltipAttributes\n} from '@visactor/vrender-components';\nimport type { IPadding } from '@visactor/vutils';\nimport type { RecursivePartial } from './base';\nimport type { BasicEncoderSpecMap } from './mark';\n\n// glyph mark includes multiple types, not support theme for glyph for now\nexport type IMarkTheme = Partial<Omit<BasicEncoderSpecMap, 'glyph'>>;\n\nexport interface IComponentTheme {\n axis?: RecursivePartial<LineAxisAttributes>;\n circleAxis?: RecursivePartial<CircleAxisAttributes>;\n\n grid?: RecursivePartial<LineAxisGridAttributes>;\n circleGrid?: RecursivePartial<CircleAxisGridAttributes>;\n\n discreteLegend?: RecursivePartial<DiscreteLegendAttrs>;\n colorLegend?: RecursivePartial<ColorLegendAttributes>;\n sizeLegend?: RecursivePartial<SizeLegendAttributes>;\n\n lineCrosshair?: RecursivePartial<LineCrosshairAttrs>;\n rectCrosshair?: RecursivePartial<RectCrosshairAttrs>;\n sectorCrosshair?: RecursivePartial<SectorCrosshairAttrs>;\n circleCrosshair?: RecursivePartial<CircleCrosshairAttrs>;\n polygonCrosshair?: RecursivePartial<PolygonCrosshairAttrs>;\n\n slider?: RecursivePartial<SliderAttributes>;\n\n dataLabel?: RecursivePartial<DataLabelAttrs>;\n lineLabel?: RecursivePartial<LineLabelAttrs>;\n rectLabel?: RecursivePartial<RectLabelAttrs>;\n arcLabel?: RecursivePartial<ArcLabelAttrs>;\n symbolLabel?: RecursivePartial<SymbolLabelAttrs>;\n pointLabel?: RecursivePartial<BaseLabelAttrs>;\n\n datazoom?: RecursivePartial<DataZoomAttributes>;\n\n continuousPlayer?: RecursivePartial<ContinuousPlayerAttributes>;\n discretePlayer?: RecursivePartial<DiscretePlayerAttributes>;\n\n tooltip?: RecursivePartial<TooltipAttributes>;\n\n title?: RecursivePartial<TitleAttrs>;\n\n scrollbar?: RecursivePartial<ScrollBarAttributes>;\n}\n\nexport interface ITheme {\n name?: string;\n background?: IColor;\n padding?: IPadding | number;\n palette?: Record<string, IColor[]>;\n marks?: IMarkTheme;\n components?: IComponentTheme;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import type { EventEmitter, IBounds, ILogger } from '@visactor/vutils';
3
- import type { EnvType, IStage, IColor, IOption3D, ILayer, IStageParams } from '@visactor/vrender';
3
+ import type { EnvType, IStage, IColor, IOption3D, ILayer, IStageParams } from '@visactor/vrender-core';
4
4
  import type { CoordinateType } from '@visactor/vgrammar-coordinate';
5
5
  import type { DataSpec } from './data';
6
6
  import type { SignalFunctionType, SignalSpec } from './signal';
@@ -14,9 +14,10 @@ import type { CommonPaddingSpec } from './base';
14
14
  import type { IMorphAnimationConfig } from './morph';
15
15
  import type { IBaseAnimate } from './animate';
16
16
  import type { IRenderer } from './renderer';
17
- import type { IAxis, ICrosshair, IDatazoom, IDimensionTooltip, IGrid, ILabel, ILegend, IPlayer, IScrollbar, ISlider, ITitle, ITooltip } from './component';
17
+ import type { IAxis, IDatazoom, IGrid, ILabel, ILegend, IPlayer, IScrollbar, ISlider, ITitle } from './component';
18
18
  import type { CoordinateSpec } from './coordinate';
19
19
  import type { ITheme } from './theme';
20
+ import type { IInteraction, InteractionSpec } from './interaction';
20
21
  export interface IViewThemeConfig {
21
22
  labelMonospace?: boolean;
22
23
  }
@@ -41,15 +42,13 @@ export interface ILayoutOptions {
41
42
  }
42
43
  export interface IViewEventConfig {
43
44
  defaults?: {
44
- prevent?: boolean | Record<string, boolean> | string[];
45
- allow?: boolean | Record<string, boolean> | string[];
45
+ prevent?: boolean | Record<string, boolean>;
46
+ allow?: boolean | Record<string, boolean>;
46
47
  };
47
- view?: boolean | Record<string, boolean> | string[];
48
- window?: boolean | Record<string, boolean> | string[];
48
+ view?: boolean | Record<string, boolean>;
49
49
  disable?: boolean;
50
50
  gesture?: boolean;
51
51
  drag?: boolean;
52
- globalCursor?: boolean;
53
52
  }
54
53
  export interface srIOption3DType extends IOption3D {
55
54
  enable?: boolean;
@@ -61,14 +60,11 @@ export interface IViewOptions extends IEnvironmentOptions, IRendererOptions, ILa
61
60
  padding?: CommonPaddingSpec;
62
61
  autoFit?: boolean;
63
62
  options3d?: srIOption3DType;
64
- hover?: boolean;
65
- select?: boolean;
66
- cursor?: boolean;
67
63
  logger?: ILogger;
68
64
  logLevel?: number;
69
- domBridge?: any;
70
65
  hooks?: Hooks;
71
66
  eventConfig?: IViewEventConfig;
67
+ background?: IColor;
72
68
  }
73
69
  export interface IRunningConfig {
74
70
  reuse?: boolean;
@@ -98,15 +94,15 @@ export interface IView {
98
94
  axis: (group: IGroupMark | string, mode?: '2d' | '3d') => IAxis;
99
95
  grid: (group: IGroupMark | string, mode?: '2d' | '3d') => IGrid;
100
96
  legend: (group: IGroupMark | string) => ILegend;
101
- crosshair: (group: IGroupMark | string) => ICrosshair;
102
97
  slider: (group: IGroupMark | string) => ISlider;
103
98
  label: (group: IGroupMark | string) => ILabel;
104
99
  datazoom: (group: IGroupMark | string) => IDatazoom;
105
100
  player: (group: IGroupMark | string) => IPlayer;
106
- tooltip: (group: IGroupMark | string) => ITooltip;
107
- dimensionTooltip: (group: IGroupMark | string) => IDimensionTooltip;
108
101
  title: (group: IGroupMark | string) => ITitle;
109
102
  scrollbar: (group: IGroupMark | string) => IScrollbar;
103
+ interaction: (type: string, spec: Partial<InteractionSpec>) => IInteraction;
104
+ removeInteraction: (type: string) => this;
105
+ removeAllInteractions: () => this;
110
106
  addGrammar: (grammar: IGrammarBase) => this;
111
107
  removeGrammar: (grammar: string | IGrammarBase) => this;
112
108
  removeAllGrammars: () => this;
@@ -120,6 +116,8 @@ export interface IView {
120
116
  getGrammarsByName: (name: string) => IGrammarBase[];
121
117
  getGrammarsByType: (grammarType: string) => IGrammarBase[];
122
118
  getMarksByType: (markType: string) => IMark[];
119
+ getMarksByName: (name: string) => IMark[] | null;
120
+ getMarksBySelector: (selector: string | string[] | IMark | IMark[]) => IMark[] | null;
123
121
  commit: (grammar: IGrammarBase) => this;
124
122
  parseSpec: (spec: ViewSpec) => this;
125
123
  updateSpec: (spec: ViewSpec) => this;
@@ -183,6 +181,7 @@ export interface ViewSpec {
183
181
  coordinates?: CoordinateSpec[];
184
182
  marks?: MarkSpec[];
185
183
  events?: EventSpec[];
184
+ interactions?: InteractionSpec[];
186
185
  }
187
186
  export interface IRecordedGrammars {
188
187
  record: (grammar: IGrammarBase) => this;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/view.ts"],"names":[],"mappings":"","file":"view.js","sourcesContent":["import type { EventEmitter, IBounds, IBoundsLike, ILogger } from '@visactor/vutils';\nimport type { EnvType, IStage, IColor, IOption3D, ILayer, IStageParams } from '@visactor/vrender';\nimport type { CoordinateType } from '@visactor/vgrammar-coordinate';\nimport type { DataSpec } from './data';\nimport type { SignalFunctionType, SignalSpec } from './signal';\nimport type {\n IData,\n ISignal,\n IScale,\n IMark,\n IGrammarBase,\n ICoordinate,\n IGlyphMark,\n IGroupMark,\n IComponent\n} from './grammar';\nimport type { ScaleSpec, GrammarScaleType } from './scale';\nimport type { MarkSpec, MarkType } from './mark';\nimport type { Hooks } from './hooks';\nimport type { ProjectionSpec } from './projection';\nimport type { BaseEventHandler, EventSpec } from './event';\nimport type { CommonPaddingSpec } from './base';\nimport type { IMorphAnimationConfig } from './morph';\nimport type { IBaseAnimate } from './animate';\nimport type { IRenderer } from './renderer';\nimport type {\n IAxis,\n ICrosshair,\n IDatazoom,\n IDimensionTooltip,\n IGrid,\n ILabel,\n ILegend,\n IPlayer,\n IScrollbar,\n ISlider,\n ITitle,\n ITooltip\n} from './component';\nimport type { CoordinateSpec } from './coordinate';\nimport type { ITheme } from './theme';\n\nexport interface IViewThemeConfig {\n labelMonospace?: boolean;\n}\n\n/**\n * 获取state相关配置\n */\nexport interface IViewStateOptions {\n signals?: (name?: string, operator?: any) => boolean;\n data?: (name?: string, object?: any) => boolean;\n recurse?: boolean;\n}\n\nexport interface IEnvironmentOptions {\n /** 环境参数 */\n mode?: EnvType;\n /**\n * 环境带的配置\n */\n modeParams?: any;\n}\n\nexport interface IRendererOptions extends Partial<IStageParams> {\n /** 非浏览器环境下,如小程序,需要传入经过包装的伪 canvas 实例 */\n renderCanvas?: string | HTMLCanvasElement;\n /** vRender stage */\n stage?: IStage;\n rendererTitle?: string;\n /** vRender layer */\n layer?: ILayer;\n}\n\nexport interface ILayoutOptions {\n parseMarkBounds?: (bounds: IBounds, mark: IMark) => IBounds;\n doLayout?: (marks: IMark[], options: ILayoutOptions, view: IView) => void;\n}\n\n/** 事件配置 */\nexport interface IViewEventConfig {\n /**\n * preventDefaults相关配置\n */\n defaults?: {\n prevent?: boolean | Record<string, boolean> | string[];\n allow?: boolean | Record<string, boolean> | string[];\n };\n view?: boolean | Record<string, boolean> | string[];\n window?: boolean | Record<string, boolean> | string[];\n disable?: boolean;\n gesture?: boolean;\n drag?: boolean;\n globalCursor?: boolean;\n}\n\nexport interface srIOption3DType extends IOption3D {\n enable?: boolean;\n /* 是否支持3d视角变换 */\n enableView3dTranform?: boolean;\n}\nexport interface IViewOptions extends IEnvironmentOptions, IRendererOptions, ILayoutOptions {\n width?: number;\n height?: number;\n padding?: CommonPaddingSpec;\n autoFit?: boolean;\n\n options3d?: srIOption3DType;\n\n /** 是否默认配置hover交互 */\n hover?: boolean;\n /** 是否开启选中交互 */\n select?: boolean;\n\n /** 是否启用 cursor 设置 */\n cursor?: boolean;\n\n /** 外部传入的logger方法 */\n logger?: ILogger;\n /**\n * 0 - None\n * 1 - Error\n * 2 - Warn\n * 3 - Info\n * 4 - Debug\n */\n logLevel?: number;\n\n /** worker 专用 */\n domBridge?: any;\n\n /** 生命周期等事件钩子 */\n hooks?: Hooks;\n\n /**\n * 事件相关配置\n * {\n * defaults: {\n * prevent: ['mousemove', 'mouseenter']\n * }\n * }\n */\n eventConfig?: IViewEventConfig;\n}\n\nexport interface IRunningConfig {\n /** whether enable reusing of grammar */\n reuse?: boolean;\n /** whether enable morph */\n morph?: boolean;\n /** force all marks to participate in morphing */\n morphAll?: boolean;\n /** morphing animation config */\n animation?: IMorphAnimationConfig;\n /** whether apply exit animations for released marks */\n enableExitAnimation?: boolean;\n}\n\nexport interface IView {\n readonly renderer: IRenderer;\n readonly rootMark: IGroupMark;\n readonly animate: IBaseAnimate;\n readonly grammars: IRecordedGrammars;\n readonly logger: ILogger;\n\n // --- Grammar API ---\n signal: <T>(value?: T, update?: SignalFunctionType<T>) => ISignal<T>;\n data: (values?: any[]) => IData;\n scale: (type: GrammarScaleType) => IScale;\n coordinate: (type: CoordinateType) => ICoordinate;\n mark: (\n type: MarkType,\n group: IGroupMark | string,\n markOptions?: { glyphType?: string; componentType?: string; mode?: '2d' | '3d' }\n ) => IMark;\n group: (group: IGroupMark | string) => IGroupMark;\n glyph: (glyphType: string, group: IGroupMark | string) => IGlyphMark;\n component: (componentType: string, group: IGroupMark | string, mode?: '2d' | '3d') => IComponent;\n axis: (group: IGroupMark | string, mode?: '2d' | '3d') => IAxis;\n grid: (group: IGroupMark | string, mode?: '2d' | '3d') => IGrid;\n legend: (group: IGroupMark | string) => ILegend;\n crosshair: (group: IGroupMark | string) => ICrosshair;\n slider: (group: IGroupMark | string) => ISlider;\n label: (group: IGroupMark | string) => ILabel;\n datazoom: (group: IGroupMark | string) => IDatazoom;\n player: (group: IGroupMark | string) => IPlayer;\n tooltip: (group: IGroupMark | string) => ITooltip;\n dimensionTooltip: (group: IGroupMark | string) => IDimensionTooltip;\n title: (group: IGroupMark | string) => ITitle;\n scrollbar: (group: IGroupMark | string) => IScrollbar;\n\n addGrammar: (grammar: IGrammarBase) => this;\n removeGrammar: (grammar: string | IGrammarBase) => this;\n removeAllGrammars: () => this;\n\n getGrammarById: (id: string) => IGrammarBase | null;\n getCustomizedById: (id: string) => IGrammarBase | null;\n getSignalById: <T>(id: string) => ISignal<T> | null;\n getDataById: (id: string) => IData | null;\n getScaleById: (id: string) => IScale | null;\n getCoordinateById: (id: string) => ICoordinate | null;\n getMarkById: (id: string) => IMark | null;\n getGrammarsByName: (name: string) => IGrammarBase[];\n getGrammarsByType: (grammarType: string) => IGrammarBase[];\n getMarksByType: (markType: string) => IMark[];\n\n commit: (grammar: IGrammarBase) => this;\n\n // --- Spec API ---\n parseSpec: (spec: ViewSpec) => this;\n updateSpec: (spec: ViewSpec) => this;\n\n // --- Evaluate API ---\n run: (runningConfig?: IRunningConfig) => this;\n runNextTick: (runningConfig?: IRunningConfig) => Promise<this>;\n runAsync: (runningConfig?: IRunningConfig) => Promise<this>;\n runSync: (runningConfig?: IRunningConfig) => this;\n runBefore: (callback: (view: IView) => void) => this;\n runAfter: (callback: (view: IView) => void) => this;\n\n // --- Theme API ---\n theme: (theme: ITheme | string) => this;\n getCurrentTheme: () => ITheme;\n setCurrentTheme: (theme: ITheme | string, render?: boolean) => Promise<this>;\n\n // --- Global Config API ---\n background: (value?: IColor) => IColor;\n width: (value?: number) => number;\n height: (value?: number) => number;\n viewWidth: (value?: number) => number;\n viewHeight: (value?: number) => number;\n padding: (p?: number | { left?: number; right?: number; top?: number; bottom?: number }) => {\n left: number;\n right: number;\n top: number;\n bottom: number;\n };\n getViewBox: () => IBounds;\n\n // --- Event API ---\n addEventListener: (type: string, handler: BaseEventHandler, options?: any) => this;\n removeEventListener: (type: string, handler: BaseEventHandler) => this;\n\n // --- Other API ---\n emit: <T extends EventEmitter.EventNames<string | symbol>>(\n event: T,\n ...args: EventEmitter.EventArgs<string | symbol, T>\n ) => boolean;\n\n resize: (width: number, height: number, render?: boolean) => Promise<this>;\n traverseMarkTree: (apply: (mark: IMark) => any, filter?: (mark: IMark) => boolean, leafFirst?: boolean) => this;\n\n getLayoutState: () => string;\n updateLayoutTag: () => this;\n\n pauseProgressive: () => boolean;\n resumeProgressive: () => boolean;\n restartProgressive: () => boolean;\n\n release: () => void;\n getImageBuffer: () => Buffer;\n}\n\nexport interface IViewConstructor {\n new (options?: IViewOptions, config?: IViewThemeConfig): IView;\n}\n\nexport interface ViewSpec {\n /** 梳理详细配置 */\n theme?: string;\n background?: IColor;\n width?: number;\n height?: number;\n padding?: number | { left?: number; right?: number; top?: number; bottom?: number };\n signals?: SignalSpec<any>[];\n projections?: ProjectionSpec[];\n data?: DataSpec[];\n scales?: ScaleSpec[];\n coordinates?: CoordinateSpec[];\n marks?: MarkSpec[];\n events?: EventSpec[];\n}\n\nexport interface IRecordedGrammars {\n record: (grammar: IGrammarBase) => this;\n unrecord: (grammar: IGrammarBase) => this;\n\n size: () => number;\n\n getSignal: <T>(key: string) => ISignal<T> | null;\n getData: (key: string) => IData | null;\n getScale: (key: string) => IScale | null;\n getCoordinate: (key: string) => ICoordinate | null;\n getMark: (key: string) => IMark | null;\n getCustomized: (key: string) => IGrammarBase | null;\n getGrammar: (key: string) => IGrammarBase | null;\n\n getAllSignals: () => ISignal<any>[];\n getAllData: () => IData[];\n getAllScales: () => IScale[];\n getAllCoordinates: () => ICoordinate[];\n getAllMarks: () => IMark[];\n getAllCustomized: () => IGrammarBase[];\n\n clear: () => void;\n\n traverse: (func: (grammar: IGrammarBase) => boolean | void) => void;\n find: (func: (grammar: IGrammarBase) => boolean) => IGrammarBase | null;\n filter: (func: (grammar: IGrammarBase) => boolean) => IGrammarBase[];\n\n release: () => void;\n}\n\nexport interface IMarkTreeNode {\n mark: IMark;\n parent: IMarkTreeNode;\n children: IMarkTreeNode[];\n}\n\nexport interface IRecordedTreeGrammars extends IRecordedGrammars {\n getAllMarkNodes: () => IMarkTreeNode[];\n}\n"]}
1
+ {"version":3,"sources":["../src/types/view.ts"],"names":[],"mappings":"","file":"view.js","sourcesContent":["import type { EventEmitter, IBounds, ILogger } from '@visactor/vutils';\nimport type { EnvType, IStage, IColor, IOption3D, ILayer, IStageParams } from '@visactor/vrender-core';\nimport type { CoordinateType } from '@visactor/vgrammar-coordinate';\nimport type { DataSpec } from './data';\nimport type { SignalFunctionType, SignalSpec } from './signal';\nimport type {\n IData,\n ISignal,\n IScale,\n IMark,\n IGrammarBase,\n ICoordinate,\n IGlyphMark,\n IGroupMark,\n IComponent\n} from './grammar';\nimport type { ScaleSpec, GrammarScaleType } from './scale';\nimport type { MarkSpec, MarkType } from './mark';\nimport type { Hooks } from './hooks';\nimport type { ProjectionSpec } from './projection';\nimport type { BaseEventHandler, EventSpec } from './event';\nimport type { CommonPaddingSpec } from './base';\nimport type { IMorphAnimationConfig } from './morph';\nimport type { IBaseAnimate } from './animate';\nimport type { IRenderer } from './renderer';\nimport type { IAxis, IDatazoom, IGrid, ILabel, ILegend, IPlayer, IScrollbar, ISlider, ITitle } from './component';\nimport type { CoordinateSpec } from './coordinate';\nimport type { ITheme } from './theme';\nimport type { IInteraction, InteractionSpec } from './interaction';\n\nexport interface IViewThemeConfig {\n labelMonospace?: boolean;\n}\n\n/**\n * 获取state相关配置\n */\nexport interface IViewStateOptions {\n signals?: (name?: string, operator?: any) => boolean;\n data?: (name?: string, object?: any) => boolean;\n recurse?: boolean;\n}\n\nexport interface IEnvironmentOptions {\n /** 环境参数 */\n mode?: EnvType;\n /**\n * 环境带的配置\n */\n modeParams?: any;\n}\n\nexport interface IRendererOptions extends Partial<IStageParams> {\n /** 非浏览器环境下,如小程序,需要传入经过包装的伪 canvas 实例 */\n renderCanvas?: string | HTMLCanvasElement;\n /** vRender stage */\n stage?: IStage;\n rendererTitle?: string;\n /** vRender layer */\n layer?: ILayer;\n}\n\nexport interface ILayoutOptions {\n parseMarkBounds?: (bounds: IBounds, mark: IMark) => IBounds;\n doLayout?: (marks: IMark[], options: ILayoutOptions, view: IView) => void;\n}\n\n/** 事件配置 */\nexport interface IViewEventConfig {\n /**\n * preventDefaults相关配置\n */\n defaults?: {\n prevent?: boolean | Record<string, boolean>;\n allow?: boolean | Record<string, boolean>;\n };\n /**\n * whether permit events of view\n */\n view?: boolean | Record<string, boolean>;\n /** disable all the events */\n disable?: boolean;\n /** use gesture events or not */\n gesture?: boolean;\n /** use drag events or not */\n drag?: boolean;\n}\n\nexport interface srIOption3DType extends IOption3D {\n enable?: boolean;\n /* 是否支持3d视角变换 */\n enableView3dTranform?: boolean;\n}\nexport interface IViewOptions extends IEnvironmentOptions, IRendererOptions, ILayoutOptions {\n width?: number;\n height?: number;\n padding?: CommonPaddingSpec;\n autoFit?: boolean;\n\n options3d?: srIOption3DType;\n /** 外部传入的logger方法 */\n logger?: ILogger;\n /**\n * 0 - None\n * 1 - Error\n * 2 - Warn\n * 3 - Info\n * 4 - Debug\n */\n logLevel?: number;\n\n /** 生命周期等事件钩子 */\n hooks?: Hooks;\n\n /**\n * 事件相关配置\n * {\n * defaults: {\n * prevent: ['mousemove', 'mouseenter']\n * }\n * }\n */\n eventConfig?: IViewEventConfig;\n background?: IColor;\n}\n\nexport interface IRunningConfig {\n /** whether enable reusing of grammar */\n reuse?: boolean;\n /** whether enable morph */\n morph?: boolean;\n /** force all marks to participate in morphing */\n morphAll?: boolean;\n /** morphing animation config */\n animation?: IMorphAnimationConfig;\n /** whether apply exit animations for released marks */\n enableExitAnimation?: boolean;\n}\n\nexport interface IView {\n readonly renderer: IRenderer;\n readonly rootMark: IGroupMark;\n readonly animate: IBaseAnimate;\n readonly grammars: IRecordedGrammars;\n readonly logger: ILogger;\n\n // --- Grammar API ---\n signal: <T>(value?: T, update?: SignalFunctionType<T>) => ISignal<T>;\n data: (values?: any[]) => IData;\n scale: (type: GrammarScaleType) => IScale;\n coordinate: (type: CoordinateType) => ICoordinate;\n mark: (\n type: MarkType,\n group: IGroupMark | string,\n markOptions?: { glyphType?: string; componentType?: string; mode?: '2d' | '3d' }\n ) => IMark;\n group: (group: IGroupMark | string) => IGroupMark;\n glyph: (glyphType: string, group: IGroupMark | string) => IGlyphMark;\n component: (componentType: string, group: IGroupMark | string, mode?: '2d' | '3d') => IComponent;\n axis: (group: IGroupMark | string, mode?: '2d' | '3d') => IAxis;\n grid: (group: IGroupMark | string, mode?: '2d' | '3d') => IGrid;\n legend: (group: IGroupMark | string) => ILegend;\n slider: (group: IGroupMark | string) => ISlider;\n label: (group: IGroupMark | string) => ILabel;\n datazoom: (group: IGroupMark | string) => IDatazoom;\n player: (group: IGroupMark | string) => IPlayer;\n title: (group: IGroupMark | string) => ITitle;\n scrollbar: (group: IGroupMark | string) => IScrollbar;\n\n interaction: (type: string, spec: Partial<InteractionSpec>) => IInteraction;\n removeInteraction: (type: string) => this;\n removeAllInteractions: () => this;\n\n addGrammar: (grammar: IGrammarBase) => this;\n removeGrammar: (grammar: string | IGrammarBase) => this;\n removeAllGrammars: () => this;\n\n getGrammarById: (id: string) => IGrammarBase | null;\n getCustomizedById: (id: string) => IGrammarBase | null;\n getSignalById: <T>(id: string) => ISignal<T> | null;\n getDataById: (id: string) => IData | null;\n getScaleById: (id: string) => IScale | null;\n getCoordinateById: (id: string) => ICoordinate | null;\n getMarkById: (id: string) => IMark | null;\n getGrammarsByName: (name: string) => IGrammarBase[];\n getGrammarsByType: (grammarType: string) => IGrammarBase[];\n getMarksByType: (markType: string) => IMark[];\n getMarksByName: (name: string) => IMark[] | null;\n getMarksBySelector: (selector: string | string[] | IMark | IMark[]) => IMark[] | null;\n\n commit: (grammar: IGrammarBase) => this;\n\n // --- Spec API ---\n parseSpec: (spec: ViewSpec) => this;\n updateSpec: (spec: ViewSpec) => this;\n\n // --- Evaluate API ---\n run: (runningConfig?: IRunningConfig) => this;\n runNextTick: (runningConfig?: IRunningConfig) => Promise<this>;\n runAsync: (runningConfig?: IRunningConfig) => Promise<this>;\n runSync: (runningConfig?: IRunningConfig) => this;\n runBefore: (callback: (view: IView) => void) => this;\n runAfter: (callback: (view: IView) => void) => this;\n\n // --- Theme API ---\n theme: (theme: ITheme | string) => this;\n getCurrentTheme: () => ITheme;\n setCurrentTheme: (theme: ITheme | string, render?: boolean) => Promise<this>;\n\n // --- Global Config API ---\n background: (value?: IColor) => IColor;\n width: (value?: number) => number;\n height: (value?: number) => number;\n viewWidth: (value?: number) => number;\n viewHeight: (value?: number) => number;\n padding: (p?: number | { left?: number; right?: number; top?: number; bottom?: number }) => {\n left: number;\n right: number;\n top: number;\n bottom: number;\n };\n getViewBox: () => IBounds;\n\n // --- Event API ---\n addEventListener: (type: string, handler: BaseEventHandler, options?: any) => this;\n removeEventListener: (type: string, handler: BaseEventHandler) => this;\n\n // --- Other API ---\n emit: <T extends EventEmitter.EventNames<string | symbol>>(\n event: T,\n ...args: EventEmitter.EventArgs<string | symbol, T>\n ) => boolean;\n\n resize: (width: number, height: number, render?: boolean) => Promise<this>;\n traverseMarkTree: (apply: (mark: IMark) => any, filter?: (mark: IMark) => boolean, leafFirst?: boolean) => this;\n\n getLayoutState: () => string;\n updateLayoutTag: () => this;\n\n pauseProgressive: () => boolean;\n resumeProgressive: () => boolean;\n restartProgressive: () => boolean;\n\n release: () => void;\n getImageBuffer: () => Buffer;\n}\n\nexport interface IViewConstructor {\n new (options?: IViewOptions, config?: IViewThemeConfig): IView;\n}\n\nexport interface ViewSpec {\n /** 梳理详细配置 */\n theme?: string;\n background?: IColor;\n width?: number;\n height?: number;\n padding?: number | { left?: number; right?: number; top?: number; bottom?: number };\n signals?: SignalSpec<any>[];\n projections?: ProjectionSpec[];\n data?: DataSpec[];\n scales?: ScaleSpec[];\n coordinates?: CoordinateSpec[];\n marks?: MarkSpec[];\n events?: EventSpec[];\n interactions?: InteractionSpec[];\n}\n\nexport interface IRecordedGrammars {\n record: (grammar: IGrammarBase) => this;\n unrecord: (grammar: IGrammarBase) => this;\n\n size: () => number;\n\n getSignal: <T>(key: string) => ISignal<T> | null;\n getData: (key: string) => IData | null;\n getScale: (key: string) => IScale | null;\n getCoordinate: (key: string) => ICoordinate | null;\n getMark: (key: string) => IMark | null;\n getCustomized: (key: string) => IGrammarBase | null;\n getGrammar: (key: string) => IGrammarBase | null;\n\n getAllSignals: () => ISignal<any>[];\n getAllData: () => IData[];\n getAllScales: () => IScale[];\n getAllCoordinates: () => ICoordinate[];\n getAllMarks: () => IMark[];\n getAllCustomized: () => IGrammarBase[];\n\n clear: () => void;\n\n traverse: (func: (grammar: IGrammarBase) => boolean | void) => void;\n find: (func: (grammar: IGrammarBase) => boolean) => IGrammarBase | null;\n filter: (func: (grammar: IGrammarBase) => boolean) => IGrammarBase[];\n\n release: () => void;\n}\n\nexport interface IMarkTreeNode {\n mark: IMark;\n parent: IMarkTreeNode;\n children: IMarkTreeNode[];\n}\n\nexport interface IRecordedTreeGrammars extends IRecordedGrammars {\n getAllMarkNodes: () => IMarkTreeNode[];\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { IBaseScale } from '@visactor/vscale';
2
+ export declare function isBandLikeScale(scale: IBaseScale): boolean;
3
+ export declare function getBandWidthOfScale(scale: IBaseScale): number;
4
+ export declare function getScaleRangeRatio(scale: IBaseScale, input: any): number;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.getScaleRangeRatio = exports.getBandWidthOfScale = exports.isBandLikeScale = void 0;
6
+
7
+ const vscale_1 = require("@visactor/vscale");
8
+
9
+ function isBandLikeScale(scale) {
10
+ return scale && (scale.type === vscale_1.ScaleEnum.Band || scale.type === vscale_1.ScaleEnum.Point);
11
+ }
12
+
13
+ function getBandWidthOfScale(scale) {
14
+ if (scale) return scale.type === vscale_1.ScaleEnum.Band ? scale.bandwidth() : scale.type === vscale_1.ScaleEnum.Point ? scale.step() : void 0;
15
+ }
16
+
17
+ function getScaleRangeRatio(scale, input) {
18
+ const range = scale.range();
19
+ return (scale.scale(input) - range[0]) / (range[range.length - 1] - range[0]);
20
+ }
21
+
22
+ exports.isBandLikeScale = isBandLikeScale, exports.getBandWidthOfScale = getBandWidthOfScale,
23
+ exports.getScaleRangeRatio = getScaleRangeRatio;
24
+ //# sourceMappingURL=scale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/util/scale.ts"],"names":[],"mappings":";;;AAAA,6CAA6C;AAI7C,SAAgB,eAAe,CAAC,KAAiB;IAC/C,OAAO,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,kBAAS,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,kBAAS,CAAC,KAAK,CAAC,CAAC;AACpF,CAAC;AAFD,0CAEC;AAED,SAAgB,mBAAmB,CAAC,KAAiB;IACnD,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,KAAK,CAAC,IAAI,KAAK,kBAAS,CAAC,IAAI;QAClC,CAAC,CAAE,KAAwB,CAAC,SAAS,EAAE;QACvC,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,kBAAS,CAAC,KAAK;YAChC,CAAC,CAAE,KAAwB,CAAC,IAAI,EAAE;YAClC,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAVD,kDAUC;AAED,SAAgB,kBAAkB,CAAC,KAAiB,EAAE,KAAU;IAC9D,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;IAC5B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC;AAHD,gDAGC","file":"scale.js","sourcesContent":["import { ScaleEnum } from '@visactor/vscale';\n// eslint-disable-next-line no-duplicate-imports\nimport type { IBandLikeScale, IBaseScale } from '@visactor/vscale';\n\nexport function isBandLikeScale(scale: IBaseScale) {\n return scale && (scale.type === ScaleEnum.Band || scale.type === ScaleEnum.Point);\n}\n\nexport function getBandWidthOfScale(scale: IBaseScale) {\n if (!scale) {\n return undefined;\n }\n\n return scale.type === ScaleEnum.Band\n ? (scale as IBandLikeScale).bandwidth()\n : scale.type === ScaleEnum.Point\n ? (scale as IBandLikeScale).step()\n : undefined;\n}\n\nexport function getScaleRangeRatio(scale: IBaseScale, input: any) {\n const range = scale.range();\n return (scale.scale(input) - range[0]) / (range[range.length - 1] - range[0]);\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { IRichText, IRichTextCharacter } from '@visactor/vrender';
1
+ import type { IRichText, IRichTextCharacter } from '@visactor/vrender-core';
2
2
  export declare function richXul(strings: TemplateStringsArray, ...insertVars: (string | number)[]): {
3
3
  type: string;
4
4
  text: IRichTextCharacter[];
package/cjs/util/text.js CHANGED
@@ -4,19 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.textHtml = exports.richJsx = exports.richXul = void 0;
6
6
 
7
- const vrender_1 = require("@visactor/vrender"), vutils_1 = require("@visactor/vutils");
7
+ const vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@visactor/vutils");
8
8
 
9
9
  function richXul(strings, ...insertVars) {
10
10
  return {
11
11
  type: "rich",
12
- text: (0, vrender_1.xul)(strings.reduce(((res, temp, i) => res + temp + (i >= insertVars.length ? "" : insertVars[i])), ""))
12
+ text: (0, vrender_core_1.xul)(strings.reduce(((res, temp, i) => res + temp + (i >= insertVars.length ? "" : insertVars[i])), ""))
13
13
  };
14
14
  }
15
15
 
16
16
  function richJsx(richText) {
17
17
  return {
18
18
  type: "rich",
19
- text: richText instanceof vrender_1.RichText ? richText.attribute.textConfig : (0,
19
+ text: richText instanceof vrender_core_1.RichText ? richText.attribute.textConfig : (0,
20
20
  vutils_1.isArray)(richText) ? richText.map((entry => entry.type ? entry.attribute : entry)) : []
21
21
  };
22
22
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/util/text.ts"],"names":[],"mappings":";;;AACA,+CAAgE;AAChE,6CAA2C;AAE3C,SAAgB,OAAO,CAAC,OAA6B,EAAE,GAAG,UAA+B;IACvF,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,IAAA,aAAU,EACd,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE;YAC9B,OAAO,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QACpE,CAAC,EAAE,EAAE,CAAC,CACP;KACF,CAAC;AACJ,CAAC;AATD,0BASC;AAED,SAAgB,OAAO,CACrB,QAA8F;IAE9F,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EACF,QAAQ,YAAY,kBAAQ;YAC1B,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU;YAC/B,CAAC,CAAC,IAAA,gBAAO,EAAC,QAAQ,CAAC;gBACnB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;oBACnB,OAAQ,KAAyD,CAAC,IAAI;wBACpE,CAAC,CAAE,KAAyD,CAAC,SAAS;wBACtE,CAAC,CAAC,KAAK,CAAC;gBACZ,CAAC,CAAC;gBACJ,CAAC,CAAC,EAAE;KACT,CAAC;AACJ,CAAC;AAhBD,0BAgBC;AAED,SAAgB,QAAQ,CAAC,OAA6B,EAAE,GAAG,UAA+B;IACxF,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE;YACpC,OAAO,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QACpE,CAAC,EAAE,EAAE,CAAC;KACP,CAAC;AACJ,CAAC;AAPD,4BAOC","file":"text.js","sourcesContent":["import type { IRichText, IRichTextCharacter } from '@visactor/vrender';\nimport { xul as vRenderXul, RichText } from '@visactor/vrender';\nimport { isArray } from '@visactor/vutils';\n\nexport function richXul(strings: TemplateStringsArray, ...insertVars: (string | number)[]) {\n return {\n type: 'rich',\n text: vRenderXul(\n strings.reduce((res, temp, i) => {\n return res + temp + (i >= insertVars.length ? '' : insertVars[i]);\n }, '')\n )\n };\n}\n\nexport function richJsx(\n richText: IRichText | { attribute: IRichTextCharacter; type: string }[] | IRichTextCharacter[]\n) {\n return {\n type: 'rich',\n text:\n richText instanceof RichText\n ? richText.attribute.textConfig\n : isArray(richText)\n ? richText.map(entry => {\n return (entry as { attribute: IRichTextCharacter; type: string }).type\n ? (entry as { attribute: IRichTextCharacter; type: string }).attribute\n : entry;\n })\n : []\n };\n}\n\nexport function textHtml(strings: TemplateStringsArray, ...insertVars: (string | number)[]) {\n return {\n type: 'html',\n text: strings.reduce((res, temp, i) => {\n return res + temp + (i >= insertVars.length ? '' : insertVars[i]);\n }, '')\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/util/text.ts"],"names":[],"mappings":";;;AACA,yDAAqE;AACrE,6CAA2C;AAE3C,SAAgB,OAAO,CAAC,OAA6B,EAAE,GAAG,UAA+B;IACvF,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,IAAA,kBAAU,EACd,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE;YAC9B,OAAO,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QACpE,CAAC,EAAE,EAAE,CAAC,CACP;KACF,CAAC;AACJ,CAAC;AATD,0BASC;AAED,SAAgB,OAAO,CACrB,QAA8F;IAE9F,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EACF,QAAQ,YAAY,uBAAQ;YAC1B,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU;YAC/B,CAAC,CAAC,IAAA,gBAAO,EAAC,QAAQ,CAAC;gBACnB,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;oBACnB,OAAQ,KAAyD,CAAC,IAAI;wBACpE,CAAC,CAAE,KAAyD,CAAC,SAAS;wBACtE,CAAC,CAAC,KAAK,CAAC;gBACZ,CAAC,CAAC;gBACJ,CAAC,CAAC,EAAE;KACT,CAAC;AACJ,CAAC;AAhBD,0BAgBC;AAED,SAAgB,QAAQ,CAAC,OAA6B,EAAE,GAAG,UAA+B;IACxF,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE;YACpC,OAAO,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QACpE,CAAC,EAAE,EAAE,CAAC;KACP,CAAC;AACJ,CAAC;AAPD,4BAOC","file":"text.js","sourcesContent":["import type { IRichText, IRichTextCharacter } from '@visactor/vrender-core';\nimport { xul as vRenderXul, RichText } from '@visactor/vrender-core';\nimport { isArray } from '@visactor/vutils';\n\nexport function richXul(strings: TemplateStringsArray, ...insertVars: (string | number)[]) {\n return {\n type: 'rich',\n text: vRenderXul(\n strings.reduce((res, temp, i) => {\n return res + temp + (i >= insertVars.length ? '' : insertVars[i]);\n }, '')\n )\n };\n}\n\nexport function richJsx(\n richText: IRichText | { attribute: IRichTextCharacter; type: string }[] | IRichTextCharacter[]\n) {\n return {\n type: 'rich',\n text:\n richText instanceof RichText\n ? richText.attribute.textConfig\n : isArray(richText)\n ? richText.map(entry => {\n return (entry as { attribute: IRichTextCharacter; type: string }).type\n ? (entry as { attribute: IRichTextCharacter; type: string }).attribute\n : entry;\n })\n : []\n };\n}\n\nexport function textHtml(strings: TemplateStringsArray, ...insertVars: (string | number)[]) {\n return {\n type: 'html',\n text: strings.reduce((res, temp, i) => {\n return res + temp + (i >= insertVars.length ? '' : insertVars[i]);\n }, '')\n };\n}\n"]}
@@ -1,11 +1,11 @@
1
1
  import type { IBounds, ILogger } from '@visactor/vutils';
2
2
  import { EventEmitter } from '@visactor/vutils';
3
- import type { IColor } from '@visactor/vrender';
3
+ import type { IColor } from '@visactor/vrender-core';
4
4
  import type { CoordinateType } from '@visactor/vgrammar-coordinate';
5
- import type { IData, ISignal, ViewSpec, IView, IViewOptions, IViewThemeConfig, Hooks, IMark, EventSpec, MarkType, GrammarScaleType, SignalFunctionType, IScale, IGrammarBase, IGroupMark, IGlyphMark, ICoordinate, BaseEventHandler, IRecordedGrammars, IComponent, IRunningConfig, IViewAnimate, ITheme } from '../types/';
5
+ import type { IData, ISignal, ViewSpec, IView, IViewOptions, IViewThemeConfig, Hooks, IMark, EventSpec, MarkType, GrammarScaleType, SignalFunctionType, IScale, IGrammarBase, IGroupMark, IGlyphMark, ICoordinate, BaseEventHandler, IRecordedGrammars, IComponent, IRunningConfig, IViewAnimate, ITheme, InteractionSpec, IInteraction } from '../types/';
6
6
  import type { IRenderer } from '../types/renderer';
7
7
  import { LayoutState } from '../graph/enums';
8
- import type { IAxis, ICrosshair, IDatazoom, IDimensionTooltip, IGrid, ILabel, ILegend, IPlayer, IScrollbar, ISlider, ITitle, ITooltip } from '../types/component';
8
+ import type { IAxis, IDatazoom, IGrid, ILabel, ILegend, IPlayer, IScrollbar, ISlider, ITitle } from '../types/component';
9
9
  export default class View extends EventEmitter implements IView {
10
10
  container: HTMLElement;
11
11
  renderer: IRenderer;
@@ -21,7 +21,6 @@ export default class View extends EventEmitter implements IView {
21
21
  private _willMorphMarks;
22
22
  private _morph;
23
23
  private _eventConfig;
24
- private _globalCursor;
25
24
  private _eventListeners;
26
25
  private _theme;
27
26
  private _dataflow;
@@ -34,8 +33,8 @@ export default class View extends EventEmitter implements IView {
34
33
  private _eventCache;
35
34
  private _progressiveMarks?;
36
35
  private _progressiveRafId?;
37
- private _cursorValue?;
38
36
  private _observer;
37
+ private _boundInteractions?;
39
38
  static useRegisters(comps: (() => void)[]): void;
40
39
  constructor(options?: IViewOptions, config?: IViewThemeConfig);
41
40
  getGrammarById(id: string): IGrammarBase;
@@ -48,6 +47,8 @@ export default class View extends EventEmitter implements IView {
48
47
  getGrammarsByName(name: string): IGrammarBase[];
49
48
  getGrammarsByType(grammarType: string): IGrammarBase[];
50
49
  getMarksByType(markType: string): IMark[];
50
+ getMarksByName(name: string): IMark[] | null;
51
+ getMarksBySelector(selector: string | string[] | IMark | IMark[]): IMark[] | null;
51
52
  private updateSignal;
52
53
  signal<T>(value?: T, update?: SignalFunctionType<T>): ISignal<T>;
53
54
  data(values?: any[]): IData;
@@ -64,13 +65,10 @@ export default class View extends EventEmitter implements IView {
64
65
  axis(group: IGroupMark | string, mode?: '2d' | '3d'): IAxis;
65
66
  grid(group: IGroupMark | string, mode?: '2d' | '3d'): IGrid;
66
67
  legend(group: IGroupMark | string): ILegend;
67
- crosshair(group: IGroupMark | string): ICrosshair;
68
68
  slider(group: IGroupMark | string): ISlider;
69
69
  label(group: IGroupMark | string): ILabel;
70
70
  datazoom(group: IGroupMark | string): IDatazoom;
71
71
  player(group: IGroupMark | string): IPlayer;
72
- tooltip(group: IGroupMark | string): ITooltip;
73
- dimensionTooltip(group: IGroupMark | string): IDimensionTooltip;
74
72
  title(group: IGroupMark | string): ITitle;
75
73
  scrollbar(group: IGroupMark | string): IScrollbar;
76
74
  customized(type: string, spec: any): IGrammarBase;
@@ -132,16 +130,14 @@ export default class View extends EventEmitter implements IView {
132
130
  private _resizeRenderer;
133
131
  private bindEvents;
134
132
  event(eventSpec: EventSpec): void;
135
- private hover;
136
- cursor(): void;
133
+ interaction(type: string, spec: Partial<InteractionSpec>): IInteraction;
134
+ removeInteraction(type: string | IInteraction): this;
135
+ removeAllInteractions(): this;
137
136
  private initEvent;
138
137
  private delegateEvent;
139
138
  addEventListener(type: string, handler: BaseEventHandler, options?: any): this;
140
139
  removeEventListener(type: string, handler?: BaseEventHandler): this;
141
- private setCursor;
142
- globalCursor(_?: boolean): string | boolean | this;
143
140
  private initializeRenderer;
144
- private initializeBuiltEvents;
145
141
  private initialize;
146
142
  normalBrowserEnv(): boolean;
147
143
  pauseProgressive(): boolean;
package/cjs/view/View.js CHANGED
@@ -34,7 +34,7 @@ Object.defineProperty(exports, "__esModule", {
34
34
  value: !0
35
35
  });
36
36
 
37
- const vutils_1 = require("@visactor/vutils"), vrender_1 = require("@visactor/vrender"), data_1 = require("./data"), events_1 = require("./events"), dataflow_1 = __importDefault(require("./dataflow")), mark_tree_1 = require("../graph/mark-tree"), constants_1 = require("../graph/constants"), canvas_renderer_1 = __importDefault(require("../graph/canvas-renderer")), events_extend_1 = __importDefault(require("../graph/util/events-extend")), constants_2 = require("./constants"), signal_1 = require("./signal"), scale_1 = require("./scale"), view_1 = require("../parse/view"), event_1 = require("../parse/event"), util_1 = require("../parse/util"), env_1 = require("../graph/util/env"), group_1 = require("./group"), mark_1 = require("./mark"), layout_1 = require("../graph/layout/layout"), glyph_1 = require("./glyph"), coordinate_1 = require("./coordinate"), morph_1 = require("../graph/animation/morph"), grammar_record_1 = require("./grammar-record"), animate_1 = require("./animate"), enums_1 = require("../graph/enums"), interval_1 = require("../semantic-marks/interval"), cell_1 = require("../semantic-marks/cell"), text_1 = require("../semantic-marks/text"), theme_manager_1 = require("../theme/theme-manager"), factory_1 = require("../core/factory"), component_1 = require("./component");
37
+ const vutils_1 = require("@visactor/vutils"), vrender_core_1 = require("@visactor/vrender-core"), data_1 = require("./data"), events_1 = require("./events"), dataflow_1 = __importDefault(require("./dataflow")), mark_tree_1 = require("../graph/mark-tree"), constants_1 = require("../graph/constants"), canvas_renderer_1 = __importDefault(require("../graph/canvas-renderer")), events_extend_1 = __importDefault(require("../graph/util/events-extend")), constants_2 = require("./constants"), signal_1 = require("./signal"), scale_1 = require("./scale"), view_1 = require("../parse/view"), event_1 = require("../parse/event"), util_1 = require("../parse/util"), env_1 = require("../graph/util/env"), group_1 = require("./group"), mark_1 = require("./mark"), layout_1 = require("../graph/layout/layout"), glyph_1 = require("./glyph"), coordinate_1 = require("./coordinate"), morph_1 = require("../graph/animation/morph"), grammar_record_1 = require("./grammar-record"), animate_1 = require("./animate"), enums_1 = require("../graph/enums"), interval_1 = require("../semantic-marks/interval"), cell_1 = require("../semantic-marks/cell"), text_1 = require("../semantic-marks/text"), theme_manager_1 = require("../theme/theme-manager"), factory_1 = require("../core/factory"), component_1 = require("./component"), graphic_1 = require("../graph/util/graphic");
38
38
 
39
39
  class View extends vutils_1.EventEmitter {
40
40
  static useRegisters(comps) {
@@ -56,8 +56,7 @@ class View extends vutils_1.EventEmitter {
56
56
  mark.isDoingProgressive() && mark.evaluateProgressive();
57
57
  })), this.doPreProgressive();
58
58
  }, this._config = config, this._options = Object.assign({
59
- mode: constants_2.BROWSER,
60
- cursor: !0
59
+ mode: constants_2.BROWSER
61
60
  }, options), this.initialize();
62
61
  }
63
62
  getGrammarById(id) {
@@ -90,6 +89,19 @@ class View extends vutils_1.EventEmitter {
90
89
  getMarksByType(markType) {
91
90
  return this.grammars.getAllMarks().filter((mark => mark.markType === markType));
92
91
  }
92
+ getMarksByName(name) {
93
+ return this.grammars.getAllMarks().filter((mark => mark.name() === name));
94
+ }
95
+ getMarksBySelector(selector) {
96
+ if (!selector) return null;
97
+ const selectors = (0, vutils_1.array)(selector);
98
+ let res = [];
99
+ return selectors.forEach((selectorStr => {
100
+ (0, util_1.isGrammar)(selectorStr) ? res = res.concat(selectorStr) : (selectorStr[0] === event_1.ID_PREFIX && (res = res.concat(this.getMarkById(selectorStr.slice(1)))),
101
+ selectorStr[0] === event_1.NAME_PREFIX && (res = res.concat(this.getMarksByName(selectorStr.slice(1)))),
102
+ (0, graphic_1.isMarkType)(selectorStr) && (res = res.concat(this.getMarksByType(selectorStr))));
103
+ })), res;
104
+ }
93
105
  updateSignal(signal, value) {
94
106
  (0, vutils_1.isString)(signal) && (signal = this.getSignalById(signal)), signal.set(value),
95
107
  this.commit(signal);
@@ -175,11 +187,6 @@ class View extends vutils_1.EventEmitter {
175
187
  componentType: enums_1.ComponentEnum.legend
176
188
  });
177
189
  }
178
- crosshair(group) {
179
- return this.mark(enums_1.GrammarMarkType.component, group, {
180
- componentType: enums_1.ComponentEnum.crosshair
181
- });
182
- }
183
190
  slider(group) {
184
191
  return this.mark(enums_1.GrammarMarkType.component, group, {
185
192
  componentType: enums_1.ComponentEnum.slider
@@ -200,16 +207,6 @@ class View extends vutils_1.EventEmitter {
200
207
  componentType: enums_1.ComponentEnum.player
201
208
  });
202
209
  }
203
- tooltip(group) {
204
- return this.mark(enums_1.GrammarMarkType.component, group, {
205
- componentType: enums_1.ComponentEnum.tooltip
206
- });
207
- }
208
- dimensionTooltip(group) {
209
- return this.mark(enums_1.GrammarMarkType.component, group, {
210
- componentType: enums_1.ComponentEnum.dimensionTooltip
211
- });
212
- }
213
210
  title(group) {
214
211
  return this.mark(enums_1.GrammarMarkType.component, group, {
215
212
  componentType: enums_1.ComponentEnum.title
@@ -242,7 +239,7 @@ class View extends vutils_1.EventEmitter {
242
239
  })), this;
243
240
  }
244
241
  parseSpec(spec) {
245
- var _a, _b, _c, _d, _e, _f, _g, _h;
242
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
246
243
  if (this.emit(enums_1.HOOK_EVENT.BEFORE_PARSE_VIEW), this._spec = spec, (0, view_1.normalizeMarkTree)(spec),
247
244
  spec.theme ? this.theme(spec.theme) : this.theme(theme_manager_1.ThemeManager.getDefaultTheme()),
248
245
  spec.width && this.width(spec.width), spec.height && this.height(spec.height), this.padding(null !== (_b = null !== (_a = spec.padding) && void 0 !== _a ? _a : this._options.padding) && void 0 !== _b ? _b : this._theme.padding),
@@ -270,11 +267,13 @@ class View extends vutils_1.EventEmitter {
270
267
  this.parseMarkSpec(mark);
271
268
  })), (null === (_h = spec.events) || void 0 === _h ? void 0 : _h.length) && spec.events.forEach((eventConfig => {
272
269
  this.event(eventConfig);
270
+ })), (null === (_j = spec.interactions) || void 0 === _j ? void 0 : _j.length) && spec.interactions.forEach((interaction => {
271
+ this.interaction(interaction.type, interaction);
273
272
  })), this.emit(enums_1.HOOK_EVENT.AFTER_PARSE_VIEW), this._needBuildLayoutTree = !0,
274
273
  this._layoutState = enums_1.LayoutState.before, this;
275
274
  }
276
275
  updateSpec(spec) {
277
- return this.removeAllGrammars(), this.parseSpec(spec);
276
+ return this.removeAllInteractions(), this.removeAllGrammars(), this.parseSpec(spec);
278
277
  }
279
278
  parseBuiltIn() {
280
279
  (0, view_1.builtInSignals)(this._options, this._config, this.getCurrentTheme()).map((signalSpec => {
@@ -635,14 +634,14 @@ class View extends vutils_1.EventEmitter {
635
634
  () => {
636
635
  this.removeEventListener(type, send);
637
636
  };
638
- } else if (source === constants_2.EVENT_SOURCE_WINDOW) return vrender_1.vglobal.addEventListener(type, send),
637
+ } else if (source === constants_2.EVENT_SOURCE_WINDOW) return vrender_core_1.vglobal.addEventListener(type, send),
639
638
  this._eventListeners.push({
640
639
  type: type,
641
- source: vrender_1.vglobal,
640
+ source: vrender_core_1.vglobal,
642
641
  handler: send
643
642
  }), () => {
644
- vrender_1.vglobal.removeEventListener(type, send);
645
- const index = this._eventListeners.findIndex((entry => entry.type === type && entry.source === vrender_1.vglobal && entry.handler === send));
643
+ vrender_core_1.vglobal.removeEventListener(type, send);
644
+ const index = this._eventListeners.findIndex((entry => entry.type === type && entry.source === vrender_core_1.vglobal && entry.handler === send));
646
645
  index >= 0 && this._eventListeners.splice(index, 1);
647
646
  };
648
647
  }
@@ -669,30 +668,24 @@ class View extends vutils_1.EventEmitter {
669
668
  singleEvent.debounce = 50, this.bindEvents(singleEvent);
670
669
  })) : this.bindEvents(eventSpec);
671
670
  }
672
- hover(hoverState) {
673
- const state = hoverState || constants_2.DEFAULT_HOVER_STATE;
674
- return this.addEventListener("pointerover", (evt => {
675
- if (!evt.element) return;
676
- evt.element.addState(state);
677
- })), this.addEventListener("pointerout", (evt => {
678
- if (!evt.element) return;
679
- evt.element.removeState(state);
680
- })), this;
671
+ interaction(type, spec) {
672
+ const interaction = factory_1.Factory.createInteraction(type, this, spec);
673
+ return interaction && (interaction.bind(), this._boundInteractions || (this._boundInteractions = []),
674
+ this._boundInteractions.push(interaction)), interaction;
681
675
  }
682
- cursor() {
683
- this._cursorValue = {
684
- user: constants_2.CURSOR_DEFAULT,
685
- element: null
686
- }, this.addEventListener("mousemove", (evt => {
687
- var _a, _b, _c;
688
- const elementCursor = null === (_b = null === (_a = null == evt ? void 0 : evt.element) || void 0 === _a ? void 0 : _a.graphicItem) || void 0 === _b ? void 0 : _b.cursor, value = this._cursorValue, user = value ? (0,
689
- vutils_1.isString)(value) ? value : value.user : constants_2.CURSOR_DEFAULT, nextValue = value && user === value.user && (elementCursor === value.element || (0,
690
- vutils_1.isNil)(elementCursor) && (0, vutils_1.isNil)(value.element)) ? value : {
691
- user: user,
692
- element: elementCursor
693
- };
694
- nextValue !== value && (this._cursorValue = nextValue, this.setCursor(nextValue.user && nextValue.user !== constants_2.CURSOR_DEFAULT ? nextValue.user : null !== (_c = nextValue.element) && void 0 !== _c ? _c : nextValue.user));
695
- }));
676
+ removeInteraction(type) {
677
+ if (this._boundInteractions) {
678
+ const instances = this._boundInteractions.filter((interaction => (0, vutils_1.isString)(type) && interaction.type === type || interaction === type));
679
+ instances.length && instances.forEach((instance => {
680
+ instance.unbind();
681
+ }));
682
+ }
683
+ return this;
684
+ }
685
+ removeAllInteractions() {
686
+ return this._boundInteractions && (this._boundInteractions.forEach((instance => {
687
+ instance.unbind();
688
+ })), this._boundInteractions = null), this;
696
689
  }
697
690
  initEvent() {
698
691
  const stage = this.renderer.stage();
@@ -707,28 +700,10 @@ class View extends vutils_1.EventEmitter {
707
700
  removeEventListener(type, handler) {
708
701
  return handler ? this.off(type, handler) : this.off(type), this;
709
702
  }
710
- setCursor(cursor) {
711
- if (this._options.domBridge && this._options.domBridge.setCursor) return void this._options.domBridge.setCursor(cursor);
712
- const el = this.globalCursor() ? !(0, vutils_1.isNil)(document) && document.body : this.container;
713
- return el ? (0, vutils_1.isNil)(cursor) ? el.style.removeProperty("cursor") : el.style.cursor = cursor : void 0;
714
- }
715
- globalCursor(_) {
716
- if (arguments.length) {
717
- if (this._globalCursor !== !!_) {
718
- const prev = this.setCursor(null);
719
- this._globalCursor = !!_, prev && this.setCursor(prev);
720
- }
721
- return this;
722
- }
723
- return this._globalCursor;
724
- }
725
703
  initializeRenderer() {
726
704
  const width = this._options.width, height = this._options.height;
727
705
  this.renderer = new canvas_renderer_1.default(this), this.renderer.initialize(width, height, this._options, this._eventConfig).background(this._background);
728
706
  }
729
- initializeBuiltEvents() {
730
- this._options.cursor && this.cursor(), this._options.hover && this.hover(), this._bindResizeEvent();
731
- }
732
707
  initialize() {
733
708
  var _a;
734
709
  this.grammars = new grammar_record_1.RecordedGrammars((grammar => grammar.id()), ((key, grammar) => this.logger.warn(`Grammar id '${key}' has been occupied`, grammar))),
@@ -739,12 +714,11 @@ class View extends vutils_1.EventEmitter {
739
714
  this._options.hooks && (Object.keys(this._options.hooks).forEach((key => {
740
715
  this.on(key, this._options.hooks[key]);
741
716
  })), this.hooks = this._options.hooks), this.container = null, this.renderer = null,
742
- this._globalCursor = !1, this._eventListeners = [], this._eventConfig = (0, events_1.initializeEventConfig)(this._options.eventConfig),
743
- this.globalCursor(this._eventConfig.globalCursor), this._theme = theme_manager_1.ThemeManager.getDefaultTheme(),
744
- this.parseBuiltIn(), (0, env_1.configureEnvironment)(this._options), this.initializeRenderer(),
745
- this._eventConfig.disable || this.initEvent(), this.initializeBuiltEvents(), this._currentDataflow = null,
746
- this._needBuildLayoutTree = !0, this._layoutState = enums_1.LayoutState.before,
747
- this.theme(this._theme);
717
+ this._eventListeners = [], this._eventConfig = (0, events_1.initializeEventConfig)(this._options.eventConfig),
718
+ this._theme = theme_manager_1.ThemeManager.getDefaultTheme(), this.parseBuiltIn(),
719
+ (0, env_1.configureEnvironment)(this._options), this.initializeRenderer(), this._eventConfig.disable || this.initEvent(),
720
+ this._bindResizeEvent(), this._currentDataflow = null, this._needBuildLayoutTree = !0,
721
+ this._layoutState = enums_1.LayoutState.before, this.theme(this._theme);
748
722
  }
749
723
  normalBrowserEnv() {
750
724
  return "browser" === this._options.mode;
@@ -768,13 +742,13 @@ class View extends vutils_1.EventEmitter {
768
742
  }
769
743
  doPreProgressive() {
770
744
  if (this._progressiveMarks && this._progressiveMarks.some((mark => mark.isDoingProgressive()))) {
771
- const raf = vrender_1.vglobal.getRequestAnimationFrame();
745
+ const raf = vrender_core_1.vglobal.getRequestAnimationFrame();
772
746
  this._progressiveRafId = raf(this.handleProgressiveFrame);
773
747
  }
774
748
  }
775
749
  clearProgressive() {
776
750
  if (this._progressiveRafId) {
777
- vrender_1.vglobal.getCancelAnimationFrame()(this._progressiveRafId);
751
+ vrender_core_1.vglobal.getCancelAnimationFrame()(this._progressiveRafId);
778
752
  }
779
753
  this._progressiveMarks && this._progressiveMarks.length && (this._progressiveMarks.forEach((entry => {
780
754
  entry.clearProgressive();
@@ -785,7 +759,8 @@ class View extends vutils_1.EventEmitter {
785
759
  this._unBindResizeEvent(), this.clearProgressive(), factory_1.Factory.unregisterRuntimeTransforms(),
786
760
  this.animate.stop(), this.grammars.release(), this._cachedGrammars.release(), this._dataflow = null,
787
761
  null === (_b = null === (_a = this.renderer) || void 0 === _a ? void 0 : _a.release) || void 0 === _b || _b.call(_a),
788
- this.renderer = null, this.removeAllListeners(), null === (_c = this._eventListeners) || void 0 === _c || _c.forEach((listener => {
762
+ this.renderer = null, this._boundInteractions = null, this.removeAllListeners(),
763
+ null === (_c = this._eventListeners) || void 0 === _c || _c.forEach((listener => {
789
764
  listener.source.removeEventListener(listener.type, listener.handler);
790
765
  })), this._eventListeners = null;
791
766
  }