@visactor/vgrammar-core 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (873) hide show
  1. package/README.md +160 -0
  2. package/README.zh-CN.md +11 -0
  3. package/cjs/component/axis.d.ts +26 -0
  4. package/cjs/component/axis.js +164 -0
  5. package/cjs/component/axis.js.map +1 -0
  6. package/cjs/component/crosshair.d.ts +50 -0
  7. package/cjs/component/crosshair.js +281 -0
  8. package/cjs/component/crosshair.js.map +1 -0
  9. package/cjs/component/datazoom.d.ts +19 -0
  10. package/cjs/component/datazoom.js +166 -0
  11. package/cjs/component/datazoom.js.map +1 -0
  12. package/cjs/component/grid.d.ts +27 -0
  13. package/cjs/component/grid.js +190 -0
  14. package/cjs/component/grid.js.map +1 -0
  15. package/cjs/component/index.d.ts +11 -0
  16. package/cjs/component/index.js +105 -0
  17. package/cjs/component/index.js.map +1 -0
  18. package/cjs/component/label.d.ts +19 -0
  19. package/cjs/component/label.js +121 -0
  20. package/cjs/component/label.js.map +1 -0
  21. package/cjs/component/legend.d.ts +26 -0
  22. package/cjs/component/legend.js +170 -0
  23. package/cjs/component/legend.js.map +1 -0
  24. package/cjs/component/player.d.ts +25 -0
  25. package/cjs/component/player.js +138 -0
  26. package/cjs/component/player.js.map +1 -0
  27. package/cjs/component/scale.d.ts +8 -0
  28. package/cjs/component/scale.js +25 -0
  29. package/cjs/component/scale.js.map +1 -0
  30. package/cjs/component/scrollbar.d.ts +23 -0
  31. package/cjs/component/scrollbar.js +187 -0
  32. package/cjs/component/scrollbar.js.map +1 -0
  33. package/cjs/component/slider.d.ts +19 -0
  34. package/cjs/component/slider.js +86 -0
  35. package/cjs/component/slider.js.map +1 -0
  36. package/cjs/component/title.d.ts +15 -0
  37. package/cjs/component/title.js +56 -0
  38. package/cjs/component/title.js.map +1 -0
  39. package/cjs/component/tooltip.d.ts +62 -0
  40. package/cjs/component/tooltip.js +305 -0
  41. package/cjs/component/tooltip.js.map +1 -0
  42. package/cjs/core/factory.d.ts +35 -0
  43. package/cjs/core/factory.js +73 -0
  44. package/cjs/core/factory.js.map +1 -0
  45. package/cjs/glyph/boxplot.d.ts +10 -0
  46. package/cjs/glyph/boxplot.js +418 -0
  47. package/cjs/glyph/boxplot.js.map +1 -0
  48. package/cjs/glyph/index.d.ts +7 -0
  49. package/cjs/glyph/index.js +64 -0
  50. package/cjs/glyph/index.js.map +1 -0
  51. package/cjs/glyph/link-path.d.ts +7 -0
  52. package/cjs/glyph/link-path.js +138 -0
  53. package/cjs/glyph/link-path.js.map +1 -0
  54. package/cjs/glyph/ripple.d.ts +1 -0
  55. package/cjs/glyph/ripple.js +44 -0
  56. package/cjs/glyph/ripple.js.map +1 -0
  57. package/cjs/glyph/tree-path.d.ts +7 -0
  58. package/cjs/glyph/tree-path.js +152 -0
  59. package/cjs/glyph/tree-path.js.map +1 -0
  60. package/cjs/glyph/violin.d.ts +1 -0
  61. package/cjs/glyph/violin.js +165 -0
  62. package/cjs/glyph/violin.js.map +1 -0
  63. package/cjs/glyph/wave.d.ts +1 -0
  64. package/cjs/glyph/wave.js +67 -0
  65. package/cjs/glyph/wave.js.map +1 -0
  66. package/cjs/graph/animation/animate.d.ts +48 -0
  67. package/cjs/graph/animation/animate.js +250 -0
  68. package/cjs/graph/animation/animate.js.map +1 -0
  69. package/cjs/graph/animation/animation/clip.d.ts +4 -0
  70. package/cjs/graph/animation/animation/clip.js +54 -0
  71. package/cjs/graph/animation/animation/clip.js.map +1 -0
  72. package/cjs/graph/animation/animation/fade.d.ts +4 -0
  73. package/cjs/graph/animation/animation/fade.js +42 -0
  74. package/cjs/graph/animation/animation/fade.js.map +1 -0
  75. package/cjs/graph/animation/animation/grow-cartesian.d.ts +7 -0
  76. package/cjs/graph/animation/animation/grow-cartesian.js +288 -0
  77. package/cjs/graph/animation/animation/grow-cartesian.js.map +1 -0
  78. package/cjs/graph/animation/animation/grow-interval.d.ts +3 -0
  79. package/cjs/graph/animation/animation/grow-interval.js +194 -0
  80. package/cjs/graph/animation/animation/grow-interval.js.map +1 -0
  81. package/cjs/graph/animation/animation/grow-points.d.ts +7 -0
  82. package/cjs/graph/animation/animation/grow-points.js +118 -0
  83. package/cjs/graph/animation/animation/grow-points.js.map +1 -0
  84. package/cjs/graph/animation/animation/grow-polar.d.ts +5 -0
  85. package/cjs/graph/animation/animation/grow-polar.js +164 -0
  86. package/cjs/graph/animation/animation/grow-polar.js.map +1 -0
  87. package/cjs/graph/animation/animation/index.d.ts +11 -0
  88. package/cjs/graph/animation/animation/index.js +191 -0
  89. package/cjs/graph/animation/animation/index.js.map +1 -0
  90. package/cjs/graph/animation/animation/move.d.ts +3 -0
  91. package/cjs/graph/animation/animation/move.js +90 -0
  92. package/cjs/graph/animation/animation/move.js.map +1 -0
  93. package/cjs/graph/animation/animation/rotate.d.ts +3 -0
  94. package/cjs/graph/animation/animation/rotate.js +42 -0
  95. package/cjs/graph/animation/animation/rotate.js.map +1 -0
  96. package/cjs/graph/animation/animation/scale.d.ts +3 -0
  97. package/cjs/graph/animation/animation/scale.js +84 -0
  98. package/cjs/graph/animation/animation/scale.js.map +1 -0
  99. package/cjs/graph/animation/animation/update.d.ts +6 -0
  100. package/cjs/graph/animation/animation/update.js +22 -0
  101. package/cjs/graph/animation/animation/update.js.map +1 -0
  102. package/cjs/graph/animation/animator.d.ts +26 -0
  103. package/cjs/graph/animation/animator.js +88 -0
  104. package/cjs/graph/animation/animator.js.map +1 -0
  105. package/cjs/graph/animation/arranger.d.ts +13 -0
  106. package/cjs/graph/animation/arranger.js +38 -0
  107. package/cjs/graph/animation/arranger.js.map +1 -0
  108. package/cjs/graph/animation/attribute.d.ts +27 -0
  109. package/cjs/graph/animation/attribute.js +124 -0
  110. package/cjs/graph/animation/attribute.js.map +1 -0
  111. package/cjs/graph/animation/config.d.ts +5 -0
  112. package/cjs/graph/animation/config.js +92 -0
  113. package/cjs/graph/animation/config.js.map +1 -0
  114. package/cjs/graph/animation/morph.d.ts +12 -0
  115. package/cjs/graph/animation/morph.js +174 -0
  116. package/cjs/graph/animation/morph.js.map +1 -0
  117. package/cjs/graph/attributes/common.d.ts +2 -0
  118. package/cjs/graph/attributes/common.js +22 -0
  119. package/cjs/graph/attributes/common.js.map +1 -0
  120. package/cjs/graph/attributes/helpers.d.ts +17 -0
  121. package/cjs/graph/attributes/helpers.js +86 -0
  122. package/cjs/graph/attributes/helpers.js.map +1 -0
  123. package/cjs/graph/attributes/index.d.ts +10 -0
  124. package/cjs/graph/attributes/index.js +257 -0
  125. package/cjs/graph/attributes/index.js.map +1 -0
  126. package/cjs/graph/canvas-renderer.d.ts +34 -0
  127. package/cjs/graph/canvas-renderer.js +121 -0
  128. package/cjs/graph/canvas-renderer.js.map +1 -0
  129. package/cjs/graph/constants.d.ts +23 -0
  130. package/cjs/graph/constants.js +21 -0
  131. package/cjs/graph/constants.js.map +1 -0
  132. package/cjs/graph/element.d.ts +66 -0
  133. package/cjs/graph/element.js +297 -0
  134. package/cjs/graph/element.js.map +1 -0
  135. package/cjs/graph/enums.d.ts +153 -0
  136. package/cjs/graph/enums.js +85 -0
  137. package/cjs/graph/enums.js.map +1 -0
  138. package/cjs/graph/glyph-element.d.ts +53 -0
  139. package/cjs/graph/glyph-element.js +202 -0
  140. package/cjs/graph/glyph-element.js.map +1 -0
  141. package/cjs/graph/index.d.ts +3 -0
  142. package/cjs/graph/index.js +44 -0
  143. package/cjs/graph/index.js.map +1 -0
  144. package/cjs/graph/layout/grid.d.ts +3 -0
  145. package/cjs/graph/layout/grid.js +75 -0
  146. package/cjs/graph/layout/grid.js.map +1 -0
  147. package/cjs/graph/layout/layout.d.ts +3 -0
  148. package/cjs/graph/layout/layout.js +33 -0
  149. package/cjs/graph/layout/layout.js.map +1 -0
  150. package/cjs/graph/layout/relative.d.ts +3 -0
  151. package/cjs/graph/layout/relative.js +86 -0
  152. package/cjs/graph/layout/relative.js.map +1 -0
  153. package/cjs/graph/mark/differ.d.ts +20 -0
  154. package/cjs/graph/mark/differ.js +110 -0
  155. package/cjs/graph/mark/differ.js.map +1 -0
  156. package/cjs/graph/mark/encode.d.ts +10 -0
  157. package/cjs/graph/mark/encode.js +95 -0
  158. package/cjs/graph/mark/encode.js.map +1 -0
  159. package/cjs/graph/mark/large-rects.d.ts +10 -0
  160. package/cjs/graph/mark/large-rects.js +31 -0
  161. package/cjs/graph/mark/large-rects.js.map +1 -0
  162. package/cjs/graph/mark/large-symbols.d.ts +11 -0
  163. package/cjs/graph/mark/large-symbols.js +33 -0
  164. package/cjs/graph/mark/large-symbols.js.map +1 -0
  165. package/cjs/graph/mark-tree.d.ts +2 -0
  166. package/cjs/graph/mark-tree.js +21 -0
  167. package/cjs/graph/mark-tree.js.map +1 -0
  168. package/cjs/graph/util/element.d.ts +2 -0
  169. package/cjs/graph/util/element.js +10 -0
  170. package/cjs/graph/util/element.js.map +1 -0
  171. package/cjs/graph/util/env.d.ts +2 -0
  172. package/cjs/graph/util/env.js +14 -0
  173. package/cjs/graph/util/env.js.map +1 -0
  174. package/cjs/graph/util/events-extend.d.ts +5 -0
  175. package/cjs/graph/util/events-extend.js +18 -0
  176. package/cjs/graph/util/events-extend.js.map +1 -0
  177. package/cjs/graph/util/graphic.d.ts +9 -0
  178. package/cjs/graph/util/graphic.js +59 -0
  179. package/cjs/graph/util/graphic.js.map +1 -0
  180. package/cjs/graph/util/point.d.ts +1 -0
  181. package/cjs/graph/util/point.js +75 -0
  182. package/cjs/graph/util/point.js.map +1 -0
  183. package/cjs/index.d.ts +14 -0
  184. package/cjs/index.js +111 -0
  185. package/cjs/index.js.map +1 -0
  186. package/cjs/parse/coordinate.d.ts +7 -0
  187. package/cjs/parse/coordinate.js +70 -0
  188. package/cjs/parse/coordinate.js.map +1 -0
  189. package/cjs/parse/event.d.ts +8 -0
  190. package/cjs/parse/event.js +33 -0
  191. package/cjs/parse/event.js.map +1 -0
  192. package/cjs/parse/mark.d.ts +4 -0
  193. package/cjs/parse/mark.js +25 -0
  194. package/cjs/parse/mark.js.map +1 -0
  195. package/cjs/parse/option.d.ts +3 -0
  196. package/cjs/parse/option.js +19 -0
  197. package/cjs/parse/option.js.map +1 -0
  198. package/cjs/parse/scale.d.ts +8 -0
  199. package/cjs/parse/scale.js +365 -0
  200. package/cjs/parse/scale.js.map +1 -0
  201. package/cjs/parse/transform.d.ts +5 -0
  202. package/cjs/parse/transform.js +103 -0
  203. package/cjs/parse/transform.js.map +1 -0
  204. package/cjs/parse/util.d.ts +13 -0
  205. package/cjs/parse/util.js +82 -0
  206. package/cjs/parse/util.js.map +1 -0
  207. package/cjs/parse/view.d.ts +17 -0
  208. package/cjs/parse/view.js +108 -0
  209. package/cjs/parse/view.js.map +1 -0
  210. package/cjs/semantic-marks/cell.d.ts +13 -0
  211. package/cjs/semantic-marks/cell.js +61 -0
  212. package/cjs/semantic-marks/cell.js.map +1 -0
  213. package/cjs/semantic-marks/interval.d.ts +14 -0
  214. package/cjs/semantic-marks/interval.js +80 -0
  215. package/cjs/semantic-marks/interval.js.map +1 -0
  216. package/cjs/semantic-marks/text.d.ts +10 -0
  217. package/cjs/semantic-marks/text.js +25 -0
  218. package/cjs/semantic-marks/text.js.map +1 -0
  219. package/cjs/theme/common/component.d.ts +15 -0
  220. package/cjs/theme/common/component.js +493 -0
  221. package/cjs/theme/common/component.js.map +1 -0
  222. package/cjs/theme/common/constants.d.ts +1 -0
  223. package/cjs/theme/common/constants.js +6 -0
  224. package/cjs/theme/common/constants.js.map +1 -0
  225. package/cjs/theme/common/mark.d.ts +2 -0
  226. package/cjs/theme/common/mark.js +15 -0
  227. package/cjs/theme/common/mark.js.map +1 -0
  228. package/cjs/theme/dark.d.ts +2 -0
  229. package/cjs/theme/dark.js +94 -0
  230. package/cjs/theme/dark.js.map +1 -0
  231. package/cjs/theme/default.d.ts +2 -0
  232. package/cjs/theme/default.js +18 -0
  233. package/cjs/theme/default.js.map +1 -0
  234. package/cjs/theme/theme-manager.d.ts +8 -0
  235. package/cjs/theme/theme-manager.js +26 -0
  236. package/cjs/theme/theme-manager.js.map +1 -0
  237. package/cjs/transforms/data/bin.d.ts +2 -0
  238. package/cjs/transforms/data/bin.js +21 -0
  239. package/cjs/transforms/data/bin.js.map +1 -0
  240. package/cjs/transforms/data/circular-relation.d.ts +2 -0
  241. package/cjs/transforms/data/circular-relation.js +56 -0
  242. package/cjs/transforms/data/circular-relation.js.map +1 -0
  243. package/cjs/transforms/data/contour.d.ts +2 -0
  244. package/cjs/transforms/data/contour.js +115 -0
  245. package/cjs/transforms/data/contour.js.map +1 -0
  246. package/cjs/transforms/data/filter.d.ts +2 -0
  247. package/cjs/transforms/data/filter.js +10 -0
  248. package/cjs/transforms/data/filter.js.map +1 -0
  249. package/cjs/transforms/data/fold.d.ts +2 -0
  250. package/cjs/transforms/data/fold.js +24 -0
  251. package/cjs/transforms/data/fold.js.map +1 -0
  252. package/cjs/transforms/data/funnel.d.ts +2 -0
  253. package/cjs/transforms/data/funnel.js +25 -0
  254. package/cjs/transforms/data/funnel.js.map +1 -0
  255. package/cjs/transforms/data/join.d.ts +2 -0
  256. package/cjs/transforms/data/join.js +33 -0
  257. package/cjs/transforms/data/join.js.map +1 -0
  258. package/cjs/transforms/data/kde.d.ts +2 -0
  259. package/cjs/transforms/data/kde.js +90 -0
  260. package/cjs/transforms/data/kde.js.map +1 -0
  261. package/cjs/transforms/data/map.d.ts +2 -0
  262. package/cjs/transforms/data/map.js +23 -0
  263. package/cjs/transforms/data/map.js.map +1 -0
  264. package/cjs/transforms/data/pick.d.ts +2 -0
  265. package/cjs/transforms/data/pick.js +20 -0
  266. package/cjs/transforms/data/pick.js.map +1 -0
  267. package/cjs/transforms/data/pie.d.ts +2 -0
  268. package/cjs/transforms/data/pie.js +24 -0
  269. package/cjs/transforms/data/pie.js.map +1 -0
  270. package/cjs/transforms/data/range.d.ts +4 -0
  271. package/cjs/transforms/data/range.js +15 -0
  272. package/cjs/transforms/data/range.js.map +1 -0
  273. package/cjs/transforms/data/sort.d.ts +2 -0
  274. package/cjs/transforms/data/sort.js +17 -0
  275. package/cjs/transforms/data/sort.js.map +1 -0
  276. package/cjs/transforms/data/stack.d.ts +2 -0
  277. package/cjs/transforms/data/stack.js +74 -0
  278. package/cjs/transforms/data/stack.js.map +1 -0
  279. package/cjs/transforms/data/unfold.d.ts +2 -0
  280. package/cjs/transforms/data/unfold.js +49 -0
  281. package/cjs/transforms/data/unfold.js.map +1 -0
  282. package/cjs/transforms/index.d.ts +23 -0
  283. package/cjs/transforms/index.js +213 -0
  284. package/cjs/transforms/index.js.map +1 -0
  285. package/cjs/transforms/mark/dodge.d.ts +2 -0
  286. package/cjs/transforms/mark/dodge.js +81 -0
  287. package/cjs/transforms/mark/dodge.js.map +1 -0
  288. package/cjs/transforms/mark/jitter.d.ts +4 -0
  289. package/cjs/transforms/mark/jitter.js +53 -0
  290. package/cjs/transforms/mark/jitter.js.map +1 -0
  291. package/cjs/transforms/mark/lttb-sample.d.ts +2 -0
  292. package/cjs/transforms/mark/lttb-sample.js +68 -0
  293. package/cjs/transforms/mark/lttb-sample.js.map +1 -0
  294. package/cjs/transforms/mark/mark-overlap.d.ts +2 -0
  295. package/cjs/transforms/mark/mark-overlap.js +79 -0
  296. package/cjs/transforms/mark/mark-overlap.js.map +1 -0
  297. package/cjs/transforms/mark/symmetry.d.ts +2 -0
  298. package/cjs/transforms/mark/symmetry.js +25 -0
  299. package/cjs/transforms/mark/symmetry.js.map +1 -0
  300. package/cjs/transforms/util/util.d.ts +5 -0
  301. package/cjs/transforms/util/util.js +41 -0
  302. package/cjs/transforms/util/util.js.map +1 -0
  303. package/cjs/transforms/view/identifier.d.ts +2 -0
  304. package/cjs/transforms/view/identifier.js +17 -0
  305. package/cjs/transforms/view/identifier.js.map +1 -0
  306. package/cjs/types/animate.d.ts +224 -0
  307. package/cjs/types/animate.js +6 -0
  308. package/cjs/types/animate.js.map +1 -0
  309. package/cjs/types/base.d.ts +36 -0
  310. package/cjs/types/base.js +6 -0
  311. package/cjs/types/base.js.map +1 -0
  312. package/cjs/types/component.d.ts +240 -0
  313. package/cjs/types/component.js +6 -0
  314. package/cjs/types/component.js.map +1 -0
  315. package/cjs/types/coordinate.d.ts +15 -0
  316. package/cjs/types/coordinate.js +6 -0
  317. package/cjs/types/coordinate.js.map +1 -0
  318. package/cjs/types/data.d.ts +55 -0
  319. package/cjs/types/data.js +5 -0
  320. package/cjs/types/data.js.map +1 -0
  321. package/cjs/types/dataflow.d.ts +13 -0
  322. package/cjs/types/dataflow.js +6 -0
  323. package/cjs/types/dataflow.js.map +1 -0
  324. package/cjs/types/element.d.ts +117 -0
  325. package/cjs/types/element.js +6 -0
  326. package/cjs/types/element.js.map +1 -0
  327. package/cjs/types/event.d.ts +58 -0
  328. package/cjs/types/event.js +6 -0
  329. package/cjs/types/event.js.map +1 -0
  330. package/cjs/types/glyph.d.ts +29 -0
  331. package/cjs/types/glyph.js +6 -0
  332. package/cjs/types/glyph.js.map +1 -0
  333. package/cjs/types/grammar.d.ts +184 -0
  334. package/cjs/types/grammar.js +6 -0
  335. package/cjs/types/grammar.js.map +1 -0
  336. package/cjs/types/hooks.d.ts +45 -0
  337. package/cjs/types/hooks.js +6 -0
  338. package/cjs/types/hooks.js.map +1 -0
  339. package/cjs/types/index.d.ts +22 -0
  340. package/cjs/types/index.js +31 -0
  341. package/cjs/types/index.js.map +1 -0
  342. package/cjs/types/layout.d.ts +5 -0
  343. package/cjs/types/layout.js +6 -0
  344. package/cjs/types/layout.js.map +1 -0
  345. package/cjs/types/mark.d.ts +344 -0
  346. package/cjs/types/mark.js +6 -0
  347. package/cjs/types/mark.js.map +1 -0
  348. package/cjs/types/morph.d.ts +29 -0
  349. package/cjs/types/morph.js +6 -0
  350. package/cjs/types/morph.js.map +1 -0
  351. package/cjs/types/plot.d.ts +326 -0
  352. package/cjs/types/plot.js +6 -0
  353. package/cjs/types/plot.js.map +1 -0
  354. package/cjs/types/projection.d.ts +61 -0
  355. package/cjs/types/projection.js +6 -0
  356. package/cjs/types/projection.js.map +1 -0
  357. package/cjs/types/renderer.d.ts +19 -0
  358. package/cjs/types/renderer.js +6 -0
  359. package/cjs/types/renderer.js.map +1 -0
  360. package/cjs/types/scale.d.ts +111 -0
  361. package/cjs/types/scale.js +6 -0
  362. package/cjs/types/scale.js.map +1 -0
  363. package/cjs/types/signal.d.ts +20 -0
  364. package/cjs/types/signal.js +6 -0
  365. package/cjs/types/signal.js.map +1 -0
  366. package/cjs/types/theme.d.ts +41 -0
  367. package/cjs/types/theme.js +6 -0
  368. package/cjs/types/theme.js.map +1 -0
  369. package/cjs/types/transform.d.ts +291 -0
  370. package/cjs/types/transform.js +6 -0
  371. package/cjs/types/transform.js.map +1 -0
  372. package/cjs/types/view.d.ts +217 -0
  373. package/cjs/types/view.js +6 -0
  374. package/cjs/types/view.js.map +1 -0
  375. package/cjs/util/data.d.ts +3 -0
  376. package/cjs/util/data.js +64 -0
  377. package/cjs/util/data.js.map +1 -0
  378. package/cjs/util/grammar-heap.d.ts +14 -0
  379. package/cjs/util/grammar-heap.js +66 -0
  380. package/cjs/util/grammar-heap.js.map +1 -0
  381. package/cjs/util/text.d.ts +19 -0
  382. package/cjs/util/text.js +32 -0
  383. package/cjs/util/text.js.map +1 -0
  384. package/cjs/util/unique-list.d.ts +12 -0
  385. package/cjs/util/unique-list.js +37 -0
  386. package/cjs/util/unique-list.js.map +1 -0
  387. package/cjs/view/View.d.ts +157 -0
  388. package/cjs/view/View.js +800 -0
  389. package/cjs/view/View.js.map +1 -0
  390. package/cjs/view/animate.d.ts +20 -0
  391. package/cjs/view/animate.js +106 -0
  392. package/cjs/view/animate.js.map +1 -0
  393. package/cjs/view/component.d.ts +26 -0
  394. package/cjs/view/component.js +64 -0
  395. package/cjs/view/component.js.map +1 -0
  396. package/cjs/view/constants.d.ts +17 -0
  397. package/cjs/view/constants.js +13 -0
  398. package/cjs/view/constants.js.map +1 -0
  399. package/cjs/view/coordinate.d.ts +23 -0
  400. package/cjs/view/coordinate.js +59 -0
  401. package/cjs/view/coordinate.js.map +1 -0
  402. package/cjs/view/data.d.ts +37 -0
  403. package/cjs/view/data.js +198 -0
  404. package/cjs/view/data.js.map +1 -0
  405. package/cjs/view/dataflow.d.ts +32 -0
  406. package/cjs/view/dataflow.js +146 -0
  407. package/cjs/view/dataflow.js.map +1 -0
  408. package/cjs/view/events.d.ts +4 -0
  409. package/cjs/view/events.js +34 -0
  410. package/cjs/view/events.js.map +1 -0
  411. package/cjs/view/glyph-meta.d.ts +29 -0
  412. package/cjs/view/glyph-meta.js +45 -0
  413. package/cjs/view/glyph-meta.js.map +1 -0
  414. package/cjs/view/glyph.d.ts +14 -0
  415. package/cjs/view/glyph.js +29 -0
  416. package/cjs/view/glyph.js.map +1 -0
  417. package/cjs/view/grammar-base.d.ts +46 -0
  418. package/cjs/view/grammar-base.js +171 -0
  419. package/cjs/view/grammar-base.js.map +1 -0
  420. package/cjs/view/grammar-record.d.ts +39 -0
  421. package/cjs/view/grammar-record.js +180 -0
  422. package/cjs/view/grammar-record.js.map +1 -0
  423. package/cjs/view/group.d.ts +13 -0
  424. package/cjs/view/group.js +39 -0
  425. package/cjs/view/group.js.map +1 -0
  426. package/cjs/view/index.d.ts +1 -0
  427. package/cjs/view/index.js +21 -0
  428. package/cjs/view/index.js.map +1 -0
  429. package/cjs/view/mark.d.ts +112 -0
  430. package/cjs/view/mark.js +600 -0
  431. package/cjs/view/mark.js.map +1 -0
  432. package/cjs/view/scale.d.ts +26 -0
  433. package/cjs/view/scale.js +86 -0
  434. package/cjs/view/scale.js.map +1 -0
  435. package/cjs/view/signal.d.ts +18 -0
  436. package/cjs/view/signal.js +56 -0
  437. package/cjs/view/signal.js.map +1 -0
  438. package/es/component/axis.d.ts +26 -0
  439. package/es/component/axis.js +162 -0
  440. package/es/component/axis.js.map +1 -0
  441. package/es/component/crosshair.d.ts +50 -0
  442. package/es/component/crosshair.js +275 -0
  443. package/es/component/crosshair.js.map +1 -0
  444. package/es/component/datazoom.d.ts +19 -0
  445. package/es/component/datazoom.js +161 -0
  446. package/es/component/datazoom.js.map +1 -0
  447. package/es/component/grid.d.ts +27 -0
  448. package/es/component/grid.js +193 -0
  449. package/es/component/grid.js.map +1 -0
  450. package/es/component/index.d.ts +11 -0
  451. package/es/component/index.js +22 -0
  452. package/es/component/index.js.map +1 -0
  453. package/es/component/label.d.ts +19 -0
  454. package/es/component/label.js +124 -0
  455. package/es/component/label.js.map +1 -0
  456. package/es/component/legend.d.ts +26 -0
  457. package/es/component/legend.js +169 -0
  458. package/es/component/legend.js.map +1 -0
  459. package/es/component/player.d.ts +25 -0
  460. package/es/component/player.js +136 -0
  461. package/es/component/player.js.map +1 -0
  462. package/es/component/scale.d.ts +8 -0
  463. package/es/component/scale.js +19 -0
  464. package/es/component/scale.js.map +1 -0
  465. package/es/component/scrollbar.d.ts +23 -0
  466. package/es/component/scrollbar.js +184 -0
  467. package/es/component/scrollbar.js.map +1 -0
  468. package/es/component/slider.d.ts +19 -0
  469. package/es/component/slider.js +86 -0
  470. package/es/component/slider.js.map +1 -0
  471. package/es/component/title.d.ts +15 -0
  472. package/es/component/title.js +58 -0
  473. package/es/component/title.js.map +1 -0
  474. package/es/component/tooltip.d.ts +62 -0
  475. package/es/component/tooltip.js +303 -0
  476. package/es/component/tooltip.js.map +1 -0
  477. package/es/core/factory.d.ts +35 -0
  478. package/es/core/factory.js +67 -0
  479. package/es/core/factory.js.map +1 -0
  480. package/es/glyph/boxplot.d.ts +10 -0
  481. package/es/glyph/boxplot.js +410 -0
  482. package/es/glyph/boxplot.js.map +1 -0
  483. package/es/glyph/index.d.ts +7 -0
  484. package/es/glyph/index.js +11 -0
  485. package/es/glyph/index.js.map +1 -0
  486. package/es/glyph/link-path.d.ts +7 -0
  487. package/es/glyph/link-path.js +132 -0
  488. package/es/glyph/link-path.js.map +1 -0
  489. package/es/glyph/ripple.d.ts +1 -0
  490. package/es/glyph/ripple.js +38 -0
  491. package/es/glyph/ripple.js.map +1 -0
  492. package/es/glyph/tree-path.d.ts +7 -0
  493. package/es/glyph/tree-path.js +146 -0
  494. package/es/glyph/tree-path.js.map +1 -0
  495. package/es/glyph/violin.d.ts +1 -0
  496. package/es/glyph/violin.js +163 -0
  497. package/es/glyph/violin.js.map +1 -0
  498. package/es/glyph/wave.d.ts +1 -0
  499. package/es/glyph/wave.js +61 -0
  500. package/es/glyph/wave.js.map +1 -0
  501. package/es/graph/animation/animate.d.ts +48 -0
  502. package/es/graph/animation/animate.js +247 -0
  503. package/es/graph/animation/animate.js.map +1 -0
  504. package/es/graph/animation/animation/clip.d.ts +4 -0
  505. package/es/graph/animation/animation/clip.js +44 -0
  506. package/es/graph/animation/animation/clip.js.map +1 -0
  507. package/es/graph/animation/animation/fade.d.ts +4 -0
  508. package/es/graph/animation/animation/fade.js +32 -0
  509. package/es/graph/animation/animation/fade.js.map +1 -0
  510. package/es/graph/animation/animation/grow-cartesian.d.ts +7 -0
  511. package/es/graph/animation/animation/grow-cartesian.js +272 -0
  512. package/es/graph/animation/animation/grow-cartesian.js.map +1 -0
  513. package/es/graph/animation/animation/grow-interval.d.ts +3 -0
  514. package/es/graph/animation/animation/grow-interval.js +184 -0
  515. package/es/graph/animation/animation/grow-interval.js.map +1 -0
  516. package/es/graph/animation/animation/grow-points.d.ts +7 -0
  517. package/es/graph/animation/animation/grow-points.js +107 -0
  518. package/es/graph/animation/animation/grow-points.js.map +1 -0
  519. package/es/graph/animation/animation/grow-polar.d.ts +5 -0
  520. package/es/graph/animation/animation/grow-polar.js +160 -0
  521. package/es/graph/animation/animation/grow-polar.js.map +1 -0
  522. package/es/graph/animation/animation/index.d.ts +11 -0
  523. package/es/graph/animation/animation/index.js +22 -0
  524. package/es/graph/animation/animation/index.js.map +1 -0
  525. package/es/graph/animation/animation/move.d.ts +3 -0
  526. package/es/graph/animation/animation/move.js +78 -0
  527. package/es/graph/animation/animation/move.js.map +1 -0
  528. package/es/graph/animation/animation/rotate.d.ts +3 -0
  529. package/es/graph/animation/animation/rotate.js +32 -0
  530. package/es/graph/animation/animation/rotate.js.map +1 -0
  531. package/es/graph/animation/animation/scale.d.ts +3 -0
  532. package/es/graph/animation/animation/scale.js +74 -0
  533. package/es/graph/animation/animation/scale.js.map +1 -0
  534. package/es/graph/animation/animation/update.d.ts +6 -0
  535. package/es/graph/animation/animation/update.js +20 -0
  536. package/es/graph/animation/animation/update.js.map +1 -0
  537. package/es/graph/animation/animator.d.ts +26 -0
  538. package/es/graph/animation/animator.js +83 -0
  539. package/es/graph/animation/animator.js.map +1 -0
  540. package/es/graph/animation/arranger.d.ts +13 -0
  541. package/es/graph/animation/arranger.js +29 -0
  542. package/es/graph/animation/arranger.js.map +1 -0
  543. package/es/graph/animation/attribute.d.ts +27 -0
  544. package/es/graph/animation/attribute.js +114 -0
  545. package/es/graph/animation/attribute.js.map +1 -0
  546. package/es/graph/animation/config.d.ts +5 -0
  547. package/es/graph/animation/config.js +84 -0
  548. package/es/graph/animation/config.js.map +1 -0
  549. package/es/graph/animation/morph.d.ts +12 -0
  550. package/es/graph/animation/morph.js +171 -0
  551. package/es/graph/animation/morph.js.map +1 -0
  552. package/es/graph/attributes/common.d.ts +2 -0
  553. package/es/graph/attributes/common.js +13 -0
  554. package/es/graph/attributes/common.js.map +1 -0
  555. package/es/graph/attributes/helpers.d.ts +17 -0
  556. package/es/graph/attributes/helpers.js +75 -0
  557. package/es/graph/attributes/helpers.js.map +1 -0
  558. package/es/graph/attributes/index.d.ts +10 -0
  559. package/es/graph/attributes/index.js +231 -0
  560. package/es/graph/attributes/index.js.map +1 -0
  561. package/es/graph/canvas-renderer.d.ts +34 -0
  562. package/es/graph/canvas-renderer.js +115 -0
  563. package/es/graph/canvas-renderer.js.map +1 -0
  564. package/es/graph/constants.d.ts +23 -0
  565. package/es/graph/constants.js +47 -0
  566. package/es/graph/constants.js.map +1 -0
  567. package/es/graph/element.d.ts +66 -0
  568. package/es/graph/element.js +292 -0
  569. package/es/graph/element.js.map +1 -0
  570. package/es/graph/enums.d.ts +153 -0
  571. package/es/graph/enums.js +129 -0
  572. package/es/graph/enums.js.map +1 -0
  573. package/es/graph/glyph-element.d.ts +53 -0
  574. package/es/graph/glyph-element.js +206 -0
  575. package/es/graph/glyph-element.js.map +1 -0
  576. package/es/graph/index.d.ts +3 -0
  577. package/es/graph/index.js +6 -0
  578. package/es/graph/index.js.map +1 -0
  579. package/es/graph/layout/grid.d.ts +3 -0
  580. package/es/graph/layout/grid.js +66 -0
  581. package/es/graph/layout/grid.js.map +1 -0
  582. package/es/graph/layout/layout.d.ts +3 -0
  583. package/es/graph/layout/layout.js +33 -0
  584. package/es/graph/layout/layout.js.map +1 -0
  585. package/es/graph/layout/relative.d.ts +3 -0
  586. package/es/graph/layout/relative.js +85 -0
  587. package/es/graph/layout/relative.js.map +1 -0
  588. package/es/graph/mark/differ.d.ts +20 -0
  589. package/es/graph/mark/differ.js +104 -0
  590. package/es/graph/mark/differ.js.map +1 -0
  591. package/es/graph/mark/encode.d.ts +10 -0
  592. package/es/graph/mark/encode.js +92 -0
  593. package/es/graph/mark/encode.js.map +1 -0
  594. package/es/graph/mark/large-rects.d.ts +10 -0
  595. package/es/graph/mark/large-rects.js +23 -0
  596. package/es/graph/mark/large-rects.js.map +1 -0
  597. package/es/graph/mark/large-symbols.d.ts +11 -0
  598. package/es/graph/mark/large-symbols.js +27 -0
  599. package/es/graph/mark/large-symbols.js.map +1 -0
  600. package/es/graph/mark-tree.d.ts +2 -0
  601. package/es/graph/mark-tree.js +15 -0
  602. package/es/graph/mark-tree.js.map +1 -0
  603. package/es/graph/util/element.d.ts +2 -0
  604. package/es/graph/util/element.js +8 -0
  605. package/es/graph/util/element.js.map +1 -0
  606. package/es/graph/util/env.d.ts +2 -0
  607. package/es/graph/util/env.js +6 -0
  608. package/es/graph/util/env.js.map +1 -0
  609. package/es/graph/util/events-extend.d.ts +5 -0
  610. package/es/graph/util/events-extend.js +12 -0
  611. package/es/graph/util/events-extend.js.map +1 -0
  612. package/es/graph/util/graphic.d.ts +9 -0
  613. package/es/graph/util/graphic.js +59 -0
  614. package/es/graph/util/graphic.js.map +1 -0
  615. package/es/graph/util/point.d.ts +1 -0
  616. package/es/graph/util/point.js +67 -0
  617. package/es/graph/util/point.js.map +1 -0
  618. package/es/index.d.ts +14 -0
  619. package/es/index.js +27 -0
  620. package/es/index.js.map +1 -0
  621. package/es/parse/coordinate.d.ts +7 -0
  622. package/es/parse/coordinate.js +65 -0
  623. package/es/parse/coordinate.js.map +1 -0
  624. package/es/parse/event.d.ts +8 -0
  625. package/es/parse/event.js +23 -0
  626. package/es/parse/event.js.map +1 -0
  627. package/es/parse/mark.d.ts +4 -0
  628. package/es/parse/mark.js +19 -0
  629. package/es/parse/mark.js.map +1 -0
  630. package/es/parse/option.d.ts +3 -0
  631. package/es/parse/option.js +10 -0
  632. package/es/parse/option.js.map +1 -0
  633. package/es/parse/scale.d.ts +8 -0
  634. package/es/parse/scale.js +347 -0
  635. package/es/parse/scale.js.map +1 -0
  636. package/es/parse/transform.d.ts +5 -0
  637. package/es/parse/transform.js +102 -0
  638. package/es/parse/transform.js.map +1 -0
  639. package/es/parse/util.d.ts +13 -0
  640. package/es/parse/util.js +65 -0
  641. package/es/parse/util.js.map +1 -0
  642. package/es/parse/view.d.ts +17 -0
  643. package/es/parse/view.js +98 -0
  644. package/es/parse/view.js.map +1 -0
  645. package/es/semantic-marks/cell.d.ts +13 -0
  646. package/es/semantic-marks/cell.js +57 -0
  647. package/es/semantic-marks/cell.js.map +1 -0
  648. package/es/semantic-marks/interval.d.ts +14 -0
  649. package/es/semantic-marks/interval.js +87 -0
  650. package/es/semantic-marks/interval.js.map +1 -0
  651. package/es/semantic-marks/text.d.ts +10 -0
  652. package/es/semantic-marks/text.js +22 -0
  653. package/es/semantic-marks/text.js.map +1 -0
  654. package/es/theme/common/component.d.ts +15 -0
  655. package/es/theme/common/component.js +510 -0
  656. package/es/theme/common/component.js.map +1 -0
  657. package/es/theme/common/constants.d.ts +1 -0
  658. package/es/theme/common/constants.js +2 -0
  659. package/es/theme/common/constants.js.map +1 -0
  660. package/es/theme/common/mark.d.ts +2 -0
  661. package/es/theme/common/mark.js +11 -0
  662. package/es/theme/common/mark.js.map +1 -0
  663. package/es/theme/dark.d.ts +2 -0
  664. package/es/theme/dark.js +96 -0
  665. package/es/theme/dark.js.map +1 -0
  666. package/es/theme/default.d.ts +2 -0
  667. package/es/theme/default.js +16 -0
  668. package/es/theme/default.js.map +1 -0
  669. package/es/theme/theme-manager.d.ts +8 -0
  670. package/es/theme/theme-manager.js +22 -0
  671. package/es/theme/theme-manager.js.map +1 -0
  672. package/es/transforms/data/bin.d.ts +2 -0
  673. package/es/transforms/data/bin.js +16 -0
  674. package/es/transforms/data/bin.js.map +1 -0
  675. package/es/transforms/data/circular-relation.d.ts +2 -0
  676. package/es/transforms/data/circular-relation.js +44 -0
  677. package/es/transforms/data/circular-relation.js.map +1 -0
  678. package/es/transforms/data/contour.d.ts +2 -0
  679. package/es/transforms/data/contour.js +111 -0
  680. package/es/transforms/data/contour.js.map +1 -0
  681. package/es/transforms/data/filter.d.ts +2 -0
  682. package/es/transforms/data/filter.js +2 -0
  683. package/es/transforms/data/filter.js.map +1 -0
  684. package/es/transforms/data/fold.d.ts +2 -0
  685. package/es/transforms/data/fold.js +16 -0
  686. package/es/transforms/data/fold.js.map +1 -0
  687. package/es/transforms/data/funnel.d.ts +2 -0
  688. package/es/transforms/data/funnel.js +17 -0
  689. package/es/transforms/data/funnel.js.map +1 -0
  690. package/es/transforms/data/join.d.ts +2 -0
  691. package/es/transforms/data/join.js +26 -0
  692. package/es/transforms/data/join.js.map +1 -0
  693. package/es/transforms/data/kde.d.ts +2 -0
  694. package/es/transforms/data/kde.js +80 -0
  695. package/es/transforms/data/kde.js.map +1 -0
  696. package/es/transforms/data/map.d.ts +2 -0
  697. package/es/transforms/data/map.js +16 -0
  698. package/es/transforms/data/map.js.map +1 -0
  699. package/es/transforms/data/pick.d.ts +2 -0
  700. package/es/transforms/data/pick.js +15 -0
  701. package/es/transforms/data/pick.js.map +1 -0
  702. package/es/transforms/data/pie.d.ts +2 -0
  703. package/es/transforms/data/pie.js +18 -0
  704. package/es/transforms/data/pie.js.map +1 -0
  705. package/es/transforms/data/range.d.ts +4 -0
  706. package/es/transforms/data/range.js +9 -0
  707. package/es/transforms/data/range.js.map +1 -0
  708. package/es/transforms/data/sort.d.ts +2 -0
  709. package/es/transforms/data/sort.js +13 -0
  710. package/es/transforms/data/sort.js.map +1 -0
  711. package/es/transforms/data/stack.d.ts +2 -0
  712. package/es/transforms/data/stack.js +72 -0
  713. package/es/transforms/data/stack.js.map +1 -0
  714. package/es/transforms/data/unfold.d.ts +2 -0
  715. package/es/transforms/data/unfold.js +45 -0
  716. package/es/transforms/data/unfold.js.map +1 -0
  717. package/es/transforms/index.d.ts +23 -0
  718. package/es/transforms/index.js +205 -0
  719. package/es/transforms/index.js.map +1 -0
  720. package/es/transforms/mark/dodge.d.ts +2 -0
  721. package/es/transforms/mark/dodge.js +74 -0
  722. package/es/transforms/mark/dodge.js.map +1 -0
  723. package/es/transforms/mark/jitter.d.ts +4 -0
  724. package/es/transforms/mark/jitter.js +48 -0
  725. package/es/transforms/mark/jitter.js.map +1 -0
  726. package/es/transforms/mark/lttb-sample.d.ts +2 -0
  727. package/es/transforms/mark/lttb-sample.js +60 -0
  728. package/es/transforms/mark/lttb-sample.js.map +1 -0
  729. package/es/transforms/mark/mark-overlap.d.ts +2 -0
  730. package/es/transforms/mark/mark-overlap.js +71 -0
  731. package/es/transforms/mark/mark-overlap.js.map +1 -0
  732. package/es/transforms/mark/symmetry.d.ts +2 -0
  733. package/es/transforms/mark/symmetry.js +20 -0
  734. package/es/transforms/mark/symmetry.js.map +1 -0
  735. package/es/transforms/util/util.d.ts +5 -0
  736. package/es/transforms/util/util.js +33 -0
  737. package/es/transforms/util/util.js.map +1 -0
  738. package/es/transforms/view/identifier.d.ts +2 -0
  739. package/es/transforms/view/identifier.js +13 -0
  740. package/es/transforms/view/identifier.js.map +1 -0
  741. package/es/types/animate.d.ts +224 -0
  742. package/es/types/animate.js +2 -0
  743. package/es/types/animate.js.map +1 -0
  744. package/es/types/base.d.ts +36 -0
  745. package/es/types/base.js +2 -0
  746. package/es/types/base.js.map +1 -0
  747. package/es/types/component.d.ts +240 -0
  748. package/es/types/component.js +2 -0
  749. package/es/types/component.js.map +1 -0
  750. package/es/types/coordinate.d.ts +15 -0
  751. package/es/types/coordinate.js +2 -0
  752. package/es/types/coordinate.js.map +1 -0
  753. package/es/types/data.d.ts +55 -0
  754. package/es/types/data.js +1 -0
  755. package/es/types/data.js.map +1 -0
  756. package/es/types/dataflow.d.ts +13 -0
  757. package/es/types/dataflow.js +2 -0
  758. package/es/types/dataflow.js.map +1 -0
  759. package/es/types/element.d.ts +117 -0
  760. package/es/types/element.js +2 -0
  761. package/es/types/element.js.map +1 -0
  762. package/es/types/event.d.ts +58 -0
  763. package/es/types/event.js +2 -0
  764. package/es/types/event.js.map +1 -0
  765. package/es/types/glyph.d.ts +29 -0
  766. package/es/types/glyph.js +2 -0
  767. package/es/types/glyph.js.map +1 -0
  768. package/es/types/grammar.d.ts +184 -0
  769. package/es/types/grammar.js +2 -0
  770. package/es/types/grammar.js.map +1 -0
  771. package/es/types/hooks.d.ts +45 -0
  772. package/es/types/hooks.js +2 -0
  773. package/es/types/hooks.js.map +1 -0
  774. package/es/types/index.d.ts +22 -0
  775. package/es/types/index.js +44 -0
  776. package/es/types/index.js.map +1 -0
  777. package/es/types/layout.d.ts +5 -0
  778. package/es/types/layout.js +2 -0
  779. package/es/types/layout.js.map +1 -0
  780. package/es/types/mark.d.ts +344 -0
  781. package/es/types/mark.js +2 -0
  782. package/es/types/mark.js.map +1 -0
  783. package/es/types/morph.d.ts +29 -0
  784. package/es/types/morph.js +2 -0
  785. package/es/types/morph.js.map +1 -0
  786. package/es/types/plot.d.ts +326 -0
  787. package/es/types/plot.js +2 -0
  788. package/es/types/plot.js.map +1 -0
  789. package/es/types/projection.d.ts +61 -0
  790. package/es/types/projection.js +2 -0
  791. package/es/types/projection.js.map +1 -0
  792. package/es/types/renderer.d.ts +19 -0
  793. package/es/types/renderer.js +2 -0
  794. package/es/types/renderer.js.map +1 -0
  795. package/es/types/scale.d.ts +111 -0
  796. package/es/types/scale.js +2 -0
  797. package/es/types/scale.js.map +1 -0
  798. package/es/types/signal.d.ts +20 -0
  799. package/es/types/signal.js +2 -0
  800. package/es/types/signal.js.map +1 -0
  801. package/es/types/theme.d.ts +41 -0
  802. package/es/types/theme.js +2 -0
  803. package/es/types/theme.js.map +1 -0
  804. package/es/types/transform.d.ts +291 -0
  805. package/es/types/transform.js +2 -0
  806. package/es/types/transform.js.map +1 -0
  807. package/es/types/view.d.ts +217 -0
  808. package/es/types/view.js +2 -0
  809. package/es/types/view.js.map +1 -0
  810. package/es/util/data.d.ts +3 -0
  811. package/es/util/data.js +60 -0
  812. package/es/util/data.js.map +1 -0
  813. package/es/util/grammar-heap.d.ts +14 -0
  814. package/es/util/grammar-heap.js +58 -0
  815. package/es/util/grammar-heap.js.map +1 -0
  816. package/es/util/text.d.ts +19 -0
  817. package/es/util/text.js +25 -0
  818. package/es/util/text.js.map +1 -0
  819. package/es/util/unique-list.d.ts +12 -0
  820. package/es/util/unique-list.js +29 -0
  821. package/es/util/unique-list.js.map +1 -0
  822. package/es/view/View.d.ts +157 -0
  823. package/es/view/View.js +836 -0
  824. package/es/view/View.js.map +1 -0
  825. package/es/view/animate.d.ts +20 -0
  826. package/es/view/animate.js +98 -0
  827. package/es/view/animate.js.map +1 -0
  828. package/es/view/component.d.ts +26 -0
  829. package/es/view/component.js +64 -0
  830. package/es/view/component.js.map +1 -0
  831. package/es/view/constants.d.ts +17 -0
  832. package/es/view/constants.js +32 -0
  833. package/es/view/constants.js.map +1 -0
  834. package/es/view/coordinate.d.ts +23 -0
  835. package/es/view/coordinate.js +52 -0
  836. package/es/view/coordinate.js.map +1 -0
  837. package/es/view/data.d.ts +37 -0
  838. package/es/view/data.js +195 -0
  839. package/es/view/data.js.map +1 -0
  840. package/es/view/dataflow.d.ts +32 -0
  841. package/es/view/dataflow.js +141 -0
  842. package/es/view/dataflow.js.map +1 -0
  843. package/es/view/events.d.ts +4 -0
  844. package/es/view/events.js +26 -0
  845. package/es/view/events.js.map +1 -0
  846. package/es/view/glyph-meta.d.ts +29 -0
  847. package/es/view/glyph-meta.js +37 -0
  848. package/es/view/glyph-meta.js.map +1 -0
  849. package/es/view/glyph.d.ts +14 -0
  850. package/es/view/glyph.js +27 -0
  851. package/es/view/glyph.js.map +1 -0
  852. package/es/view/grammar-base.d.ts +46 -0
  853. package/es/view/grammar-base.js +165 -0
  854. package/es/view/grammar-base.js.map +1 -0
  855. package/es/view/grammar-record.d.ts +39 -0
  856. package/es/view/grammar-record.js +170 -0
  857. package/es/view/grammar-record.js.map +1 -0
  858. package/es/view/group.d.ts +13 -0
  859. package/es/view/group.js +39 -0
  860. package/es/view/group.js.map +1 -0
  861. package/es/view/index.d.ts +1 -0
  862. package/es/view/index.js +2 -0
  863. package/es/view/index.js.map +1 -0
  864. package/es/view/mark.d.ts +112 -0
  865. package/es/view/mark.js +604 -0
  866. package/es/view/mark.js.map +1 -0
  867. package/es/view/scale.d.ts +26 -0
  868. package/es/view/scale.js +82 -0
  869. package/es/view/scale.js.map +1 -0
  870. package/es/view/signal.d.ts +18 -0
  871. package/es/view/signal.js +52 -0
  872. package/es/view/signal.js.map +1 -0
  873. package/package.json +67 -0
