@visactor/vchart 1.3.0-beta.9 → 1.3.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 (925) hide show
  1. package/build/es5/index.js +3 -3
  2. package/build/index.js +17475 -16797
  3. package/build/index.min.js +2 -2
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/animation/utils.js +2 -2
  6. package/cjs/animation/utils.js.map +1 -1
  7. package/cjs/chart/area/area.js +2 -2
  8. package/cjs/chart/area/area.js.map +1 -1
  9. package/cjs/chart/bar/bar-3d.js +2 -2
  10. package/cjs/chart/bar/bar-3d.js.map +1 -1
  11. package/cjs/chart/bar/bar.js +2 -2
  12. package/cjs/chart/bar/bar.js.map +1 -1
  13. package/cjs/chart/base-chart.d.ts +1 -0
  14. package/cjs/chart/base-chart.js +14 -8
  15. package/cjs/chart/base-chart.js.map +1 -1
  16. package/cjs/chart/box-plot/box-plot.js +2 -2
  17. package/cjs/chart/box-plot/box-plot.js.map +1 -1
  18. package/cjs/chart/cartesian/cartesian.js +1 -1
  19. package/cjs/chart/cartesian/cartesian.js.map +1 -1
  20. package/cjs/chart/circle-packing/circle-packing.js +2 -2
  21. package/cjs/chart/circle-packing/circle-packing.js.map +1 -1
  22. package/cjs/chart/funnel/funnel-3d.js +2 -2
  23. package/cjs/chart/funnel/funnel-3d.js.map +1 -1
  24. package/cjs/chart/funnel/funnel.js +2 -2
  25. package/cjs/chart/funnel/funnel.js.map +1 -1
  26. package/cjs/chart/gauge/gauge.js +2 -2
  27. package/cjs/chart/gauge/gauge.js.map +1 -1
  28. package/cjs/chart/heatmap/heatmap.js +2 -2
  29. package/cjs/chart/heatmap/heatmap.js.map +1 -1
  30. package/cjs/chart/histogram/histogram-3d.js +2 -2
  31. package/cjs/chart/histogram/histogram-3d.js.map +1 -1
  32. package/cjs/chart/histogram/histogram.js +2 -2
  33. package/cjs/chart/histogram/histogram.js.map +1 -1
  34. package/cjs/chart/index.d.ts +1 -1
  35. package/cjs/chart/index.js.map +1 -1
  36. package/cjs/chart/line/line.js +2 -2
  37. package/cjs/chart/line/line.js.map +1 -1
  38. package/cjs/chart/map/map.js +2 -2
  39. package/cjs/chart/map/map.js.map +1 -1
  40. package/cjs/chart/pie/pie-3d.js +2 -2
  41. package/cjs/chart/pie/pie-3d.js.map +1 -1
  42. package/cjs/chart/pie/pie.js +2 -2
  43. package/cjs/chart/pie/pie.js.map +1 -1
  44. package/cjs/chart/polar/progress-like.js +2 -2
  45. package/cjs/chart/polar/progress-like.js.map +1 -1
  46. package/cjs/chart/polar/rose-like.js +1 -1
  47. package/cjs/chart/polar/rose-like.js.map +1 -1
  48. package/cjs/chart/progress/circular/circular.js +2 -2
  49. package/cjs/chart/progress/circular/circular.js.map +1 -1
  50. package/cjs/chart/progress/linear/linear.js +4 -4
  51. package/cjs/chart/progress/linear/linear.js.map +1 -1
  52. package/cjs/chart/radar/radar.js +4 -4
  53. package/cjs/chart/radar/radar.js.map +1 -1
  54. package/cjs/chart/range-area/range-area.js +2 -2
  55. package/cjs/chart/range-area/range-area.js.map +1 -1
  56. package/cjs/chart/range-column/range-column-3d.js +2 -2
  57. package/cjs/chart/range-column/range-column-3d.js.map +1 -1
  58. package/cjs/chart/range-column/range-column.js +2 -2
  59. package/cjs/chart/range-column/range-column.js.map +1 -1
  60. package/cjs/chart/rose/rose.js +3 -3
  61. package/cjs/chart/rose/rose.js.map +1 -1
  62. package/cjs/chart/sankey/sankey.js +2 -2
  63. package/cjs/chart/sankey/sankey.js.map +1 -1
  64. package/cjs/chart/scatter/scatter.js +2 -2
  65. package/cjs/chart/scatter/scatter.js.map +1 -1
  66. package/cjs/chart/sequence/sequence.js +2 -2
  67. package/cjs/chart/sequence/sequence.js.map +1 -1
  68. package/cjs/chart/sunburst/sunburst.js +2 -2
  69. package/cjs/chart/sunburst/sunburst.js.map +1 -1
  70. package/cjs/chart/treemap/treemap.js +2 -2
  71. package/cjs/chart/treemap/treemap.js.map +1 -1
  72. package/cjs/chart/util.js +1 -1
  73. package/cjs/chart/util.js.map +1 -1
  74. package/cjs/chart/waterfall/waterfall.js +2 -2
  75. package/cjs/chart/waterfall/waterfall.js.map +1 -1
  76. package/cjs/chart/word-cloud/word-cloud-3d.js +2 -2
  77. package/cjs/chart/word-cloud/word-cloud-3d.js.map +1 -1
  78. package/cjs/chart/word-cloud/word-cloud.js +2 -2
  79. package/cjs/chart/word-cloud/word-cloud.js.map +1 -1
  80. package/cjs/compile/compiler.d.ts +4 -0
  81. package/cjs/compile/compiler.js +4 -0
  82. package/cjs/compile/compiler.js.map +1 -1
  83. package/cjs/compile/interface/compilable-item.d.ts +1 -0
  84. package/cjs/compile/interface/compilable-item.js.map +1 -1
  85. package/cjs/component/axis/base-axis.d.ts +1 -14
  86. package/cjs/component/axis/base-axis.js +18 -29
  87. package/cjs/component/axis/base-axis.js.map +1 -1
  88. package/cjs/component/axis/cartesian/axis.d.ts +1 -1
  89. package/cjs/component/axis/cartesian/axis.js +23 -23
  90. package/cjs/component/axis/cartesian/axis.js.map +1 -1
  91. package/cjs/component/axis/cartesian/index.d.ts +1 -0
  92. package/cjs/component/axis/cartesian/index.js +2 -1
  93. package/cjs/component/axis/cartesian/index.js.map +1 -1
  94. package/cjs/component/axis/cartesian/interface/spec.d.ts +4 -1
  95. package/cjs/component/axis/cartesian/interface/spec.js.map +1 -1
  96. package/cjs/component/axis/cartesian/linear-axis.js +2 -2
  97. package/cjs/component/axis/cartesian/linear-axis.js.map +1 -1
  98. package/cjs/component/axis/cartesian/symlog-axis.d.ts +16 -0
  99. package/cjs/component/axis/cartesian/symlog-axis.js +23 -0
  100. package/cjs/component/axis/cartesian/symlog-axis.js.map +1 -0
  101. package/cjs/component/axis/cartesian/time-axis.js +2 -2
  102. package/cjs/component/axis/cartesian/time-axis.js.map +1 -1
  103. package/cjs/component/axis/interface.d.ts +4 -8
  104. package/cjs/component/axis/interface.js.map +1 -1
  105. package/cjs/component/axis/mixin/linear-axis-mixin.js +3 -3
  106. package/cjs/component/axis/mixin/linear-axis-mixin.js.map +1 -1
  107. package/cjs/component/axis/polar/axis.d.ts +1 -1
  108. package/cjs/component/axis/polar/axis.js +14 -14
  109. package/cjs/component/axis/polar/axis.js.map +1 -1
  110. package/cjs/component/axis/polar/interface/common.d.ts +1 -1
  111. package/cjs/component/axis/polar/interface/common.js.map +1 -1
  112. package/cjs/component/axis/{utils.d.ts → util.d.ts} +1 -1
  113. package/cjs/component/axis/{utils.js → util.js} +6 -6
  114. package/cjs/component/axis/util.js.map +1 -0
  115. package/cjs/component/base/base-component.d.ts +10 -2
  116. package/cjs/component/base/base-component.js +10 -5
  117. package/cjs/component/base/base-component.js.map +1 -1
  118. package/cjs/component/base/interface.d.ts +8 -0
  119. package/cjs/component/base/interface.js +6 -0
  120. package/cjs/component/base/interface.js.map +1 -0
  121. package/cjs/component/base/util.d.ts +2 -1
  122. package/cjs/component/base/util.js +21 -16
  123. package/cjs/component/base/util.js.map +1 -1
  124. package/cjs/component/brush/brush.d.ts +12 -2
  125. package/cjs/component/brush/brush.js +74 -63
  126. package/cjs/component/brush/brush.js.map +1 -1
  127. package/cjs/component/crosshair/base.d.ts +2 -2
  128. package/cjs/component/crosshair/base.js +1 -1
  129. package/cjs/component/crosshair/base.js.map +1 -1
  130. package/cjs/component/crosshair/cartesian.js +9 -9
  131. package/cjs/component/crosshair/cartesian.js.map +1 -1
  132. package/cjs/component/crosshair/interface/spec.d.ts +8 -8
  133. package/cjs/component/crosshair/interface/spec.js.map +1 -1
  134. package/cjs/component/crosshair/interface/theme.d.ts +3 -1
  135. package/cjs/component/crosshair/interface/theme.js.map +1 -1
  136. package/cjs/component/crosshair/polar.js +9 -9
  137. package/cjs/component/crosshair/polar.js.map +1 -1
  138. package/cjs/component/crosshair/util.d.ts +5 -0
  139. package/cjs/component/crosshair/util.js +41 -4
  140. package/cjs/component/crosshair/util.js.map +1 -1
  141. package/cjs/component/custom-mark/custom-mark.d.ts +1 -1
  142. package/cjs/component/custom-mark/custom-mark.js +3 -3
  143. package/cjs/component/custom-mark/custom-mark.js.map +1 -1
  144. package/cjs/component/data-zoom/data-filter-base-component.js +2 -3
  145. package/cjs/component/data-zoom/data-filter-base-component.js.map +1 -1
  146. package/cjs/component/data-zoom/data-zoom/data-zoom.js +6 -6
  147. package/cjs/component/data-zoom/data-zoom/data-zoom.js.map +1 -1
  148. package/cjs/component/data-zoom/data-zoom/interface.d.ts +2 -2
  149. package/cjs/component/data-zoom/data-zoom/interface.js.map +1 -1
  150. package/cjs/component/data-zoom/interface.d.ts +2 -5
  151. package/cjs/component/data-zoom/interface.js.map +1 -1
  152. package/cjs/component/geo/geo-coordinate.d.ts +2 -0
  153. package/cjs/component/geo/geo-coordinate.js +15 -5
  154. package/cjs/component/geo/geo-coordinate.js.map +1 -1
  155. package/cjs/component/geo/projection.d.ts +1 -0
  156. package/cjs/component/geo/projection.js +4 -0
  157. package/cjs/component/geo/projection.js.map +1 -1
  158. package/cjs/component/index.d.ts +2 -2
  159. package/cjs/component/index.js +6 -1
  160. package/cjs/component/index.js.map +1 -1
  161. package/cjs/component/indicator/indicator.d.ts +1 -0
  162. package/cjs/component/indicator/indicator.js +10 -7
  163. package/cjs/component/indicator/indicator.js.map +1 -1
  164. package/cjs/component/indicator/interface.d.ts +5 -6
  165. package/cjs/component/indicator/interface.js.map +1 -1
  166. package/cjs/component/interface/theme.d.ts +2 -2
  167. package/cjs/component/interface/theme.js.map +1 -1
  168. package/cjs/component/interface/type.d.ts +1 -0
  169. package/cjs/component/interface/type.js +12 -11
  170. package/cjs/component/interface/type.js.map +1 -1
  171. package/cjs/component/label/base-label.d.ts +0 -1
  172. package/cjs/component/label/base-label.js +0 -5
  173. package/cjs/component/label/base-label.js.map +1 -1
  174. package/cjs/component/label/interface.d.ts +2 -1
  175. package/cjs/component/label/interface.js.map +1 -1
  176. package/cjs/component/label/label.d.ts +0 -1
  177. package/cjs/component/label/label.js +1 -6
  178. package/cjs/component/label/label.js.map +1 -1
  179. package/cjs/component/label/totalLabel.js +1 -1
  180. package/cjs/component/label/totalLabel.js.map +1 -1
  181. package/cjs/component/legend/base-legend.js +4 -4
  182. package/cjs/component/legend/base-legend.js.map +1 -1
  183. package/cjs/component/legend/continuous/util.js +4 -4
  184. package/cjs/component/legend/continuous/util.js.map +1 -1
  185. package/cjs/component/legend/discrete/interface.d.ts +3 -1
  186. package/cjs/component/legend/discrete/interface.js.map +1 -1
  187. package/cjs/component/legend/discrete/legend.js +2 -2
  188. package/cjs/component/legend/discrete/legend.js.map +1 -1
  189. package/cjs/component/legend/discrete/util.js +2 -2
  190. package/cjs/component/legend/discrete/util.js.map +1 -1
  191. package/cjs/component/legend/interface.d.ts +2 -6
  192. package/cjs/component/legend/interface.js.map +1 -1
  193. package/cjs/component/legend/util.js +2 -2
  194. package/cjs/component/legend/util.js.map +1 -1
  195. package/cjs/component/marker/interface.d.ts +2 -2
  196. package/cjs/component/marker/interface.js.map +1 -1
  197. package/cjs/component/poptip/interface.d.ts +15 -0
  198. package/cjs/component/poptip/interface.js +6 -0
  199. package/cjs/component/poptip/interface.js.map +1 -0
  200. package/cjs/component/title/interface/spec.d.ts +2 -2
  201. package/cjs/component/title/interface/spec.js.map +1 -1
  202. package/cjs/component/tooltip/handler/dom/model/content-column-model.js +5 -5
  203. package/cjs/component/tooltip/handler/dom/model/content-column-model.js.map +1 -1
  204. package/cjs/component/tooltip/handler/dom/model/content-model.js +2 -2
  205. package/cjs/component/tooltip/handler/dom/model/content-model.js.map +1 -1
  206. package/cjs/component/tooltip/handler/dom/model/title-model.js +2 -2
  207. package/cjs/component/tooltip/handler/dom/model/title-model.js.map +1 -1
  208. package/cjs/component/tooltip/handler/dom/model/tooltip-model.js +2 -2
  209. package/cjs/component/tooltip/handler/dom/model/tooltip-model.js.map +1 -1
  210. package/cjs/component/tooltip/handler/dom/util.js +3 -3
  211. package/cjs/component/tooltip/handler/dom/util.js.map +1 -1
  212. package/cjs/component/tooltip/handler/utils/attribute.js +3 -3
  213. package/cjs/component/tooltip/handler/utils/attribute.js.map +1 -1
  214. package/cjs/component/tooltip/handler/utils/get-spec.js +1 -1
  215. package/cjs/component/tooltip/handler/utils/get-spec.js.map +1 -1
  216. package/cjs/component/tooltip/handler/utils/style.js +2 -2
  217. package/cjs/component/tooltip/handler/utils/style.js.map +1 -1
  218. package/cjs/component/tooltip/processor/base.js +1 -1
  219. package/cjs/component/tooltip/processor/base.js.map +1 -1
  220. package/cjs/component/tooltip/tooltip.js +1 -1
  221. package/cjs/component/tooltip/tooltip.js.map +1 -1
  222. package/cjs/core/index.d.ts +1 -1
  223. package/cjs/core/index.js +1 -1
  224. package/cjs/core/index.js.map +1 -1
  225. package/cjs/core/vchart.js +20 -17
  226. package/cjs/core/vchart.js.map +1 -1
  227. package/cjs/data/transforms/legend-data/discrete/discrete.js +4 -2
  228. package/cjs/data/transforms/legend-data/discrete/discrete.js.map +1 -1
  229. package/cjs/data/transforms/tick-data/discrete/polar-angle.js +2 -2
  230. package/cjs/data/transforms/tick-data/discrete/polar-angle.js.map +1 -1
  231. package/cjs/data/transforms/tick-data/util.js +5 -5
  232. package/cjs/data/transforms/tick-data/util.js.map +1 -1
  233. package/cjs/event/events/dimension/util/cartesian.js +2 -2
  234. package/cjs/event/events/dimension/util/cartesian.js.map +1 -1
  235. package/cjs/event/events/dimension/util/polar.js +1 -1
  236. package/cjs/event/events/dimension/util/polar.js.map +1 -1
  237. package/cjs/interaction/trigger.js +2 -2
  238. package/cjs/interaction/trigger.js.map +1 -1
  239. package/cjs/mark/base/base-mark.d.ts +1 -0
  240. package/cjs/mark/base/base-mark.js +19 -2
  241. package/cjs/mark/base/base-mark.js.map +1 -1
  242. package/cjs/mark/mark-set/index.d.ts +1 -0
  243. package/cjs/mark/mark-set/index.js.map +1 -1
  244. package/cjs/model/base-model.js +2 -2
  245. package/cjs/model/base-model.js.map +1 -1
  246. package/cjs/model/interface.d.ts +1 -1
  247. package/cjs/model/interface.js.map +1 -1
  248. package/cjs/plugin/components/index.d.ts +0 -2
  249. package/cjs/plugin/components/index.js +1 -2
  250. package/cjs/plugin/components/index.js.map +1 -1
  251. package/cjs/series/area/area.d.ts +1 -0
  252. package/cjs/series/area/area.js +4 -3
  253. package/cjs/series/area/area.js.map +1 -1
  254. package/cjs/series/bar/bar.js +9 -9
  255. package/cjs/series/bar/bar.js.map +1 -1
  256. package/cjs/series/base/base-series.d.ts +1 -0
  257. package/cjs/series/base/base-series.js +25 -8
  258. package/cjs/series/base/base-series.js.map +1 -1
  259. package/cjs/series/cartesian/cartesian.d.ts +4 -0
  260. package/cjs/series/cartesian/cartesian.js +16 -4
  261. package/cjs/series/cartesian/cartesian.js.map +1 -1
  262. package/cjs/series/cartesian/interface.d.ts +1 -0
  263. package/cjs/series/cartesian/interface.js.map +1 -1
  264. package/cjs/series/dot/dot.js +1 -1
  265. package/cjs/series/dot/dot.js.map +1 -1
  266. package/cjs/series/funnel/funnel.js +13 -3
  267. package/cjs/series/funnel/funnel.js.map +1 -1
  268. package/cjs/series/heatmap/heatmap.js +1 -1
  269. package/cjs/series/heatmap/heatmap.js.map +1 -1
  270. package/cjs/series/line/interface.d.ts +0 -2
  271. package/cjs/series/line/interface.js.map +1 -1
  272. package/cjs/series/line/line.d.ts +1 -0
  273. package/cjs/series/line/line.js +1 -1
  274. package/cjs/series/line/line.js.map +1 -1
  275. package/cjs/series/map/geo-source.js +2 -2
  276. package/cjs/series/map/geo-source.js.map +1 -1
  277. package/cjs/series/map/interface.d.ts +1 -0
  278. package/cjs/series/map/interface.js.map +1 -1
  279. package/cjs/series/map/map.js +8 -4
  280. package/cjs/series/map/map.js.map +1 -1
  281. package/cjs/series/mixin/line-mixin.d.ts +1 -1
  282. package/cjs/series/mixin/line-mixin.js +1 -1
  283. package/cjs/series/mixin/line-mixin.js.map +1 -1
  284. package/cjs/series/pie/pie.js +1 -1
  285. package/cjs/series/pie/pie.js.map +1 -1
  286. package/cjs/series/polar/interface.d.ts +1 -0
  287. package/cjs/series/polar/interface.js.map +1 -1
  288. package/cjs/series/polar/polar.d.ts +4 -0
  289. package/cjs/series/polar/polar.js +15 -3
  290. package/cjs/series/polar/polar.js.map +1 -1
  291. package/cjs/series/radar/radar.d.ts +1 -0
  292. package/cjs/series/radar/radar.js +1 -1
  293. package/cjs/series/radar/radar.js.map +1 -1
  294. package/cjs/series/range-column/range-column.js +1 -1
  295. package/cjs/series/range-column/range-column.js.map +1 -1
  296. package/cjs/series/rose/rose.js +1 -1
  297. package/cjs/series/rose/rose.js.map +1 -1
  298. package/cjs/series/sankey/interface.d.ts +3 -2
  299. package/cjs/series/sankey/interface.js.map +1 -1
  300. package/cjs/series/sankey/sankey.d.ts +5 -0
  301. package/cjs/series/sankey/sankey.js +246 -92
  302. package/cjs/series/sankey/sankey.js.map +1 -1
  303. package/cjs/series/scatter/scatter.js +1 -1
  304. package/cjs/series/scatter/scatter.js.map +1 -1
  305. package/cjs/series/util/utils.d.ts +4 -1
  306. package/cjs/series/util/utils.js +8 -6
  307. package/cjs/series/util/utils.js.map +1 -1
  308. package/cjs/theme/builtin/common/component/axis/cartesian-axis.js +4 -4
  309. package/cjs/theme/builtin/common/component/axis/cartesian-axis.js.map +1 -1
  310. package/cjs/theme/builtin/common/component/axis/common-axis.js +12 -6
  311. package/cjs/theme/builtin/common/component/axis/common-axis.js.map +1 -1
  312. package/cjs/theme/builtin/common/component/axis/polar-axis.js +1 -1
  313. package/cjs/theme/builtin/common/component/axis/polar-axis.js.map +1 -1
  314. package/cjs/theme/builtin/common/component/crosshair.js +73 -117
  315. package/cjs/theme/builtin/common/component/crosshair.js.map +1 -1
  316. package/cjs/theme/builtin/common/component/data-zoom.js +19 -7
  317. package/cjs/theme/builtin/common/component/data-zoom.js.map +1 -1
  318. package/cjs/theme/builtin/common/component/indicator.js +17 -5
  319. package/cjs/theme/builtin/common/component/indicator.js.map +1 -1
  320. package/cjs/theme/builtin/common/component/legend/color-legend.js +31 -5
  321. package/cjs/theme/builtin/common/component/legend/color-legend.js.map +1 -1
  322. package/cjs/theme/builtin/common/component/legend/continuous.js +26 -12
  323. package/cjs/theme/builtin/common/component/legend/continuous.js.map +1 -1
  324. package/cjs/theme/builtin/common/component/legend/discrete-legend.js +22 -9
  325. package/cjs/theme/builtin/common/component/legend/discrete-legend.js.map +1 -1
  326. package/cjs/theme/builtin/common/component/legend/size-legend.js +54 -15
  327. package/cjs/theme/builtin/common/component/legend/size-legend.js.map +1 -1
  328. package/cjs/theme/builtin/common/component/map-label.js +5 -5
  329. package/cjs/theme/builtin/common/component/map-label.js.map +1 -1
  330. package/cjs/theme/builtin/common/component/mark-area.js +7 -2
  331. package/cjs/theme/builtin/common/component/mark-area.js.map +1 -1
  332. package/cjs/theme/builtin/common/component/mark-line.js +7 -2
  333. package/cjs/theme/builtin/common/component/mark-line.js.map +1 -1
  334. package/cjs/theme/builtin/common/component/player.js +33 -7
  335. package/cjs/theme/builtin/common/component/player.js.map +1 -1
  336. package/cjs/theme/builtin/common/component/poptip.d.ts +2 -2
  337. package/cjs/theme/builtin/common/component/poptip.js +20 -12
  338. package/cjs/theme/builtin/common/component/poptip.js.map +1 -1
  339. package/cjs/theme/builtin/common/component/title.js +9 -5
  340. package/cjs/theme/builtin/common/component/title.js.map +1 -1
  341. package/cjs/theme/builtin/common/component/tooltip.js +13 -10
  342. package/cjs/theme/builtin/common/component/tooltip.js.map +1 -1
  343. package/cjs/theme/builtin/common/component/total-label.js +4 -4
  344. package/cjs/theme/builtin/common/component/total-label.js.map +1 -1
  345. package/cjs/theme/builtin/common/constants.js +17 -10
  346. package/cjs/theme/builtin/common/constants.js.map +1 -1
  347. package/cjs/theme/builtin/common/mark.js +8 -4
  348. package/cjs/theme/builtin/common/mark.js.map +1 -1
  349. package/cjs/theme/builtin/common/series/area.js +2 -7
  350. package/cjs/theme/builtin/common/series/area.js.map +1 -1
  351. package/cjs/theme/builtin/common/series/bar.js +2 -7
  352. package/cjs/theme/builtin/common/series/bar.js.map +1 -1
  353. package/cjs/theme/builtin/common/series/bar3d.js +1 -6
  354. package/cjs/theme/builtin/common/series/bar3d.js.map +1 -1
  355. package/cjs/theme/builtin/common/series/circle-packing.js +11 -5
  356. package/cjs/theme/builtin/common/series/circle-packing.js.map +1 -1
  357. package/cjs/theme/builtin/common/series/dot.js +11 -3
  358. package/cjs/theme/builtin/common/series/dot.js.map +1 -1
  359. package/cjs/theme/builtin/common/series/funnel.js +7 -4
  360. package/cjs/theme/builtin/common/series/funnel.js.map +1 -1
  361. package/cjs/theme/builtin/common/series/funnel3d.js +7 -4
  362. package/cjs/theme/builtin/common/series/funnel3d.js.map +1 -1
  363. package/cjs/theme/builtin/common/series/line.js +2 -7
  364. package/cjs/theme/builtin/common/series/line.js.map +1 -1
  365. package/cjs/theme/builtin/common/series/map.js +4 -2
  366. package/cjs/theme/builtin/common/series/map.js.map +1 -1
  367. package/cjs/theme/builtin/common/series/pie.js +1 -6
  368. package/cjs/theme/builtin/common/series/pie.js.map +1 -1
  369. package/cjs/theme/builtin/common/series/pie3d.js +2 -9
  370. package/cjs/theme/builtin/common/series/pie3d.js.map +1 -1
  371. package/cjs/theme/builtin/common/series/radar.js +2 -7
  372. package/cjs/theme/builtin/common/series/radar.js.map +1 -1
  373. package/cjs/theme/builtin/common/series/rangeColumn.js +2 -3
  374. package/cjs/theme/builtin/common/series/rangeColumn.js.map +1 -1
  375. package/cjs/theme/builtin/common/series/rose.js +1 -2
  376. package/cjs/theme/builtin/common/series/rose.js.map +1 -1
  377. package/cjs/theme/builtin/common/series/sankey.js +0 -1
  378. package/cjs/theme/builtin/common/series/sankey.js.map +1 -1
  379. package/cjs/theme/builtin/common/series/scatter.js +2 -7
  380. package/cjs/theme/builtin/common/series/scatter.js.map +1 -1
  381. package/cjs/theme/builtin/common/series/sunburst.js +5 -2
  382. package/cjs/theme/builtin/common/series/sunburst.js.map +1 -1
  383. package/cjs/theme/builtin/common/series/treemap.js +9 -5
  384. package/cjs/theme/builtin/common/series/treemap.js.map +1 -1
  385. package/cjs/theme/builtin/common/series/waterfall.js +5 -6
  386. package/cjs/theme/builtin/common/series/waterfall.js.map +1 -1
  387. package/cjs/theme/builtin/dark/color-scheme.js +5 -3
  388. package/cjs/theme/builtin/dark/color-scheme.js.map +1 -1
  389. package/cjs/theme/builtin/index.d.ts +0 -1
  390. package/cjs/theme/builtin/index.js +1 -2
  391. package/cjs/theme/builtin/index.js.map +1 -1
  392. package/cjs/theme/builtin/light/color-scheme.js +4 -2
  393. package/cjs/theme/builtin/light/color-scheme.js.map +1 -1
  394. package/cjs/theme/builtin/light/index.js +2 -2
  395. package/cjs/theme/builtin/light/index.js.map +1 -1
  396. package/cjs/theme/color-scheme/builtin/interface.d.ts +22 -0
  397. package/cjs/theme/color-scheme/builtin/interface.js +6 -0
  398. package/cjs/theme/color-scheme/builtin/interface.js.map +1 -0
  399. package/cjs/theme/color-scheme/interface.d.ts +3 -2
  400. package/cjs/theme/color-scheme/interface.js.map +1 -1
  401. package/cjs/theme/color-scheme/util.js +8 -2
  402. package/cjs/theme/color-scheme/util.js.map +1 -1
  403. package/cjs/theme/interface.d.ts +16 -5
  404. package/cjs/theme/interface.js.map +1 -1
  405. package/cjs/typings/spec/common.d.ts +2 -1
  406. package/cjs/typings/spec/common.js.map +1 -1
  407. package/cjs/typings/visual.d.ts +10 -20
  408. package/cjs/typings/visual.js.map +1 -1
  409. package/cjs/util/data.d.ts +0 -8
  410. package/cjs/util/data.js +2 -9
  411. package/cjs/util/data.js.map +1 -1
  412. package/cjs/util/object.d.ts +2 -4
  413. package/cjs/util/object.js +2 -18
  414. package/cjs/util/object.js.map +1 -1
  415. package/cjs/util/scale.d.ts +2 -6
  416. package/cjs/util/scale.js +1 -6
  417. package/cjs/util/scale.js.map +1 -1
  418. package/cjs/util/space.d.ts +3 -10
  419. package/cjs/util/space.js +13 -28
  420. package/cjs/util/space.js.map +1 -1
  421. package/cjs/util/spec/background.d.ts +4 -0
  422. package/cjs/util/spec/background.js +27 -0
  423. package/cjs/util/spec/background.js.map +1 -0
  424. package/cjs/util/spec/clone-deep.d.ts +1 -0
  425. package/cjs/util/spec/clone-deep.js +27 -0
  426. package/cjs/util/spec/clone-deep.js.map +1 -0
  427. package/cjs/util/spec/common.d.ts +3 -0
  428. package/cjs/util/spec/common.js +23 -0
  429. package/cjs/util/spec/common.js.map +1 -0
  430. package/cjs/util/spec/index.d.ts +7 -0
  431. package/cjs/util/spec/index.js +24 -0
  432. package/cjs/util/spec/index.js.map +1 -0
  433. package/cjs/util/spec/merge-spec.d.ts +1 -0
  434. package/cjs/util/spec/merge-spec.js +58 -0
  435. package/cjs/util/spec/merge-spec.js.map +1 -0
  436. package/cjs/util/spec/merge-theme.d.ts +3 -0
  437. package/cjs/util/spec/merge-theme.js +37 -0
  438. package/cjs/util/spec/merge-theme.js.map +1 -0
  439. package/cjs/util/spec/preprocess.d.ts +3 -0
  440. package/cjs/util/spec/preprocess.js +24 -0
  441. package/cjs/util/spec/preprocess.js.map +1 -0
  442. package/cjs/util/spec/transform.d.ts +3 -0
  443. package/cjs/util/spec/transform.js +28 -0
  444. package/cjs/util/spec/transform.js.map +1 -0
  445. package/cjs/util/text.d.ts +1 -2
  446. package/cjs/util/text.js +4 -14
  447. package/cjs/util/text.js.map +1 -1
  448. package/cjs/vchart-all.js +1 -1
  449. package/cjs/vchart-all.js.map +1 -1
  450. package/cjs/vchart-simple.js +3 -4
  451. package/cjs/vchart-simple.js.map +1 -1
  452. package/esm/animation/utils.js +3 -3
  453. package/esm/animation/utils.js.map +1 -1
  454. package/esm/chart/area/area.js +3 -3
  455. package/esm/chart/area/area.js.map +1 -1
  456. package/esm/chart/bar/bar-3d.js +2 -2
  457. package/esm/chart/bar/bar-3d.js.map +1 -1
  458. package/esm/chart/bar/bar.js +2 -2
  459. package/esm/chart/bar/bar.js.map +1 -1
  460. package/esm/chart/base-chart.d.ts +1 -0
  461. package/esm/chart/base-chart.js +14 -8
  462. package/esm/chart/base-chart.js.map +1 -1
  463. package/esm/chart/box-plot/box-plot.js +1 -1
  464. package/esm/chart/box-plot/box-plot.js.map +1 -1
  465. package/esm/chart/cartesian/cartesian.js +1 -1
  466. package/esm/chart/cartesian/cartesian.js.map +1 -1
  467. package/esm/chart/circle-packing/circle-packing.js +1 -1
  468. package/esm/chart/circle-packing/circle-packing.js.map +1 -1
  469. package/esm/chart/funnel/funnel-3d.js +1 -1
  470. package/esm/chart/funnel/funnel-3d.js.map +1 -1
  471. package/esm/chart/funnel/funnel.js +1 -1
  472. package/esm/chart/funnel/funnel.js.map +1 -1
  473. package/esm/chart/gauge/gauge.js +2 -2
  474. package/esm/chart/gauge/gauge.js.map +1 -1
  475. package/esm/chart/heatmap/heatmap.js +1 -1
  476. package/esm/chart/heatmap/heatmap.js.map +1 -1
  477. package/esm/chart/histogram/histogram-3d.js +2 -2
  478. package/esm/chart/histogram/histogram-3d.js.map +1 -1
  479. package/esm/chart/histogram/histogram.js +2 -2
  480. package/esm/chart/histogram/histogram.js.map +1 -1
  481. package/esm/chart/index.d.ts +1 -1
  482. package/esm/chart/index.js.map +1 -1
  483. package/esm/chart/line/line.js +1 -1
  484. package/esm/chart/line/line.js.map +1 -1
  485. package/esm/chart/map/map.js +2 -2
  486. package/esm/chart/map/map.js.map +1 -1
  487. package/esm/chart/pie/pie-3d.js +2 -2
  488. package/esm/chart/pie/pie-3d.js.map +1 -1
  489. package/esm/chart/pie/pie.js +2 -2
  490. package/esm/chart/pie/pie.js.map +1 -1
  491. package/esm/chart/polar/progress-like.js +1 -1
  492. package/esm/chart/polar/progress-like.js.map +1 -1
  493. package/esm/chart/polar/rose-like.js +1 -1
  494. package/esm/chart/polar/rose-like.js.map +1 -1
  495. package/esm/chart/progress/circular/circular.js +1 -1
  496. package/esm/chart/progress/circular/circular.js.map +1 -1
  497. package/esm/chart/progress/linear/linear.js +2 -2
  498. package/esm/chart/progress/linear/linear.js.map +1 -1
  499. package/esm/chart/radar/radar.js +5 -5
  500. package/esm/chart/radar/radar.js.map +1 -1
  501. package/esm/chart/range-area/range-area.js +1 -1
  502. package/esm/chart/range-area/range-area.js.map +1 -1
  503. package/esm/chart/range-column/range-column-3d.js +1 -1
  504. package/esm/chart/range-column/range-column-3d.js.map +1 -1
  505. package/esm/chart/range-column/range-column.js +1 -1
  506. package/esm/chart/range-column/range-column.js.map +1 -1
  507. package/esm/chart/rose/rose.js +4 -4
  508. package/esm/chart/rose/rose.js.map +1 -1
  509. package/esm/chart/sankey/sankey.js +1 -1
  510. package/esm/chart/sankey/sankey.js.map +1 -1
  511. package/esm/chart/scatter/scatter.js +2 -2
  512. package/esm/chart/scatter/scatter.js.map +1 -1
  513. package/esm/chart/sequence/sequence.js +4 -2
  514. package/esm/chart/sequence/sequence.js.map +1 -1
  515. package/esm/chart/sunburst/sunburst.js +1 -1
  516. package/esm/chart/sunburst/sunburst.js.map +1 -1
  517. package/esm/chart/treemap/treemap.js +1 -1
  518. package/esm/chart/treemap/treemap.js.map +1 -1
  519. package/esm/chart/util.js +2 -2
  520. package/esm/chart/util.js.map +1 -1
  521. package/esm/chart/waterfall/waterfall.js +1 -1
  522. package/esm/chart/waterfall/waterfall.js.map +1 -1
  523. package/esm/chart/word-cloud/word-cloud-3d.js +1 -1
  524. package/esm/chart/word-cloud/word-cloud-3d.js.map +1 -1
  525. package/esm/chart/word-cloud/word-cloud.js +1 -1
  526. package/esm/chart/word-cloud/word-cloud.js.map +1 -1
  527. package/esm/compile/compiler.d.ts +4 -0
  528. package/esm/compile/compiler.js +4 -0
  529. package/esm/compile/compiler.js.map +1 -1
  530. package/esm/compile/interface/compilable-item.d.ts +1 -0
  531. package/esm/compile/interface/compilable-item.js.map +1 -1
  532. package/esm/component/axis/base-axis.d.ts +1 -14
  533. package/esm/component/axis/base-axis.js +19 -30
  534. package/esm/component/axis/base-axis.js.map +1 -1
  535. package/esm/component/axis/cartesian/axis.d.ts +1 -1
  536. package/esm/component/axis/cartesian/axis.js +20 -20
  537. package/esm/component/axis/cartesian/axis.js.map +1 -1
  538. package/esm/component/axis/cartesian/index.d.ts +1 -0
  539. package/esm/component/axis/cartesian/index.js +2 -0
  540. package/esm/component/axis/cartesian/index.js.map +1 -1
  541. package/esm/component/axis/cartesian/interface/spec.d.ts +4 -1
  542. package/esm/component/axis/cartesian/interface/spec.js.map +1 -1
  543. package/esm/component/axis/cartesian/linear-axis.js +1 -3
  544. package/esm/component/axis/cartesian/linear-axis.js.map +1 -1
  545. package/esm/component/axis/cartesian/symlog-axis.d.ts +16 -0
  546. package/esm/component/axis/cartesian/symlog-axis.js +24 -0
  547. package/esm/component/axis/cartesian/symlog-axis.js.map +1 -0
  548. package/esm/component/axis/cartesian/time-axis.js +3 -3
  549. package/esm/component/axis/cartesian/time-axis.js.map +1 -1
  550. package/esm/component/axis/interface.d.ts +4 -8
  551. package/esm/component/axis/interface.js.map +1 -1
  552. package/esm/component/axis/mixin/linear-axis-mixin.js +1 -1
  553. package/esm/component/axis/mixin/linear-axis-mixin.js.map +1 -1
  554. package/esm/component/axis/polar/axis.d.ts +1 -1
  555. package/esm/component/axis/polar/axis.js +13 -13
  556. package/esm/component/axis/polar/axis.js.map +1 -1
  557. package/esm/component/axis/polar/interface/common.d.ts +1 -1
  558. package/esm/component/axis/polar/interface/common.js.map +1 -1
  559. package/esm/component/axis/{utils.d.ts → util.d.ts} +1 -1
  560. package/esm/component/axis/{utils.js → util.js} +7 -5
  561. package/esm/component/axis/util.js.map +1 -0
  562. package/esm/component/base/base-component.d.ts +10 -2
  563. package/esm/component/base/base-component.js +9 -5
  564. package/esm/component/base/base-component.js.map +1 -1
  565. package/esm/component/base/interface.d.ts +8 -0
  566. package/esm/component/base/interface.js +2 -0
  567. package/esm/component/base/interface.js.map +1 -0
  568. package/esm/component/base/util.d.ts +2 -1
  569. package/esm/component/base/util.js +14 -7
  570. package/esm/component/base/util.js.map +1 -1
  571. package/esm/component/brush/brush.d.ts +12 -2
  572. package/esm/component/brush/brush.js +74 -62
  573. package/esm/component/brush/brush.js.map +1 -1
  574. package/esm/component/crosshair/base.d.ts +2 -2
  575. package/esm/component/crosshair/base.js +1 -1
  576. package/esm/component/crosshair/base.js.map +1 -1
  577. package/esm/component/crosshair/cartesian.js +7 -7
  578. package/esm/component/crosshair/cartesian.js.map +1 -1
  579. package/esm/component/crosshair/interface/spec.d.ts +8 -8
  580. package/esm/component/crosshair/interface/spec.js.map +1 -1
  581. package/esm/component/crosshair/interface/theme.d.ts +3 -1
  582. package/esm/component/crosshair/interface/theme.js.map +1 -1
  583. package/esm/component/crosshair/polar.js +8 -8
  584. package/esm/component/crosshair/polar.js.map +1 -1
  585. package/esm/component/crosshair/util.d.ts +5 -0
  586. package/esm/component/crosshair/util.js +34 -0
  587. package/esm/component/crosshair/util.js.map +1 -1
  588. package/esm/component/custom-mark/custom-mark.d.ts +1 -1
  589. package/esm/component/custom-mark/custom-mark.js +4 -4
  590. package/esm/component/custom-mark/custom-mark.js.map +1 -1
  591. package/esm/component/data-zoom/data-filter-base-component.js +2 -3
  592. package/esm/component/data-zoom/data-filter-base-component.js.map +1 -1
  593. package/esm/component/data-zoom/data-zoom/data-zoom.js +8 -6
  594. package/esm/component/data-zoom/data-zoom/data-zoom.js.map +1 -1
  595. package/esm/component/data-zoom/data-zoom/interface.d.ts +2 -2
  596. package/esm/component/data-zoom/data-zoom/interface.js.map +1 -1
  597. package/esm/component/data-zoom/interface.d.ts +2 -5
  598. package/esm/component/data-zoom/interface.js.map +1 -1
  599. package/esm/component/geo/geo-coordinate.d.ts +2 -0
  600. package/esm/component/geo/geo-coordinate.js +16 -6
  601. package/esm/component/geo/geo-coordinate.js.map +1 -1
  602. package/esm/component/geo/projection.d.ts +1 -0
  603. package/esm/component/geo/projection.js +4 -0
  604. package/esm/component/geo/projection.js.map +1 -1
  605. package/esm/component/index.d.ts +2 -2
  606. package/esm/component/index.js +2 -2
  607. package/esm/component/index.js.map +1 -1
  608. package/esm/component/indicator/indicator.d.ts +1 -0
  609. package/esm/component/indicator/indicator.js +8 -7
  610. package/esm/component/indicator/indicator.js.map +1 -1
  611. package/esm/component/indicator/interface.d.ts +5 -6
  612. package/esm/component/indicator/interface.js.map +1 -1
  613. package/esm/component/interface/theme.d.ts +2 -2
  614. package/esm/component/interface/theme.js.map +1 -1
  615. package/esm/component/interface/type.d.ts +1 -0
  616. package/esm/component/interface/type.js +12 -11
  617. package/esm/component/interface/type.js.map +1 -1
  618. package/esm/component/label/base-label.d.ts +0 -1
  619. package/esm/component/label/base-label.js +0 -5
  620. package/esm/component/label/base-label.js.map +1 -1
  621. package/esm/component/label/interface.d.ts +2 -1
  622. package/esm/component/label/interface.js.map +1 -1
  623. package/esm/component/label/label.d.ts +0 -1
  624. package/esm/component/label/label.js +2 -7
  625. package/esm/component/label/label.js.map +1 -1
  626. package/esm/component/label/totalLabel.js +2 -2
  627. package/esm/component/label/totalLabel.js.map +1 -1
  628. package/esm/component/legend/base-legend.js +5 -5
  629. package/esm/component/legend/base-legend.js.map +1 -1
  630. package/esm/component/legend/continuous/util.js +5 -3
  631. package/esm/component/legend/continuous/util.js.map +1 -1
  632. package/esm/component/legend/discrete/interface.d.ts +3 -1
  633. package/esm/component/legend/discrete/interface.js.map +1 -1
  634. package/esm/component/legend/discrete/legend.js +2 -2
  635. package/esm/component/legend/discrete/legend.js.map +1 -1
  636. package/esm/component/legend/discrete/util.js +4 -4
  637. package/esm/component/legend/discrete/util.js.map +1 -1
  638. package/esm/component/legend/interface.d.ts +2 -6
  639. package/esm/component/legend/interface.js.map +1 -1
  640. package/esm/component/legend/util.js +4 -2
  641. package/esm/component/legend/util.js.map +1 -1
  642. package/esm/component/marker/interface.d.ts +2 -2
  643. package/esm/component/marker/interface.js.map +1 -1
  644. package/esm/component/poptip/interface.d.ts +15 -0
  645. package/esm/component/poptip/interface.js +2 -0
  646. package/esm/component/poptip/interface.js.map +1 -0
  647. package/esm/component/title/interface/spec.d.ts +2 -2
  648. package/esm/component/title/interface/spec.js.map +1 -1
  649. package/esm/component/tooltip/handler/dom/model/content-column-model.js +7 -5
  650. package/esm/component/tooltip/handler/dom/model/content-column-model.js.map +1 -1
  651. package/esm/component/tooltip/handler/dom/model/content-model.js +2 -2
  652. package/esm/component/tooltip/handler/dom/model/content-model.js.map +1 -1
  653. package/esm/component/tooltip/handler/dom/model/title-model.js +3 -3
  654. package/esm/component/tooltip/handler/dom/model/title-model.js.map +1 -1
  655. package/esm/component/tooltip/handler/dom/model/tooltip-model.js +4 -2
  656. package/esm/component/tooltip/handler/dom/model/tooltip-model.js.map +1 -1
  657. package/esm/component/tooltip/handler/dom/util.js +4 -4
  658. package/esm/component/tooltip/handler/dom/util.js.map +1 -1
  659. package/esm/component/tooltip/handler/utils/attribute.js +5 -5
  660. package/esm/component/tooltip/handler/utils/attribute.js.map +1 -1
  661. package/esm/component/tooltip/handler/utils/get-spec.js +2 -2
  662. package/esm/component/tooltip/handler/utils/get-spec.js.map +1 -1
  663. package/esm/component/tooltip/handler/utils/style.js +2 -2
  664. package/esm/component/tooltip/handler/utils/style.js.map +1 -1
  665. package/esm/component/tooltip/processor/base.js +1 -1
  666. package/esm/component/tooltip/processor/base.js.map +1 -1
  667. package/esm/component/tooltip/tooltip.js +2 -2
  668. package/esm/component/tooltip/tooltip.js.map +1 -1
  669. package/esm/core/index.d.ts +1 -1
  670. package/esm/core/index.js +1 -1
  671. package/esm/core/index.js.map +1 -1
  672. package/esm/core/vchart.js +22 -19
  673. package/esm/core/vchart.js.map +1 -1
  674. package/esm/data/transforms/legend-data/discrete/discrete.js +4 -3
  675. package/esm/data/transforms/legend-data/discrete/discrete.js.map +1 -1
  676. package/esm/data/transforms/tick-data/discrete/polar-angle.js +1 -1
  677. package/esm/data/transforms/tick-data/discrete/polar-angle.js.map +1 -1
  678. package/esm/data/transforms/tick-data/util.js +1 -1
  679. package/esm/data/transforms/tick-data/util.js.map +1 -1
  680. package/esm/event/events/dimension/util/cartesian.js +2 -2
  681. package/esm/event/events/dimension/util/cartesian.js.map +1 -1
  682. package/esm/event/events/dimension/util/polar.js +1 -1
  683. package/esm/event/events/dimension/util/polar.js.map +1 -1
  684. package/esm/interaction/trigger.js +3 -3
  685. package/esm/interaction/trigger.js.map +1 -1
  686. package/esm/mark/base/base-mark.d.ts +1 -0
  687. package/esm/mark/base/base-mark.js +20 -3
  688. package/esm/mark/base/base-mark.js.map +1 -1
  689. package/esm/mark/mark-set/index.d.ts +1 -0
  690. package/esm/mark/mark-set/index.js.map +1 -1
  691. package/esm/model/base-model.js +4 -4
  692. package/esm/model/base-model.js.map +1 -1
  693. package/esm/model/interface.d.ts +1 -1
  694. package/esm/model/interface.js.map +1 -1
  695. package/esm/plugin/components/index.d.ts +0 -2
  696. package/esm/plugin/components/index.js +0 -3
  697. package/esm/plugin/components/index.js.map +1 -1
  698. package/esm/series/area/area.d.ts +1 -0
  699. package/esm/series/area/area.js +5 -5
  700. package/esm/series/area/area.js.map +1 -1
  701. package/esm/series/bar/bar.js +2 -4
  702. package/esm/series/bar/bar.js.map +1 -1
  703. package/esm/series/base/base-series.d.ts +1 -0
  704. package/esm/series/base/base-series.js +25 -9
  705. package/esm/series/base/base-series.js.map +1 -1
  706. package/esm/series/cartesian/cartesian.d.ts +4 -0
  707. package/esm/series/cartesian/cartesian.js +15 -3
  708. package/esm/series/cartesian/cartesian.js.map +1 -1
  709. package/esm/series/cartesian/interface.d.ts +1 -0
  710. package/esm/series/cartesian/interface.js.map +1 -1
  711. package/esm/series/dot/dot.js +2 -2
  712. package/esm/series/dot/dot.js.map +1 -1
  713. package/esm/series/funnel/funnel.js +12 -2
  714. package/esm/series/funnel/funnel.js.map +1 -1
  715. package/esm/series/heatmap/heatmap.js +2 -2
  716. package/esm/series/heatmap/heatmap.js.map +1 -1
  717. package/esm/series/line/interface.d.ts +0 -2
  718. package/esm/series/line/interface.js.map +1 -1
  719. package/esm/series/line/line.d.ts +1 -0
  720. package/esm/series/line/line.js +1 -1
  721. package/esm/series/line/line.js.map +1 -1
  722. package/esm/series/map/geo-source.js +3 -1
  723. package/esm/series/map/geo-source.js.map +1 -1
  724. package/esm/series/map/interface.d.ts +1 -0
  725. package/esm/series/map/interface.js.map +1 -1
  726. package/esm/series/map/map.js +9 -3
  727. package/esm/series/map/map.js.map +1 -1
  728. package/esm/series/mixin/line-mixin.d.ts +1 -1
  729. package/esm/series/mixin/line-mixin.js +2 -2
  730. package/esm/series/mixin/line-mixin.js.map +1 -1
  731. package/esm/series/pie/pie.js +2 -2
  732. package/esm/series/pie/pie.js.map +1 -1
  733. package/esm/series/polar/interface.d.ts +1 -0
  734. package/esm/series/polar/interface.js.map +1 -1
  735. package/esm/series/polar/polar.d.ts +4 -0
  736. package/esm/series/polar/polar.js +15 -2
  737. package/esm/series/polar/polar.js.map +1 -1
  738. package/esm/series/radar/radar.d.ts +1 -0
  739. package/esm/series/radar/radar.js +1 -1
  740. package/esm/series/radar/radar.js.map +1 -1
  741. package/esm/series/range-column/range-column.js +2 -2
  742. package/esm/series/range-column/range-column.js.map +1 -1
  743. package/esm/series/rose/rose.js +2 -2
  744. package/esm/series/rose/rose.js.map +1 -1
  745. package/esm/series/sankey/interface.d.ts +3 -2
  746. package/esm/series/sankey/interface.js.map +1 -1
  747. package/esm/series/sankey/sankey.d.ts +5 -0
  748. package/esm/series/sankey/sankey.js +248 -93
  749. package/esm/series/sankey/sankey.js.map +1 -1
  750. package/esm/series/scatter/scatter.js +2 -2
  751. package/esm/series/scatter/scatter.js.map +1 -1
  752. package/esm/series/util/utils.d.ts +4 -1
  753. package/esm/series/util/utils.js +6 -4
  754. package/esm/series/util/utils.js.map +1 -1
  755. package/esm/theme/builtin/common/component/axis/cartesian-axis.js +4 -4
  756. package/esm/theme/builtin/common/component/axis/cartesian-axis.js.map +1 -1
  757. package/esm/theme/builtin/common/component/axis/common-axis.js +12 -6
  758. package/esm/theme/builtin/common/component/axis/common-axis.js.map +1 -1
  759. package/esm/theme/builtin/common/component/axis/polar-axis.js +1 -1
  760. package/esm/theme/builtin/common/component/axis/polar-axis.js.map +1 -1
  761. package/esm/theme/builtin/common/component/crosshair.js +73 -117
  762. package/esm/theme/builtin/common/component/crosshair.js.map +1 -1
  763. package/esm/theme/builtin/common/component/data-zoom.js +16 -6
  764. package/esm/theme/builtin/common/component/data-zoom.js.map +1 -1
  765. package/esm/theme/builtin/common/component/indicator.js +14 -4
  766. package/esm/theme/builtin/common/component/indicator.js.map +1 -1
  767. package/esm/theme/builtin/common/component/legend/color-legend.js +32 -4
  768. package/esm/theme/builtin/common/component/legend/color-legend.js.map +1 -1
  769. package/esm/theme/builtin/common/component/legend/continuous.js +26 -12
  770. package/esm/theme/builtin/common/component/legend/continuous.js.map +1 -1
  771. package/esm/theme/builtin/common/component/legend/discrete-legend.js +22 -9
  772. package/esm/theme/builtin/common/component/legend/discrete-legend.js.map +1 -1
  773. package/esm/theme/builtin/common/component/legend/size-legend.js +55 -14
  774. package/esm/theme/builtin/common/component/legend/size-legend.js.map +1 -1
  775. package/esm/theme/builtin/common/component/map-label.js +4 -6
  776. package/esm/theme/builtin/common/component/map-label.js.map +1 -1
  777. package/esm/theme/builtin/common/component/mark-area.js +4 -1
  778. package/esm/theme/builtin/common/component/mark-area.js.map +1 -1
  779. package/esm/theme/builtin/common/component/mark-line.js +4 -1
  780. package/esm/theme/builtin/common/component/mark-line.js.map +1 -1
  781. package/esm/theme/builtin/common/component/player.js +33 -7
  782. package/esm/theme/builtin/common/component/player.js.map +1 -1
  783. package/esm/theme/builtin/common/component/poptip.d.ts +2 -2
  784. package/esm/theme/builtin/common/component/poptip.js +17 -11
  785. package/esm/theme/builtin/common/component/poptip.js.map +1 -1
  786. package/esm/theme/builtin/common/component/title.js +9 -5
  787. package/esm/theme/builtin/common/component/title.js.map +1 -1
  788. package/esm/theme/builtin/common/component/tooltip.js +12 -11
  789. package/esm/theme/builtin/common/component/tooltip.js.map +1 -1
  790. package/esm/theme/builtin/common/component/total-label.js +3 -5
  791. package/esm/theme/builtin/common/component/total-label.js.map +1 -1
  792. package/esm/theme/builtin/common/constants.js +16 -7
  793. package/esm/theme/builtin/common/constants.js.map +1 -1
  794. package/esm/theme/builtin/common/mark.js +8 -4
  795. package/esm/theme/builtin/common/mark.js.map +1 -1
  796. package/esm/theme/builtin/common/series/area.js +1 -4
  797. package/esm/theme/builtin/common/series/area.js.map +1 -1
  798. package/esm/theme/builtin/common/series/bar.js +1 -4
  799. package/esm/theme/builtin/common/series/bar.js.map +1 -1
  800. package/esm/theme/builtin/common/series/bar3d.js +0 -3
  801. package/esm/theme/builtin/common/series/bar3d.js.map +1 -1
  802. package/esm/theme/builtin/common/series/circle-packing.js +8 -4
  803. package/esm/theme/builtin/common/series/circle-packing.js.map +1 -1
  804. package/esm/theme/builtin/common/series/dot.js +8 -2
  805. package/esm/theme/builtin/common/series/dot.js.map +1 -1
  806. package/esm/theme/builtin/common/series/funnel.js +6 -5
  807. package/esm/theme/builtin/common/series/funnel.js.map +1 -1
  808. package/esm/theme/builtin/common/series/funnel3d.js +6 -5
  809. package/esm/theme/builtin/common/series/funnel3d.js.map +1 -1
  810. package/esm/theme/builtin/common/series/line.js +1 -4
  811. package/esm/theme/builtin/common/series/line.js.map +1 -1
  812. package/esm/theme/builtin/common/series/map.js +4 -2
  813. package/esm/theme/builtin/common/series/map.js.map +1 -1
  814. package/esm/theme/builtin/common/series/pie.js +0 -3
  815. package/esm/theme/builtin/common/series/pie.js.map +1 -1
  816. package/esm/theme/builtin/common/series/pie3d.js +1 -6
  817. package/esm/theme/builtin/common/series/pie3d.js.map +1 -1
  818. package/esm/theme/builtin/common/series/radar.js +1 -4
  819. package/esm/theme/builtin/common/series/radar.js.map +1 -1
  820. package/esm/theme/builtin/common/series/rangeColumn.js +1 -4
  821. package/esm/theme/builtin/common/series/rangeColumn.js.map +1 -1
  822. package/esm/theme/builtin/common/series/rose.js +1 -2
  823. package/esm/theme/builtin/common/series/rose.js.map +1 -1
  824. package/esm/theme/builtin/common/series/sankey.js +0 -1
  825. package/esm/theme/builtin/common/series/sankey.js.map +1 -1
  826. package/esm/theme/builtin/common/series/scatter.js +1 -4
  827. package/esm/theme/builtin/common/series/scatter.js.map +1 -1
  828. package/esm/theme/builtin/common/series/sunburst.js +6 -1
  829. package/esm/theme/builtin/common/series/sunburst.js.map +1 -1
  830. package/esm/theme/builtin/common/series/treemap.js +8 -6
  831. package/esm/theme/builtin/common/series/treemap.js.map +1 -1
  832. package/esm/theme/builtin/common/series/waterfall.js +4 -7
  833. package/esm/theme/builtin/common/series/waterfall.js.map +1 -1
  834. package/esm/theme/builtin/dark/color-scheme.js +5 -3
  835. package/esm/theme/builtin/dark/color-scheme.js.map +1 -1
  836. package/esm/theme/builtin/index.d.ts +0 -1
  837. package/esm/theme/builtin/index.js +0 -2
  838. package/esm/theme/builtin/index.js.map +1 -1
  839. package/esm/theme/builtin/light/color-scheme.js +4 -2
  840. package/esm/theme/builtin/light/color-scheme.js.map +1 -1
  841. package/esm/theme/builtin/light/index.js +2 -2
  842. package/esm/theme/builtin/light/index.js.map +1 -1
  843. package/esm/theme/color-scheme/builtin/interface.d.ts +22 -0
  844. package/esm/theme/color-scheme/builtin/interface.js +2 -0
  845. package/esm/theme/color-scheme/builtin/interface.js.map +1 -0
  846. package/esm/theme/color-scheme/interface.d.ts +3 -2
  847. package/esm/theme/color-scheme/interface.js.map +1 -1
  848. package/esm/theme/color-scheme/util.js +8 -3
  849. package/esm/theme/color-scheme/util.js.map +1 -1
  850. package/esm/theme/interface.d.ts +16 -5
  851. package/esm/theme/interface.js.map +1 -1
  852. package/esm/typings/spec/common.d.ts +2 -1
  853. package/esm/typings/spec/common.js.map +1 -1
  854. package/esm/typings/visual.d.ts +10 -20
  855. package/esm/typings/visual.js.map +1 -1
  856. package/esm/util/data.d.ts +0 -8
  857. package/esm/util/data.js +1 -7
  858. package/esm/util/data.js.map +1 -1
  859. package/esm/util/object.d.ts +2 -4
  860. package/esm/util/object.js +2 -13
  861. package/esm/util/object.js.map +1 -1
  862. package/esm/util/scale.d.ts +2 -6
  863. package/esm/util/scale.js +1 -5
  864. package/esm/util/scale.js.map +1 -1
  865. package/esm/util/space.d.ts +3 -10
  866. package/esm/util/space.js +5 -23
  867. package/esm/util/space.js.map +1 -1
  868. package/esm/util/spec/background.d.ts +4 -0
  869. package/esm/util/spec/background.js +21 -0
  870. package/esm/util/spec/background.js.map +1 -0
  871. package/esm/util/spec/clone-deep.d.ts +1 -0
  872. package/esm/util/spec/clone-deep.js +20 -0
  873. package/esm/util/spec/clone-deep.js.map +1 -0
  874. package/esm/util/spec/common.d.ts +3 -0
  875. package/esm/util/spec/common.js +15 -0
  876. package/esm/util/spec/common.js.map +1 -0
  877. package/esm/util/spec/index.d.ts +7 -0
  878. package/esm/util/spec/index.js +14 -0
  879. package/esm/util/spec/index.js.map +1 -0
  880. package/esm/util/spec/merge-spec.d.ts +1 -0
  881. package/esm/util/spec/merge-spec.js +48 -0
  882. package/esm/util/spec/merge-spec.js.map +1 -0
  883. package/esm/util/spec/merge-theme.d.ts +3 -0
  884. package/esm/util/spec/merge-theme.js +34 -0
  885. package/esm/util/spec/merge-theme.js.map +1 -0
  886. package/esm/util/spec/preprocess.d.ts +3 -0
  887. package/esm/util/spec/preprocess.js +20 -0
  888. package/esm/util/spec/preprocess.js.map +1 -0
  889. package/esm/util/spec/transform.d.ts +3 -0
  890. package/esm/util/spec/transform.js +20 -0
  891. package/esm/util/spec/transform.js.map +1 -0
  892. package/esm/util/text.d.ts +1 -2
  893. package/esm/util/text.js +4 -12
  894. package/esm/util/text.js.map +1 -1
  895. package/esm/vchart-all.js +2 -2
  896. package/esm/vchart-all.js.map +1 -1
  897. package/esm/vchart-simple.js +18 -2
  898. package/esm/vchart-simple.js.map +1 -1
  899. package/package.json +20 -13
  900. package/cjs/component/axis/utils.js.map +0 -1
  901. package/cjs/plugin/components/axis-label-overlap-plugin.d.ts +0 -10
  902. package/cjs/plugin/components/axis-label-overlap-plugin.js +0 -75
  903. package/cjs/plugin/components/axis-label-overlap-plugin.js.map +0 -1
  904. package/cjs/theme/builtin/common/component/axis/log-axis.d.ts +0 -2
  905. package/cjs/theme/builtin/common/component/axis/log-axis.js +0 -22
  906. package/cjs/theme/builtin/common/component/axis/log-axis.js.map +0 -1
  907. package/cjs/theme/builtin/constant.d.ts +0 -2
  908. package/cjs/theme/builtin/constant.js +0 -8
  909. package/cjs/theme/builtin/constant.js.map +0 -1
  910. package/cjs/util/spec.d.ts +0 -17
  911. package/cjs/util/spec.js +0 -121
  912. package/cjs/util/spec.js.map +0 -1
  913. package/esm/component/axis/utils.js.map +0 -1
  914. package/esm/plugin/components/axis-label-overlap-plugin.d.ts +0 -10
  915. package/esm/plugin/components/axis-label-overlap-plugin.js +0 -72
  916. package/esm/plugin/components/axis-label-overlap-plugin.js.map +0 -1
  917. package/esm/theme/builtin/common/component/axis/log-axis.d.ts +0 -2
  918. package/esm/theme/builtin/common/component/axis/log-axis.js +0 -18
  919. package/esm/theme/builtin/common/component/axis/log-axis.js.map +0 -1
  920. package/esm/theme/builtin/constant.d.ts +0 -2
  921. package/esm/theme/builtin/constant.js +0 -4
  922. package/esm/theme/builtin/constant.js.map +0 -1
  923. package/esm/util/spec.d.ts +0 -17
  924. package/esm/util/spec.js +0 -112
  925. package/esm/util/spec.js.map +0 -1
