@antv/g2 5.1.6 → 5.1.8-beta.1

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 (265) hide show
  1. package/README.md +2 -2
  2. package/README.zh-CN.md +1 -1
  3. package/dist/g2.full.min.js +1 -1
  4. package/dist/g2.lite.min.js +1 -1
  5. package/dist/g2.min.js +1 -1
  6. package/esm/animation/growInX.js +0 -4
  7. package/esm/animation/growInX.js.map +1 -1
  8. package/esm/animation/growInY.js +0 -4
  9. package/esm/animation/growInY.js.map +1 -1
  10. package/esm/animation/scaleInX.js +5 -7
  11. package/esm/animation/scaleInX.js.map +1 -1
  12. package/esm/animation/scaleInY.js +5 -7
  13. package/esm/animation/scaleInY.js.map +1 -1
  14. package/esm/animation/scaleOutX.js +5 -7
  15. package/esm/animation/scaleOutX.js.map +1 -1
  16. package/esm/animation/scaleOutY.js +5 -7
  17. package/esm/animation/scaleOutY.js.map +1 -1
  18. package/esm/animation/zoomIn.js +4 -5
  19. package/esm/animation/zoomIn.js.map +1 -1
  20. package/esm/animation/zoomOut.js +4 -6
  21. package/esm/animation/zoomOut.js.map +1 -1
  22. package/esm/component/axis.js +1 -5
  23. package/esm/component/axis.js.map +1 -1
  24. package/esm/component/index.d.ts +0 -1
  25. package/esm/component/index.js +0 -1
  26. package/esm/component/index.js.map +1 -1
  27. package/esm/component/legendContinuous.js +1 -1
  28. package/esm/component/legendContinuous.js.map +1 -1
  29. package/esm/coordinate/index.d.ts +0 -2
  30. package/esm/coordinate/index.js +0 -1
  31. package/esm/coordinate/index.js.map +1 -1
  32. package/esm/exports.d.ts +6 -1
  33. package/esm/exports.js +4 -0
  34. package/esm/exports.js.map +1 -1
  35. package/esm/index.d.ts +114 -114
  36. package/esm/index.js +2 -2
  37. package/esm/index.js.map +1 -1
  38. package/esm/lib/builtinlib.d.ts +7 -7
  39. package/esm/lib/core.d.ts +32 -32
  40. package/esm/lib/index.d.ts +0 -2
  41. package/esm/lib/index.js +0 -2
  42. package/esm/lib/index.js.map +1 -1
  43. package/esm/lib/lite.d.ts +18 -18
  44. package/esm/lib/std.d.ts +56 -56
  45. package/esm/mark/index.d.ts +0 -4
  46. package/esm/mark/index.js +0 -4
  47. package/esm/mark/index.js.map +1 -1
  48. package/esm/mark/liquid.js +2 -1
  49. package/esm/mark/liquid.js.map +1 -1
  50. package/esm/runtime/component.js +1 -3
  51. package/esm/runtime/component.js.map +1 -1
  52. package/esm/runtime/types/component.d.ts +1 -6
  53. package/esm/shape/index.d.ts +0 -4
  54. package/esm/shape/index.js +0 -4
  55. package/esm/shape/index.js.map +1 -1
  56. package/esm/shape/interval/color.d.ts +4 -0
  57. package/esm/shape/interval/color.js +10 -7
  58. package/esm/shape/interval/color.js.map +1 -1
  59. package/esm/shape/interval/rect.d.ts +4 -0
  60. package/esm/shape/interval/rect.js.map +1 -1
  61. package/esm/shape/line/smooth.js +8 -4
  62. package/esm/shape/line/smooth.js.map +1 -1
  63. package/esm/spec/coordinate.d.ts +1 -4
  64. package/esm/spec/mark.d.ts +1 -3
  65. package/esm/theme/create.d.ts +1 -0
  66. package/esm/theme/create.js +1 -0
  67. package/esm/theme/create.js.map +1 -1
  68. package/esm/transform/filter.js +3 -1
  69. package/esm/transform/filter.js.map +1 -1
  70. package/esm/transform/maybeTitle.js +6 -1
  71. package/esm/transform/maybeTitle.js.map +1 -1
  72. package/esm/utils/dateFormat.d.ts +1 -0
  73. package/esm/utils/dateFormat.js +18 -0
  74. package/esm/utils/dateFormat.js.map +1 -0
  75. package/esm/utils/number.d.ts +4 -0
  76. package/esm/utils/number.js +8 -0
  77. package/esm/utils/number.js.map +1 -1
  78. package/lib/animation/growInX.js +0 -4
  79. package/lib/animation/growInX.js.map +1 -1
  80. package/lib/animation/growInY.js +0 -4
  81. package/lib/animation/growInY.js.map +1 -1
  82. package/lib/animation/scaleInX.js +5 -7
  83. package/lib/animation/scaleInX.js.map +1 -1
  84. package/lib/animation/scaleInY.js +5 -7
  85. package/lib/animation/scaleInY.js.map +1 -1
  86. package/lib/animation/scaleOutX.js +5 -7
  87. package/lib/animation/scaleOutX.js.map +1 -1
  88. package/lib/animation/scaleOutY.js +5 -7
  89. package/lib/animation/scaleOutY.js.map +1 -1
  90. package/lib/animation/zoomIn.js +4 -5
  91. package/lib/animation/zoomIn.js.map +1 -1
  92. package/lib/animation/zoomOut.js +4 -6
  93. package/lib/animation/zoomOut.js.map +1 -1
  94. package/lib/component/axis.js +3 -7
  95. package/lib/component/axis.js.map +1 -1
  96. package/lib/component/index.d.ts +0 -1
  97. package/lib/component/index.js +1 -3
  98. package/lib/component/index.js.map +1 -1
  99. package/lib/component/legendContinuous.js +1 -1
  100. package/lib/component/legendContinuous.js.map +1 -1
  101. package/lib/coordinate/index.d.ts +0 -2
  102. package/lib/coordinate/index.js +1 -3
  103. package/lib/coordinate/index.js.map +1 -1
  104. package/lib/exports.d.ts +6 -1
  105. package/lib/exports.js +13 -1
  106. package/lib/exports.js.map +1 -1
  107. package/lib/index.d.ts +114 -114
  108. package/lib/index.js +1 -2
  109. package/lib/index.js.map +1 -1
  110. package/lib/lib/builtinlib.d.ts +7 -7
  111. package/lib/lib/core.d.ts +32 -32
  112. package/lib/lib/index.d.ts +0 -2
  113. package/lib/lib/index.js +1 -5
  114. package/lib/lib/index.js.map +1 -1
  115. package/lib/lib/lite.d.ts +18 -18
  116. package/lib/lib/std.d.ts +56 -56
  117. package/lib/mark/index.d.ts +0 -4
  118. package/lib/mark/index.js +1 -9
  119. package/lib/mark/index.js.map +1 -1
  120. package/lib/mark/liquid.js +2 -1
  121. package/lib/mark/liquid.js.map +1 -1
  122. package/lib/runtime/component.js +2 -4
  123. package/lib/runtime/component.js.map +1 -1
  124. package/lib/runtime/types/component.d.ts +1 -6
  125. package/lib/shape/index.d.ts +0 -4
  126. package/lib/shape/index.js +6 -14
  127. package/lib/shape/index.js.map +1 -1
  128. package/lib/shape/interval/color.d.ts +4 -0
  129. package/lib/shape/interval/color.js +10 -7
  130. package/lib/shape/interval/color.js.map +1 -1
  131. package/lib/shape/interval/rect.d.ts +4 -0
  132. package/lib/shape/interval/rect.js.map +1 -1
  133. package/lib/shape/line/smooth.js +6 -2
  134. package/lib/shape/line/smooth.js.map +1 -1
  135. package/lib/spec/coordinate.d.ts +1 -4
  136. package/lib/spec/mark.d.ts +1 -3
  137. package/lib/theme/create.d.ts +1 -0
  138. package/lib/theme/create.js +1 -0
  139. package/lib/theme/create.js.map +1 -1
  140. package/lib/transform/filter.js +3 -1
  141. package/lib/transform/filter.js.map +1 -1
  142. package/lib/transform/maybeTitle.js +6 -1
  143. package/lib/transform/maybeTitle.js.map +1 -1
  144. package/lib/utils/dateFormat.d.ts +1 -0
  145. package/lib/utils/dateFormat.js +22 -0
  146. package/lib/utils/dateFormat.js.map +1 -0
  147. package/lib/utils/number.d.ts +4 -0
  148. package/lib/utils/number.js +10 -1
  149. package/lib/utils/number.js.map +1 -1
  150. package/package.json +10 -17
  151. package/src/animation/growInX.ts +1 -6
  152. package/src/animation/growInY.ts +1 -6
  153. package/src/animation/scaleInX.ts +8 -11
  154. package/src/animation/scaleInY.ts +8 -11
  155. package/src/animation/scaleOutX.ts +8 -11
  156. package/src/animation/scaleOutY.ts +8 -11
  157. package/src/animation/zoomIn.ts +4 -6
  158. package/src/animation/zoomOut.ts +4 -7
  159. package/src/component/axis.ts +1 -5
  160. package/src/component/index.ts +0 -1
  161. package/src/component/legendContinuous.ts +1 -1
  162. package/src/coordinate/index.ts +0 -2
  163. package/src/exports.ts +18 -2
  164. package/src/index.ts +2 -2
  165. package/src/lib/index.ts +0 -2
  166. package/src/mark/index.ts +0 -4
  167. package/src/mark/liquid.ts +2 -1
  168. package/src/runtime/component.ts +1 -4
  169. package/src/runtime/types/component.ts +2 -9
  170. package/src/shape/index.ts +0 -4
  171. package/src/shape/interval/color.ts +16 -4
  172. package/src/shape/interval/rect.ts +5 -0
  173. package/src/shape/line/smooth.ts +12 -4
  174. package/src/spec/coordinate.ts +0 -5
  175. package/src/spec/mark.ts +0 -3
  176. package/src/theme/create.ts +1 -0
  177. package/src/transform/filter.ts +3 -1
  178. package/src/transform/maybeTitle.ts +8 -1
  179. package/src/utils/dateFormat.ts +22 -0
  180. package/src/utils/number.ts +8 -0
  181. package/CHANGELOG.md +0 -417
  182. package/esm/component/axisZ.d.ts +0 -8
  183. package/esm/component/axisZ.js +0 -14
  184. package/esm/component/axisZ.js.map +0 -1
  185. package/esm/coordinate/cartesian3D.d.ts +0 -7
  186. package/esm/coordinate/cartesian3D.js +0 -6
  187. package/esm/coordinate/cartesian3D.js.map +0 -1
  188. package/esm/lib/auto.d.ts +0 -3
  189. package/esm/lib/auto.js +0 -7
  190. package/esm/lib/auto.js.map +0 -1
  191. package/esm/lib/threed.d.ts +0 -7
  192. package/esm/lib/threed.js +0 -13
  193. package/esm/lib/threed.js.map +0 -1
  194. package/esm/mark/auto.d.ts +0 -1
  195. package/esm/mark/auto.js +0 -26
  196. package/esm/mark/auto.js.map +0 -1
  197. package/esm/mark/interval3D.d.ts +0 -8
  198. package/esm/mark/interval3D.js +0 -65
  199. package/esm/mark/interval3D.js.map +0 -1
  200. package/esm/mark/line3D.d.ts +0 -7
  201. package/esm/mark/line3D.js +0 -65
  202. package/esm/mark/line3D.js.map +0 -1
  203. package/esm/mark/point3D.d.ts +0 -9
  204. package/esm/mark/point3D.js +0 -76
  205. package/esm/mark/point3D.js.map +0 -1
  206. package/esm/shape/interval3D/cube.d.ts +0 -6
  207. package/esm/shape/interval3D/cube.js +0 -71
  208. package/esm/shape/interval3D/cube.js.map +0 -1
  209. package/esm/shape/line3D/line.d.ts +0 -3
  210. package/esm/shape/line3D/line.js +0 -30
  211. package/esm/shape/line3D/line.js.map +0 -1
  212. package/esm/shape/point3D/cube.d.ts +0 -6
  213. package/esm/shape/point3D/cube.js +0 -70
  214. package/esm/shape/point3D/cube.js.map +0 -1
  215. package/esm/shape/point3D/sphere.d.ts +0 -6
  216. package/esm/shape/point3D/sphere.js +0 -70
  217. package/esm/shape/point3D/sphere.js.map +0 -1
  218. package/lib/component/axisZ.d.ts +0 -8
  219. package/lib/component/axisZ.js +0 -19
  220. package/lib/component/axisZ.js.map +0 -1
  221. package/lib/coordinate/cartesian3D.d.ts +0 -7
  222. package/lib/coordinate/cartesian3D.js +0 -10
  223. package/lib/coordinate/cartesian3D.js.map +0 -1
  224. package/lib/lib/auto.d.ts +0 -3
  225. package/lib/lib/auto.js +0 -11
  226. package/lib/lib/auto.js.map +0 -1
  227. package/lib/lib/threed.d.ts +0 -7
  228. package/lib/lib/threed.js +0 -17
  229. package/lib/lib/threed.js.map +0 -1
  230. package/lib/mark/auto.d.ts +0 -1
  231. package/lib/mark/auto.js +0 -30
  232. package/lib/mark/auto.js.map +0 -1
  233. package/lib/mark/interval3D.d.ts +0 -8
  234. package/lib/mark/interval3D.js +0 -69
  235. package/lib/mark/interval3D.js.map +0 -1
  236. package/lib/mark/line3D.d.ts +0 -7
  237. package/lib/mark/line3D.js +0 -69
  238. package/lib/mark/line3D.js.map +0 -1
  239. package/lib/mark/point3D.d.ts +0 -9
  240. package/lib/mark/point3D.js +0 -80
  241. package/lib/mark/point3D.js.map +0 -1
  242. package/lib/shape/interval3D/cube.d.ts +0 -6
  243. package/lib/shape/interval3D/cube.js +0 -75
  244. package/lib/shape/interval3D/cube.js.map +0 -1
  245. package/lib/shape/line3D/line.d.ts +0 -3
  246. package/lib/shape/line3D/line.js +0 -34
  247. package/lib/shape/line3D/line.js.map +0 -1
  248. package/lib/shape/point3D/cube.d.ts +0 -6
  249. package/lib/shape/point3D/cube.js +0 -74
  250. package/lib/shape/point3D/cube.js.map +0 -1
  251. package/lib/shape/point3D/sphere.d.ts +0 -6
  252. package/lib/shape/point3D/sphere.js +0 -74
  253. package/lib/shape/point3D/sphere.js.map +0 -1
  254. package/src/component/axisZ.ts +0 -25
  255. package/src/coordinate/cartesian3D.ts +0 -11
  256. package/src/lib/auto.ts +0 -7
  257. package/src/lib/threed.ts +0 -13
  258. package/src/mark/auto.ts +0 -22
  259. package/src/mark/interval3D.ts +0 -100
  260. package/src/mark/line3D.ts +0 -81
  261. package/src/mark/point3D.ts +0 -90
  262. package/src/shape/interval3D/cube.ts +0 -69
  263. package/src/shape/line3D/line.ts +0 -29
  264. package/src/shape/point3D/cube.ts +0 -68
  265. package/src/shape/point3D/sphere.ts +0 -68
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.clamp = void 0;
3
+ exports.prettyNumber = exports.clamp = void 0;
4
4
  /**
5
5
  * Clamp number within the inclusive range within the lower and upper bounds.
6
6
  */
