@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,206 @@
1
+ import { has, isNil, isBoolean, isFunction } from "@visactor/vutils";
2
+
3
+ import { isEqual } from "@visactor/vgrammar-util";
4
+
5
+ import { cloneTransformAttributes, transformAttributes } from "./attributes";
6
+
7
+ import { BridgeElementKey, CollectionMarkType } from "./constants";
8
+
9
+ import { DiffState, HOOK_EVENT, GrammarMarkType } from "./enums";
10
+
11
+ import { Element } from "./element";
12
+
13
+ import { invokeEncoderToItems } from "./mark/encode";
14
+
15
+ export class GlyphElement extends Element {
16
+ constructor(mark) {
17
+ super(mark), this.getStateAttrs = (stateName, nextStates) => {
18
+ var _a, _b, _c;
19
+ const isRuntimeState = !isNil(null === (_a = this.runtimeStatesEncoder) || void 0 === _a ? void 0 : _a[stateName]), encoder = isRuntimeState ? this.runtimeStatesEncoder[stateName] : null === (_b = this.mark.getSpec().encode) || void 0 === _b ? void 0 : _b[stateName], glyphStateAttributes = {};
20
+ if (!encoder) return glyphStateAttributes;
21
+ if (isFunction(encoder)) return glyphStateAttributes.attributes = encoder(this.getDatum(), this, stateName, nextStates),
22
+ glyphStateAttributes;
23
+ if (!isRuntimeState && (null === (_c = this.graphicItem.glyphStates) || void 0 === _c ? void 0 : _c[stateName])) return this.graphicItem.glyphStates[stateName];
24
+ if (encoder) {
25
+ const item = this.items[0], targetItems = [ Object.assign({}, item, {
26
+ nextAttrs: {}
27
+ }) ];
28
+ return invokeEncoderToItems(this, targetItems, encoder, this.mark.parameters()),
29
+ this.coordinateTransformEncode(targetItems), glyphStateAttributes.attributes = targetItems[0].nextAttrs,
30
+ this.graphicItem.glyphStates ? this.graphicItem.glyphStates[stateName] || (this.graphicItem.glyphStates[stateName] = glyphStateAttributes) : this.graphicItem.glyphStates = {
31
+ [stateName]: glyphStateAttributes
32
+ }, glyphStateAttributes;
33
+ }
34
+ return glyphStateAttributes;
35
+ }, this.glyphMeta = this.mark.getGlyphMeta();
36
+ }
37
+ getGlyphGraphicItems() {
38
+ return this.glyphGraphicItems;
39
+ }
40
+ initGraphicItem(attributes = {}) {
41
+ if (this.graphicItem) return;
42
+ const attrs = Object.assign({}, attributes);
43
+ this.graphicItem = this.mark.addGraphicItem(attrs, this.groupKey), this.graphicItem[BridgeElementKey] = this,
44
+ this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(!1);
45
+ const glyphMarks = this.glyphMeta.getMarks();
46
+ this.glyphGraphicItems = {}, this.graphicItem.getSubGraphic().forEach((graphic => {
47
+ const markType = glyphMarks[graphic.name];
48
+ this.glyphGraphicItems[graphic.name] = graphic, graphic.onBeforeAttributeUpdate = attributes => {
49
+ if (!this.mark) return attributes;
50
+ return transformAttributes(markType, attributes, this, graphic.name);
51
+ };
52
+ })), this.clearGraphicAttributes();
53
+ }
54
+ useStates(states, hasAnimation) {
55
+ var _a;
56
+ if (!this.graphicItem) return;
57
+ this.mark.emit(HOOK_EVENT.BEFORE_ELEMENT_STATE, {
58
+ states: states
59
+ }, this), this.states = states.slice();
60
+ const stateAnimation = isBoolean(hasAnimation) ? hasAnimation : !!(null === (_a = this.mark.getSpec().animation) || void 0 === _a ? void 0 : _a.state);
61
+ this.graphicItem.glyphStateProxy = this.getStateAttrs, this.graphicItem.useStates(this.states, stateAnimation),
62
+ this.mark.emit(HOOK_EVENT.AFTER_ELEMENT_STATE, {
63
+ states: states
64
+ }, this);
65
+ }
66
+ encodeGraphic() {
67
+ this.coordinateTransformEncode(this.items);
68
+ const graphicAttributes = this.transformElementItems(this.items, this.mark.markType);
69
+ this.graphicItem || this.initGraphicItem(), this.diffState === DiffState.enter ? (this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(!0),
70
+ this.applyGraphicAttributes(graphicAttributes), this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(!1)) : this.applyGraphicAttributes(graphicAttributes),
71
+ this.diffState !== DiffState.enter && this.diffState !== DiffState.update || !this.states.length || (Object.values(this.glyphGraphicItems).forEach((graphicItem => {
72
+ graphicItem.states = {};
73
+ })), this.useStates(this.states)), this.items.map((item => {
74
+ item.nextAttrs = {};
75
+ }));
76
+ }
77
+ encodeCustom(nextAttrs) {
78
+ var _a;
79
+ let customEncodeValues = {};
80
+ const channelEncoder = this.glyphMeta.getChannelEncoder(), functionEncoder = this.glyphMeta.getFunctionEncoder();
81
+ if (functionEncoder && (customEncodeValues = functionEncoder.call(null, Object.assign({}, null === (_a = this.graphicItem) || void 0 === _a ? void 0 : _a.attribute, nextAttrs), this.getDatum(), this, this.mark.getGlyphConfig())),
82
+ channelEncoder) {
83
+ let allAttrs;
84
+ Object.keys(channelEncoder).forEach((channel => {
85
+ var _a;
86
+ if (!isNil(nextAttrs[channel])) {
87
+ allAttrs || (allAttrs = Object.assign({}, null === (_a = this.graphicItem) || void 0 === _a ? void 0 : _a.attribute, nextAttrs));
88
+ const encodeResult = channelEncoder[channel].call(null, channel, nextAttrs[channel], allAttrs, this.getDatum(), this, this.mark.getGlyphConfig());
89
+ Object.keys(null != encodeResult ? encodeResult : {}).forEach((markName => {
90
+ var _a;
91
+ customEncodeValues[markName] = Object.assign(null !== (_a = customEncodeValues[markName]) && void 0 !== _a ? _a : {}, encodeResult[markName]);
92
+ }));
93
+ }
94
+ }));
95
+ }
96
+ return customEncodeValues;
97
+ }
98
+ encodeDefault() {
99
+ const defaultEncodeValues = {};
100
+ if (this.diffState === DiffState.enter && this.glyphMeta.getDefaultEncoder()) {
101
+ const defaultEncodeResult = this.glyphMeta.getDefaultEncoder().call(null, this.getDatum(), this, this.mark.getGlyphConfig());
102
+ Object.assign(defaultEncodeValues, defaultEncodeResult);
103
+ }
104
+ return defaultEncodeValues;
105
+ }
106
+ _onGlyphAttributeUpdate(first = !1) {
107
+ return attributes => {
108
+ if (!this.mark) return attributes;
109
+ const glyphMarks = this.glyphMeta.getMarks(), graphicAttributes = transformAttributes(this.mark.getAttributeTransforms(), attributes, this), defaultEncodeValues = first ? this.encodeDefault() : null, customEncodeValues = this.encodeCustom(attributes);
110
+ return Object.keys(glyphMarks).forEach((markName => {
111
+ const markType = glyphMarks[markName], graphicItem = this.glyphGraphicItems[markName], customAttributes = null == customEncodeValues ? void 0 : customEncodeValues[markName], additionalAttributes = Object.assign({}, customAttributes);
112
+ if (first) {
113
+ const defaultAttributes = null == defaultEncodeValues ? void 0 : defaultEncodeValues[markName];
114
+ Object.keys(null != defaultAttributes ? defaultAttributes : {}).forEach((key => {
115
+ has(this.items[0].nextAttrs, key) || has(additionalAttributes, key) || (additionalAttributes[key] = defaultAttributes[key]);
116
+ }));
117
+ }
118
+ const glyphAttributes = Object.assign({}, cloneTransformAttributes(markType, attributes), additionalAttributes), glyphItems = this._generateGlyphItems(markType, this.items, glyphAttributes);
119
+ this.coordinateTransformEncode(glyphItems);
120
+ const graphicAttributes = this.transformElementItems(glyphItems, markType);
121
+ this.applyGlyphGraphicAttributes(graphicAttributes, markName, graphicItem), markType === GrammarMarkType.shape && (graphicItem.datum = glyphItems[0].datum);
122
+ })), graphicAttributes;
123
+ };
124
+ }
125
+ _generateGlyphItems(markType, items, additionalAttributes) {
126
+ var _a;
127
+ const nextAttrs = null === (_a = items[0]) || void 0 === _a ? void 0 : _a.nextAttrs, glyphItems = items.map((item => Object.assign({}, item, {
128
+ nextAttrs: additionalAttributes
129
+ })));
130
+ return CollectionMarkType.includes(markType) && nextAttrs.enableSegments && glyphItems.forEach(((glyphItem, index) => {
131
+ glyphItem.nextAttrs = Object.assign({}, items[index].nextAttrs, additionalAttributes);
132
+ })), glyphItems;
133
+ }
134
+ getGraphicAttribute(channel, prev = !1, markName) {
135
+ if (!this.graphicItem) return;
136
+ const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);
137
+ if (prev && has(prevGraphicAttributes, channel)) return prevGraphicAttributes[channel];
138
+ return (markName ? this.glyphGraphicItems[markName] : this.graphicItem).attribute[channel];
139
+ }
140
+ setGraphicAttribute(channel, value, final = !0, markName) {
141
+ if (!this.graphicItem) return;
142
+ const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem, finalGraphicAttributes = this.getFinalGraphicAttributes(markName), prevGraphicAttributes = this.getPrevGraphicAttributes(markName);
143
+ final && (finalGraphicAttributes[channel] = value), has(prevGraphicAttributes, channel) || (prevGraphicAttributes[channel] = graphicItem.attribute[channel]),
144
+ graphicItem.setAttribute(channel, value);
145
+ }
146
+ setGraphicAttributes(attributes, final = !0, markName) {
147
+ if (!this.graphicItem) return;
148
+ const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem, finalGraphicAttributes = this.getFinalGraphicAttributes(markName), prevGraphicAttributes = this.getPrevGraphicAttributes(markName);
149
+ Object.keys(attributes).forEach((key => {
150
+ final && (finalGraphicAttributes[key] = attributes[key]), has(prevGraphicAttributes, key) || (prevGraphicAttributes[key] = graphicItem.attribute[key]);
151
+ })), graphicItem.setAttributes(attributes);
152
+ }
153
+ diffAttributes(graphicAttributes, markName) {
154
+ const diffResult = {}, finalGraphicAttributes = this.getFinalGraphicAttributes(markName);
155
+ for (const key in graphicAttributes) isEqual(key, finalGraphicAttributes, graphicAttributes) || (diffResult[key] = graphicAttributes[key]);
156
+ return diffResult;
157
+ }
158
+ applyGlyphGraphicAttributes(graphicAttributes, markName, graphicItem) {
159
+ if (this.mark.needAnimate()) {
160
+ const nextGraphicAttributes = this.diffAttributes(graphicAttributes, markName), prevGraphicAttributes = this.getPrevGraphicAttributes(markName), finalGraphicAttributes = this.getFinalGraphicAttributes(markName);
161
+ Object.keys(nextGraphicAttributes).forEach((channel => {
162
+ prevGraphicAttributes[channel] = graphicItem.attribute[channel], finalGraphicAttributes[channel] = nextGraphicAttributes[channel];
163
+ })), this.setNextGraphicAttributes(nextGraphicAttributes, markName), this.setPrevGraphicAttributes(prevGraphicAttributes, markName),
164
+ this.setFinalGraphicAttributes(finalGraphicAttributes, markName), graphicItem.setAttributes(nextGraphicAttributes);
165
+ } else graphicItem.setAttributes(graphicAttributes);
166
+ }
167
+ getFinalGraphicAttributes(markName) {
168
+ return (markName ? this.glyphGraphicItems[markName] : this.graphicItem).finalAttrs;
169
+ }
170
+ setFinalGraphicAttributes(attributes, markName) {
171
+ (markName ? this.glyphGraphicItems[markName] : this.graphicItem).finalAttrs = attributes;
172
+ }
173
+ getPrevGraphicAttributes(markName) {
174
+ return (markName ? this.glyphGraphicItems[markName] : this.graphicItem).prevAttrs;
175
+ }
176
+ setPrevGraphicAttributes(attributes, markName) {
177
+ (markName ? this.glyphGraphicItems[markName] : this.graphicItem).prevAttrs = attributes;
178
+ }
179
+ getNextGraphicAttributes(markName) {
180
+ return (markName ? this.glyphGraphicItems[markName] : this.graphicItem).nextAttrs;
181
+ }
182
+ setNextGraphicAttributes(attributes, markName) {
183
+ (markName ? this.glyphGraphicItems[markName] : this.graphicItem).nextAttrs = attributes;
184
+ }
185
+ clearChangedGraphicAttributes() {
186
+ this.setPrevGraphicAttributes({}), this.setNextGraphicAttributes({}), Object.keys(this.glyphGraphicItems).forEach((markName => {
187
+ this.setPrevGraphicAttributes({}, markName), this.setNextGraphicAttributes({}, markName);
188
+ }));
189
+ }
190
+ clearGraphicAttributes() {
191
+ this.setPrevGraphicAttributes({}), this.setNextGraphicAttributes({}), this.setFinalGraphicAttributes({}),
192
+ Object.keys(this.glyphGraphicItems).forEach((markName => {
193
+ this.setPrevGraphicAttributes({}, markName), this.setNextGraphicAttributes({}, markName),
194
+ this.setFinalGraphicAttributes({}, markName);
195
+ }));
196
+ }
197
+ remove() {
198
+ this.glyphGraphicItems = null, super.remove();
199
+ }
200
+ release() {
201
+ this.glyphGraphicItems && (Object.values(this.glyphGraphicItems).forEach((graphicItem => {
202
+ graphicItem[BridgeElementKey] = null;
203
+ })), this.glyphGraphicItems = null), super.release();
204
+ }
205
+ }
206
+ //# sourceMappingURL=glyph-element.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/graph/glyph-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAUlD,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAGrD,MAAM,O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,EAAE;YACrD,IAAI,CAAC,wBAAwB,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;YAC5C,IAAI,CAAC,wBAAwB,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;YAC5C,IAAI,CAAC,yBAAyB,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAC9B,KAAK,CAAC,MAAM,EAAE,CAAC;IACjB,CAAC;IAED,OAAO;QACL,IAAI,IAAI,CAAC,iBAAiB,EAAE;YAC1B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;gBAC1D,WAAW,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC;YACvC,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;SAC/B;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACF","file":"glyph-element.js","sourcesContent":["import { has, isNil, isBoolean, isFunction } from '@visactor/vutils';\nimport { isEqual } from '@visactor/vgrammar-util';\nimport type {\n IGlyphElement,\n IGlyphMark,\n MarkElementItem,\n MarkSpec,\n IGlyphMeta,\n MarkType,\n StateProxyEncodeSpec\n} from '../types';\nimport { cloneTransformAttributes, transformAttributes } from './attributes';\nimport { BridgeElementKey, CollectionMarkType } from './constants';\nimport { DiffState, HOOK_EVENT, GrammarMarkType } from './enums';\nimport { Element } from './element';\nimport { invokeEncoderToItems } from './mark/encode';\nimport type { IGraphicAttribute, IGlyph } from '@visactor/vrender';\n\nexport class GlyphElement extends Element implements IGlyphElement {\n declare graphicItem: IGlyph;\n\n declare mark: IGlyphMark;\n protected glyphGraphicItems: { [markName: string]: any };\n\n private glyphMeta: IGlyphMeta;\n\n constructor(mark: IGlyphMark) {\n super(mark);\n this.glyphMeta = this.mark.getGlyphMeta();\n }\n\n getGlyphGraphicItems() {\n return this.glyphGraphicItems;\n }\n\n initGraphicItem(attributes: any = {}) {\n if (this.graphicItem) {\n return;\n }\n\n const attrs = Object.assign({}, attributes);\n this.graphicItem = this.mark.addGraphicItem(attrs, this.groupKey) as IGlyph;\n this.graphicItem[BridgeElementKey] = this;\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(false);\n\n const glyphMarks = this.glyphMeta.getMarks();\n this.glyphGraphicItems = {};\n this.graphicItem.getSubGraphic().forEach((graphic: any) => {\n const markType = glyphMarks[graphic.name];\n this.glyphGraphicItems[graphic.name] = graphic;\n graphic.onBeforeAttributeUpdate = (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const graphicAttributes = transformAttributes(markType, attributes, this, graphic.name);\n return graphicAttributes;\n };\n });\n\n this.clearGraphicAttributes();\n }\n\n useStates(states: string[], hasAnimation?: boolean) {\n if (!this.graphicItem) {\n return;\n }\n this.mark.emit(HOOK_EVENT.BEFORE_ELEMENT_STATE, { states }, this);\n\n this.states = states.slice();\n const stateAnimation = isBoolean(hasAnimation)\n ? hasAnimation\n : !!(this.mark.getSpec() as MarkSpec).animation?.state;\n this.graphicItem.glyphStateProxy = this.getStateAttrs;\n this.graphicItem.useStates(this.states, stateAnimation);\n\n this.mark.emit(HOOK_EVENT.AFTER_ELEMENT_STATE, { states }, this);\n }\n\n protected getStateAttrs = (stateName: string, nextStates: string[]) => {\n const isRuntimeState = !isNil(this.runtimeStatesEncoder?.[stateName]);\n const encoder = isRuntimeState\n ? this.runtimeStatesEncoder[stateName]\n : (this.mark.getSpec() as MarkSpec).encode?.[stateName];\n\n const glyphStateAttributes = {} as {\n attributes: Partial<IGraphicAttribute>;\n subAttributes: Partial<IGraphicAttribute>[];\n };\n\n if (!encoder) {\n return glyphStateAttributes;\n }\n\n if (isFunction(encoder)) {\n glyphStateAttributes.attributes = (encoder as StateProxyEncodeSpec)(this.getDatum(), this, stateName, nextStates);\n return glyphStateAttributes;\n }\n\n if (!isRuntimeState && this.graphicItem.glyphStates?.[stateName]) {\n return this.graphicItem.glyphStates[stateName];\n }\n\n if (encoder) {\n const item = this.items[0];\n const targetItems = [Object.assign({}, item, { nextAttrs: {} })];\n\n invokeEncoderToItems(this, targetItems, encoder, (this.mark as any).parameters());\n this.coordinateTransformEncode(targetItems);\n\n glyphStateAttributes.attributes = targetItems[0].nextAttrs;\n\n if (!this.graphicItem.glyphStates) {\n this.graphicItem.glyphStates = { [stateName]: glyphStateAttributes };\n } else if (!this.graphicItem.glyphStates[stateName]) {\n this.graphicItem.glyphStates[stateName] = glyphStateAttributes;\n }\n\n return glyphStateAttributes;\n }\n\n return glyphStateAttributes;\n };\n\n encodeGraphic() {\n this.coordinateTransformEncode(this.items);\n const graphicAttributes = this.transformElementItems(this.items, this.mark.markType);\n\n if (!this.graphicItem) {\n this.initGraphicItem();\n }\n\n if (this.diffState === DiffState.enter) {\n // apply default encoder when enter\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(true);\n this.applyGraphicAttributes(graphicAttributes);\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(false);\n } else {\n this.applyGraphicAttributes(graphicAttributes);\n }\n\n if ((this.diffState === DiffState.enter || this.diffState === DiffState.update) && this.states.length) {\n Object.values(this.glyphGraphicItems).forEach(graphicItem => {\n // 更新数据流后,states计算不缓存\n graphicItem.states = {};\n });\n this.useStates(this.states);\n }\n\n // clear item attributes\n this.items.map(item => {\n item.nextAttrs = {};\n });\n }\n\n encodeCustom(nextAttrs?: any): { [markName: string]: any } {\n let customEncodeValues: { [markName: string]: any } = {};\n const channelEncoder = this.glyphMeta.getChannelEncoder();\n const functionEncoder = this.glyphMeta.getFunctionEncoder();\n\n if (functionEncoder) {\n customEncodeValues = functionEncoder.call(\n null,\n Object.assign({}, this.graphicItem?.attribute, nextAttrs),\n this.getDatum(),\n this,\n this.mark.getGlyphConfig()\n );\n }\n if (channelEncoder) {\n // TODO: maybe delete origin encode value?\n let allAttrs: any;\n Object.keys(channelEncoder).forEach(channel => {\n if (!isNil(nextAttrs[channel])) {\n if (!allAttrs) {\n allAttrs = Object.assign({}, this.graphicItem?.attribute, nextAttrs);\n }\n const encodeResult = channelEncoder[channel].call(\n null,\n channel,\n nextAttrs[channel],\n allAttrs,\n this.getDatum(),\n this,\n this.mark.getGlyphConfig()\n );\n Object.keys(encodeResult ?? {}).forEach(markName => {\n customEncodeValues[markName] = Object.assign(customEncodeValues[markName] ?? {}, encodeResult[markName]);\n });\n }\n });\n }\n return customEncodeValues;\n }\n\n private encodeDefault() {\n const defaultEncodeValues: { [markName: string]: any } = {};\n // apply default encode\n if (this.diffState === DiffState.enter && this.glyphMeta.getDefaultEncoder()) {\n const defaultEncodeResult = this.glyphMeta\n .getDefaultEncoder()\n .call(null, this.getDatum(), this, this.mark.getGlyphConfig());\n Object.assign(defaultEncodeValues, defaultEncodeResult);\n }\n return defaultEncodeValues;\n }\n\n private _onGlyphAttributeUpdate(first: boolean = false) {\n return (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const glyphMarks = this.glyphMeta.getMarks();\n\n const graphicAttributes = transformAttributes(this.mark.getAttributeTransforms(), attributes, this);\n\n // apply default encode\n const defaultEncodeValues = first ? this.encodeDefault() : null;\n // apply custom encode\n const customEncodeValues = this.encodeCustom(attributes);\n\n Object.keys(glyphMarks).forEach(markName => {\n const markType = glyphMarks[markName];\n const graphicItem = this.glyphGraphicItems[markName];\n const customAttributes = customEncodeValues?.[markName];\n const additionalAttributes = Object.assign({}, customAttributes);\n if (first) {\n // apply default attributes when visual channel is not set\n const defaultAttributes = defaultEncodeValues?.[markName];\n Object.keys(defaultAttributes ?? {}).forEach(key => {\n if (!has(this.items[0].nextAttrs, key) && !has(additionalAttributes, key)) {\n additionalAttributes[key] = defaultAttributes[key];\n }\n });\n }\n const glyphAttributes = Object.assign({}, cloneTransformAttributes(markType, attributes), additionalAttributes);\n const glyphItems = this._generateGlyphItems(markType, this.items, glyphAttributes);\n this.coordinateTransformEncode(glyphItems);\n const graphicAttributes = this.transformElementItems(glyphItems, markType);\n\n this.applyGlyphGraphicAttributes(graphicAttributes, markName, graphicItem);\n\n if (markType === GrammarMarkType.shape) {\n // FIXME: shape需要拿到原始数据进行编码,暂时把数据绑定到graphicItem上,看后续graphicItem是否需要支持数据绑定\n graphicItem.datum = glyphItems[0].datum;\n }\n });\n\n return graphicAttributes;\n };\n }\n\n private _generateGlyphItems(markType: MarkType, items: MarkElementItem[], additionalAttributes: any) {\n const nextAttrs = items[0]?.nextAttrs;\n const glyphItems = items.map(item => Object.assign({}, item, { nextAttrs: additionalAttributes }));\n\n if ((CollectionMarkType as string[]).includes(markType) && nextAttrs.enableSegments) {\n // segment mark require all items to apply additional attributes\n glyphItems.forEach((glyphItem, index) => {\n glyphItem.nextAttrs = Object.assign({}, items[index].nextAttrs, additionalAttributes);\n });\n }\n\n return glyphItems;\n }\n\n getGraphicAttribute(channel: string, prev: boolean = false, markName?: any) {\n if (!this.graphicItem) {\n return undefined;\n }\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n if (prev && has(prevGraphicAttributes, channel)) {\n return prevGraphicAttributes[channel];\n }\n\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.attribute[channel];\n }\n\n setGraphicAttribute(channel: string, value: any, final: boolean = true, markName?: any) {\n if (!this.graphicItem) {\n return;\n }\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n\n if (final) {\n finalGraphicAttributes[channel] = value;\n }\n if (!has(prevGraphicAttributes, channel)) {\n prevGraphicAttributes[channel] = graphicItem.attribute[channel];\n }\n\n graphicItem.setAttribute(channel, value);\n }\n\n setGraphicAttributes(attributes: { [channel: string]: any }, final: boolean = true, markName?: any) {\n if (!this.graphicItem) {\n return;\n }\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n\n Object.keys(attributes).forEach(key => {\n if (final) {\n finalGraphicAttributes[key] = attributes[key];\n }\n if (!has(prevGraphicAttributes, key)) {\n prevGraphicAttributes[key] = graphicItem.attribute[key];\n }\n });\n\n graphicItem.setAttributes(attributes);\n }\n\n protected diffAttributes(graphicAttributes: { [channel: string]: any }, markName?: string) {\n const diffResult = {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n for (const key in graphicAttributes) {\n if (!isEqual(key, finalGraphicAttributes, graphicAttributes)) {\n diffResult[key] = graphicAttributes[key];\n }\n }\n return diffResult;\n }\n\n protected applyGlyphGraphicAttributes(graphicAttributes: any, markName: string, graphicItem: any): void {\n if (this.mark.needAnimate()) {\n // If mark need animate, diff attributes.\n const nextGraphicAttributes = this.diffAttributes(graphicAttributes, markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n Object.keys(nextGraphicAttributes).forEach(channel => {\n prevGraphicAttributes[channel] = graphicItem.attribute[channel];\n finalGraphicAttributes[channel] = nextGraphicAttributes[channel];\n });\n this.setNextGraphicAttributes(nextGraphicAttributes, markName);\n this.setPrevGraphicAttributes(prevGraphicAttributes, markName);\n this.setFinalGraphicAttributes(finalGraphicAttributes, markName);\n\n // Apply next attributes to current graphic item immediately.\n // Scene graph tree should be handled like no animation exists in dataflow procedure.\n graphicItem.setAttributes(nextGraphicAttributes);\n } else {\n graphicItem.setAttributes(graphicAttributes);\n }\n }\n\n getFinalGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.finalAttrs;\n }\n\n protected setFinalGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.finalAttrs = attributes;\n }\n\n getPrevGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.prevAttrs;\n }\n\n protected setPrevGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.prevAttrs = attributes;\n }\n\n getNextGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.nextAttrs;\n }\n\n protected setNextGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.nextAttrs = attributes;\n }\n\n clearChangedGraphicAttributes() {\n this.setPrevGraphicAttributes({});\n this.setNextGraphicAttributes({});\n Object.keys(this.glyphGraphicItems).forEach(markName => {\n this.setPrevGraphicAttributes({}, markName);\n this.setNextGraphicAttributes({}, markName);\n });\n }\n\n clearGraphicAttributes() {\n this.setPrevGraphicAttributes({});\n this.setNextGraphicAttributes({});\n this.setFinalGraphicAttributes({});\n Object.keys(this.glyphGraphicItems).forEach(markName => {\n this.setPrevGraphicAttributes({}, markName);\n this.setNextGraphicAttributes({}, markName);\n this.setFinalGraphicAttributes({}, markName);\n });\n }\n\n remove() {\n this.glyphGraphicItems = null;\n super.remove();\n }\n\n release() {\n if (this.glyphGraphicItems) {\n Object.values(this.glyphGraphicItems).forEach(graphicItem => {\n graphicItem[BridgeElementKey] = null;\n });\n this.glyphGraphicItems = null;\n }\n super.release();\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export * from './enums';
2
+ export { Element } from './element';
3
+ export { getLinePoints, getRulePoints } from './attributes/helpers';
@@ -0,0 +1,6 @@
1
+ export * from "./enums";
2
+
3
+ export { Element } from "./element";
4
+
5
+ export { getLinePoints, getRulePoints } from "./attributes/helpers";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/graph/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC","file":"index.js","sourcesContent":["export * from './enums';\nexport { Element } from './element';\nexport { getLinePoints, getRulePoints } from './attributes/helpers';\n"]}
@@ -0,0 +1,3 @@
1
+ import type { IBounds } from '@visactor/vutils';
2
+ import type { IGroupMark, ILayoutOptions, IMark } from '../../types';
3
+ export declare const doGridLayout: (group: IGroupMark, children: IMark[], parentLayoutBounds: IBounds, options?: ILayoutOptions) => void;
@@ -0,0 +1,66 @@
1
+ import { Bounds, isValidNumber } from "@visactor/vutils";
2
+
3
+ function parseTemplate(template, total) {
4
+ if (isValidNumber(template)) return template;
5
+ const trimmedTemplate = template.trim();
6
+ if ("auto" === trimmedTemplate) return 0;
7
+ if (trimmedTemplate.endsWith("%")) {
8
+ const percent = parseFloat(trimmedTemplate.substring(0, trimmedTemplate.length - 1));
9
+ return isValidNumber(percent) ? percent * total : 0;
10
+ }
11
+ return 0;
12
+ }
13
+
14
+ function computeGrid(layout, width, height) {
15
+ var _a, _b, _c, _d;
16
+ const templateRows = null !== (_a = layout.gridTemplateRows) && void 0 !== _a ? _a : [ height ], templateColumns = null !== (_b = layout.gridTemplateColumns) && void 0 !== _b ? _b : [ width ], rowGap = null !== (_c = layout.gridRowGap) && void 0 !== _c ? _c : 0, columnGap = null !== (_d = layout.gridColumnGap) && void 0 !== _d ? _d : 0, rows = templateRows.map((row => parseTemplate(row, height))), columns = templateColumns.map((column => parseTemplate(column, width))), rowAuto = Math.max(0, rows.reduce(((left, row) => left - row), height) - rows.length * rowGap) / templateRows.filter((row => "auto" === row)).length, columnAuto = Math.max(0, columns.reduce(((left, column) => left - column), width) - columns.length * columnGap) / templateColumns.filter((column => "auto" === column)).length;
17
+ let lastRow = 0;
18
+ const accumulateRows = rows.map(((row, index) => {
19
+ const finalRow = "auto" === templateRows[index] ? rowAuto : row, last = lastRow;
20
+ return lastRow += finalRow + rowGap, last;
21
+ }));
22
+ accumulateRows.push(lastRow);
23
+ let lastColumn = 0;
24
+ const accumulateColumns = columns.map(((column, index) => {
25
+ const finalColumn = "auto" === templateColumns[index] ? columnAuto : column, last = lastColumn;
26
+ return lastColumn += finalColumn + columnGap, last;
27
+ }));
28
+ return accumulateColumns.push(lastColumn), {
29
+ rows: accumulateRows,
30
+ columns: accumulateColumns,
31
+ rowGap: rowGap,
32
+ columnGap: columnGap
33
+ };
34
+ }
35
+
36
+ function normalizeIndex(index, count) {
37
+ return Math.min(index < 0 ? index + count : index - 1, count);
38
+ }
39
+
40
+ function normalizeStartEndIndex(start, end, count) {
41
+ let finalStart = normalizeIndex(start, count), finalEnd = normalizeIndex(end, count);
42
+ if (isValidNumber(start) || isValidNumber(end) ? isValidNumber(start) ? isValidNumber(end) || (finalStart = normalizeIndex(Math.max(0, finalEnd - 1), count)) : finalEnd = normalizeIndex(finalStart + 1, count) : (finalStart = 1,
43
+ finalEnd = 2), finalStart > finalEnd) {
44
+ const temp = finalEnd;
45
+ finalEnd = finalStart, finalStart = temp;
46
+ }
47
+ return {
48
+ start: finalStart,
49
+ end: finalEnd
50
+ };
51
+ }
52
+
53
+ function getCellBounds(grid, rowStart, rowEnd, columnStart, columnEnd) {
54
+ const rowCount = grid.rows.length, columnCount = grid.columns.length, {start: finalRowStart, end: finalRowEnd} = normalizeStartEndIndex(rowStart, rowEnd, rowCount), {start: finalColumnStart, end: finalColumnEnd} = normalizeStartEndIndex(columnStart, columnEnd, columnCount), x1 = grid.columns[finalRowStart], x2 = grid.columns[finalRowEnd] - (finalColumnEnd === columnCount ? 0 : grid.columnGap), y1 = grid.rows[finalColumnStart], y2 = grid.rows[finalColumnEnd] - (finalRowEnd === rowCount ? 0 : grid.rowGap);
55
+ return (new Bounds).set(x1, y1, x2, y2);
56
+ }
57
+
58
+ export const doGridLayout = (group, children, parentLayoutBounds, options) => {
59
+ const grid = computeGrid(group.getSpec().layout, parentLayoutBounds.width(), parentLayoutBounds.height());
60
+ null == children || children.forEach((mark => {
61
+ const markLayout = mark.getSpec().layout;
62
+ mark.layoutBounds = getCellBounds(grid, markLayout.gridRowStart, markLayout.gridRowEnd, markLayout.gridColumnStart, markLayout.gridColumnEnd),
63
+ mark.commit();
64
+ }));
65
+ };
66
+ //# sourceMappingURL=grid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/graph/layout/grid.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAUzD,SAAS,aAAa,CAAC,QAAkC,EAAE,KAAa;IACtE,IAAI,aAAa,CAAC,QAAQ,CAAC,EAAE;QAC3B,OAAO,QAAQ,CAAC;KACjB;IACD,MAAM,eAAe,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;IACxC,IAAI,eAAe,KAAK,MAAM,EAAE;QAE9B,OAAO,CAAC,CAAC;KACV;SAAM,IAAI,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACxC,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,EAAE,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;QACrF,IAAI,aAAa,CAAC,OAAO,CAAC,EAAE;YAC1B,OAAO,OAAO,GAAG,KAAK,CAAC;SACxB;QACD,OAAO,CAAC,CAAC;KACV;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,WAAW,CAAC,MAA6B,EAAE,KAAa,EAAE,MAAc;;IAC/E,MAAM,YAAY,GAAG,MAAA,MAAM,CAAC,gBAAgB,mCAAI,CAAC,MAAM,CAAC,CAAC;IACzD,MAAM,eAAe,GAAG,MAAA,MAAM,CAAC,mBAAmB,mCAAI,CAAC,KAAK,CAAC,CAAC;IAC9D,MAAM,MAAM,GAAG,MAAA,MA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AC,SAAS,CAAC,CAAC;IAC7F,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACvC,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpF,OAAO,IAAI,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,KAAiB,EACjB,QAAiB,EACjB,kBAA2B,EAC3B,OAAwB,EACxB,EAAE;IACF,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,MAA+B,CAAC;IAC/D,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,EAAE,kBAAkB,CAAC,KAAK,EAAE,EAAE,kBAAkB,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1F,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,CAAC,IAAI,CAAC,EAAE;QACvB,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,MAA0B,CAAC;QAC7D,IAAI,CAAC,YAAY,GAAG,aAAa,CAC/B,IAAI,EACJ,UAAU,CAAC,YAAY,EACvB,UAAU,CAAC,UAAU,EACrB,UAAU,CAAC,eAAe,EAC1B,UAAU,CAAC,aAAa,CACzB,CAAC;QACF,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","file":"grid.js","sourcesContent":["import type { IBounds } from '@visactor/vutils';\nimport { Bounds, isValidNumber } from '@visactor/vutils';\nimport type { IGroupMark, ILayoutOptions, IMark, MarkGridItemSpec, MarkGridContainerSpec } from '../../types';\n\ninterface IGrid {\n rows: number[];\n columns: number[];\n rowGap: number;\n columnGap: number;\n}\n\nfunction parseTemplate(template: number | string | 'auto', total: number) {\n if (isValidNumber(template)) {\n return template;\n }\n const trimmedTemplate = template.trim();\n if (trimmedTemplate === 'auto') {\n // handle auto later\n return 0;\n } else if (trimmedTemplate.endsWith('%')) {\n const percent = parseFloat(trimmedTemplate.substring(0, trimmedTemplate.length - 1));\n if (isValidNumber(percent)) {\n return percent * total;\n }\n return 0;\n }\n return 0;\n}\n\nfunction computeGrid(layout: MarkGridContainerSpec, width: number, height: number): IGrid {\n const templateRows = layout.gridTemplateRows ?? [height];\n const templateColumns = layout.gridTemplateColumns ?? [width];\n const rowGap = layout.gridRowGap ?? 0;\n const columnGap = layout.gridColumnGap ?? 0;\n\n // compute simple cell size\n const rows = templateRows.map(row => parseTemplate(row, height));\n const columns = templateColumns.map(column => parseTemplate(column, width));\n\n // compute auto grid\n const rowLeftSize = Math.max(0, rows.reduce((left, row) => left - row, height) - rows.length * rowGap);\n const rowAuto = rowLeftSize / templateRows.filter(row => row === 'auto').length;\n const columnLeftSize = Math.max(\n 0,\n columns.reduce((left, column) => left - column, width) - columns.length * columnGap\n );\n const columnAuto = columnLeftSize / templateColumns.filter(column => column === 'auto').length;\n // accumulate grid size\n let lastRow = 0;\n const accumulateRows = rows.map((row, index) => {\n const finalRow = templateRows[index] === 'auto' ? rowAuto : row;\n const last = lastRow;\n lastRow += finalRow + rowGap;\n return last;\n });\n accumulateRows.push(lastRow);\n let lastColumn = 0;\n const accumulateColumns = columns.map((column, index) => {\n const finalColumn = templateColumns[index] === 'auto' ? columnAuto : column;\n const last = lastColumn;\n lastColumn += finalColumn + columnGap;\n return last;\n });\n accumulateColumns.push(lastColumn);\n\n return {\n rows: accumulateRows,\n columns: accumulateColumns,\n rowGap,\n columnGap\n };\n}\n\nfunction normalizeIndex(index: number, count: number) {\n return Math.min(index < 0 ? index + count : index - 1, count);\n}\n\nfunction normalizeStartEndIndex(start: number, end: number, count: number) {\n let finalStart = normalizeIndex(start, count);\n let finalEnd = normalizeIndex(end, count);\n if (!isValidNumber(start) && !isValidNumber(end)) {\n finalStart = 1;\n finalEnd = 2;\n } else if (!isValidNumber(start)) {\n finalEnd = normalizeIndex(finalStart + 1, count);\n } else if (!isValidNumber(end)) {\n finalStart = normalizeIndex(Math.max(0, finalEnd - 1), count);\n }\n if (finalStart > finalEnd) {\n const temp = finalEnd;\n finalEnd = finalStart;\n finalStart = temp;\n }\n return { start: finalStart, end: finalEnd };\n}\n\nfunction getCellBounds(grid: IGrid, rowStart: number, rowEnd: number, columnStart: number, columnEnd: number): Bounds {\n const rowCount = grid.rows.length;\n const columnCount = grid.columns.length;\n const { start: finalRowStart, end: finalRowEnd } = normalizeStartEndIndex(rowStart, rowEnd, rowCount);\n const { start: finalColumnStart, end: finalColumnEnd } = normalizeStartEndIndex(columnStart, columnEnd, columnCount);\n\n const x1 = grid.columns[finalRowStart];\n const x2 = grid.columns[finalRowEnd] - (finalColumnEnd === columnCount ? 0 : grid.columnGap);\n const y1 = grid.rows[finalColumnStart];\n const y2 = grid.rows[finalColumnEnd] - (finalRowEnd === rowCount ? 0 : grid.rowGap);\n return new Bounds().set(x1, y1, x2, y2);\n}\n\nexport const doGridLayout = (\n group: IGroupMark,\n children: IMark[],\n parentLayoutBounds: IBounds,\n options?: ILayoutOptions\n) => {\n const layout = group.getSpec().layout as MarkGridContainerSpec;\n const grid = computeGrid(layout, parentLayoutBounds.width(), parentLayoutBounds.height());\n children?.forEach(mark => {\n const markLayout = mark.getSpec().layout as MarkGridItemSpec;\n mark.layoutBounds = getCellBounds(\n grid,\n markLayout.gridRowStart,\n markLayout.gridRowEnd,\n markLayout.gridColumnStart,\n markLayout.gridColumnEnd\n );\n mark.commit();\n });\n};\n"]}
@@ -0,0 +1,3 @@
1
+ import type { IMark } from '../../types/grammar';
2
+ import type { ILayoutOptions, IView } from '../../types/view';
3
+ export declare const defaultDoLayout: (layoutMarks: IMark[], options: ILayoutOptions, view: IView) => void;
@@ -0,0 +1,33 @@
1
+ import { isFunction } from "@visactor/vutils";
2
+
3
+ import { SIGNAL_VIEW_HEIGHT, SIGNAL_PADDING, SIGNAL_VIEW_WIDTH } from "./../../view/constants";
4
+
5
+ import { GrammarMarkType } from "../enums";
6
+
7
+ import { doGridLayout } from "./grid";
8
+
9
+ import { doRelativeLayout } from "./relative";
10
+
11
+ export const defaultDoLayout = (layoutMarks, options, view) => {
12
+ null == layoutMarks || layoutMarks.forEach((mark => {
13
+ var _a;
14
+ if (mark.markType !== GrammarMarkType.group) return;
15
+ const layoutChildren = mark.layoutChildren, layoutSpec = mark.getSpec().layout, bounds = null !== (_a = mark.layoutBounds) && void 0 !== _a ? _a : mark.getBounds();
16
+ if (bounds) {
17
+ if (isFunction(layoutSpec)) layoutSpec.call(null, mark, layoutChildren, bounds, options); else if (isFunction(layoutSpec.callback)) layoutSpec.callback.call(null, mark, layoutChildren, bounds, options); else if ("relative" === layoutSpec.display) if (layoutSpec.updateViewSignals) {
18
+ const oldViewBox = view.getViewBox();
19
+ oldViewBox && bounds.intersect(oldViewBox);
20
+ const viewBounds = doRelativeLayout(mark, layoutChildren, bounds, options), viewWidth = viewBounds.width(), viewHeight = viewBounds.height(), padding = {
21
+ top: viewBounds.y1,
22
+ right: view.width() - viewBounds.x2,
23
+ left: viewBounds.x1,
24
+ bottom: view.height() - viewBounds.y2
25
+ };
26
+ view.updateSignal(SIGNAL_VIEW_WIDTH, viewWidth), view.updateSignal(SIGNAL_VIEW_HEIGHT, viewHeight),
27
+ view.updateSignal(SIGNAL_PADDING, padding);
28
+ } else doRelativeLayout(mark, layoutChildren, bounds, options); else "grid" === layoutSpec.display && doGridLayout(mark, layoutChildren, bounds, options);
29
+ defaultDoLayout(layoutChildren, options, view);
30
+ }
31
+ }));
32
+ };
33
+ //# sourceMappingURL=layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/graph/layout/layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,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C,UAAU,CAAC,CAAC;iBAC9B;gBAED,MAAM,UAAU,GAAG,gBAAgB,CAAC,IAAkB,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;gBACzF,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC;gBACrC,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC;gBACvC,MAAM,OAAO,GAAG;oBACd,GAAG,EAAE,UAAU,CAAC,EAAE;oBAClB,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,UAAU,CAAC,EAAE;oBACnC,IAAI,EAAE,UAAU,CAAC,EAAE;oBACnB,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,UAAU,CAAC,EAAE;iBACtC,CAAC;gBACD,IAAY,CAAC,YAAY,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;gBACxD,IAAY,CAAC,YAAY,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;gBAC1D,IAAY,CAAC,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;aACrD;iBAAM;gBACL,gBAAgB,CAAC,IAAkB,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;aACvE;SACF;aAAM,IAAK,UAAoC,CAAC,OAAO,KAAK,MAAM,EAAE;YACnE,YAAY,CAAC,IAAkB,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;SACnE;QAED,eAAe,CAAC,cAAc,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","file":"layout.js","sourcesContent":["import { isFunction } from '@visactor/vutils';\nimport { SIGNAL_VIEW_HEIGHT, SIGNAL_PADDING, SIGNAL_VIEW_WIDTH } from './../../view/constants';\nimport type { MarkRelativeContainerSpec, MarkGridContainerSpec } from './../../types/mark';\nimport { GrammarMarkType } from '../enums';\nimport type { IMark, IGroupMark } from '../../types/grammar';\nimport type { ILayoutOptions, IView } from '../../types/view';\nimport { doGridLayout } from './grid';\nimport { doRelativeLayout } from './relative';\n\nexport const defaultDoLayout = (layoutMarks: IMark[], options: ILayoutOptions, view: IView) => {\n layoutMarks?.forEach(mark => {\n if (mark.markType !== GrammarMarkType.group) {\n return;\n }\n\n const layoutChildren = (mark as IGroupMark).layoutChildren;\n\n // FIXME buildLayoutTree的时候过滤一下空的group\n // if (!layoutChildren?.length) {\n // return;\n // }\n\n const layoutSpec = mark.getSpec().layout;\n const bounds = mark.layoutBounds ?? mark.getBounds();\n\n if (!bounds) {\n return;\n }\n\n if (isFunction(layoutSpec)) {\n layoutSpec.call(null, mark as IGroupMark, layoutChildren, bounds, options);\n } else if (isFunction(layoutSpec.callback)) {\n layoutSpec.callback.call(null, mark as IGroupMark, layoutChildren, bounds, options);\n } else if ((layoutSpec as MarkRelativeContainerSpec).display === 'relative') {\n if (layoutSpec.updateViewSignals) {\n const oldViewBox = view.getViewBox();\n\n if (oldViewBox) {\n bounds.intersect(oldViewBox);\n }\n\n const viewBounds = doRelativeLayout(mark as IGroupMark, layoutChildren, bounds, options);\n const viewWidth = viewBounds.width();\n const viewHeight = viewBounds.height();\n const padding = {\n top: viewBounds.y1,\n right: view.width() - viewBounds.x2,\n left: viewBounds.x1,\n bottom: view.height() - viewBounds.y2\n };\n (view as any).updateSignal(SIGNAL_VIEW_WIDTH, viewWidth);\n (view as any).updateSignal(SIGNAL_VIEW_HEIGHT, viewHeight);\n (view as any).updateSignal(SIGNAL_PADDING, padding);\n } else {\n doRelativeLayout(mark as IGroupMark, layoutChildren, bounds, options);\n }\n } else if ((layoutSpec as MarkGridContainerSpec).display === 'grid') {\n doGridLayout(mark as IGroupMark, layoutChildren, bounds, options);\n }\n\n defaultDoLayout(layoutChildren, options, view);\n });\n};\n"]}
@@ -0,0 +1,3 @@
1
+ import type { IBounds } from '@visactor/vutils';
2
+ import type { IGroupMark, ILayoutOptions, IMark } from '../../types';
3
+ export declare const doRelativeLayout: (group: IGroupMark, children: IMark[], parentLayoutBounds: IBounds, options?: ILayoutOptions) => IBounds;
@@ -0,0 +1,85 @@
1
+ import { ComponentEnum } from "./../enums";
2
+
3
+ import { Bounds } from "@visactor/vutils";
4
+
5
+ import { toPercent } from "@visactor/vgrammar-util";
6
+
7
+ import { normalizePadding } from "../../parse/view";
8
+
9
+ const defaultLayoutOrder = {
10
+ [ComponentEnum.axis]: 0,
11
+ [ComponentEnum.legend]: 1,
12
+ [ComponentEnum.slider]: 2,
13
+ [ComponentEnum.player]: 3,
14
+ [ComponentEnum.datazoom]: 4
15
+ }, getLayoutOrderOfMark = mark => {
16
+ var _a, _b, _c;
17
+ return null !== (_b = null === (_a = mark.getSpec().layout) || void 0 === _a ? void 0 : _a.order) && void 0 !== _b ? _b : "component" === mark.markType && null !== (_c = defaultLayoutOrder[mark.componentType]) && void 0 !== _c ? _c : 1 / 0;
18
+ };
19
+
20
+ export const doRelativeLayout = (group, children, parentLayoutBounds, options) => {
21
+ const viewBounds = parentLayoutBounds.clone(), groupLayoutSpec = group.getSpec().layout, maxChildWidth = toPercent(groupLayoutSpec.maxChildWidth, viewBounds.width()), maxChildHeight = toPercent(groupLayoutSpec.maxChildHeight, viewBounds.width());
22
+ let minDeltaX1 = 0, minDeltaX2 = 0, minDeltaY1 = 0, minDeltaY2 = 0;
23
+ children.forEach((child => {
24
+ const layoutSpec = child.getSpec().layout, padding = normalizePadding(layoutSpec.padding), bounds = options.parseMarkBounds ? options.parseMarkBounds(child.getBounds(), child) : child.getBounds();
25
+ if ("top" === layoutSpec.position || "bottom" === layoutSpec.position) {
26
+ const childHeight = Math.min(bounds.height() + padding.top + padding.bottom, maxChildHeight);
27
+ "top" === layoutSpec.position ? viewBounds.y1 += childHeight : viewBounds.y2 -= childHeight,
28
+ bounds.x1 < parentLayoutBounds.x1 && (minDeltaX1 = Math.max(minDeltaX1, parentLayoutBounds.x1 - bounds.x1)),
29
+ bounds.x2 > parentLayoutBounds.x2 && (minDeltaX2 = Math.max(minDeltaX2, bounds.x2 - parentLayoutBounds.x2));
30
+ }
31
+ if ("left" === layoutSpec.position || "right" === layoutSpec.position) {
32
+ const childWidth = Math.min(bounds.width() + padding.left + padding.right, maxChildWidth);
33
+ "left" === layoutSpec.position ? viewBounds.x1 += childWidth : viewBounds.x2 -= childWidth,
34
+ bounds.y1 < parentLayoutBounds.y1 && (minDeltaY1 = Math.max(minDeltaY1, parentLayoutBounds.y1 - bounds.y1)),
35
+ bounds.y2 > parentLayoutBounds.y2 && (minDeltaY2 = Math.max(minDeltaY2, bounds.y2 - parentLayoutBounds.y2));
36
+ }
37
+ "outside" === layoutSpec.position && (viewBounds.x1 += Math.max(parentLayoutBounds.x1 - bounds.x1, 0) + padding.left,
38
+ viewBounds.x2 -= Math.max(bounds.x2 - parentLayoutBounds.x2, 0) + padding.right,
39
+ viewBounds.y1 += Math.max(parentLayoutBounds.y1 - bounds.y1, 0) + padding.top, viewBounds.y2 -= Math.max(bounds.y2 - parentLayoutBounds.y2) + padding.bottom);
40
+ })), minDeltaX1 > viewBounds.x1 - parentLayoutBounds.x1 && minDeltaX1 < parentLayoutBounds.width() && (viewBounds.x1 = parentLayoutBounds.x1 + minDeltaX1),
41
+ minDeltaX2 > parentLayoutBounds.x2 - viewBounds.x2 && minDeltaX2 < parentLayoutBounds.width() && (viewBounds.x2 = parentLayoutBounds.x2 - minDeltaX2),
42
+ minDeltaY1 > viewBounds.y1 - parentLayoutBounds.y1 && minDeltaY1 < parentLayoutBounds.height() && (viewBounds.y1 = parentLayoutBounds.y1 + minDeltaY1),
43
+ minDeltaY2 > parentLayoutBounds.y2 - viewBounds.y2 && minDeltaY2 < parentLayoutBounds.height() && (viewBounds.y2 = parentLayoutBounds.y2 - minDeltaY2);
44
+ let curTopY = viewBounds.y1, curBottomY = viewBounds.y2, curLeftX = viewBounds.x1, curRightX = viewBounds.x2;
45
+ const sortedChildren = children.slice().sort(((markA, markB) => getLayoutOrderOfMark(markA) - getLayoutOrderOfMark(markB)));
46
+ for (let i = 0, len = sortedChildren.length; i < len; i++) {
47
+ const child = sortedChildren[i], layoutSpec = child.getSpec().layout, padding = normalizePadding(layoutSpec.padding), bounds = options.parseMarkBounds ? options.parseMarkBounds(child.getBounds(), child) : child.getBounds();
48
+ if ("top" === layoutSpec.position || "bottom" === layoutSpec.position) {
49
+ const childHeight = Math.min(bounds.height() + padding.top + padding.bottom, maxChildHeight);
50
+ if ("top" === layoutSpec.position ? (child.layoutBounds = (new Bounds).set(viewBounds.x1, curTopY - childHeight, viewBounds.x2, curTopY),
51
+ curTopY -= childHeight) : (child.layoutBounds = (new Bounds).set(viewBounds.x1, curBottomY, viewBounds.x2, curBottomY + childHeight),
52
+ curBottomY += childHeight), child.relativePosition = {
53
+ top: child.layoutBounds.y1 - viewBounds.y1,
54
+ bottom: child.layoutBounds.y1 - viewBounds.y2
55
+ }, layoutSpec.align) {
56
+ const childWidth = bounds.width() + padding.left + padding.right;
57
+ childWidth < viewBounds.width() && ("center" === layoutSpec.align ? (child.layoutBounds.x1 = (viewBounds.x1 + viewBounds.x2) / 2 - childWidth / 2,
58
+ child.layoutBounds.x2 = child.layoutBounds.x1 + childWidth, child.relativePosition.left = child.relativePosition.right = (viewBounds.width() - childWidth) / 2) : "right" === layoutSpec.align ? (child.layoutBounds.x1 = viewBounds.x2 - childWidth,
59
+ child.layoutBounds.x2 = viewBounds.x2, child.relativePosition.right = 0, child.relativePosition.left = viewBounds.width() - childWidth) : "left" === layoutSpec.align && (child.layoutBounds.x1 = viewBounds.x1,
60
+ child.layoutBounds.x2 = viewBounds.x1 + childWidth, child.relativePosition.left = 0,
61
+ child.relativePosition.right = viewBounds.width() - childWidth));
62
+ }
63
+ } else if ("left" === layoutSpec.position || "right" === layoutSpec.position) {
64
+ const childWidth = Math.min(bounds.width() + padding.left + padding.right, maxChildWidth);
65
+ if ("left" === layoutSpec.position ? (child.layoutBounds = (new Bounds).set(curLeftX - childWidth, viewBounds.y1, curLeftX, viewBounds.y2),
66
+ curLeftX -= childWidth) : (child.layoutBounds = (new Bounds).set(curRightX, viewBounds.y1, curRightX + childWidth, viewBounds.y2),
67
+ curRightX += childWidth), child.relativePosition = {
68
+ left: child.layoutBounds.x1 - viewBounds.x1,
69
+ right: child.layoutBounds.x1 - viewBounds.x2
70
+ }, layoutSpec.align) {
71
+ const childHeight = bounds.height() + padding.top + padding.bottom;
72
+ childWidth < viewBounds.width() && ("middle" === layoutSpec.align ? (child.layoutBounds.y1 = (viewBounds.y1 + viewBounds.y2) / 2 - childHeight / 2,
73
+ child.layoutBounds.y2 = child.layoutBounds.y1 + childHeight, child.relativePosition.top = child.relativePosition.bottom = (viewBounds.height() - childHeight) / 2) : "bottom" === layoutSpec.align ? (child.layoutBounds.y1 = viewBounds.y2 - childHeight,
74
+ child.layoutBounds.y2 = viewBounds.y2, child.relativePosition.top = viewBounds.height() - childHeight,
75
+ child.relativePosition.bottom = 0) : "top" === layoutSpec.align && (child.layoutBounds.y1 = viewBounds.y1,
76
+ child.layoutBounds.y2 = viewBounds.y1 + childHeight, child.relativePosition.bottom = viewBounds.height() - childHeight,
77
+ child.relativePosition.top = 0));
78
+ }
79
+ } else "outside" === layoutSpec.position ? (curLeftX -= Math.max(parentLayoutBounds.x1 - bounds.x1, 0) + padding.left,
80
+ curRightX -= Math.max(bounds.x2 - parentLayoutBounds.x2, 0) + padding.right, curTopY -= Math.max(parentLayoutBounds.y1 - bounds.y1, 0) + padding.top,
81
+ curBottomY += Math.max(bounds.y2 - parentLayoutBounds.y2) + padding.bottom) : child.layoutBounds = viewBounds;
82
+ }
83
+ return viewBounds;
84
+ };
85
+ //# sourceMappingURL=relative.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/graph/layout/relative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG3C,OAAO,EAAE,MAAM,EAAO,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;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F;SACF;aAAM,IAAI,UAAU,CAAC,QAAQ,KAAK,SAAS,EAAE;YAC5C,QAAQ,IAAI,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;YAC1E,SAAS,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,GAAG,kBAAkB,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;YAC5E,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;YACxE,UAAU,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,GAAG,kBAAkB,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;SAC5E;aAAM;YACL,KAAK,CAAC,YAAY,GAAG,UAAU,CAAC;SACjC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC","file":"relative.js","sourcesContent":["import { ComponentEnum } from './../enums';\nimport type { IBounds } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { Bounds, pad } from '@visactor/vutils';\nimport { toPercent } from '@visactor/vgrammar-util';\nimport type {\n IGroupMark,\n ILayoutOptions,\n IMark,\n MarkRelativeItemSpec,\n MarkRelativeContainerSpec,\n IComponent\n} from '../../types';\nimport { normalizePadding } from '../../parse/view';\n\nconst defaultLayoutOrder = {\n [ComponentEnum.axis]: 0,\n [ComponentEnum.legend]: 1,\n [ComponentEnum.slider]: 2,\n [ComponentEnum.player]: 3,\n [ComponentEnum.datazoom]: 4\n};\n\nconst getLayoutOrderOfMark = (mark: IMark) => {\n return (\n (mark.getSpec().layout as MarkRelativeItemSpec)?.order ??\n (mark.markType === 'component' ? defaultLayoutOrder[(mark as IComponent).componentType] ?? Infinity : Infinity)\n );\n};\n\nexport const doRelativeLayout = (\n group: IGroupMark,\n children: IMark[],\n parentLayoutBounds: IBounds,\n options?: ILayoutOptions\n) => {\n const viewBounds = parentLayoutBounds.clone();\n const groupLayoutSpec = group.getSpec().layout as MarkRelativeContainerSpec;\n const maxChildWidth = toPercent(groupLayoutSpec.maxChildWidth, viewBounds.width());\n const maxChildHeight = toPercent(groupLayoutSpec.maxChildHeight, viewBounds.width());\n let minDeltaX1 = 0;\n let minDeltaX2 = 0;\n let minDeltaY1 = 0;\n let minDeltaY2 = 0;\n\n children.forEach((child: IMark) => {\n const layoutSpec = child.getSpec().layout as MarkRelativeItemSpec;\n const padding = normalizePadding(layoutSpec.padding);\n const bounds = options.parseMarkBounds ? options.parseMarkBounds(child.getBounds(), child) : child.getBounds();\n\n if (layoutSpec.position === 'top' || layoutSpec.position === 'bottom') {\n const childHeight = Math.min(bounds.height() + padding.top + padding.bottom, maxChildHeight);\n\n if (layoutSpec.position === 'top') {\n viewBounds.y1 += childHeight;\n } else {\n viewBounds.y2 -= childHeight;\n }\n\n if (bounds.x1 < parentLayoutBounds.x1) {\n minDeltaX1 = Math.max(minDeltaX1, parentLayoutBounds.x1 - bounds.x1);\n }\n\n if (bounds.x2 > parentLayoutBounds.x2) {\n minDeltaX2 = Math.max(minDeltaX2, bounds.x2 - parentLayoutBounds.x2);\n }\n }\n\n if (layoutSpec.position === 'left' || layoutSpec.position === 'right') {\n const childWidth = Math.min(bounds.width() + padding.left + padding.right, maxChildWidth);\n\n if (layoutSpec.position === 'left') {\n viewBounds.x1 += childWidth;\n } else {\n viewBounds.x2 -= childWidth;\n }\n\n if (bounds.y1 < parentLayoutBounds.y1) {\n minDeltaY1 = Math.max(minDeltaY1, parentLayoutBounds.y1 - bounds.y1);\n }\n\n if (bounds.y2 > parentLayoutBounds.y2) {\n minDeltaY2 = Math.max(minDeltaY2, bounds.y2 - parentLayoutBounds.y2);\n }\n }\n\n if (layoutSpec.position === 'outside') {\n viewBounds.x1 += Math.max(parentLayoutBounds.x1 - bounds.x1, 0) + padding.left;\n viewBounds.x2 -= Math.max(bounds.x2 - parentLayoutBounds.x2, 0) + padding.right;\n viewBounds.y1 += Math.max(parentLayoutBounds.y1 - bounds.y1, 0) + padding.top;\n viewBounds.y2 -= Math.max(bounds.y2 - parentLayoutBounds.y2) + padding.bottom;\n }\n });\n\n if (minDeltaX1 > viewBounds.x1 - parentLayoutBounds.x1 && minDeltaX1 < parentLayoutBounds.width()) {\n viewBounds.x1 = parentLayoutBounds.x1 + minDeltaX1;\n }\n\n if (minDeltaX2 > parentLayoutBounds.x2 - viewBounds.x2 && minDeltaX2 < parentLayoutBounds.width()) {\n viewBounds.x2 = parentLayoutBounds.x2 - minDeltaX2;\n }\n\n if (minDeltaY1 > viewBounds.y1 - parentLayoutBounds.y1 && minDeltaY1 < parentLayoutBounds.height()) {\n viewBounds.y1 = parentLayoutBounds.y1 + minDeltaY1;\n }\n\n if (minDeltaY2 > parentLayoutBounds.y2 - viewBounds.y2 && minDeltaY2 < parentLayoutBounds.height()) {\n viewBounds.y2 = parentLayoutBounds.y2 - minDeltaY2;\n }\n\n let curTopY = viewBounds.y1;\n let curBottomY = viewBounds.y2;\n let curLeftX = viewBounds.x1;\n let curRightX = viewBounds.x2;\n\n const sortedChildren = children.slice().sort((markA, markB) => {\n return getLayoutOrderOfMark(markA) - getLayoutOrderOfMark(markB);\n });\n\n for (let i = 0, len = sortedChildren.length; i < len; i++) {\n const child = sortedChildren[i];\n const layoutSpec = child.getSpec().layout as MarkRelativeItemSpec;\n const padding = normalizePadding(layoutSpec.padding);\n const bounds = options.parseMarkBounds ? options.parseMarkBounds(child.getBounds(), child) : child.getBounds();\n\n if (layoutSpec.position === 'top' || layoutSpec.position === 'bottom') {\n const childHeight = Math.min(bounds.height() + padding.top + padding.bottom, maxChildHeight);\n\n if (layoutSpec.position === 'top') {\n child.layoutBounds = new Bounds().set(viewBounds.x1, curTopY - childHeight, viewBounds.x2, curTopY);\n curTopY -= childHeight;\n } else {\n child.layoutBounds = new Bounds().set(viewBounds.x1, curBottomY, viewBounds.x2, curBottomY + childHeight);\n curBottomY += childHeight;\n }\n child.relativePosition = {\n top: child.layoutBounds.y1 - viewBounds.y1,\n bottom: child.layoutBounds.y1 - viewBounds.y2\n };\n\n if (layoutSpec.align) {\n const childWidth = bounds.width() + padding.left + padding.right;\n\n if (childWidth < viewBounds.width()) {\n if (layoutSpec.align === 'center') {\n child.layoutBounds.x1 = (viewBounds.x1 + viewBounds.x2) / 2 - childWidth / 2;\n child.layoutBounds.x2 = child.layoutBounds.x1 + childWidth;\n child.relativePosition.left = child.relativePosition.right = (viewBounds.width() - childWidth) / 2;\n } else if (layoutSpec.align === 'right') {\n child.layoutBounds.x1 = viewBounds.x2 - childWidth;\n child.layoutBounds.x2 = viewBounds.x2;\n child.relativePosition.right = 0;\n child.relativePosition.left = viewBounds.width() - childWidth;\n } else if (layoutSpec.align === 'left') {\n child.layoutBounds.x1 = viewBounds.x1;\n child.layoutBounds.x2 = viewBounds.x1 + childWidth;\n child.relativePosition.left = 0;\n child.relativePosition.right = viewBounds.width() - childWidth;\n }\n }\n }\n } else if (layoutSpec.position === 'left' || layoutSpec.position === 'right') {\n const childWidth = Math.min(bounds.width() + padding.left + padding.right, maxChildWidth);\n\n if (layoutSpec.position === 'left') {\n child.layoutBounds = new Bounds().set(curLeftX - childWidth, viewBounds.y1, curLeftX, viewBounds.y2);\n curLeftX -= childWidth;\n } else {\n child.layoutBounds = new Bounds().set(curRightX, viewBounds.y1, curRightX + childWidth, viewBounds.y2);\n curRightX += childWidth;\n }\n\n child.relativePosition = {\n left: child.layoutBounds.x1 - viewBounds.x1,\n right: child.layoutBounds.x1 - viewBounds.x2\n };\n\n if (layoutSpec.align) {\n const childHeight = bounds.height() + padding.top + padding.bottom;\n\n if (childWidth < viewBounds.width()) {\n if (layoutSpec.align === 'middle') {\n child.layoutBounds.y1 = (viewBounds.y1 + viewBounds.y2) / 2 - childHeight / 2;\n child.layoutBounds.y2 = child.layoutBounds.y1 + childHeight;\n child.relativePosition.top = child.relativePosition.bottom = (viewBounds.height() - childHeight) / 2;\n } else if (layoutSpec.align === 'bottom') {\n child.layoutBounds.y1 = viewBounds.y2 - childHeight;\n child.layoutBounds.y2 = viewBounds.y2;\n child.relativePosition.top = viewBounds.height() - childHeight;\n child.relativePosition.bottom = 0;\n } else if (layoutSpec.align === 'top') {\n child.layoutBounds.y1 = viewBounds.y1;\n child.layoutBounds.y2 = viewBounds.y1 + childHeight;\n child.relativePosition.bottom = viewBounds.height() - childHeight;\n child.relativePosition.top = 0;\n }\n }\n }\n } else if (layoutSpec.position === 'outside') {\n curLeftX -= Math.max(parentLayoutBounds.x1 - bounds.x1, 0) + padding.left;\n curRightX -= Math.max(bounds.x2 - parentLayoutBounds.x2, 0) + padding.right;\n curTopY -= Math.max(parentLayoutBounds.y1 - bounds.y1, 0) + padding.top;\n curBottomY += Math.max(bounds.y2 - parentLayoutBounds.y2) + padding.bottom;\n } else {\n child.layoutBounds = viewBounds;\n }\n }\n\n return viewBounds;\n};\n"]}
@@ -0,0 +1,20 @@
1
+ import type { DiffResult } from '../../types/base';
2
+ export type GroupedData<T> = {
3
+ keys: (symbol | string)[];
4
+ data: Map<symbol | string, T[]>;
5
+ };
6
+ export declare function groupData<T>(data: T[], key: ((datum: T) => symbol | string) | string, sort?: (a: T, b: T) => number): GroupedData<T>;
7
+ export declare class Differ<T> {
8
+ private prevData;
9
+ private currentData;
10
+ private callback;
11
+ constructor(data?: T[], key?: ((datum: T) => symbol | string) | string, sort?: (a: T, b: T) => number);
12
+ setCurrentData(currentData: GroupedData<T>): void;
13
+ getCurrentData(): GroupedData<T>;
14
+ doDiff(): void;
15
+ setCallback(callback: (key: symbol | string, data: T[], prevData: T[]) => void): void;
16
+ updateToCurrent(): void;
17
+ reset(): void;
18
+ }
19
+ export declare function diffSingle<U, V>(prev: U[], next: V[], key: (datum: U | V) => symbol | string): DiffResult<U, V>;
20
+ export declare function diffMultiple<U, V>(prev: U[], next: V[], key: (datum: U | V) => symbol | string): DiffResult<U[], V[]>;