@@ -0,0 +1,169 @@
1
+ import { isContinuous } from "@visactor/vscale";
2
+
3
+ import { DiscreteLegend, ColorContinuousLegend, SizeContinuousLegend, LegendEvent } from "@visactor/vrender-components";
4
+
5
+ import { array, isString, merge, last } from "@visactor/vutils";
6
+
7
+ import { ComponentDataRank, ComponentEnum, LegendEnum } from "../graph";
8
+
9
+ import { parseColor } from "../parse/util";
10
+
11
+ import { ScaleComponent } from "./scale";
12
+
13
+ import { invokeEncoder } from "../graph/mark/encode";
14
+
15
+ import { Factory } from "../core/factory";
16
+
17
+ export const generateDiscreteLegendAttributes = (scale, theme, addition, shapeScale) => {
18
+ var _a;
19
+ const legendTheme = null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.discreteLegend;
20
+ if (!scale) return merge({}, legendTheme, null != addition ? addition : {});
21
+ const items = Array.from(new Set(array(scale.domain()))).map(((item, index) => {
22
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
23
+ const value = scale.scale(item), color = parseColor(value), shape = color ? Object.assign(Object.assign({}, null !== (_e = null === (_d = null === (_c = null === (_b = null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.discreteLegend) || void 0 === _b ? void 0 : _b.items) || void 0 === _c ? void 0 : _c[0]) || void 0 === _d ? void 0 : _d.shape) && void 0 !== _e ? _e : {}), {
24
+ fill: color,
25
+ stroke: color
26
+ }) : null !== (_k = null === (_j = null === (_h = null === (_g = null === (_f = null == theme ? void 0 : theme.components) || void 0 === _f ? void 0 : _f.discreteLegend) || void 0 === _g ? void 0 : _g.items) || void 0 === _h ? void 0 : _h[0]) || void 0 === _j ? void 0 : _j.shape) && void 0 !== _k ? _k : {};
27
+ return shapeScale && Object.assign(shape, {
28
+ symbolType: shapeScale.scale(item)
29
+ }), {
30
+ label: item.toString(),
31
+ id: item,
32
+ shape: shape,
33
+ index: index
34
+ };
35
+ }));
36
+ return merge({}, legendTheme, {
37
+ items: items
38
+ }, null != addition ? addition : {});
39
+ };
40
+
41
+ export const generateColorLegendAttributes = (scale, theme, addition) => {
42
+ var _a;
43
+ const legendTheme = null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.colorLegend;
44
+ if (!scale) return merge({}, legendTheme, null != addition ? addition : {});
45
+ const domain = scale.domain();
46
+ return merge({}, legendTheme, {
47
+ colors: scale.range().slice(),
48
+ min: domain[0],
49
+ max: last(domain)
50
+ }, null != addition ? addition : {});
51
+ };
52
+
53
+ export const generateSizeLegendAttributes = (scale, theme, addition) => {
54
+ var _a;
55
+ const legendTheme = null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.sizeLegend;
56
+ if (!scale) return merge({}, legendTheme, null != addition ? addition : {});
57
+ const domain = scale.domain(), attributes = {
58
+ min: domain[0],
59
+ max: domain[domain.length - 1],
60
+ value: [ domain[0], domain[domain.length - 1] ]
61
+ };
62
+ return merge({}, legendTheme, attributes, null != addition ? addition : {});
63
+ };
64
+
65
+ export class Legend extends ScaleComponent {
66
+ constructor(view, group) {
67
+ super(view, ComponentEnum.legend, group), this.spec.componentType = ComponentEnum.legend,
68
+ this.spec.legendType = "auto";
69
+ }
70
+ parseAddition(spec) {
71
+ var _a, _b;
72
+ return this.shapeScale(spec.shapeScale), super.parseAddition(spec), this.target(null === (_a = spec.target) || void 0 === _a ? void 0 : _a.data, null === (_b = spec.target) || void 0 === _b ? void 0 : _b.filter),
73
+ this.legendType(spec.legendType), this;
74
+ }
75
+ scale(scale) {
76
+ return super.scale(scale), this._legendComponentType = null, this;
77
+ }
78
+ shapeScale(shapeScale) {
79
+ if (this.spec.shapeScale) {
80
+ const lastScaleGrammar = isString(this.spec.shapeScale) ? this.view.getScaleById(this.spec.shapeScale) : this.spec.shapeScale;
81
+ this.detach(lastScaleGrammar), this.spec.shapeScale = void 0;
82
+ }
83
+ const scaleGrammar = isString(shapeScale) ? this.view.getScaleById(shapeScale) : shapeScale;
84
+ return this.spec.shapeScale = scaleGrammar, this.attach(scaleGrammar), this.commit(),
85
+ this;
86
+ }
87
+ legendType(legendType) {
88
+ return this.spec.legendType = legendType, this._legendComponentType = null, this._prepareRejoin(),
89
+ this.commit(), this;
90
+ }
91
+ isContinuousLegend() {
92
+ return this._getLegendComponentType() !== LegendEnum.discreteLegend;
93
+ }
94
+ target(data, filter) {
95
+ var _a;
96
+ const isContinuous = this.isContinuousLegend(), eventName = isContinuous ? "change" : LegendEvent.legendItemClick, lastData = null === (_a = this.spec.target) || void 0 === _a ? void 0 : _a.data, lastDataGrammar = isString(lastData) ? this.view.getDataById(lastData) : lastData;
97
+ lastDataGrammar && this.view.removeEventListener(eventName, this._filterCallback),
98
+ this.spec.target = void 0;
99
+ const dataGrammar = isString(data) ? this.view.getDataById(data) : data, dataFilter = isString(filter) ? isContinuous ? (datum, filterValue) => datum[filter] >= filterValue.start && datum[filter] <= filterValue.end : (datum, filterValue) => filterValue.includes(datum[filter]) : filter;
100
+ return this._filterData(lastDataGrammar, dataGrammar, ComponentDataRank.legend, (event => isContinuous ? {
101
+ start: event.detail.value[0],
102
+ end: event.detail.value[1]
103
+ } : event.detail.currentSelected), dataFilter), dataGrammar && (this.view.addEventListener(eventName, this._filterCallback),
104
+ this.spec.target = {
105
+ data: dataGrammar,
106
+ filter: filter
107
+ }), this;
108
+ }
109
+ setSelected(selectedValues) {
110
+ var _a, _b;
111
+ return (null === (_b = null === (_a = this.elements[0]) || void 0 === _a ? void 0 : _a.getGraphicItem) || void 0 === _b ? void 0 : _b.call(_a)).setSelected(selectedValues),
112
+ this;
113
+ }
114
+ addGraphicItem(attrs, groupKey) {
115
+ const graphicItem = Factory.createGraphicComponent(this._getLegendComponentType(), attrs);
116
+ return super.addGraphicItem(attrs, groupKey, graphicItem);
117
+ }
118
+ release() {
119
+ this._filterCallback && this.view.removeEventListener("change", this._filterCallback),
120
+ super.release();
121
+ }
122
+ _updateComponentEncoders() {
123
+ const scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale, shapeScaleGrammar = isString(this.spec.shapeScale) ? this.view.getScaleById(this.spec.shapeScale) : this.spec.shapeScale, encoders = Object.assign({
124
+ update: {}
125
+ }, this.spec.encode), componentEncoders = Object.keys(encoders).reduce(((res, state) => {
126
+ const encoder = encoders[state];
127
+ return encoder && (res[state] = {
128
+ callback: (datum, element, parameters) => {
129
+ var _a, _b;
130
+ const theme = this.view.getCurrentTheme(), addition = invokeEncoder(encoder, datum, element, parameters), scale = null === (_a = null == scaleGrammar ? void 0 : scaleGrammar.getScale) || void 0 === _a ? void 0 : _a.call(scaleGrammar);
131
+ switch (this._getLegendComponentType()) {
132
+ case LegendEnum.discreteLegend:
133
+ return generateDiscreteLegendAttributes(scale, theme, addition, null === (_b = null == shapeScaleGrammar ? void 0 : shapeScaleGrammar.getScale) || void 0 === _b ? void 0 : _b.call(shapeScaleGrammar));
134
+
135
+ case LegendEnum.colorLegend:
136
+ return generateColorLegendAttributes(scale, theme, addition);
137
+
138
+ case LegendEnum.sizeLegend:
139
+ return generateSizeLegendAttributes(scale, theme, addition);
140
+ }
141
+ return addition;
142
+ }
143
+ }), res;
144
+ }), {});
145
+ this._encoders = componentEncoders;
146
+ }
147
+ _getLegendComponentType() {
148
+ var _a;
149
+ if (this._legendComponentType) return this._legendComponentType;
150
+ if (this.spec.legendType && "auto" !== this.spec.legendType) this._legendComponentType = "color" === this.spec.legendType ? "colorLegend" : "size" === this.spec.legendType ? "sizeLegend" : "discreteLegend"; else {
151
+ const scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale, scaleType = null === (_a = null == scaleGrammar ? void 0 : scaleGrammar.getScaleType) || void 0 === _a ? void 0 : _a.call(scaleGrammar);
152
+ if (scaleType && isContinuous(scaleType)) {
153
+ const range = scaleGrammar.getScale().range();
154
+ parseColor(null == range ? void 0 : range[0]) ? this._legendComponentType = LegendEnum.colorLegend : this._legendComponentType = LegendEnum.sizeLegend;
155
+ } else this._legendComponentType = LegendEnum.discreteLegend;
156
+ }
157
+ return this._legendComponentType;
158
+ }
159
+ }
160
+
161
+ Legend.componentType = ComponentEnum.legend;
162
+
163
+ export const registerLegend = () => {
164
+ Factory.registerGraphicComponent(LegendEnum.discreteLegend, (attrs => new DiscreteLegend(attrs))),
165
+ Factory.registerGraphicComponent(LegendEnum.colorLegend, (attrs => new ColorContinuousLegend(attrs))),
166
+ Factory.registerGraphicComponent(LegendEnum.sizeLegend, (attrs => new SizeContinuousLegend(attrs))),
167
+ Factory.registerComponent(ComponentEnum.legend, Legend);
168
+ };
169
+ //# sourceMappingURL=legend.js.map
@@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wB,CAC9B,UAAU,CAAC,UAAU,EACrB,CAAC,KAA2B,EAAE,EAAE,CAAC,IAAI,oBAAoB,CAAC,KAAK,CAAwB,CACxF,CAAC;IAEF,OAAO,CAAC,iBAAiB,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1D,CAAC,CAAC","file":"legend.js","sourcesContent":["import type { IGraphic } from '@visactor/vrender';\nimport type { IBaseScale } from '@visactor/vscale';\n// eslint-disable-next-line no-duplicate-imports\nimport { isContinuous } from '@visactor/vscale';\nimport type { DiscreteLegendAttrs, ColorLegendAttributes, SizeLegendAttributes } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { DiscreteLegend, ColorContinuousLegend, SizeContinuousLegend, LegendEvent } from '@visactor/vrender-components';\nimport { array, isString, merge, last } from '@visactor/vutils';\nimport { ComponentDataRank, ComponentEnum, LegendEnum } from '../graph';\nimport type {\n BaseSignleEncodeSpec,\n IData,\n IElement,\n IGroupMark,\n IScale,\n ITheme,\n IView,\n Nil,\n RecursivePartial,\n StateEncodeSpec\n} from '../types';\nimport type { ILegend, LegendSpec, LegendType } from '../types/component';\nimport { parseColor } from '../parse/util';\nimport { ScaleComponent } from './scale';\nimport { invokeEncoder } from '../graph/mark/encode';\nimport { Factory } from '../core/factory';\n\nexport const generateDiscreteLegendAttributes = (\n scale: IBaseScale,\n theme?: ITheme,\n addition?: RecursivePartial<DiscreteLegendAttrs>,\n shapeScale?: IBaseScale\n): DiscreteLegendAttrs => {\n const legendTheme = theme?.components?.discreteLegend;\n if (!scale) {\n return merge({}, legendTheme, addition ?? {});\n }\n // get domain items without repetitions\n const domainItems = Array.from(new Set(array(scale.domain())));\n const items = domainItems.map((item, index) => {\n const value = scale.scale(item);\n const color = parseColor(value);\n const shape = color\n ? {\n ...(theme?.components?.discreteLegend?.items?.[0]?.shape ?? {}),\n fill: color,\n stroke: color\n }\n : theme?.components?.discreteLegend?.items?.[0]?.shape ?? {};\n\n if (shapeScale) {\n Object.assign(shape, { symbolType: shapeScale.scale(item) });\n }\n\n return {\n label: item.toString(),\n id: item,\n shape,\n index\n };\n });\n return merge({}, legendTheme, { items }, addition ?? {});\n};\n\nexport const generateColorLegendAttributes = (\n scale: IBaseScale,\n theme?: ITheme,\n addition?: RecursivePartial<ColorLegendAttributes>\n): ColorLegendAttributes => {\n const legendTheme = theme?.components?.colorLegend;\n if (!scale) {\n return merge({}, legendTheme, addition ?? {});\n }\n const domain = scale.domain();\n return merge({}, legendTheme, { colors: scale.range().slice(), min: domain[0], max: last(domain) }, addition ?? {});\n};\n\nexport const generateSizeLegendAttributes = (\n scale: IBaseScale,\n theme?: ITheme,\n addition?: RecursivePartial<SizeLegendAttributes>\n): SizeLegendAttributes => {\n const legendTheme = theme?.components?.sizeLegend;\n if (!scale) {\n return merge({}, legendTheme, addition ?? {});\n }\n const domain = scale.domain();\n const attributes = {\n min: domain[0],\n max: domain[domain.length - 1],\n value: [domain[0], domain[domain.length - 1]]\n };\n return merge({}, legendTheme, attributes, addition ?? {});\n};\n\nexport class Legend extends ScaleComponent implements ILegend {\n static readonly componentType: string = ComponentEnum.legend;\n protected declare spec: LegendSpec;\n\n private _legendComponentType: keyof typeof LegendEnum;\n\n constructor(view: IView, group?: IGroupMark) {\n super(view, ComponentEnum.legend, group);\n this.spec.componentType = ComponentEnum.legend;\n this.spec.legendType = 'auto';\n }\n\n protected parseAddition(spec: LegendSpec) {\n this.shapeScale(spec.shapeScale);\n super.parseAddition(spec);\n this.target(spec.target?.data, spec.target?.filter);\n this.legendType(spec.legendType);\n return this;\n }\n\n scale(scale?: IScale | string | Nil) {\n super.scale(scale);\n this._legendComponentType = null;\n return this;\n }\n\n shapeScale(shapeScale: LegendSpec['shapeScale']) {\n if (this.spec.shapeScale) {\n const lastScaleGrammar = isString(this.spec.shapeScale)\n ? this.view.getScaleById(this.spec.shapeScale)\n : this.spec.shapeScale;\n this.detach(lastScaleGrammar);\n this.spec.shapeScale = undefined;\n }\n const scaleGrammar = isString(shapeScale) ? this.view.getScaleById(shapeScale) : shapeScale;\n this.spec.shapeScale = scaleGrammar;\n this.attach(scaleGrammar);\n\n this.commit();\n return this;\n }\n\n legendType(legendType: LegendType | Nil) {\n this.spec.legendType = legendType;\n // clear legend type when spec is changed\n this._legendComponentType = null;\n this._prepareRejoin();\n this.commit();\n return this;\n }\n\n isContinuousLegend() {\n return this._getLegendComponentType() !== LegendEnum.discreteLegend;\n }\n\n target(data: IData | string | Nil, filter: string | ((datum: any, legendValues: any) => boolean) | Nil) {\n const isContinuous = this.isContinuousLegend();\n const eventName = isContinuous ? 'change' : LegendEvent.legendItemClick;\n const lastData = this.spec.target?.data;\n const lastDataGrammar = isString(lastData) ? this.view.getDataById(lastData) : lastData;\n if (lastDataGrammar) {\n this.view.removeEventListener(eventName, this._filterCallback);\n }\n this.spec.target = undefined;\n const dataGrammar = isString(data) ? this.view.getDataById(data) : data;\n const getFilterValue = (event: any) =>\n isContinuous ? { start: event.detail.value[0], end: event.detail.value[1] } : event.detail.currentSelected;\n const dataFilter = isString(filter)\n ? isContinuous\n ? (datum: any, filterValue: { start: number; end: number }) =>\n datum[filter] >= filterValue.start && datum[filter] <= filterValue.end\n : (datum: any, filterValue: any[]) => filterValue.includes(datum[filter])\n : filter;\n this._filterData(lastDataGrammar, dataGrammar, ComponentDataRank.legend, getFilterValue, dataFilter);\n if (dataGrammar) {\n this.view.addEventListener(eventName, this._filterCallback);\n this.spec.target = { data: dataGrammar, filter };\n }\n return this;\n }\n\n setSelected(selectedValues: any[]) {\n // FIXME: provide ILegend interface in vis-component\n const legend = this.elements[0]?.getGraphicItem?.() as unknown as DiscreteLegend;\n legend.setSelected(selectedValues);\n return this;\n }\n\n addGraphicItem(attrs: any, groupKey?: string) {\n const graphicItem = Factory.createGraphicComponent(this._getLegendComponentType(), attrs);\n return super.addGraphicItem(attrs, groupKey, graphicItem);\n }\n\n release() {\n if (this._filterCallback) {\n this.view.removeEventListener('change', this._filterCallback);\n }\n super.release();\n }\n\n protected _updateComponentEncoders() {\n const scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n const shapeScaleGrammar = isString(this.spec.shapeScale)\n ? this.view.getScaleById(this.spec.shapeScale)\n : this.spec.shapeScale;\n const encoders = Object.assign({ update: {} }, this.spec.encode);\n const componentEncoders: StateEncodeSpec = Object.keys(encoders).reduce((res, state) => {\n const encoder = encoders[state];\n if (encoder) {\n res[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const theme = this.view.getCurrentTheme();\n const addition = invokeEncoder(encoder as BaseSignleEncodeSpec, datum, element, parameters);\n const scale = scaleGrammar?.getScale?.();\n switch (this._getLegendComponentType()) {\n case LegendEnum.discreteLegend:\n return generateDiscreteLegendAttributes(scale, theme, addition, shapeScaleGrammar?.getScale?.());\n case LegendEnum.colorLegend:\n return generateColorLegendAttributes(scale, theme, addition);\n case LegendEnum.sizeLegend:\n return generateSizeLegendAttributes(scale, theme, addition);\n }\n return addition;\n }\n };\n }\n return res;\n }, {});\n this._encoders = componentEncoders;\n }\n\n private _getLegendComponentType() {\n if (this._legendComponentType) {\n return this._legendComponentType;\n }\n\n // compute legend component type when needed\n if (!this.spec.legendType || this.spec.legendType === 'auto') {\n const scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n const scaleType = scaleGrammar?.getScaleType?.();\n if (scaleType && isContinuous(scaleType)) {\n const range: any[] = scaleGrammar.getScale().range();\n if (parseColor(range?.[0])) {\n this._legendComponentType = LegendEnum.colorLegend;\n } else {\n this._legendComponentType = LegendEnum.sizeLegend;\n }\n } else {\n this._legendComponentType = LegendEnum.discreteLegend;\n }\n } else {\n this._legendComponentType =\n this.spec.legendType === 'color'\n ? 'colorLegend'\n : this.spec.legendType === 'size'\n ? 'sizeLegend'\n : 'discreteLegend';\n }\n return this._legendComponentType;\n }\n}\n\nexport const registerLegend = () => {\n Factory.registerGraphicComponent(\n LegendEnum.discreteLegend,\n (attrs: DiscreteLegendAttrs) => new DiscreteLegend(attrs) as unknown as IGraphic\n );\n Factory.registerGraphicComponent(\n LegendEnum.colorLegend,\n (attrs: ColorLegendAttributes) => new ColorContinuousLegend(attrs) as unknown as IGraphic\n );\n Factory.registerGraphicComponent(\n LegendEnum.sizeLegend,\n (attrs: SizeLegendAttributes) => new SizeContinuousLegend(attrs) as unknown as IGraphic\n );\n\n Factory.registerComponent(ComponentEnum.legend, Legend);\n};\n"]}
@@ -0,0 +1,25 @@
1
+ import type { ContinuousPlayerAttributes, DiscretePlayerAttributes } from '@visactor/vrender-components';
2
+ import type { IData, IGroupMark, ITheme, IView, Nil, RecursivePartial } from '../types';
3
+ import type { IPlayer, PlayerFilterValue, PlayerSpec, PlayerType } from '../types/component';
4
+ import { Component } from '../view/component';
5
+ export declare const generateContinuousPlayerAttributes: (data: any[], theme?: ITheme, addition?: RecursivePartial<ContinuousPlayerAttributes>) => ContinuousPlayerAttributes;
6
+ export declare const generateDiscretePlayerAttributes: (data: any[], theme?: ITheme, addition?: RecursivePartial<DiscretePlayerAttributes>) => DiscretePlayerAttributes;
7
+ export declare class Player extends Component implements IPlayer {
8
+ static readonly componentType: string;
9
+ protected spec: PlayerSpec;
10
+ protected _filterValue: PlayerFilterValue;
11
+ private _playerComponentType;
12
+ constructor(view: IView, group?: IGroupMark);
13
+ protected parseAddition(spec: PlayerSpec): this;
14
+ playerType(playerType: PlayerType): this;
15
+ target(data: IData | string | Nil, source: IData | string | any[] | Nil): this;
16
+ play(): this;
17
+ pause(): this;
18
+ backward(): this;
19
+ forward(): this;
20
+ addGraphicItem(attrs: any, groupKey?: string, newGraphicItem?: any): any;
21
+ release(): void;
22
+ protected _updateComponentEncoders(): void;
23
+ private _getPlayerComponentType;
24
+ }
25
+ export declare const registerPlayer: () => void;
@@ -0,0 +1,136 @@
1
+ import { isArray, isString, merge } from "@visactor/vutils";
2
+
3
+ import { PlayerEventEnum } from "@visactor/vrender-components";
4
+
5
+ import { ContinuousPlayer, DiscretePlayer } from "@visactor/vrender-components";
6
+
7
+ import { ComponentDataRank, ComponentEnum, PlayerEnum } from "../graph";
8
+
9
+ import { Component } from "../view/component";
10
+
11
+ import { invokeEncoder } from "../graph/mark/encode";
12
+
13
+ import { Factory } from "../core/factory";
14
+
15
+ export const generateContinuousPlayerAttributes = (data, theme, addition) => {
16
+ var _a;
17
+ const playerTheme = null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.continuousPlayer;
18
+ return merge({}, playerTheme, {
19
+ data: data,
20
+ dataIndex: 0
21
+ }, null != addition ? addition : {});
22
+ };
23
+
24
+ export const generateDiscretePlayerAttributes = (data, theme, addition) => {
25
+ var _a;
26
+ const playerTheme = null === (_a = null == theme ? void 0 : theme.components) || void 0 === _a ? void 0 : _a.discretePlayer;
27
+ return merge({}, playerTheme, {
28
+ data: data,
29
+ dataIndex: 0
30
+ }, null != addition ? addition : {});
31
+ };
32
+
33
+ export class Player extends Component {
34
+ constructor(view, group) {
35
+ super(view, ComponentEnum.player, group), this.spec.componentType = ComponentEnum.player,
36
+ this.spec.playerType = "auto";
37
+ }
38
+ parseAddition(spec) {
39
+ var _a, _b;
40
+ return super.parseAddition(spec), this.playerType(spec.playerType), this.target(null === (_a = spec.target) || void 0 === _a ? void 0 : _a.data, null === (_b = spec.target) || void 0 === _b ? void 0 : _b.source),
41
+ this;
42
+ }
43
+ playerType(playerType) {
44
+ return this.spec.playerType = playerType, this._playerComponentType = null, this._prepareRejoin(),
45
+ this.commit(), this;
46
+ }
47
+ target(data, source) {
48
+ var _a, _b, _c;
49
+ if (null === (_a = this.spec.target) || void 0 === _a ? void 0 : _a.source) {
50
+ const lastSource = null === (_b = this.spec.target) || void 0 === _b ? void 0 : _b.source, lastSourceDataGrammar = isArray(lastSource) ? null : isString(lastSource) ? this.view.getDataById(lastSource) : lastSource;
51
+ this.detach(lastSourceDataGrammar);
52
+ }
53
+ const sourceDataGrammar = isArray(source) ? null : isString(source) ? this.view.getDataById(source) : source;
54
+ this.attach(sourceDataGrammar);
55
+ const lastData = null === (_c = this.spec.target) || void 0 === _c ? void 0 : _c.data, lastDataGrammar = isString(lastData) ? this.view.getDataById(lastData) : lastData;
56
+ lastDataGrammar && this.view.removeEventListener(PlayerEventEnum.OnChange, this._filterCallback),
57
+ this.spec.target = void 0;
58
+ const dataGrammar = isString(data) ? this.view.getDataById(data) : data;
59
+ return this._filterData(lastDataGrammar, dataGrammar, ComponentDataRank.player, (event => ({
60
+ index: event.detail.index,
61
+ value: event.detail.value
62
+ })), void 0, ((data, filterValue) => filterValue.value)), dataGrammar && (this.view.addEventListener(PlayerEventEnum.OnChange, this._filterCallback),
63
+ this.spec.target = {
64
+ data: dataGrammar,
65
+ source: source
66
+ }), this;
67
+ }
68
+ play() {
69
+ var _a, _b;
70
+ return (null === (_b = null === (_a = this.elements[0]) || void 0 === _a ? void 0 : _a.getGraphicItem) || void 0 === _b ? void 0 : _b.call(_a)).play(),
71
+ this;
72
+ }
73
+ pause() {
74
+ var _a, _b;
75
+ return (null === (_b = null === (_a = this.elements[0]) || void 0 === _a ? void 0 : _a.getGraphicItem) || void 0 === _b ? void 0 : _b.call(_a)).pause(),
76
+ this;
77
+ }
78
+ backward() {
79
+ var _a, _b;
80
+ return (null === (_b = null === (_a = this.elements[0]) || void 0 === _a ? void 0 : _a.getGraphicItem) || void 0 === _b ? void 0 : _b.call(_a)).backward(),
81
+ this;
82
+ }
83
+ forward() {
84
+ var _a, _b;
85
+ return (null === (_b = null === (_a = this.elements[0]) || void 0 === _a ? void 0 : _a.getGraphicItem) || void 0 === _b ? void 0 : _b.call(_a)).forward(),
86
+ this;
87
+ }
88
+ addGraphicItem(attrs, groupKey, newGraphicItem) {
89
+ const initialAttributes = merge({
90
+ slider: {
91
+ handlerStyle: {
92
+ size: 16
93
+ }
94
+ }
95
+ }, attrs), graphicItem = null != newGraphicItem ? newGraphicItem : Factory.createGraphicComponent(this._getPlayerComponentType(), initialAttributes);
96
+ return super.addGraphicItem(initialAttributes, groupKey, graphicItem);
97
+ }
98
+ release() {
99
+ this._filterCallback && this.view.removeEventListener("change", this._filterCallback),
100
+ super.release();
101
+ }
102
+ _updateComponentEncoders() {
103
+ const encoders = Object.assign({
104
+ update: {}
105
+ }, this.spec.encode), componentEncoders = Object.keys(encoders).reduce(((res, state) => {
106
+ const encoder = encoders[state];
107
+ return encoder && (res[state] = {
108
+ callback: (datum, element, parameters) => {
109
+ var _a, _b;
110
+ const theme = this.view.getCurrentTheme(), addition = invokeEncoder(encoder, datum, element, parameters), source = null === (_a = this.spec.target) || void 0 === _a ? void 0 : _a.source, sourceDataGrammar = isArray(source) ? null : isString(source) ? this.view.getDataById(source) : source, sourceData = isArray(source) ? source : null !== (_b = null == sourceDataGrammar ? void 0 : sourceDataGrammar.getValue()) && void 0 !== _b ? _b : [];
111
+ switch (this._getPlayerComponentType()) {
112
+ case "continuousPlayer":
113
+ return generateContinuousPlayerAttributes(sourceData, theme, addition);
114
+
115
+ case "discretePlayer":
116
+ return generateDiscretePlayerAttributes(sourceData, theme, addition);
117
+ }
118
+ }
119
+ }), res;
120
+ }), {});
121
+ this._encoders = componentEncoders;
122
+ }
123
+ _getPlayerComponentType() {
124
+ return this._playerComponentType || (this.spec.playerType && "auto" !== this.spec.playerType ? this._playerComponentType = "discrete" === this.spec.playerType ? "discretePlayer" : "continuous" === this.spec.playerType ? "continuousPlayer" : "discretePlayer" : this._playerComponentType = "discretePlayer"),
125
+ this._playerComponentType;
126
+ }
127
+ }
128
+
129
+ Player.componentType = ComponentEnum.player;
130
+
131
+ export const registerPlayer = () => {
132
+ Factory.registerGraphicComponent(PlayerEnum.continuousPlayer, (attrs => new ContinuousPlayer(attrs))),
133
+ Factory.registerGraphicComponent(PlayerEnum.discretePlayer, (attrs => new DiscretePlayer(attrs))),
134
+ Factory.registerComponent(ComponentEnum.player, Player);
135
+ };
136
+ //# sourceMappingURL=player.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/component/player.ts"],"names":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AO,CAAC,wBAAwB,CAC9B,UAAU,CAAC,gBAAgB,EAC3B,CAAC,KAAiC,EAAE,EAAE,CAAC,IAAI,gBAAgB,CAAC,KAAK,CAAwB,CAC1F,CAAC;IACF,OAAO,CAAC,wBAAwB,CAC9B,UAAU,CAAC,cAAc,EACzB,CAAC,KAA+B,EAAE,EAAE,CAAC,IAAI,cAAc,CAAC,KAAK,CAAwB,CACtF,CAAC;IAEF,OAAO,CAAC,iBAAiB,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC1D,CAAC,CAAC","file":"player.js","sourcesContent":["import { isArray, isString, merge } from '@visactor/vutils';\nimport type { IGraphic } from '@visactor/vrender';\nimport type {\n ContinuousPlayerAttributes,\n DiscretePlayerAttributes,\n IDiscretePlayer\n} from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { PlayerEventEnum } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport { ContinuousPlayer, DiscretePlayer } from '@visactor/vrender-components';\nimport type {\n BaseSignleEncodeSpec,\n IData,\n IElement,\n IGroupMark,\n ITheme,\n IView,\n Nil,\n RecursivePartial,\n StateEncodeSpec\n} from '../types';\nimport { ComponentDataRank, ComponentEnum, PlayerEnum } from '../graph';\nimport type { IPlayer, PlayerFilterValue, PlayerSpec, PlayerType } from '../types/component';\nimport { Component } from '../view/component';\nimport { invokeEncoder } from '../graph/mark/encode';\nimport { Factory } from '../core/factory';\n\nexport const generateContinuousPlayerAttributes = (\n data: any[],\n theme?: ITheme,\n addition?: RecursivePartial<ContinuousPlayerAttributes>\n): ContinuousPlayerAttributes => {\n const playerTheme = theme?.components?.continuousPlayer;\n return merge({}, playerTheme, { data, dataIndex: 0 }, addition ?? {});\n};\n\nexport const generateDiscretePlayerAttributes = (\n data: any[],\n theme?: ITheme,\n addition?: RecursivePartial<DiscretePlayerAttributes>\n): DiscretePlayerAttributes => {\n const playerTheme = theme?.components?.discretePlayer;\n return merge({}, playerTheme, { data, dataIndex: 0 }, addition ?? {});\n};\n\nexport class Player extends Component implements IPlayer {\n static readonly componentType: string = ComponentEnum.player;\n protected declare spec: PlayerSpec;\n protected declare _filterValue: PlayerFilterValue;\n\n private _playerComponentType: keyof typeof PlayerEnum;\n\n constructor(view: IView, group?: IGroupMark) {\n super(view, ComponentEnum.player, group);\n this.spec.componentType = ComponentEnum.player;\n this.spec.playerType = 'auto';\n }\n\n protected parseAddition(spec: PlayerSpec) {\n super.parseAddition(spec);\n this.playerType(spec.playerType);\n this.target(spec.target?.data, spec.target?.source);\n return this;\n }\n\n playerType(playerType: PlayerType) {\n this.spec.playerType = playerType;\n // clear legend type when spec is changed\n this._playerComponentType = null;\n this._prepareRejoin();\n this.commit();\n return this;\n }\n\n target(data: IData | string | Nil, source: IData | string | any[] | Nil) {\n if (this.spec.target?.source) {\n const lastSource = this.spec.target?.source;\n const lastSourceDataGrammar = isArray(lastSource)\n ? null\n : isString(lastSource)\n ? this.view.getDataById(lastSource)\n : lastSource;\n this.detach(lastSourceDataGrammar);\n }\n const sourceDataGrammar = isArray(source) ? null : isString(source) ? this.view.getDataById(source) : source;\n this.attach(sourceDataGrammar);\n\n const lastData = this.spec.target?.data;\n const lastDataGrammar = isString(lastData) ? this.view.getDataById(lastData) : lastData;\n if (lastDataGrammar) {\n this.view.removeEventListener(PlayerEventEnum.OnChange, this._filterCallback);\n }\n this.spec.target = undefined;\n const dataGrammar = isString(data) ? this.view.getDataById(data) : data;\n const getFilterValue = (event: any) => ({ index: event.detail.index, value: event.detail.value });\n const dataTransform = (data: any[], filterValue: PlayerFilterValue) => filterValue.value;\n this._filterData(lastDataGrammar, dataGrammar, ComponentDataRank.player, getFilterValue, undefined, dataTransform);\n if (dataGrammar) {\n this.view.addEventListener(PlayerEventEnum.OnChange, this._filterCallback);\n this.spec.target = { data: dataGrammar, source };\n }\n return this;\n }\n\n play() {\n // FIXME: unite IDiscretePlayer and IContinuousPlayer interface in vis-component\n const datazoom = this.elements[0]?.getGraphicItem?.() as unknown as IDiscretePlayer;\n datazoom.play();\n return this;\n }\n\n pause() {\n // FIXME: unite IDiscretePlayer and IContinuousPlayer interface in vis-component\n const datazoom = this.elements[0]?.getGraphicItem?.() as unknown as IDiscretePlayer;\n datazoom.pause();\n return this;\n }\n\n backward() {\n // FIXME: unite IDiscretePlayer and IContinuousPlayer interface in vis-component\n const datazoom = this.elements[0]?.getGraphicItem?.() as unknown as IDiscretePlayer;\n datazoom.backward();\n return this;\n }\n\n forward() {\n // FIXME: unite IDiscretePlayer and IContinuousPlayer interface in vis-component\n const datazoom = this.elements[0]?.getGraphicItem?.() as unknown as IDiscretePlayer;\n datazoom.forward();\n return this;\n }\n\n addGraphicItem(attrs: any, groupKey?: string, newGraphicItem?: any) {\n // FIXME: vis-component should handle the situation when handlerStyle is not set\n const defaultAttributes = { slider: { handlerStyle: { size: 16 } } };\n const initialAttributes = merge(defaultAttributes, attrs);\n const graphicItem =\n newGraphicItem ?? Factory.createGraphicComponent(this._getPlayerComponentType(), initialAttributes);\n return super.addGraphicItem(initialAttributes, groupKey, graphicItem);\n }\n\n release() {\n if (this._filterCallback) {\n this.view.removeEventListener('change', this._filterCallback);\n }\n super.release();\n }\n\n protected _updateComponentEncoders() {\n const encoders = Object.assign({ update: {} }, this.spec.encode);\n const componentEncoders: StateEncodeSpec = Object.keys(encoders).reduce((res, state) => {\n const encoder = encoders[state];\n if (encoder) {\n res[state] = {\n callback: (datum: any, element: IElement, parameters: any) => {\n const theme = this.view.getCurrentTheme();\n const addition = invokeEncoder(encoder as BaseSignleEncodeSpec, datum, element, parameters);\n const source = this.spec.target?.source;\n const sourceDataGrammar = isArray(source)\n ? null\n : isString(source)\n ? this.view.getDataById(source)\n : source;\n const sourceData = isArray(source) ? source : sourceDataGrammar?.getValue() ?? [];\n switch (this._getPlayerComponentType()) {\n case 'continuousPlayer':\n return generateContinuousPlayerAttributes(sourceData, theme, addition);\n case 'discretePlayer':\n return generateDiscretePlayerAttributes(sourceData, theme, addition);\n }\n }\n };\n }\n return res;\n }, {});\n this._encoders = componentEncoders;\n }\n\n private _getPlayerComponentType() {\n if (this._playerComponentType) {\n return this._playerComponentType;\n }\n\n // compute legend component type when needed\n if (!this.spec.playerType || this.spec.playerType === 'auto') {\n // const scaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n // const scaleType = scaleGrammar?.getScaleType?.();\n // if (scaleType && isContinuous(scaleType)) {\n // const range: any[] = scaleGrammar.getScale().range();\n // if (parseColor(range?.[0])) {\n // this._legendComponentType = LegendEnum.colorLegend;\n // } else {\n // this._legendComponentType = LegendEnum.sizeLegend;\n // }\n // } else {\n // this._legendComponentType = LegendEnum.discreteLegend;\n // }\n this._playerComponentType = 'discretePlayer';\n } else {\n this._playerComponentType =\n this.spec.playerType === 'discrete'\n ? 'discretePlayer'\n : this.spec.playerType === 'continuous'\n ? 'continuousPlayer'\n : 'discretePlayer';\n }\n return this._playerComponentType;\n }\n}\n\nexport const registerPlayer = () => {\n Factory.registerGraphicComponent(\n PlayerEnum.continuousPlayer,\n (attrs: ContinuousPlayerAttributes) => new ContinuousPlayer(attrs) as unknown as IGraphic\n );\n Factory.registerGraphicComponent(\n PlayerEnum.discretePlayer,\n (attrs: DiscretePlayerAttributes) => new DiscretePlayer(attrs) as unknown as IGraphic\n );\n\n Factory.registerComponent(ComponentEnum.player, Player);\n};\n"]}
@@ -0,0 +1,8 @@
1
+ import type { IScale, Nil } from '../types';
2
+ import type { IScaleComponent, ScaleComponentSpec } from '../types/component';
3
+ import { Component } from '../view/component';
4
+ export declare abstract class ScaleComponent extends Component implements IScaleComponent {
5
+ protected spec: ScaleComponentSpec;
6
+ protected parseAddition(spec: ScaleComponentSpec): this;
7
+ scale(scale?: IScale | string | Nil): this;
8
+ }
@@ -0,0 +1,19 @@
1
+ import { isString } from "@visactor/vutils";
2
+
3
+ import { Component } from "../view/component";
4
+
5
+ export class ScaleComponent extends Component {
6
+ parseAddition(spec) {
7
+ return super.parseAddition(spec), this.scale(spec.scale), this;
8
+ }
9
+ scale(scale) {
10
+ if (this.spec.scale) {
11
+ const lastScaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;
12
+ this.detach(lastScaleGrammar), this.spec.scale = void 0;
13
+ }
14
+ const scaleGrammar = isString(scale) ? this.view.getScaleById(scale) : scale;
15
+ return this.spec.scale = scaleGrammar, this.attach(scaleGrammar), this._updateComponentEncoders(),
16
+ this.commit(), this;
17
+ }
18
+ }
19
+ //# sourceMappingURL=scale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/component/scale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,OAAgB,cAAe,SAAQ,SAAS;IAG1C,aAAa,CAAC,IAAwB;QAC9C,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,KAA6B;QACjC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACnB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;YAC/G,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;SAC7B;QACD,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC7E,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC;QAC/B,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QAE1B,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAEhC,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;CACF","file":"scale.js","sourcesContent":["import { isString } from '@visactor/vutils';\nimport type { IScale, Nil } from '../types';\nimport type { IScaleComponent, ScaleComponentSpec } from '../types/component';\nimport { Component } from '../view/component';\n\nexport abstract class ScaleComponent extends Component implements IScaleComponent {\n protected declare spec: ScaleComponentSpec;\n\n protected parseAddition(spec: ScaleComponentSpec) {\n super.parseAddition(spec);\n this.scale(spec.scale);\n return this;\n }\n\n scale(scale?: IScale | string | Nil) {\n if (this.spec.scale) {\n const lastScaleGrammar = isString(this.spec.scale) ? this.view.getScaleById(this.spec.scale) : this.spec.scale;\n this.detach(lastScaleGrammar);\n this.spec.scale = undefined;\n }\n const scaleGrammar = isString(scale) ? this.view.getScaleById(scale) : scale;\n this.spec.scale = scaleGrammar;\n this.attach(scaleGrammar);\n\n this._updateComponentEncoders();\n\n this.commit();\n return this;\n }\n}\n"]}
@@ -0,0 +1,23 @@
1
+ import type { Direction, OrientType, ScrollBarAttributes } from '@visactor/vrender-components';
2
+ import type { IData, IGroupMark, ITheme, IView, MarkFunctionType, Nil, RecursivePartial } from '../types';
3
+ import type { IScrollbar, ScrollbarFilterValue, ScrollbarSpec } from '../types/component';
4
+ import { ScaleComponent } from './scale';
5
+ export declare const generateScrollbarAttributes: (groupSize: {
6
+ width: number;
7
+ height: number;
8
+ }, direction?: Direction, position?: OrientType, theme?: ITheme, addition?: RecursivePartial<ScrollBarAttributes>) => ScrollBarAttributes;
9
+ export declare class Scrollbar extends ScaleComponent implements IScrollbar {
10
+ static readonly componentType: string;
11
+ protected spec: ScrollbarSpec;
12
+ constructor(view: IView, group?: IGroupMark);
13
+ protected parseAddition(spec: ScrollbarSpec): this;
14
+ target(data: IData | string | Nil, filter: string | ((datum: any, value: ScrollbarFilterValue) => boolean) | Nil): this;
15
+ container(container: IGroupMark | string | Nil): this;
16
+ direction(direction: MarkFunctionType<Direction> | Nil): this;
17
+ position(position: MarkFunctionType<OrientType> | Nil): this;
18
+ setScrollStart(start: number): this;
19
+ addGraphicItem(attrs: any, groupKey?: string): any;
20
+ release(): void;
21
+ protected _updateComponentEncoders(): void;
22
+ }
23
+ export declare const registerScrollbar: () => void;