@@ -8,4 +8,13 @@ function clamp(v, lower, upper) {
8
8
  return Math.max(lower, Math.min(v, upper));
9
9
  }
10
10
  exports.clamp = clamp;
11
+ /**
12
+ * Precision conversion
13
+ */
14
+ function prettyNumber(n, precision = 10) {
15
+ if (typeof n !== 'number')
16
+ return n;
17
+ return Math.abs(n) < 1e-15 ? n : parseFloat(n.toFixed(precision));
18
+ }
19
+ exports.prettyNumber = prettyNumber;
11
20
  //# sourceMappingURL=number.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"number.js","sourceRoot":"src/","sources":["utils/number.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,SAAgB,KAAK,CAAC,CAAS,EAAE,KAAa,EAAE,KAAa;IAC3D,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAC7C,CAAC;AAFD,sBAEC"}
1
+ {"version":3,"file":"number.js","sourceRoot":"src/","sources":["utils/number.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,SAAgB,KAAK,CAAC,CAAS,EAAE,KAAa,EAAE,KAAa;IAC3D,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAC7C,CAAC;AAFD,sBAEC;AAED;;GAEG;AACH,SAAgB,YAAY,CAAC,CAAS,EAAE,SAAS,GAAG,EAAE;IACpD,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC;IACpC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;AACpE,CAAC;AAHD,oCAGC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g2",
3
- "version": "5.1.6",
3
+ "version": "5.1.8-beta.1",
4
4
  "description": "the Grammar of Graphics in Javascript",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -23,16 +23,16 @@
23
23
  "dist"
24
24
  ],
25
25
  "scripts": {
26
- "dev": "vite",
26
+ "dev": "TZ=Asia/Shanghai vite",
27
27
  "dev:link": "cross-env LINK=1 vite",
28
28
  "clean": "rimraf lib esm dist",
29
29
  "lint-staged": "lint-staged",
30
30
  "size": "limit-size",
31
31
  "lint": "eslint ./src ./__tests__ && prettier ./src ./__tests__ --check ",
32
32
  "fix": "eslint ./src ./__tests__ --fix && prettier ./src ./__tests__ --write ",
33
- "test": "node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__/ --coverage -i --logHeapUsage",
34
- "test:unit": "node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__/unit/ --coverage -i --logHeapUsage",
35
- "test:integration": "node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__/integration/ --coverage -i --logHeapUsage",
33
+ "test": "TZ=Asia/Shanghai node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__ --logHeapUsage",
34
+ "test:unit": "TZ=Asia/Shanghai node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__/unit/ --coverage --logHeapUsage",
35
+ "test:integration": "TZ=Asia/Shanghai node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__/integration/ --coverage --logHeapUsage",
36
36
  "preview": "vite preview",
37
37
  "build:umd": "rimraf ./dist && node --expose-gc --max-old-space-size=4096 node_modules/rollup/dist/bin/rollup -c && npm run size",
38
38
  "build:cjs": "rimraf ./lib && tsc --module commonjs --outDir lib",
@@ -40,7 +40,6 @@
40
40
  "build": "run-p build:*",
41
41
  "bundle-vis": "cross-env BUNDLE_VIS=1 run-p build:umd",
42
42
  "ci": "run-s lint test build",
43
- "prepublishOnly": "npm run ci",
44
43
  "prepare": "husky install",
45
44
  "upload": "node scripts/upload/snapshot.js",
46
45
  "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
@@ -57,14 +56,11 @@
57
56
  "animation"
58
57
  ],
59
58
  "dependencies": {
60
- "@antv/ava": "^3.0.7",
61
59
  "@antv/coord": "^0.4.1",
62
60
  "@antv/event-emitter": "^0.1.3",
63
61
  "@antv/g": "^5.18.6",
64
62
  "@antv/g-canvas": "^1.11.5",
65
- "@antv/g-plugin-3d": "^1.9.14",
66
- "@antv/g-plugin-dragndrop": "^1.8.3",
67
- "@antv/component": "^1.0.0-beta.1",
63
+ "@antv/component": "^1.0.0-beta.2",
68
64
  "@antv/path-util": "^3.0.1",
69
65
  "@antv/scale": "^0.4.7",
70
66
  "@antv/util": "^3.3.2",
@@ -84,13 +80,12 @@
84
80
  },
85
81
  "devDependencies": {
86
82
  "@antv/data-set": "^0.11.8",
87
- "@antv/g-plugin-3d": "^1.9.5",
88
- "@antv/g-plugin-control": "^1.9.5",
89
83
  "@antv/g-plugin-rough-canvas-renderer": "^1.7.9",
90
84
  "@antv/g-plugin-rough-svg-renderer": "^1.7.9",
85
+ "@antv/g-svg": "^1.10.20",
86
+ "@antv/g2-extension-ava": "^0.1.1",
87
+ "@antv/g2-extension-3d": "^0.1.0",
91
88
  "@antv/translator": "^1.0.0",
92
- "@antv/g-svg": "^1.10.7",
93
- "@antv/g-webgl": "^1.9.8",
94
89
  "@commitlint/cli": "^11.0.0",
95
90
  "@commitlint/config-conventional": "^17.4.4",
96
91
  "@optimize-lodash/rollup-plugin": "^4.0.3",
@@ -101,14 +96,12 @@
101
96
  "@types/d3-array": "3.0.5",
102
97
  "@types/d3-path": "^3.0.0",
103
98
  "@types/d3-shape": "^3.0.2",
99
+ "@types/diff": "^5.0.0",
104
100
  "@types/jest": "^26.0.20",
105
101
  "@types/pixelmatch": "^5.2.4",
106
102
  "@types/pngjs": "^6.0.1",
107
103
  "@typescript-eslint/eslint-plugin": "^4.18.0",
108
104
  "@typescript-eslint/parser": "^4.18.0",
109
- "ali-oss": "^6.17.1",
110
- "archiver": "^5.3.1",
111
- "canvas": "2.11.0",
112
105
  "conventional-changelog-cli": "^2.2.2",
113
106
  "cross-env": "^7.0.3",
114
107
  "d3-dsv": "^3.0.1",
@@ -1,4 +1,4 @@
1
- import { IAnimation, Path } from '@antv/g';
1
+ import { Path } from '@antv/g';
2
2
  import { AnimationComponent as AC } from '../runtime';
3
3
  import { Animation } from './types';
4
4
  import { ScaleInX } from './scaleInX';
@@ -22,11 +22,6 @@ export const GrowInX: AC<GrowInXOptions> = (options, context) => {
22
22
 
23
23
  const animation = ScaleInX(options, context)([clipPath], to, defaults);
24
24
 
25
- (animation as IAnimation).finished.then(() => {
26
- clipPath.remove();
27
- shape.style.clipPath = null;
28
- });
29
-
30
25
  return animation;
31
26
  };
32
27
  };
@@ -1,4 +1,4 @@
1
- import { IAnimation, Path } from '@antv/g';
1
+ import { Path } from '@antv/g';
2
2
  import { AnimationComponent as AC } from '../runtime';
3
3
  import { Animation } from './types';
4
4
  import { ScaleInY } from './scaleInY';
@@ -22,11 +22,6 @@ export const GrowInY: AC<GrowInYOptions> = (options, context) => {
22
22
 
23
23
  const animation = ScaleInY(options, context)([clipPath], to, defaults);
24
24
 
25
- (animation as IAnimation).finished.then(() => {
26
- clipPath.remove();
27
- shape.style.clipPath = null;
28
- });
29
-
30
25
  return animation;
31
26
  };
32
27
  };