@@ -10,12 +10,4 @@ export declare function mergeFields(targetFields: {
10
10
  key: string;
11
11
  operations: StatisticOperations;
12
12
  }[];
13
- export declare function findFields(list: {
14
- key: string;
15
- operations: StatisticOperations;
16
- }[], fieldKey: string): {
17
- key: string;
18
- operations: StatisticOperations;
19
- };
20
13
  export declare function getFieldAlias(dataView: DataView, field: string): any;
21
- export declare function getFieldFormat(dataView: DataView, key: string): any;
package/esm/util/data.js CHANGED
@@ -6,7 +6,7 @@ export function mergeFields(targetFields, mergeFields) {
6
6
  return targetFields;
7
7
  }
8
8
 
9
- export function findFields(list, fieldKey) {
9
+ function findFields(list, fieldKey) {
10
10
  return list.find((i => i.key === fieldKey));
11
11
  }
12
12
 
@@ -16,10 +16,4 @@ export function getFieldAlias(dataView, field) {
16
16
  const fields = dataView.getFields();
17
17
  return fields && fields[field] ? null !== (_a = fields[field].alias) && void 0 !== _a ? _a : field : null != field ? field : null;
18
18
  }
19
-
20
- export function getFieldFormat(dataView, key) {
21
- if (!dataView) return null;
22
- const fields = dataView.getFields();
23
- return fields && fields[key] ? fields[key].format : null;
24
- }
25
19
  //# sourceMappingURL=data.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/util/data.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,WAAW,CACzB,YAGG,EACH,WAGG;IAKH,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC3C,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QACtD,IAAI,CAAC,OAAO,EAAE;YACZ,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SAC5B;aAAM;YACL,OAAO,CAAC,UAAU,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;SAClF;KACF;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,IAGG,EACH,QAAgB;IAEhB,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC;AAC5C,CAAC;AAGD,MAAM,UAAU,aAAa,CAAC,QAAkB,EAAE,KAAa;;IAC7D,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,CAAC;KACtB;IACD,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;IACpC,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,CAAC;KACtB;IACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;QAClB,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,CAAC;KACtB;IACD,OAAO,MAAA,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,mCAAI,KAAK,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,QAAkB,EAAE,GAAW;IAC5D,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,IAAI,CAAC;KACb;IACD,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,EAAiC,CAAC;IACnE,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IACD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;QAChB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;AAC5B,CAAC","file":"data.js","sourcesContent":["import type { DataView } from '@visactor/vdataset';\nimport type { StatisticOperations } from '../data/transforms/dimension-statistics';\nimport type { IFieldsMeta } from '../typings/spec/common';\n\nexport function mergeFields(\n targetFields: {\n key: string;\n operations: StatisticOperations;\n }[],\n mergeFields: {\n key: string;\n operations: StatisticOperations;\n }[]\n): {\n key: string;\n operations: StatisticOperations;\n}[] {\n for (let i = 0; i < mergeFields.length; i++) {\n const element = mergeFields[i];\n const _target = findFields(targetFields, element.key);\n if (!_target) {\n targetFields.push(element);\n } else {\n _target.operations = [...new Set(_target.operations.concat(element.operations))];\n }\n }\n return targetFields;\n}\n\nexport function findFields(\n list: {\n key: string;\n operations: StatisticOperations;\n }[],\n fieldKey: string\n) {\n return list.find(i => i.key === fieldKey);\n}\n\n// 如果不存在别名就返回 field\nexport function getFieldAlias(dataView: DataView, field: string) {\n if (!dataView) {\n return field ?? null;\n }\n const fields = dataView.getFields();\n if (!fields) {\n return field ?? null;\n }\n if (!fields[field]) {\n return field ?? null;\n }\n return fields[field].alias ?? field;\n}\n\nexport function getFieldFormat(dataView: DataView, key: string) {\n if (!dataView) {\n return null;\n }\n const fields = dataView.getFields() as Record<string, IFieldsMeta>;\n if (!fields) {\n return null;\n }\n if (!fields[key]) {\n return null;\n }\n // @ts-ignore\n return fields[key].format;\n}\n"]}
1
+ {"version":3,"sources":["../src/util/data.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,WAAW,CACzB,YAGG,EACH,WAGG;IAKH,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC3C,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QACtD,IAAI,CAAC,OAAO,EAAE;YACZ,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;SAC5B;aAAM;YACL,OAAO,CAAC,UAAU,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;SAClF;KACF;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,UAAU,CACjB,IAGG,EACH,QAAgB;IAEhB,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC;AAC5C,CAAC;AAGD,MAAM,UAAU,aAAa,CAAC,QAAkB,EAAE,KAAa;;IAC7D,IAAI,CAAC,QAAQ,EAAE;QACb,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,CAAC;KACtB;IACD,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC;IACpC,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,CAAC;KACtB;IACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;QAClB,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,CAAC;KACtB;IACD,OAAO,MAAA,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,mCAAI,KAAK,CAAC;AACtC,CAAC","file":"data.js","sourcesContent":["import type { DataView } from '@visactor/vdataset';\nimport type { StatisticOperations } from '../data/transforms/dimension-statistics';\nimport type { IFieldsMeta } from '../typings/spec/common';\n\nexport function mergeFields(\n targetFields: {\n key: string;\n operations: StatisticOperations;\n }[],\n mergeFields: {\n key: string;\n operations: StatisticOperations;\n }[]\n): {\n key: string;\n operations: StatisticOperations;\n}[] {\n for (let i = 0; i < mergeFields.length; i++) {\n const element = mergeFields[i];\n const _target = findFields(targetFields, element.key);\n if (!_target) {\n targetFields.push(element);\n } else {\n _target.operations = [...new Set(_target.operations.concat(element.operations))];\n }\n }\n return targetFields;\n}\n\nfunction findFields(\n list: {\n key: string;\n operations: StatisticOperations;\n }[],\n fieldKey: string\n) {\n return list.find(i => i.key === fieldKey);\n}\n\n// 如果不存在别名就返回 field\nexport function getFieldAlias(dataView: DataView, field: string) {\n if (!dataView) {\n return field ?? null;\n }\n const fields = dataView.getFields();\n if (!fields) {\n return field ?? null;\n }\n if (!fields[field]) {\n return field ?? null;\n }\n return fields[field].alias ?? field;\n}\n"]}
@@ -1,5 +1,3 @@
1
- import { get, pick, merge, cloneDeep } from '@visactor/vutils';
2
- export { get, pick, merge, cloneDeep };
3
- export declare function removeEmpty<T extends object>(obj: T): Partial<T>;
4
- export declare function sortByKey<T extends object>(object: T, includeKeys?: string[], excludeKeys?: string[]): Partial<T>;
1
+ import { get, pick, cloneDeep } from '@visactor/vutils';
2
+ export { get, pick, cloneDeep };
5
3
  export declare function field(f: string | string[]): (datum: any) => any;
@@ -1,17 +1,6 @@
1
- import { get, pick, merge, cloneDeep, isArray } from "@visactor/vutils";
1
+ import { get, pick, cloneDeep, isArray } from "@visactor/vutils";
2
2
 
3
- export { get, pick, merge, cloneDeep };
4
-
5
- export function removeEmpty(obj) {
6
- return Object.keys(obj).forEach((key => {
7
- obj[key] && "object" == typeof obj[key] ? removeEmpty(obj[key]) : void 0 === obj[key] && delete obj[key];
8
- })), obj;
9
- }
10
-
11
- export function sortByKey(object, includeKeys, excludeKeys) {
12
- return Object.keys(object).sort().reduce(((obj, key) => (includeKeys ? includeKeys.includes(key) && (obj[key] = object[key]) : excludeKeys && !excludeKeys.includes(key) && (obj[key] = object[key]),
13
- obj)), {});
14
- }
3
+ export { get, pick, cloneDeep };
15
4
 
16
5
  export function field(f) {
17
6
  return function(datum) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/util/object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAExE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAEvC,MAAM,UAAU,WAAW,CAAmB,GAAM;IAClD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QAC7B,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE;YAC5C,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;SACvB;aAAM,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;YACjC,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;SACjB;IACH,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,SAAS,CAAmB,MAAS,EAAE,WAAsB,EAAE,WAAsB;IACnG,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;SACvB,IAAI,EAAE;SACN,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACnB,IAAI,WAAW,EAAE;YACf,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;SACvD;aAAM,IAAI,WAAW,EAAE;YACtB,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;SACxD;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAO,CAAC,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,CAAoB;IACxC,OAAO,UAAU,KAAU;QACzB,IAAI,KAAU,CAAC;QACf,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACf,KAAK,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,CAAC,CAAC,CAAC;SACpB;aAAM;YACL,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;SAC/C;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC","file":"object.js","sourcesContent":["import { get, pick, merge, cloneDeep, isArray } from '@visactor/vutils';\n\nexport { get, pick, merge, cloneDeep };\n\nexport function removeEmpty<T extends object>(obj: T): Partial<T> {\n Object.keys(obj).forEach(key => {\n if (obj[key] && typeof obj[key] === 'object') {\n removeEmpty(obj[key]);\n } else if (obj[key] === undefined) {\n delete obj[key];\n }\n });\n return obj;\n}\n\nexport function sortByKey<T extends object>(object: T, includeKeys?: string[], excludeKeys?: string[]): Partial<T> {\n return Object.keys(object)\n .sort()\n .reduce((obj, key) => {\n if (includeKeys) {\n includeKeys.includes(key) && (obj[key] = object[key]);\n } else if (excludeKeys) {\n !excludeKeys.includes(key) && (obj[key] = object[key]);\n }\n return obj;\n }, {} as T);\n}\n\nexport function field(f: string | string[]) {\n return function (datum: any) {\n let value: any;\n if (!isArray(f)) {\n value = datum?.[f];\n } else {\n value = f.reduce((cur, g) => cur?.[g], datum);\n }\n return value;\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/util/object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEjE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAEhC,MAAM,UAAU,KAAK,CAAC,CAAoB;IACxC,OAAO,UAAU,KAAU;QACzB,IAAI,KAAU,CAAC;QACf,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACf,KAAK,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,CAAC,CAAC,CAAC;SACpB;aAAM;YACL,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;SAC/C;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC","file":"object.js","sourcesContent":["import { get, pick, cloneDeep, isArray } from '@visactor/vutils';\n\nexport { get, pick, cloneDeep };\n\nexport function field(f: string | string[]) {\n return function (datum: any) {\n let value: any;\n if (!isArray(f)) {\n value = datum?.[f];\n } else {\n value = f.reduce((cur, g) => cur?.[g], datum);\n }\n return value;\n };\n}\n"]}
@@ -1,9 +1,7 @@
1
1
  import type { DataView } from '@visactor/vdataset';
2
2
  import type { IGlobalScale } from '../scale/interface';
3
- import { BandScale, LinearScale, OrdinalScale, PointScale, ThresholdScale } from '@visactor/vscale';
4
- import type { IBaseScale } from '@visactor/vscale';
5
- import type { ScaleType } from '../typings/scale';
6
- import type { IVisual, IVisualSpecBase } from '../typings/visual';
3
+ import { type IBaseScale, BandScale, LinearScale, OrdinalScale, PointScale, ThresholdScale } from '@visactor/vscale';
4
+ import type { IVisual } from '../typings/visual';
7
5
  import { ColorOrdinalScale } from '../scale/color-ordinal-scale';
8
6
  declare const defaultScaleMap: {
9
7
  linear: typeof LinearScale;
@@ -18,8 +16,6 @@ export declare function createScaleWithSpec(spec: IVisual<any>, context: {
18
16
  globalScale: IGlobalScale;
19
17
  dataStatistics: DataView;
20
18
  }): IBaseScale | null;
21
- export declare function initScaleWithSpec(scale: IBaseScale, spec: IVisualSpecBase<any, any>): void;
22
- export declare function isValidScaleType(type: ScaleType): boolean;
23
19
  export declare function valueInScaleRange(v: number, s?: IBaseScale): number;
24
20
  export declare function isSpecValueWithScale(specValue: any): boolean;
25
21
  export {};
package/esm/util/scale.js CHANGED
@@ -24,15 +24,11 @@ export function createScaleWithSpec(spec, context) {
24
24
  return scale && initScaleWithSpec(scale, spec), scale;
25
25
  }
26
26
 
27
- export function initScaleWithSpec(scale, spec) {
27
+ function initScaleWithSpec(scale, spec) {
28
28
  scale && spec && (spec.domain && scale.domain(spec.domain), spec.range && scale.range(spec.range),
29
29
  spec.specified && scale.specified && scale.specified(spec.specified));
30
30
  }
31
31
 
32
- export function isValidScaleType(type) {
33
- return Object.keys(defaultScaleMap).includes(type);
34
- }
35
-
36
32
  export function valueInScaleRange(v, s) {
37
33
  if (!s) return v;
38
34
  const range = s.range(), min = Math.min(range[0], range[range.length - 1]), max = Math.max(range[0], range[range.length - 1]);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/util/scale.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKpG,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,MAAM,eAAe,GAAG;I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IAAI,CAAC,SAAS,IAAmB,KAAM,CAAC,SAAS,EAAE;QACtC,KAAM,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;KACjD;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAe;IAC9C,OAAO,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,CAAS,EAAE,CAAc;IACzD,IAAI,CAAC,CAAC,EAAE;QACN,OAAO,CAAC,CAAC;KACV;IACD,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;IACxB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IACxD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IACxD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,SAAc;IACjD,OAAO,OAAO,CAAC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,CAAC,IAAI,OAAO,CAAC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,CAAC,CAAC;AAChE,CAAC","file":"scale.js","sourcesContent":["/**\n * @description Scale 相关的工具函数\n */\nimport { isString, isValid } from '@visactor/vutils';\nimport type { DataView } from '@visactor/vdataset';\nimport type { IGlobalScale } from '../scale/interface';\nimport { BandScale, LinearScale, OrdinalScale, PointScale, ThresholdScale } from '@visactor/vscale';\n// eslint-disable-next-line no-duplicate-imports\nimport type { IBaseScale } from '@visactor/vscale';\nimport type { ScaleType } from '../typings/scale';\nimport type { IVisual, IVisualSpecBase } from '../typings/visual';\nimport { ColorOrdinalScale } from '../scale/color-ordinal-scale';\n\nconst defaultScaleMap = {\n linear: LinearScale,\n band: BandScale,\n point: PointScale,\n ordinal: OrdinalScale,\n threshold: ThresholdScale,\n colorOrdinal: ColorOrdinalScale\n};\n\nexport function createScale(type: keyof typeof defaultScaleMap): IBaseScale | null {\n const scaleConstructor = defaultScaleMap[type];\n if (scaleConstructor) {\n return new scaleConstructor();\n }\n\n return null;\n}\n\nexport function createScaleWithSpec(\n spec: IVisual<any>,\n context: {\n globalScale: IGlobalScale;\n dataStatistics: DataView;\n }\n): IBaseScale | null {\n if ('scale' in spec && spec.scale) {\n if (isString(spec.scale) && context?.globalScale) {\n return context.globalScale.registerMarkAttributeScale(spec, context.dataStatistics);\n }\n return spec.scale as unknown as IBaseScale;\n }\n const scale = createScale((spec as IVisualSpecBase<any, any>).type);\n if (scale) {\n initScaleWithSpec(scale, spec as IVisualSpecBase<any, any>);\n }\n return scale;\n}\n\n// 需要一个通用的从spec初始化scale的方法,避免在scale属性更新后需要维护多组逻辑\nexport function initScaleWithSpec(scale: IBaseScale, spec: IVisualSpecBase<any, any>) {\n if (!scale || !spec) {\n return;\n }\n\n if (spec.domain) {\n scale.domain(spec.domain);\n }\n\n if (spec.range) {\n scale.range(spec.range);\n }\n\n if (spec.specified && (<OrdinalScale>scale).specified) {\n (<OrdinalScale>scale).specified(spec.specified);\n }\n}\n\nexport function isValidScaleType(type: ScaleType): boolean {\n return Object.keys(defaultScaleMap).includes(type);\n}\n\nexport function valueInScaleRange(v: number, s?: IBaseScale) {\n if (!s) {\n return v;\n }\n const range = s.range();\n const min = Math.min(range[0], range[range.length - 1]);\n const max = Math.max(range[0], range[range.length - 1]);\n return Math.min(Math.max(min, v), max);\n}\n\nexport function isSpecValueWithScale(specValue: any) {\n return isValid(specValue?.field) && isValid(specValue?.scale);\n}\n"]}
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IAA+B;IAC3E,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE;QACnB,OAAO;KACR;IAED,IAAI,IAAI,CAAC,MAAM,EAAE;QACf,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KAC3B;IAED,IAAI,IAAI,CAAC,KAAK,EAAE;QACd,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACzB;IAED,IAAI,IAAI,CAAC,SAAS,IAAmB,KAAM,CAAC,SAAS,EAAE;QACtC,KAAM,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;KACjD;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,CAAS,EAAE,CAAc;IACzD,IAAI,CAAC,CAAC,EAAE;QACN,OAAO,CAAC,CAAC;KACV;IACD,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;IACxB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IACxD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IACxD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,SAAc;IACjD,OAAO,OAAO,CAAC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,CAAC,IAAI,OAAO,CAAC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,CAAC,CAAC;AAChE,CAAC","file":"scale.js","sourcesContent":["/**\n * @description Scale 相关的工具函数\n */\nimport { isString, isValid } from '@visactor/vutils';\nimport type { DataView } from '@visactor/vdataset';\nimport type { IGlobalScale } from '../scale/interface';\nimport { type IBaseScale, BandScale, LinearScale, OrdinalScale, PointScale, ThresholdScale } from '@visactor/vscale';\nimport type { IVisual, IVisualSpecBase } from '../typings/visual';\nimport { ColorOrdinalScale } from '../scale/color-ordinal-scale';\n\nconst defaultScaleMap = {\n linear: LinearScale,\n band: BandScale,\n point: PointScale,\n ordinal: OrdinalScale,\n threshold: ThresholdScale,\n colorOrdinal: ColorOrdinalScale\n};\n\nexport function createScale(type: keyof typeof defaultScaleMap): IBaseScale | null {\n const scaleConstructor = defaultScaleMap[type];\n if (scaleConstructor) {\n return new scaleConstructor();\n }\n\n return null;\n}\n\nexport function createScaleWithSpec(\n spec: IVisual<any>,\n context: {\n globalScale: IGlobalScale;\n dataStatistics: DataView;\n }\n): IBaseScale | null {\n if ('scale' in spec && spec.scale) {\n if (isString(spec.scale) && context?.globalScale) {\n return context.globalScale.registerMarkAttributeScale(spec, context.dataStatistics);\n }\n return spec.scale as unknown as IBaseScale;\n }\n const scale = createScale((spec as IVisualSpecBase<any, any>).type);\n if (scale) {\n initScaleWithSpec(scale, spec as IVisualSpecBase<any, any>);\n }\n return scale;\n}\n\n// 需要一个通用的从spec初始化scale的方法,避免在scale属性更新后需要维护多组逻辑\nfunction initScaleWithSpec(scale: IBaseScale, spec: IVisualSpecBase<any, any>) {\n if (!scale || !spec) {\n return;\n }\n\n if (spec.domain) {\n scale.domain(spec.domain);\n }\n\n if (spec.range) {\n scale.range(spec.range);\n }\n\n if (spec.specified && (<OrdinalScale>scale).specified) {\n (<OrdinalScale>scale).specified(spec.specified);\n }\n}\n\nexport function valueInScaleRange(v: number, s?: IBaseScale) {\n if (!s) {\n return v;\n }\n const range = s.range();\n const min = Math.min(range[0], range[range.length - 1]);\n const max = Math.max(range[0], range[range.length - 1]);\n return Math.min(Math.max(min, v), max);\n}\n\nexport function isSpecValueWithScale(specValue: any) {\n return isValid(specValue?.field) && isValid(specValue?.scale);\n}\n"]}
@@ -1,21 +1,14 @@
1
- import type { IPercentOffset } from './../model/interface';
2
- import type { ILayoutPaddingSpec } from '../model/interface';
3
- import type { IBoundsLike } from '@visactor/vutils';
4
- import type { ILayoutNumber, IPercent, ILayoutOrientPadding, ILayoutRect } from '../model/interface';
1
+ import { type IBoundsLike } from '@visactor/vutils';
2
+ import type { ILayoutPaddingSpec, IPercentOffset, ILayoutNumber, IPercent, ILayoutOrientPadding, ILayoutRect } from '../model/interface';
5
3
  import type { IPadding, IRect } from '../typings/space';
6
- import { Direction } from '../typings/space';
7
4
  import type { IPoint } from '../typings/coordinate';
8
5
  export declare function isValidOrient(orient: string): boolean;
9
- export declare function getSpecPadding(padding: IPadding | number | undefined | null, defaultPadding: IPadding): IPadding;
10
6
  export declare function isPointInRect(point: IPoint, rect: IRect): boolean;
11
7
  export declare function isPercent(v: any): v is IPercent;
12
8
  export declare function isPercentOffset(v: any): v is IPercentOffset;
13
9
  export declare function calcLayoutNumber(v: ILayoutNumber | undefined, size: number, callOp?: ILayoutRect): number;
14
10
  export declare function calcPadding(paddingSpec: ILayoutOrientPadding, rect: ILayoutRect, callOp: ILayoutRect): IPadding;
15
11
  export declare function boundsInRect(bounds: IBoundsLike, rect: ILayoutRect): ILayoutRect;
16
- export declare function boundsOutViewBox(bounds: IBoundsLike, box: IBoundsLike, direction: Direction): {
17
- start: number;
18
- end: number;
19
- };
20
12
  export declare function normalizeLayoutPaddingSpec(spec: ILayoutPaddingSpec): ILayoutOrientPadding;
21
13
  export declare function convertPoint(point: IPoint, relativePoint: IPoint, convert: boolean): IPoint;
14
+ export declare const getActualNumValue: (originValue: number | string, total: number) => number;
package/esm/util/space.js CHANGED
@@ -2,8 +2,6 @@ import { isArray } from "@visactor/vutils";
2
2
 
3
3
  import { isNumber, isNil, isString, isFunction, couldBeValidNumber, isObject } from "./type";
4
4
 
5
- import { Direction } from "../typings/space";
6
-
7
5
  export function isValidOrient(orient) {
8
6
  switch (orient) {
9
7
  case "left":
@@ -17,15 +15,6 @@ export function isValidOrient(orient) {
17
15
  }
18
16
  }
19
17
 
20
- export function getSpecPadding(padding, defaultPadding) {
21
- return isNil(padding) ? Object.assign({}, defaultPadding) : "number" == typeof padding ? {
22
- top: padding,
23
- bottom: padding,
24
- left: padding,
25
- right: padding
26
- } : Object.assign(Object.assign({}, defaultPadding), padding);
27
- }
28
-
29
18
  export function isPointInRect(point, rect) {
30
19
  const {x: x, y: y, width: width, height: height} = rect, {x: x0, y: y0} = point;
31
20
  return x0 < x + width && y0 < y + height && y0 > y && x0 > x;
@@ -78,18 +67,6 @@ export function boundsInRect(bounds, rect) {
78
67
  };
79
68
  }
80
69
 
81
- export function boundsOutViewBox(bounds, box, direction) {
82
- if (!bounds || !box) return {
83
- start: 0,
84
- end: 0
85
- };
86
- const start = -(direction === Direction.horizontal ? bounds.x1 : bounds.y1), end = direction === Direction.horizontal ? bounds.x2 - (box.x2 - box.x1) : bounds.y2 - (box.y2 - box.y1);
87
- return {
88
- start: start > 0 ? start : 0,
89
- end: end > 0 ? end : 0
90
- };
91
- }
92
-
93
70
  export function normalizeLayoutPaddingSpec(spec) {
94
71
  let result = {};
95
72
  return isArray(spec) ? (isNil(spec[0]) || (result.top = result.left = result.bottom = result.right = spec[0]),
@@ -104,4 +81,9 @@ export function convertPoint(point, relativePoint, convert) {
104
81
  y: point.y + relativePoint.y
105
82
  } : point;
106
83
  }
84
+
85
+ export const getActualNumValue = (originValue, total) => {
86
+ const originNumValue = Number(originValue), originStrValue = originValue.toString();
87
+ return isNaN(originNumValue) && "%" === originStrValue[originStrValue.length - 1] ? total * (Number(originStrValue.slice(0, originStrValue.length - 1)) / 100) : originNumValue;
88
+ };
107
89
  //# sourceMappingURL=space.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/util/space.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ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.js","sourcesContent":["import type { IPercentOffset } from './../model/interface';\nimport type { ILayoutPaddingSpec } from '../model/interface';\nimport type { IBoundsLike } from '@visactor/vutils';\nimport { isArray } from '@visactor/vutils';\nimport { isNumber, isNil, isString, isFunction, couldBeValidNumber, isObject } from './type';\nimport type { ILayoutNumber, IPercent, ILayoutOrientPadding, ILayoutRect } from '../model/interface';\nimport type { IPadding, IRect } from '../typings/space';\n// eslint-disable-next-line no-duplicate-imports\nimport { Direction } from '../typings/space';\nimport type { IPoint } from '../typings/coordinate';\n\nexport function isValidOrient(orient: string): boolean {\n switch (orient) {\n case 'left':\n case 'right':\n case 'top':\n case 'bottom':\n return true;\n default:\n return false;\n }\n}\n\nexport function getSpecPadding(padding: IPadding | number | undefined | null, defaultPadding: IPadding): IPadding {\n if (isNil(padding)) {\n return { ...defaultPadding };\n }\n if (typeof padding === 'number') {\n return {\n top: padding,\n bottom: padding,\n left: padding,\n right: padding\n };\n }\n return {\n ...defaultPadding,\n ...padding\n };\n}\n\nexport function isPointInRect(point: IPoint, rect: IRect) {\n const { x, y, width, height } = rect;\n const { x: x0, y: y0 } = point;\n return x0 < x + width && y0 < y + height && y0 > y && x0 > x;\n}\n\nexport function isPercent(v: any): v is IPercent {\n if (!isString(v)) {\n return false;\n }\n if (!v.endsWith('%')) {\n return false;\n }\n return couldBeValidNumber(v.substring(0, v.length - 1));\n}\n\nexport function isPercentOffset(v: any): v is IPercentOffset {\n if (!isObject(v)) {\n return false;\n }\n if ('percent' in v || 'offset' in v) {\n return true;\n }\n return false;\n}\n\nexport function calcLayoutNumber(\n v: ILayoutNumber | undefined,\n size: number,\n callOp?: ILayoutRect //如果是函数类型的话,函数的参数\n) {\n if (isNumber(v)) {\n return v;\n }\n if (isPercent(v)) {\n return (Number(v.substring(0, v.length - 1)) * size) / 100;\n }\n if (isFunction(v)) {\n return v(callOp);\n }\n if (isObject(v)) {\n return size * (v.percent ?? 0) + (v.offset ?? 0);\n }\n return 0;\n}\n\nexport function calcPadding(\n paddingSpec: ILayoutOrientPadding,\n rect: ILayoutRect,\n callOp: ILayoutRect //如果是函数类型的话,函数的参数\n): IPadding {\n const result: IPadding = {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0\n };\n if (Object.values(paddingSpec).every(value => isNumber(value))) {\n result.top = (<IPadding>paddingSpec).top ?? 0;\n result.right = (<IPadding>paddingSpec).right ?? 0;\n result.bottom = (<IPadding>paddingSpec).bottom ?? 0;\n result.left = (<IPadding>paddingSpec).left ?? 0;\n return result;\n }\n const paddings = [\n {\n orients: ['left', 'right'],\n size: rect.width\n },\n {\n orients: ['top', 'bottom'],\n size: rect.height\n }\n ];\n paddings.forEach(p => {\n p.orients.forEach(o => {\n result[o] = calcLayoutNumber(paddingSpec[o], p.size, callOp);\n });\n });\n return result;\n}\n\nexport function boundsInRect(bounds: IBoundsLike, rect: ILayoutRect): ILayoutRect {\n if (!bounds) {\n return { width: 0, height: 0 };\n }\n return {\n width: Math.ceil(Math.min(bounds.x2 - bounds.x1, rect.width)),\n height: Math.ceil(Math.min(bounds.y2 - bounds.y1, rect.height))\n };\n}\n\nexport function boundsOutViewBox(\n bounds: IBoundsLike,\n box: IBoundsLike,\n direction: Direction\n): {\n start: number;\n end: number;\n} {\n if (!bounds || !box) {\n return { start: 0, end: 0 };\n }\n const start = -(direction === Direction.horizontal ? bounds.x1 : bounds.y1);\n const end = direction === Direction.horizontal ? bounds.x2 - (box.x2 - box.x1) : bounds.y2 - (box.y2 - box.y1);\n return { start: start > 0 ? start : 0, end: end > 0 ? end : 0 };\n}\n\nexport function normalizeLayoutPaddingSpec(spec: ILayoutPaddingSpec): ILayoutOrientPadding {\n let result: ILayoutOrientPadding = {};\n if (isArray(spec)) {\n if (!isNil(spec[0])) {\n result.top = result.left = result.bottom = result.right = spec[0];\n }\n if (!isNil(spec[1])) {\n result.left = result.right = spec[1];\n }\n if (!isNil(spec[2])) {\n result.bottom = spec[2];\n }\n if (!isNil(spec[3])) {\n result.left = spec[3];\n }\n return result;\n }\n if (isNumber(spec) || isPercent(spec) || isFunction(spec) || isPercentOffset(spec)) {\n result.top = result.left = result.bottom = result.right = spec;\n return result;\n }\n if (isObject(spec)) {\n result = { ...spec };\n return result;\n }\n return result;\n}\n\nexport function convertPoint(point: IPoint, relativePoint: IPoint, convert: boolean) {\n if (convert) {\n return {\n x: point.x + relativePoint.x,\n y: point.y + relativePoint.y\n };\n }\n return point;\n}\n"]}
1
+ {"version":3,"sources":["../src/util/space.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAoB,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAY7F,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,QAAQ,MAAM,EAAE;QACd,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO,CAAC;QACb,KAAK,KAAK,CAAC;QACX,KAAK,QAAQ;YACX,OAAO,IAAI,CAAC;QACd;YACE,OAAO,KAAK,CAAC;KAChB;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAa,EAAE,IAAW;IACtD,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACrC,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC;IAC/B,OAAO,EAAE,GAAG,CAAC,GAAG,KAAK,IAAI,EAAE,GAAG,CAAC,GAAG,MAAM,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,CAAM;IAC9B,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;QAChB,OAAO,KAAK,CAAC;KACd;IACD,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;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CAAC;QAC/D,OAAO,MAAM,CAAC;KACf;IACD,IAAI,QAAQ,CAAC,IAAI,CAAC,EAAE;QAClB,MAAM,qBAAQ,IAAI,CAAE,CAAC;QACrB,OAAO,MAAM,CAAC;KACf;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAa,EAAE,aAAqB,EAAE,OAAgB;IACjF,IAAI,OAAO,EAAE;QACX,OAAO;YACL,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC;YAC5B,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC;SAC7B,CAAC;KACH;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAQD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,WAA4B,EAAE,KAAa,EAAU,EAAE;IACvF,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;IAC3C,MAAM,cAAc,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;IAC9C,IAAI,KAAK,CAAC,cAAc,CAAC,IAAI,cAAc,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE;QAC9E,OAAO,KAAK,GAAG,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;KACnF;IACD,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC","file":"space.js","sourcesContent":["import { isArray, type IBoundsLike } from '@visactor/vutils';\nimport { isNumber, isNil, isString, isFunction, couldBeValidNumber, isObject } from './type';\nimport type {\n ILayoutPaddingSpec,\n IPercentOffset,\n ILayoutNumber,\n IPercent,\n ILayoutOrientPadding,\n ILayoutRect\n} from '../model/interface';\nimport type { IPadding, IRect } from '../typings/space';\nimport type { IPoint } from '../typings/coordinate';\n\nexport function isValidOrient(orient: string): boolean {\n switch (orient) {\n case 'left':\n case 'right':\n case 'top':\n case 'bottom':\n return true;\n default:\n return false;\n }\n}\n\nexport function isPointInRect(point: IPoint, rect: IRect) {\n const { x, y, width, height } = rect;\n const { x: x0, y: y0 } = point;\n return x0 < x + width && y0 < y + height && y0 > y && x0 > x;\n}\n\nexport function isPercent(v: any): v is IPercent {\n if (!isString(v)) {\n return false;\n }\n if (!v.endsWith('%')) {\n return false;\n }\n return couldBeValidNumber(v.substring(0, v.length - 1));\n}\n\nexport function isPercentOffset(v: any): v is IPercentOffset {\n if (!isObject(v)) {\n return false;\n }\n if ('percent' in v || 'offset' in v) {\n return true;\n }\n return false;\n}\n\nexport function calcLayoutNumber(\n v: ILayoutNumber | undefined,\n size: number,\n callOp?: ILayoutRect //如果是函数类型的话,函数的参数\n) {\n if (isNumber(v)) {\n return v;\n }\n if (isPercent(v)) {\n return (Number(v.substring(0, v.length - 1)) * size) / 100;\n }\n if (isFunction(v)) {\n return v(callOp);\n }\n if (isObject(v)) {\n return size * (v.percent ?? 0) + (v.offset ?? 0);\n }\n return 0;\n}\n\nexport function calcPadding(\n paddingSpec: ILayoutOrientPadding,\n rect: ILayoutRect,\n callOp: ILayoutRect //如果是函数类型的话,函数的参数\n): IPadding {\n const result: IPadding = {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0\n };\n if (Object.values(paddingSpec).every(value => isNumber(value))) {\n result.top = (<IPadding>paddingSpec).top ?? 0;\n result.right = (<IPadding>paddingSpec).right ?? 0;\n result.bottom = (<IPadding>paddingSpec).bottom ?? 0;\n result.left = (<IPadding>paddingSpec).left ?? 0;\n return result;\n }\n const paddings = [\n {\n orients: ['left', 'right'],\n size: rect.width\n },\n {\n orients: ['top', 'bottom'],\n size: rect.height\n }\n ];\n paddings.forEach(p => {\n p.orients.forEach(o => {\n result[o] = calcLayoutNumber(paddingSpec[o], p.size, callOp);\n });\n });\n return result;\n}\n\nexport function boundsInRect(bounds: IBoundsLike, rect: ILayoutRect): ILayoutRect {\n if (!bounds) {\n return { width: 0, height: 0 };\n }\n return {\n width: Math.ceil(Math.min(bounds.x2 - bounds.x1, rect.width)),\n height: Math.ceil(Math.min(bounds.y2 - bounds.y1, rect.height))\n };\n}\n\nexport function normalizeLayoutPaddingSpec(spec: ILayoutPaddingSpec): ILayoutOrientPadding {\n let result: ILayoutOrientPadding = {};\n if (isArray(spec)) {\n if (!isNil(spec[0])) {\n result.top = result.left = result.bottom = result.right = spec[0];\n }\n if (!isNil(spec[1])) {\n result.left = result.right = spec[1];\n }\n if (!isNil(spec[2])) {\n result.bottom = spec[2];\n }\n if (!isNil(spec[3])) {\n result.left = spec[3];\n }\n return result;\n }\n if (isNumber(spec) || isPercent(spec) || isFunction(spec) || isPercentOffset(spec)) {\n result.top = result.left = result.bottom = result.right = spec;\n return result;\n }\n if (isObject(spec)) {\n result = { ...spec };\n return result;\n }\n return result;\n}\n\nexport function convertPoint(point: IPoint, relativePoint: IPoint, convert: boolean) {\n if (convert) {\n return {\n x: point.x + relativePoint.x,\n y: point.y + relativePoint.y\n };\n }\n return point;\n}\n\n/**\n * 将相对数值转换为绝对数值\n * @param originValue 原始值(相对值或绝对值)\n * @param total 总体值\n * @returns 实际绝对数值\n */\nexport const getActualNumValue = (originValue: number | string, total: number): number => {\n const originNumValue = Number(originValue);\n const originStrValue = originValue.toString();\n if (isNaN(originNumValue) && originStrValue[originStrValue.length - 1] === '%') {\n return total * (Number(originStrValue.slice(0, originStrValue.length - 1)) / 100);\n }\n return originNumValue;\n};\n"]}
@@ -0,0 +1,4 @@
1
+ import type { IBackgroundSpec, IBackgroundStyleSpec } from '../../typings';
2
+ export declare function convertBackgroundSpec(bg: IBackgroundSpec): Omit<IBackgroundStyleSpec, 'image'> & {
3
+ background?: IBackgroundStyleSpec['image'];
4
+ };
@@ -0,0 +1,21 @@
1
+ var __rest = this && this.__rest || function(s, e) {
2
+ var t = {};
3
+ for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
4
+ if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
5
+ var i = 0;
6
+ for (p = Object.getOwnPropertySymbols(s); i < p.length; i++) e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
7
+ }
8
+ return t;
9
+ };
10
+
11
+ export function convertBackgroundSpec(bg) {
12
+ if (!bg) return null;
13
+ if ("string" == typeof bg) return {
14
+ fill: bg,
15
+ fillOpacity: 1
16
+ };
17
+ if ("object" != typeof bg) return null;
18
+ const {x: x, y: y, width: width, height: height, x1: x1, y1: y1, image: image} = bg, rest = __rest(bg, [ "x", "y", "width", "height", "x1", "y1", "image" ]);
19
+ return rest.background = image, rest;
20
+ }
21
+ //# sourceMappingURL=background.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/util/spec/background.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,MAAM,UAAU,qBAAqB,CACnC,EAAmB;IAEnB,IAAI,CAAC,EAAE,EAAE;QACP,OAAO,IAAI,CAAC;KACb;IACD,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QAC1B,OAAO;YACL,IAAI,EAAE,EAAE;YACR,WAAW,EAAE,CAAC;SACf,CAAC;KACH;IACD,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;QAC1B,OAAO,IAAI,CAAC;KACb;IACD,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,KAAc,EAAE,EAAX,IAAI,UAAK,EAAE,EAApD,kDAA+C,CAAK,CAAC;IAC3D,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IACxB,OAAO,IAAI,CAAC;AACd,CAAC","file":"background.js","sourcesContent":["import type { IBackgroundSpec, IBackgroundStyleSpec } from '../../typings';\n\nexport function convertBackgroundSpec(\n bg: IBackgroundSpec\n): Omit<IBackgroundStyleSpec, 'image'> & { background?: IBackgroundStyleSpec['image'] } {\n if (!bg) {\n return null;\n }\n if (typeof bg === 'string') {\n return {\n fill: bg,\n fillOpacity: 1\n };\n }\n if (typeof bg !== 'object') {\n return null;\n }\n const { x, y, width, height, x1, y1, image, ...rest } = bg;\n rest.background = image;\n return rest;\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare function cloneDeepSpec(spec: any): any;
@@ -0,0 +1,20 @@
1
+ import { isArray, isBoolean, isDate, isNumber, isString, isValid } from "@visactor/vutils";
2
+
3
+ import { isDataView, isHTMLElement } from "./common";
4
+
5
+ export function cloneDeepSpec(spec) {
6
+ const value = spec;
7
+ let result;
8
+ if (!isValid(value) || "object" != typeof value) return value;
9
+ if (isDataView(value) || isHTMLElement(value)) return value;
10
+ const isArr = isArray(value), length = value.length;
11
+ result = isArr ? new Array(length) : "object" == typeof value ? {} : isBoolean(value) || isNumber(value) || isString(value) ? value : isDate(value) ? new Date(+value) : void 0;
12
+ const props = isArr ? void 0 : Object.keys(Object(value));
13
+ let index = -1;
14
+ if (result) for (;++index < (props || value).length; ) {
15
+ const key = props ? props[index] : index, subValue = value[key];
16
+ result[key] = cloneDeepSpec(subValue);
17
+ }
18
+ return result;
19
+ }
20
+ //# sourceMappingURL=clone-deep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/util/spec/clone-deep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAMrD,MAAM,UAAU,aAAa,CAAC,IAAS;IACrC,MAAM,KAAK,GAAG,IAAI,CAAC;IAEnB,IAAI,MAAM,CAAC;IACX,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAChD,OAAO,KAAK,CAAC;KACd;IAGD,IAAI,UAAU,CAAC,KAAK,CAAC,I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actor/vutils';\nimport { isDataView, isHTMLElement } from './common';\n\n/**\n * 深拷贝 spec,为避免循环引用,DataView 维持原有引用\n * @param spec 原spec\n */\nexport function cloneDeepSpec(spec: any) {\n const value = spec;\n\n let result;\n if (!isValid(value) || typeof value !== 'object') {\n return value;\n }\n\n // 判断是不是不能深拷贝的对象\n if (isDataView(value) || isHTMLElement(value)) {\n return value;\n }\n\n const isArr = isArray(value);\n const length = value.length;\n // 不考虑特殊数组的额外处理\n if (isArr) {\n result = new Array(length);\n }\n // 不考虑 buffer / arguments 类型的处理以及 prototype 的额外处理\n else if (typeof value === 'object') {\n result = {};\n }\n // 不建议使用作为 Boolean / Number / String 作为构造器\n else if (isBoolean(value) || isNumber(value) || isString(value)) {\n result = value;\n } else if (isDate(value)) {\n result = new Date(+value);\n }\n // 不考虑 ArrayBuffer / DataView / TypedArray / map / set / regexp / symbol 类型\n else {\n result = undefined;\n }\n\n // 不考虑 map / set / TypedArray 类型的赋值\n\n // 不考虑对象的 symbol 属性\n const props = isArr ? undefined : Object.keys(Object(value));\n\n let index = -1;\n if (result) {\n while (++index < (props || value).length) {\n const key = props ? props[index] : index;\n const subValue = value[key];\n result[key] = cloneDeepSpec(subValue);\n }\n }\n return result;\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import { DataView } from '@visactor/vdataset';
2
+ export declare function isDataView(obj: any): obj is DataView;
3
+ export declare function isHTMLElement(obj: any): obj is Element;
@@ -0,0 +1,15 @@
1
+ import { DataView } from "@visactor/vdataset";
2
+
3
+ export function isDataView(obj) {
4
+ return obj instanceof DataView;
5
+ }
6
+
7
+ export function isHTMLElement(obj) {
8
+ try {
9
+ return obj instanceof Element;
10
+ } catch (_a) {
11
+ const htmlElementKeys = [ "children", "innerHTML", "classList", "setAttribute", "tagName", "getBoundingClientRect" ], keys = Object.keys(obj);
12
+ return htmlElementKeys.every((key => keys.includes(key)));
13
+ }
14
+ }
15
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/util/spec/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,MAAM,UAAU,UAAU,CAAC,GAAQ;IACjC,OAAO,GAAG,YAAY,QAAQ,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAQ;IACpC,IAAI;QACF,OAAO,GAAG,YAAY,OAAO,CAAC;KAC/B;IAAC,WAAM;QAEN,MAAM,eAAe,GAAsB;YACzC,UAAU;YACV,WAAW;YACX,WAAW;YACX,cAAc;YACd,SAAS;YACT,uBAAuB;SACxB,CAAC;QACF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC9B,OAAO,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;KACzD;AACH,CAAC","file":"common.js","sourcesContent":["import { DataView } from '@visactor/vdataset';\n\nexport function isDataView(obj: any): obj is DataView {\n return obj instanceof DataView;\n}\n\nexport function isHTMLElement(obj: any): obj is Element {\n try {\n return obj instanceof Element;\n } catch {\n // 跨端 plan B\n const htmlElementKeys: (keyof Element)[] = [\n 'children',\n 'innerHTML',\n 'classList',\n 'setAttribute',\n 'tagName',\n 'getBoundingClientRect'\n ];\n const keys = Object.keys(obj);\n return htmlElementKeys.every(key => keys.includes(key));\n }\n}\n"]}
@@ -0,0 +1,7 @@
1
+ export * from './background';
2
+ export * from './clone-deep';
3
+ export * from './common';
4
+ export * from './merge-spec';
5
+ export * from './merge-theme';
6
+ export * from './preprocess';
7
+ export * from './transform';
@@ -0,0 +1,14 @@
1
+ export * from "./background";
2
+
3
+ export * from "./clone-deep";
4
+
5
+ export * from "./common";
6
+
7
+ export * from "./merge-spec";
8
+
9
+ export * from "./merge-theme";
10
+
11
+ export * from "./preprocess";
12
+
13
+ export * from "./transform";
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/util/spec/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC","file":"index.js","sourcesContent":["export * from './background';\nexport * from './clone-deep';\nexport * from './common';\nexport * from './merge-spec';\nexport * from './merge-theme';\nexport * from './preprocess';\nexport * from './transform';\n"]}
@@ -0,0 +1 @@
1
+ export declare function mergeSpec(target: any, ...sources: any[]): any;
@@ -0,0 +1,48 @@
1
+ import { isArray, isArrayLike, isPlainObject, isValid } from "@visactor/vutils";
2
+
3
+ function baseMerge(target, source, shallowArray = !1) {
4
+ if (source) {
5
+ if (target === source) return;
6
+ if (isValid(source) && "object" == typeof source) {
7
+ const iterable = Object(source), props = [];
8
+ for (const key in iterable) props.push(key);
9
+ let {length: length} = props, propIndex = -1;
10
+ for (;length--; ) {
11
+ const key = props[++propIndex];
12
+ isValid(iterable[key]) && "object" == typeof iterable[key] && !isArray(target[key]) ? baseMergeDeep(target, source, key, shallowArray) : assignMergeValue(target, key, iterable[key]);
13
+ }
14
+ }
15
+ }
16
+ }
17
+
18
+ function baseMergeDeep(target, source, key, shallowArray = !1) {
19
+ const objValue = target[key], srcValue = source[key];
20
+ let newValue = source[key], isCommon = !0;
21
+ if (isArray(srcValue)) {
22
+ if (shallowArray) newValue = []; else if (isArray(objValue)) newValue = objValue; else if (isArrayLike(objValue)) {
23
+ newValue = new Array(objValue.length);
24
+ let index = -1;
25
+ const length = objValue.length;
26
+ for (;++index < length; ) newValue[index] = objValue[index];
27
+ }
28
+ } else isPlainObject(srcValue) ? (newValue = objValue, "function" != typeof objValue && "object" == typeof objValue || (newValue = {})) : isCommon = !1;
29
+ isCommon && baseMerge(newValue, srcValue, shallowArray), assignMergeValue(target, key, newValue);
30
+ }
31
+
32
+ function assignMergeValue(target, key, value) {
33
+ (void 0 !== value && !eq(target[key], value) || void 0 === value && !(key in target)) && (target[key] = value);
34
+ }
35
+
36
+ function eq(value, other) {
37
+ return value === other || Number.isNaN(value) && Number.isNaN(other);
38
+ }
39
+
40
+ export function mergeSpec(target, ...sources) {
41
+ let sourceIndex = -1;
42
+ const length = sources.length;
43
+ for (;++sourceIndex < length; ) {
44
+ baseMerge(target, sources[sourceIndex], !0);
45
+ }
46
+ return target;
47
+ }
48
+ //# sourceMappingURL=merge-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/util/spec/merge-spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhF,SAAS,SAAS,CAAC,MAAW,EAAE,MAAW,EAAE,eAAwB,KAAK;IACxE,IAAI,MAAM,EAAE;QACV,IAAI,MAAM,KAAK,MAAM,EAAE;YACrB,OAAO;SACR;QACD,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;YAEjD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;YAChC,MAAM,KAAK,GAAG,EAAE,CAAC;YAEjB,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;gBAC1B,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aACjB;YACD,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;YACvB,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC;YACnB,OAAO,MAAM,EAAE,EAAE;gBACf,MAAM,GAAG,GAAG,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;gBAC/B,IACE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;oBACtB,OAAO,QAAQ,CAAC,GAAG,CAAC,KAAK,QAAQ;oBACjC,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC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AK,CAAC;KAClB;IAED,IAAI,QAAQ,EAAE;QACZ,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;KAC7C;IACD,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAc,EAAE,GAAW,EAAE,KAAU;IAC/D,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,CAAC,EAAE;QAEjG,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;KACrB;AACH,CAAC;AAED,SAAS,EAAE,CAAC,KAAU,EAAE,KAAU;IAChC,OAAO,KAAK,KAAK,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AACzE,CAAC;AAKD,MAAM,UAAU,SAAS,CAAC,MAAW,EAAE,GAAG,OAAc;IACtD,IAAI,WAAW,GAAG,CAAC,CAAC,CAAC;IACrB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC9B,OAAO,EAAE,WAAW,GAAG,MAAM,EAAE;QAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;QACpC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;KACjC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","file":"merge-spec.js","sourcesContent":["import { isArray, isArrayLike, isPlainObject, isValid } from '@visactor/vutils';\n\nfunction baseMerge(target: any, source: any, shallowArray: boolean = false) {\n if (source) {\n if (target === source) {\n return;\n }\n if (isValid(source) && typeof source === 'object') {\n // baseFor\n const iterable = Object(source);\n const props = [];\n // keysIn\n for (const key in iterable) {\n props.push(key);\n }\n let { length } = props;\n let propIndex = -1;\n while (length--) {\n const key = props[++propIndex];\n if (\n isValid(iterable[key]) &&\n typeof iterable[key] === 'object' &&\n !isArray(target[key]) // VChart 特有逻辑\n ) {\n baseMergeDeep(target, source, key, shallowArray);\n } else {\n assignMergeValue(target, key, iterable[key]);\n }\n }\n }\n }\n}\n\n// 由于目前 VChart 内部对 spec 会先执行一次深拷贝,merge 暂时不考虑 source 中有环的问题\nfunction baseMergeDeep(target: object, source: object, key: string, shallowArray: boolean = false) {\n const objValue = target[key];\n const srcValue = source[key];\n let newValue = source[key];\n let isCommon = true;\n // 不考虑 buffer / typedArray 类型\n if (isArray(srcValue)) {\n if (shallowArray) {\n // 依据参数对数组做浅拷贝\n newValue = [];\n } else if (isArray(objValue)) {\n newValue = objValue;\n } else if (isArrayLike(objValue)) {\n // 如果 source 为数组,则 target 的 arrayLike 对象也视作为数组处理\n newValue = new Array(objValue.length);\n let index = -1;\n const length = objValue.length;\n while (++index < length) {\n newValue[index] = objValue[index];\n }\n }\n }\n // else if (isArray(srcValue) && shallowArray) {\n // newValue = [];\n // }\n // 不考虑 argument 类型\n else if (isPlainObject(srcValue)) {\n newValue = objValue;\n // 不考虑 prototype 的额外处理\n if (typeof objValue === 'function' || typeof objValue !== 'object') {\n newValue = {};\n }\n } else {\n isCommon = false;\n }\n // 对 class 等复杂对象或者浅拷贝的 array 不做拷贝处理\n if (isCommon) {\n baseMerge(newValue, srcValue, shallowArray);\n }\n assignMergeValue(target, key, newValue);\n}\n\nfunction assignMergeValue(target: object, key: string, value: any) {\n if ((value !== undefined && !eq(target[key], value)) || (value === undefined && !(key in target))) {\n // 不考虑 __proto__ 的赋值处理\n target[key] = value;\n }\n}\n\nfunction eq(value: any, other: any) {\n return value === other || (Number.isNaN(value) && Number.isNaN(other));\n}\n\n/* 与原生的 lodash merge 差异在于对数组是否应用最后一个 source 的结果\n * 以及对一些特殊情况的处理,比如对数组类型 padding 和对象类型的 padding 的 merge\n */\nexport function mergeSpec(target: any, ...sources: any[]): any {\n let sourceIndex = -1;\n const length = sources.length;\n while (++sourceIndex < length) {\n const source = sources[sourceIndex];\n baseMerge(target, source, true);\n }\n return target;\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import { type Maybe } from '@visactor/vutils';
2
+ import type { ITheme } from '../../theme';
3
+ export declare function mergeTheme(target: Maybe<ITheme>, ...sources: Maybe<ITheme>[]): Maybe<ITheme>;
@@ -0,0 +1,34 @@
1
+ import { array } from "@visactor/vutils";
2
+
3
+ import { transformColorSchemeToStandardStruct } from "../../theme/color-scheme/util";
4
+
5
+ import { seriesMarkInfoMap } from "../../series/interface";
6
+
7
+ import { mergeSpec } from "./merge-spec";
8
+
9
+ export function mergeTheme(target, ...sources) {
10
+ return mergeSpec(transformThemeToMerge(target), ...sources.map(transformThemeToMerge));
11
+ }
12
+
13
+ function transformThemeToMerge(theme) {
14
+ if (!theme) return theme;
15
+ let {colorScheme: colorScheme} = theme;
16
+ colorScheme && (colorScheme = Object.keys(colorScheme).reduce(((scheme, key) => {
17
+ const value = colorScheme[key];
18
+ return scheme[key] = transformColorSchemeToStandardStruct(value), scheme;
19
+ }), {}));
20
+ let {series: series} = theme;
21
+ const {mark: markByType, markByName: markByName} = theme;
22
+ return (markByType || markByName) && (series = Object.keys(seriesMarkInfoMap).reduce(((newSeriesTheme, key) => {
23
+ var _a;
24
+ const value = null !== (_a = null == series ? void 0 : series[key]) && void 0 !== _a ? _a : {}, newValue = {};
25
+ return Object.values(seriesMarkInfoMap[key]).forEach((({type: type, name: name}) => {
26
+ var _a, _b;
27
+ newValue[name] = mergeSpec({}, null !== (_a = null == markByType ? void 0 : markByType[array(type)[0]]) && void 0 !== _a ? _a : {}, null !== (_b = null == markByName ? void 0 : markByName[name]) && void 0 !== _b ? _b : {}, value[name]);
28
+ })), newSeriesTheme[key] = Object.assign(Object.assign({}, value), newValue), newSeriesTheme;
29
+ }), {})), Object.assign(Object.assign({}, theme), {
30
+ col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AC,cAAc,EAAE,GAAG,EAAE,EAAE;;YACrE,MAAM,KAAK,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAG,GAAG,CAAC,mCAAI,EAAE,CAAC;YAClC,MAAM,QAAQ,GAAG,EAAE,CAAC;YACpB,MAAM,CAAC,MAAM,CAAkB,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE;;gBAChF,QAAQ,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,EAAE,EAAE,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,mCAAI,EAAE,EAAE,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAG,IAAI,CAAC,mCAAI,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;YAC5G,CAAC,CAAC,CAAC;YACH,cAAc,CAAC,GAAG,CAAC,mCACd,KAAK,GACL,QAAQ,CACZ,CAAC;YACF,OAAO,cAAc,CAAC;QACxB,CAAC,EAAE,EAAkB,CAAC,CAAC;KACxB;IAED,uCACK,KAAK,KACR,WAAW;QACX,MAAM,IACN;AACJ,CAAC","file":"merge-theme.js","sourcesContent":["import { type Maybe, array } from '@visactor/vutils';\nimport type { ITheme } from '../../theme';\nimport { transformColorSchemeToStandardStruct } from '../../theme/color-scheme/util';\nimport type { IThemeColorScheme } from '../../theme/color-scheme/interface';\nimport type { ISeriesTheme } from '../../series/interface';\n// eslint-disable-next-line no-duplicate-imports\nimport { seriesMarkInfoMap, type ISeriesMarkInfo } from '../../series/interface';\nimport { mergeSpec } from './merge-spec';\n\nexport function mergeTheme(target: Maybe<ITheme>, ...sources: Maybe<ITheme>[]): Maybe<ITheme> {\n return mergeSpec(transformThemeToMerge(target), ...sources.map(transformThemeToMerge));\n}\n\nfunction transformThemeToMerge(theme?: Maybe<ITheme>): Maybe<ITheme> {\n if (!theme) {\n return theme;\n }\n\n // 将色板转化为标准形式\n let { colorScheme } = theme;\n if (colorScheme) {\n colorScheme = Object.keys(colorScheme).reduce<IThemeColorScheme>((scheme, key) => {\n const value = colorScheme[key];\n scheme[key] = transformColorSchemeToStandardStruct(value);\n return scheme;\n }, {} as IThemeColorScheme);\n }\n\n // 将全局 mark 主题 merge 进系列主题\n let { series } = theme;\n const { mark: markByType, markByName } = theme;\n if (markByType || markByName) {\n series = Object.keys(seriesMarkInfoMap).reduce((newSeriesTheme, key) => {\n const value = series?.[key] ?? {};\n const newValue = {};\n Object.values<ISeriesMarkInfo>(seriesMarkInfoMap[key]).forEach(({ type, name }) => {\n newValue[name] = mergeSpec({}, markByType?.[array(type)[0]] ?? {}, markByName?.[name] ?? {}, value[name]);\n });\n newSeriesTheme[key] = {\n ...value,\n ...newValue\n };\n return newSeriesTheme;\n }, {} as ISeriesTheme);\n }\n\n return {\n ...theme,\n colorScheme,\n series\n };\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import type { SeriesTypeEnum } from '../../series/interface';
2
+ import type { IThemeColorScheme } from '../../theme/color-scheme/interface';
3
+ export declare function preprocessSpecOrTheme(obj: any, colorScheme?: IThemeColorScheme, seriesType?: SeriesTypeEnum): any;
@@ -0,0 +1,20 @@
1
+ import { isArray, isFunction, isObject } from "@visactor/vutils";
2
+
3
+ import { isDataView, isHTMLElement } from "./common";
4
+
5
+ import { getActualColor, isColorKey } from "../../theme/color-scheme/util";
6
+
7
+ import { normalizeLayoutPaddingSpec } from "../space";
8
+
9
+ export function preprocessSpecOrTheme(obj, colorScheme, seriesType) {
10
+ if (isArray(obj)) return obj.map((element => isObject(element) && !isFunction(element) ? preprocessSpecOrTheme(element, colorScheme, seriesType) : element));
11
+ const newObj = {};
12
+ return Object.keys(obj).forEach((key => {
13
+ const value = obj[key];
14
+ if (key.includes("data")) newObj[key] = value; else if (isObject(value)) {
15
+ if (isFunction(value) || isDataView(value) || isHTMLElement(value)) return void (newObj[key] = value);
16
+ isColorKey(value) ? newObj[key] = getActualColor(value, colorScheme, seriesType) : newObj[key] = "padding" === key ? normalizeLayoutPaddingSpec(value) : preprocessSpecOrTheme(value, colorScheme, seriesType);
17
+ } else newObj[key] = value;
18
+ })), newObj;
19
+ }
20
+ //# sourceMappingURL=preprocess.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/util/spec/preprocess.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAGtD,MAAM,UAAU,qBAAqB,CAAC,GAAQ,EAAE,WAA+B,EAAE,UAA2B;IAC1G,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE;QAChB,OAAO,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;YACvB,IAAI,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;gBAC7C,OAAO,qBAAqB,CAAC,OAAO,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;aAChE;YACD,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC,CAAC;KACJ;IAED,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QAC7B,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QAEvB,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YACxB,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YACpB,OAAO;SACR;QACD,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE;YAEnB,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE;gBAClE,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;gBACpB,OAAO;aACR;YACD,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE;gBAErB,MAAM,CAAC,GAAG,CAAC,GAAG,cAAc,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;aAC9D;iBAAM,IAAI,GAAG,KAAK,SAAS,EAAE;gBAE5B,MAAM,CAAC,GAAG,CAAC,GAAG,0BAA0B,CAAC,KAAK,CAAC,CAAC;aACjD;iBAAM;gBACL,MAAM,CAAC,GAAG,CAAC,GAAG,qBAAqB,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;aACrE;SACF;aAAM;YACL,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;SACrB;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","file":"preprocess.js","sourcesContent":["import { isArray, isFunction, isObject } from '@visactor/vutils';\nimport type { SeriesTypeEnum } from '../../series/interface';\nimport type { IThemeColorScheme } from '../../theme/color-scheme/interface';\nimport { isDataView, isHTMLElement } from './common';\nimport { getActualColor, isColorKey } from '../../theme/color-scheme/util';\nimport { normalizeLayoutPaddingSpec } from '../space';\n\n/** 对 spec 或者类 spec 配置(如 theme)进行预处理,如进行语义化颜色的转换等 */\nexport function preprocessSpecOrTheme(obj: any, colorScheme?: IThemeColorScheme, seriesType?: SeriesTypeEnum): any {\n if (isArray(obj)) {\n return obj.map(element => {\n if (isObject(element) && !isFunction(element)) {\n return preprocessSpecOrTheme(element, colorScheme, seriesType);\n }\n return element;\n });\n }\n\n const newObj = {};\n Object.keys(obj).forEach(key => {\n const value = obj[key];\n // 绕过数据\n if (key.includes('data')) {\n newObj[key] = value;\n return;\n }\n if (isObject(value)) {\n // 绕过不可深拷贝的对象\n if (isFunction(value) || isDataView(value) || isHTMLElement(value)) {\n newObj[key] = value;\n return;\n }\n if (isColorKey(value)) {\n // 查询、替换语义化颜色\n newObj[key] = getActualColor(value, colorScheme, seriesType);\n } else if (key === 'padding') {\n // 标准化 padding\n newObj[key] = normalizeLayoutPaddingSpec(value);\n } else {\n newObj[key] = preprocessSpecOrTheme(value, colorScheme, seriesType);\n }\n } else {\n newObj[key] = value;\n }\n });\n\n return newObj;\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export declare function specTransform(spec: unknown, special?: {
2
+ [key: string]: (v: unknown) => unknown;
3
+ }): unknown;
@@ -0,0 +1,20 @@
1
+ import { isArray } from "@visactor/vutils";
2
+
3
+ export function specTransform(spec, special = {
4
+ data: v => v
5
+ }) {
6
+ if (!spec) return spec;
7
+ if (spec.constructor === Object) {
8
+ const result = {};
9
+ for (const key in spec) if (Object.prototype.hasOwnProperty.call(spec, key)) {
10
+ if (special[key]) {
11
+ result[key] = special[key](spec[key]);
12
+ continue;
13
+ }
14
+ result[key] = specTransform(spec[key], special);
15
+ }
16
+ return result;
17
+ }
18
+ return isArray(spec) ? spec.map((s => specTransform(s, special))) : spec;
19
+ }
20
+ //# sourceMappingURL=transform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/util/spec/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,MAAM,UAAU,aAAa,CAC3B,IAAa,EACb,UAEI;IACF,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;CACb;IAED,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAC;KACb;IAED,IAAI,IAAI,CAAC,WAAW,KAAK,MAAM,EAAE;QAC/B,MAAM,MAAM,GAAQ,EAAE,CAAC;QACvB,KAAK,MAAM,GAAG,IAAI,IAAW,EAAE;YAC7B,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE;gBAEnD,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE;oBAChB,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;oBACtC,SAAS;iBACV;gBACD,MAAM,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;aACjD;SACF;QACD,OAAO,MAAM,CAAC;KACf;IAED,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE;QACjB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;KACjD;IACD,OAAO,IAAI,CAAC;AACd,CAAC","file":"transform.js","sourcesContent":["import { isArray } from '@visactor/vutils';\n\n// todo 以目前的场景来看,并没有递归的需要。\n// 考虑到不确定性,还是递归处理spec对象,时间消耗很少\nexport function specTransform(\n spec: unknown,\n special: {\n [key: string]: (v: unknown) => unknown;\n } = {\n data: v => v\n }\n): unknown {\n if (!spec) {\n return spec;\n }\n // 如果是普通对象\n if (spec.constructor === Object) {\n const result: any = {};\n for (const key in spec as any) {\n if (Object.prototype.hasOwnProperty.call(spec, key)) {\n // todo 特殊处理怎样更合理?\n if (special[key]) {\n result[key] = special[key](spec[key]);\n continue;\n }\n result[key] = specTransform(spec[key], special);\n }\n }\n return result;\n }\n // 如果是数组\n if (isArray(spec)) {\n return spec.map(s => specTransform(s, special));\n }\n return spec;\n}\n"]}
@@ -1,5 +1,4 @@
1
1
  import type { ITextMeasureOption } from '@visactor/vutils';
2
- import { TextMeasure, TestTextMeasure } from '@visactor/vutils';
2
+ import { TextMeasure } from '@visactor/vutils';
3
3
  import type { ITextMarkSpec } from '../typings';
4
4
  export declare const initTextMeasure: (textSpec?: Partial<ITextMarkSpec>, option?: Partial<ITextMeasureOption>, useNaiveCanvas?: boolean) => TextMeasure<ITextMarkSpec>;
5
- export declare const testTextMeasure: (textSpec?: Partial<ITextMarkSpec>, useVRender?: boolean) => TestTextMeasure<any>;