@@ -16,29 +16,31 @@ export const ScaleInX: AC<ScaleInXOptions> = (options, context) => {
16
16
 
17
17
  return (from, _, defaults) => {
18
18
  const [shape] = from;
19
- const { height } = shape.getBoundingClientRect();
20
19
  const {
21
20
  transform: prefix = '',
22
21
  fillOpacity = 1,
23
22
  strokeOpacity = 1,
24
23
  opacity = 1,
25
24
  } = shape.style;
26
- const [transformOrigin, transform]: [[number, number], string] =
27
- isTranspose(coordinate)
28
- ? [[0, height], `scale(1, ${ZERO})`] // left-bottom corner
29
- : [[0, 0], `scale(${ZERO}, 1)`]; // left-top corner
25
+ const [transformOrigin, transform]: [string, string] = isTranspose(
26
+ coordinate,
27
+ )
28
+ ? [`left bottom`, `scale(1, ${ZERO})`] // left-bottom corner
29
+ : [`left top`, `scale(${ZERO}, 1)`]; // left-top corner
30
30
 
31
31
  // Using a short fadeIn transition to hide element with scale(0.001)
32
32
  // which is still visible.
33
33
  const keyframes = [
34
34
  {
35
35
  transform: `${prefix} ${transform}`.trimStart(),
36
+ transformOrigin,
36
37
  fillOpacity: 0,
37
38
  strokeOpacity: 0,
38
39
  opacity: 0,
39
40
  },
40
41
  {
41
42
  transform: `${prefix} ${transform}`.trimStart(),
43
+ transformOrigin,
42
44
  fillOpacity,
43
45
  strokeOpacity,
44
46
  opacity,
@@ -46,20 +48,15 @@ export const ScaleInX: AC<ScaleInXOptions> = (options, context) => {
46
48
  },
47
49
  {
48
50
  transform: `${prefix} scale(1, 1)`.trimStart(),
51
+ transformOrigin,
49
52
  fillOpacity,
50
53
  strokeOpacity,
51
54
  opacity,
52
55
  },
53
56
  ];
54
57
 
55
- // Change transform origin for correct transform.
56
- shape.setOrigin(transformOrigin);
57
-
58
58
  const animation = shape.animate(keyframes, { ...defaults, ...options });
59
59
 
60
- // Reset transform origin to eliminate side effect for following animations.
61
- animation.finished.then(() => shape.setOrigin(0, 0));
62
-
63
60
  return animation;
64
61
  };
65
62
  };
@@ -16,29 +16,31 @@ export const ScaleInY: AC<ScaleInYOptions> = (options, context) => {
16
16
 
17
17
  return (from, _, defaults) => {
18
18
  const [shape] = from;
19
- const { height } = shape.getBoundingClientRect();
20
19
  const {
21
20
  transform: prefix = '',
22
21
  fillOpacity = 1,
23
22
  strokeOpacity = 1,
24
23
  opacity = 1,
25
24
  } = shape.style;
26
- const [transformOrigin, transform]: [[number, number], string] =
27
- isTranspose(coordinate)
28
- ? [[0, 0], `scale(${ZERO}, 1)`] // left-top corner
29
- : [[0, height], `scale(1, ${ZERO})`]; // left-bottom corner
25
+ const [transformOrigin, transform]: [string, string] = isTranspose(
26
+ coordinate,
27
+ )
28
+ ? [`left top`, `scale(${ZERO}, 1)`] // left-top corner
29
+ : [`left bottom`, `scale(1, ${ZERO})`]; // left-bottom corner
30
30
 
31
31
  // Using a short fadeIn transition to hide element with scale(0.001)
32
32
  // which is still visible.
33
33
  const keyframes = [
34
34
  {
35
35
  transform: `${prefix} ${transform}`.trimStart(),
36
+ transformOrigin,
36
37
  fillOpacity: 0,
37
38
  strokeOpacity: 0,
38
39
  opacity: 0,
39
40
  },
40
41
  {
41
42
  transform: `${prefix} ${transform}`.trimStart(),
43
+ transformOrigin,
42
44
  fillOpacity,
43
45
  strokeOpacity,
44
46
  opacity,
@@ -46,20 +48,15 @@ export const ScaleInY: AC<ScaleInYOptions> = (options, context) => {
46
48
  },
47
49
  {
48
50
  transform: `${prefix} scale(1, 1)`.trimStart(),
51
+ transformOrigin,
49
52
  fillOpacity,
50
53
  strokeOpacity,
51
54
  opacity,
52
55
  },
53
56
  ];
54
57
 
55
- // Change transform origin for correct transform.
56
- shape.setOrigin(transformOrigin);
57
-
58
58
  const animation = shape.animate(keyframes, { ...defaults, ...options });
59
59
 
60
- // Reset transform origin to eliminate side effect for following animations.
61
- animation.finished.then(() => shape.setOrigin(0, 0));
62
-
63
60
  return animation;
64
61
  };
65
62
  };
@@ -16,26 +16,28 @@ export const ScaleOutX: AC<ScaleOutXOptions> = (options, context) => {
16
16
 
17
17
  return (from, _, defaults) => {
18
18
  const [shape] = from;
19
- const { height } = shape.getBoundingClientRect();
20
19
  const {
21
20
  transform: prefix = '',
22
21
  fillOpacity = 1,
23
22
  strokeOpacity = 1,
24
23
  opacity = 1,
25
24
  } = shape.style;
26
- const [transformOrigin, transform]: [[number, number], string] =
27
- isTranspose(coordinate)
28
- ? [[0, height], `scale(1, ${ZERO})`] // left-bottom corner
29
- : [[0, 0], `scale(${ZERO}, 1)`]; // left-top corner
25
+ const [transformOrigin, transform]: [string, string] = isTranspose(
26
+ coordinate,
27
+ )
28
+ ? [`left bottom`, `scale(1, ${ZERO})`] // left-bottom corner
29
+ : [`left top`, `scale(${ZERO}, 1)`]; // left-top corner
30
30
 
31
31
  // Using a short fadeIn transition to hide element with scale(0.001)
32
32
  // which is still visible.
33
33
  const keyframes = [
34
34
  {
35
35
  transform: `${prefix} scale(1, 1)`.trimStart(),
36
+ transformOrigin,
36
37
  },
37
38
  {
38
39
  transform: `${prefix} ${transform}`.trimStart(),
40
+ transformOrigin,
39
41
  fillOpacity,
40
42
  strokeOpacity,
41
43
  opacity,
@@ -43,20 +45,15 @@ export const ScaleOutX: AC<ScaleOutXOptions> = (options, context) => {
43
45
  },
44
46
  {
45
47
  transform: `${prefix} ${transform}`.trimStart(),
48
+ transformOrigin,
46
49
  fillOpacity: 0,
47
50
  strokeOpacity: 0,
48
51
  opacity: 0,
49
52
  },
50
53
  ];
51
54
 
52
- // Change transform origin for correct transform.
53
- shape.setOrigin(transformOrigin);
54
-
55
55
  const animation = shape.animate(keyframes, { ...defaults, ...options });
56
56
 
57
- // Reset transform origin to eliminate side effect for following animations.
58
- animation.finished.then(() => shape.setOrigin(0, 0));
59
-
60
57
  return animation;
61
58
  };
62
59
  };
@@ -16,26 +16,28 @@ export const ScaleOutY: AC<ScaleOutYOptions> = (options, context) => {
16
16
 
17
17
  return (from, _, defaults) => {
18
18
  const [shape] = from;
19
- const { height } = shape.getBoundingClientRect();
20
19
  const {
21
20
  transform: prefix = '',
22
21
  fillOpacity = 1,
23
22
  strokeOpacity = 1,
24
23
  opacity = 1,
25
24
  } = shape.style;
26
- const [transformOrigin, transform]: [[number, number], string] =
27
- isTranspose(coordinate)
28
- ? [[0, 0], `scale(${ZERO}, 1)`] // left-top corner
29
- : [[0, height], `scale(1, ${ZERO})`]; // left-bottom corner
25
+ const [transformOrigin, transform]: [string, string] = isTranspose(
26
+ coordinate,
27
+ )
28
+ ? [`left top`, `scale(${ZERO}, 1)`] // left-top corner
29
+ : [`left bottom`, `scale(1, ${ZERO})`]; // left-bottom corner
30
30
 
31
31
  // Using a short fadeIn transition to hide element with scale(0.001)
32
32
  // which is still visible.
33
33
  const keyframes = [
34
34
  {
35
35
  transform: `${prefix} scale(1, 1)`.trimStart(),
36
+ transformOrigin,
36
37
  },
37
38
  {
38
39
  transform: `${prefix} ${transform}`.trimStart(),
40
+ transformOrigin,
39
41
  fillOpacity,
40
42
  strokeOpacity,
41
43
  opacity,
@@ -43,20 +45,15 @@ export const ScaleOutY: AC<ScaleOutYOptions> = (options, context) => {
43
45
  },
44
46
  {
45
47
  transform: `${prefix} ${transform}`.trimStart(),
48
+ transformOrigin,
46
49
  fillOpacity: 0,
47
50
  strokeOpacity: 0,
48
51
  opacity: 0,
49
52
  },
50
53
  ];
51
54
 
52
- // Change transform origin for correct transform.
53
- shape.setOrigin(transformOrigin);
54
-
55
55
  const animation = shape.animate(keyframes, { ...defaults, ...options });
56
56
 
57
- // Reset transform origin to eliminate side effect for following animations.
58
- animation.finished.then(() => shape.setOrigin(0, 0));
59
-
60
57
  return animation;
61
58
  };
62
59
  };
@@ -16,15 +16,18 @@ export const ZoomIn: AC<ZoomInOptions> = (options) => {
16
16
  strokeOpacity = 1,
17
17
  opacity = 1,
18
18
  } = shape.style;
19
+ const transformOrigin = 'center center';
19
20
  const keyframes = [
20
21
  {
21
22
  transform: `${prefix} scale(${ZERO})`.trimStart(),
23
+ transformOrigin,
22
24
  fillOpacity: 0,
23
25
  strokeOpacity: 0,
24
26
  opacity: 0,
25
27
  },
26
28
  {
27
29
  transform: `${prefix} scale(${ZERO})`.trimStart(),
30
+ transformOrigin,
28
31
  fillOpacity,
29
32
  strokeOpacity,
30
33
  opacity,
@@ -32,20 +35,15 @@ export const ZoomIn: AC<ZoomInOptions> = (options) => {
32
35
  },
33
36
  {
34
37
  transform: `${prefix} scale(1)`.trimStart(),
38
+ transformOrigin,
35
39
  fillOpacity,
36
40
  strokeOpacity,
37
41
  opacity,
38
42
  },
39
43
  ];
40
- const { width, height } = shape.getBoundingClientRect();
41
- // Change transform origin for correct transform.
42
- shape.setOrigin([width / 2, height / 2]);
43
44
 
44
45
  const animation = shape.animate(keyframes, { ...defaults, ...options });
45
46
 
46
- // Reset transform origin to eliminate side effect for following animations.
47
- animation.finished.then(() => shape.setOrigin(0, 0));
48
-
49
47
  return animation;
50
48
  };
51
49
  };
@@ -16,10 +16,12 @@ export const ZoomOut: AC<ZoomOutOptions> = (options) => {
16
16
  strokeOpacity = 1,
17
17
  opacity = 1,
18
18
  } = shape.style;
19
+ const transformOrigin = 'center center';
19
20
  const keyframes = [
20
- { transform: `${prefix} scale(1)`.trimStart() },
21
+ { transform: `${prefix} scale(1)`.trimStart(), transformOrigin },
21
22
  {
22
23
  transform: `${prefix} scale(${ZERO})`.trimStart(),
24
+ transformOrigin,
23
25
  fillOpacity,
24
26
  strokeOpacity,
25
27
  opacity,
@@ -27,20 +29,15 @@ export const ZoomOut: AC<ZoomOutOptions> = (options) => {
27
29
  },
28
30
  {
29
31
  transform: `${prefix} scale(${ZERO})`.trimStart(),
32
+ transformOrigin,
30
33
  fillOpacity: 0,
31
34
  strokeOpacity: 0,
32
35
  opacity: 0,
33
36
  },
34
37
  ];
35
38
 
36
- const { width, height } = shape.getBoundingClientRect();
37
- // Change transform origin for correct transform.
38
- shape.setOrigin([width / 2, height / 2]);
39
39
  const animation = shape.animate(keyframes, { ...defaults, ...options });
40
40
 
41
- // Reset transform origin to eliminate side effect for following animations.
42
- animation.finished.then(() => shape.setOrigin(0, 0));
43
-
44
41
  return animation;
45
42
  };
46
43
  };
@@ -25,6 +25,7 @@ import {
25
25
  isTranspose,
26
26
  radiusOf,
27
27
  } from '../utils/coordinate';
28
+ import { prettyNumber } from '../utils/number';
28
29
  import { capitalizeFirst } from '../utils/helper';
29
30
  import { adaptor, isVertical, titleContent } from './utils';
30
31
 
@@ -116,11 +117,6 @@ function ticksOf(
116
117
  return tickMethod(min, max, tickCount);
117
118
  }
118
119
 
119
- function prettyNumber(n: number) {
120
- if (typeof n !== 'number') return n;
121
- return Math.abs(n) < 1e-15 ? n : parseFloat(n.toFixed(15));
122
- }
123
-
124
120
  // Set inset for axis.
125
121
  function createInset(position, coordinate) {
126
122
  if (isPolar(coordinate)) return (d) => d;
@@ -1,7 +1,6 @@
1
1
  export { LinearAxis as AxisLinear, ArcAxis as AxisArc } from './axis';
2
2
  export { AxisX } from './axisX';
3
3
  export { AxisY } from './axisY';
4
- export { AxisZ } from './axisZ';
5
4
  export { AxisRadar } from './axisRadar';
6
5
  export { LegendCategory } from './legendCategory';
7
6
  export { LegendContinuous } from './legendContinuous';
@@ -161,7 +161,7 @@ function getLinearConfig(
161
161
  data: scale.getTicks().map((value) => ({ value })),
162
162
  color: new Array(Math.floor(length)).fill(0).map((d, i) => {
163
163
  const value = ((max - min) / (length - 1)) * i + min;
164
- const color = scale.map(value);
164
+ const color = scale.map(value) || defaultColor;
165
165
  const opacity = opacityScale ? opacityScale.map(value) : 1;
166
166
  return color.replace(
167
167
  /rgb[a]*\(([\d]{1,3}) *, *([\d]{1,3}) *, *([\d]{1,3})[\S\s]*\)/,
@@ -1,5 +1,4 @@
1
1
  export { Cartesian } from './cartesian';
2
- export { Cartesian3D } from './cartesian3D';
3
2
  export { Polar, getPolarOptions } from './polar';
4
3
  export { Helix } from './helix';
5
4
  export { Transpose } from './transpose';
@@ -10,7 +9,6 @@ export { Fisheye } from './fisheye';
10
9
  export { Radar } from './radar';
11
10
 
12
11
  export type { CartesianOptions } from './cartesian';
13
- export type { Cartesian3DOptions } from './cartesian3D';
14
12
  export type { PolarOptions } from './polar';
15
13
  export type { HelixOptions } from './helix';
16
14
  export type { TransposeOptions } from './transpose';
package/src/exports.ts CHANGED
@@ -27,6 +27,22 @@ export {
27
27
 
28
28
  export { ChartEvent } from './utils/event';
29
29
 
30
- export type { G2Context } from './runtime';
31
-
32
30
  export * from './spec';
31
+
32
+ export type {
33
+ G2Context,
34
+ ShapeComponent,
35
+ MarkComponent,
36
+ GuideComponentComponent,
37
+ SingleMark,
38
+ G2BaseComponent,
39
+ Vector2,
40
+ Vector3,
41
+ Channel,
42
+ } from './runtime';
43
+ export { select, Selection } from './utils/selection';
44
+ export * from './transform';
45
+ export { LinearAxis } from './component/axis';
46
+ export type { AxisOptions } from './component/axis';
47
+
48
+ export { Light, Dark, Academy, Classic, ClassicDark } from './theme';
package/src/index.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { corelib, plotlib, graphlib, geolib, stdlib, threedlib } from './lib';
1
+ import { corelib, plotlib, graphlib, geolib, stdlib } from './lib';
2
2
  import { extend, Runtime } from './api';
3
3
  import { API, CompositionAPI } from './api/extend';
4
4
  import { G2Spec } from './spec';
5
5
 
6
- export { corelib, plotlib, graphlib, geolib, stdlib, threedlib };
6
+ export { corelib, plotlib, graphlib, geolib, stdlib };
7
7
 
8
8
  export * from './exports';
9
9
 
package/src/lib/index.ts CHANGED
@@ -2,7 +2,5 @@ export { corelib } from './core';
2
2
  export { geolib } from './geo';
3
3
  export { graphlib } from './graph';
4
4
  export { plotlib } from './plot';
5
- export { threedlib } from './threed';
6
5
  export { stdlib } from './std';
7
6
  export { litelib } from './lite';
8
- export { autolib } from './auto';
package/src/mark/index.ts CHANGED
@@ -1,10 +1,7 @@
1
1
  export { Interval } from './interval';
2
2
  export { Rect } from './rect';
3
3
  export { Line } from './line';
4
- export { Line3D } from './line3D';
5
4
  export { Point } from './point';
6
- export { Point3D } from './point3D';
7
- export { Interval3D } from './interval3D';
8
5
  export { Text } from './text';
9
6
  export { Cell } from './cell';
10
7
  export { Area } from './area';
@@ -32,7 +29,6 @@ export { Gauge } from './gauge';
32
29
  export { Density } from './density';
33
30
  export { Heatmap } from './heatmap';
34
31
  export { Liquid } from './liquid';
35
- export { Auto } from './auto';
36
32
 
37
33
  export type { IntervalOptions } from './interval';
38
34
  export type { RectOptions } from './rect';
@@ -1,5 +1,6 @@
1
1
  import { deepMix, isNumber } from '@antv/util';
2
2
  import { subObject } from '../utils/helper';
3
+ import { prettyNumber } from '../utils/number';
3
4
  import { CompositeMarkComponent as CC } from '../runtime';
4
5
  import { LiquidMark } from '../spec';
5
6
  import { LiquidShape } from '../shape';
@@ -89,7 +90,7 @@ export const Liquid: CC<LiquidOptions> = (options) => {
89
90
  }),
90
91
  deepMix({}, DEFAULT_TEXT_OPTIONS, {
91
92
  style: {
92
- text: `${percent * 100} %`,
93
+ text: `${prettyNumber(percent * 100)} %`,
93
94
  ...textStyle,
94
95
  },
95
96
  animate,
@@ -13,6 +13,7 @@ import {
13
13
  type RadialOptions,
14
14
  } from '../coordinate';
15
15
  import { combine } from '../utils/array';
16
+ import { prettyNumber } from '../utils/number';
16
17
  import { capitalizeFirst, defined, subObject } from '../utils/helper';
17
18
  import { LEGEND_INFER_STRATEGIES } from '../component/constant';
18
19
  import {
@@ -1115,7 +1116,3 @@ function normalizeLabel(d: string | DisplayObject): DisplayObject {
1115
1116
  if (d instanceof DisplayObject) return d;
1116
1117
  return new Text({ style: { text: `${d}` } });
1117
1118
  }
1118
-
1119
- function prettyNumber(n: number) {
1120
- return Math.abs(n) < 1e-15 ? n : parseFloat(n.toFixed(15));
1121
- }
@@ -1,4 +1,4 @@
1
- import { Coordinate, Transformation, Transformation3D } from '@antv/coord';
1
+ import { Coordinate, Transformation } from '@antv/coord';
2
2
  import EventEmitter from '@antv/event-emitter';
3
3
  import { DisplayObject, IAnimation as GAnimation, IDocument } from '@antv/g';
4
4
  import {
@@ -14,7 +14,7 @@ import {
14
14
  import { DataComponent } from './data';
15
15
  import { Encode, EncodeComponent } from './encode';
16
16
  import { Mark, MarkComponent } from './mark';
17
- import { G2ViewTree, G2Library, G2Mark, G2Context } from './options';
17
+ import { G2ViewTree, G2Library, G2Mark } from './options';
18
18
  import { Transform, TransformComponent } from './transform';
19
19
 
20
20
  export type G2ComponentNamespaces =
@@ -116,13 +116,6 @@ export type CoordinateComponent<O = Record<string, unknown>> = G2BaseComponent<
116
116
  CoordinateProps
117
117
  >;
118
118
 
119
- export type Coordinate3DTransform = Transformation3D[];
120
- export type Coordinate3DProps = {
121
- transform?: boolean;
122
- };
123
- export type Coordinate3DComponent<O = Record<string, unknown>> =
124
- G2BaseComponent<Coordinate3DTransform, O, Coordinate3DProps>;
125
-
126
119
  export type Palette = string[];
127
120
  export type PaletteComponent<O = Record<string, unknown>> = G2BaseComponent<
128
121
  Palette,
@@ -10,7 +10,6 @@ export { HV as LineHV } from './line/hv';
10
10
  export { VH as LineVH } from './line/vh';
11
11
  export { HVH as LineHVH } from './line/hvh';
12
12
  export { Trail as LineTrail } from './line/trail';
13
- export { Line as Line3DShape } from './line3D/line';
14
13
  export { HollowBowtie as PointHollowBowtie } from './point/hollowBowtie';
15
14
  export { HollowDiamond as PointHollowDiamond } from './point/hollowDiamond';
16
15
  export { HollowHexagon as PointHollowHexagon } from './point/hollowHexagon';
@@ -30,9 +29,6 @@ export { Square as PointSquare } from './point/square';
30
29
  export { Tick as PointTick } from './point/tick';
31
30
  export { Triangle as PointTriangle } from './point/triangle';
32
31
  export { TriangleDown as PointTriangleDown } from './point/triangleDown';
33
- export { Sphere } from './point3D/sphere';
34
- export { Cube } from './point3D/cube';
35
- export { Cube as IntervalCube } from './interval3D/cube';
36
32
  export { Vector as VectorShape } from './vector/vector';
37
33
  export { Text as TextShape } from './text/text';
38
34
  export { Badge as TextBadge } from './text/badge';