@antv/g6 5.0.0-alpha.9 → 5.0.0-beta.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 (895) hide show
  1. package/dist/g6.min.js +2 -2
  2. package/esm/api-doc/behaviors.d.ts +2 -0
  3. package/esm/api-doc/behaviors.js +2 -0
  4. package/esm/api-doc/behaviors.js.map +1 -0
  5. package/esm/api-doc/graph.d.ts +4 -0
  6. package/esm/api-doc/graph.js +4 -0
  7. package/esm/api-doc/graph.js.map +1 -0
  8. package/esm/api-doc/item.d.ts +9 -0
  9. package/esm/api-doc/item.js +3 -0
  10. package/esm/api-doc/item.js.map +1 -0
  11. package/esm/api-doc/layout.d.ts +1 -0
  12. package/esm/api-doc/layout.js +2 -0
  13. package/esm/api-doc/layout.js.map +1 -0
  14. package/esm/api-doc/plugins.d.ts +1 -0
  15. package/esm/api-doc/plugins.js +2 -0
  16. package/esm/api-doc/plugins.js.map +1 -0
  17. package/esm/api-doc/types.d.ts +0 -0
  18. package/esm/api-doc/types.js +3 -0
  19. package/esm/api-doc/types.js.map +1 -0
  20. package/esm/api-doc/util.d.ts +3 -0
  21. package/esm/api-doc/util.js +4 -0
  22. package/esm/api-doc/util.js.map +1 -0
  23. package/esm/constant/shape.d.ts +7 -14
  24. package/esm/constant/shape.js +1 -0
  25. package/esm/constant/shape.js.map +1 -1
  26. package/esm/index.d.ts +213 -113
  27. package/esm/index.js +11 -4
  28. package/esm/index.js.map +1 -1
  29. package/esm/item/combo.d.ts +13 -6
  30. package/esm/item/combo.js +72 -8
  31. package/esm/item/combo.js.map +1 -1
  32. package/esm/item/edge.d.ts +12 -9
  33. package/esm/item/edge.js +38 -11
  34. package/esm/item/edge.js.map +1 -1
  35. package/esm/item/item.d.ts +8 -6
  36. package/esm/item/item.js +124 -81
  37. package/esm/item/item.js.map +1 -1
  38. package/esm/item/node.d.ts +14 -9
  39. package/esm/item/node.js +63 -48
  40. package/esm/item/node.js.map +1 -1
  41. package/esm/runtime/controller/data.d.ts +17 -1
  42. package/esm/runtime/controller/data.js +320 -223
  43. package/esm/runtime/controller/data.js.map +1 -1
  44. package/esm/runtime/controller/interaction.d.ts +1 -0
  45. package/esm/runtime/controller/interaction.js +7 -4
  46. package/esm/runtime/controller/interaction.js.map +1 -1
  47. package/esm/runtime/controller/item.d.ts +37 -4
  48. package/esm/runtime/controller/item.js +475 -177
  49. package/esm/runtime/controller/item.js.map +1 -1
  50. package/esm/runtime/controller/layout.d.ts +4 -1
  51. package/esm/runtime/controller/layout.js +96 -14
  52. package/esm/runtime/controller/layout.js.map +1 -1
  53. package/esm/runtime/controller/plugin.d.ts +11 -0
  54. package/esm/runtime/controller/plugin.js +39 -6
  55. package/esm/runtime/controller/plugin.js.map +1 -1
  56. package/esm/runtime/controller/theme.js +8 -4
  57. package/esm/runtime/controller/theme.js.map +1 -1
  58. package/esm/runtime/graph.d.ts +181 -39
  59. package/esm/runtime/graph.js +561 -72
  60. package/esm/runtime/graph.js.map +1 -1
  61. package/esm/stdlib/behavior/activate-relations.d.ts +2 -3
  62. package/esm/stdlib/behavior/activate-relations.js +13 -9
  63. package/esm/stdlib/behavior/activate-relations.js.map +1 -1
  64. package/esm/stdlib/behavior/brush-select.d.ts +3 -4
  65. package/esm/stdlib/behavior/brush-select.js +2 -2
  66. package/esm/stdlib/behavior/brush-select.js.map +1 -1
  67. package/esm/stdlib/behavior/click-select.d.ts +2 -3
  68. package/esm/stdlib/behavior/click-select.js +8 -6
  69. package/esm/stdlib/behavior/click-select.js.map +1 -1
  70. package/esm/stdlib/behavior/collapse-expand-combo.d.ts +1 -2
  71. package/esm/stdlib/behavior/collapse-expand-combo.js +1 -1
  72. package/esm/stdlib/behavior/collapse-expand-combo.js.map +1 -1
  73. package/esm/stdlib/behavior/collapse-expand-tree.d.ts +44 -0
  74. package/esm/stdlib/behavior/collapse-expand-tree.js +69 -0
  75. package/esm/stdlib/behavior/collapse-expand-tree.js.map +1 -0
  76. package/esm/stdlib/behavior/drag-canvas.d.ts +1 -2
  77. package/esm/stdlib/behavior/drag-canvas.js +15 -11
  78. package/esm/stdlib/behavior/drag-canvas.js.map +1 -1
  79. package/esm/stdlib/behavior/drag-combo.d.ts +16 -4
  80. package/esm/stdlib/behavior/drag-combo.js +70 -31
  81. package/esm/stdlib/behavior/drag-combo.js.map +1 -1
  82. package/esm/stdlib/behavior/drag-node.d.ts +20 -4
  83. package/esm/stdlib/behavior/drag-node.js +145 -57
  84. package/esm/stdlib/behavior/drag-node.js.map +1 -1
  85. package/esm/stdlib/behavior/hover-activate.d.ts +1 -2
  86. package/esm/stdlib/behavior/hover-activate.js +1 -1
  87. package/esm/stdlib/behavior/hover-activate.js.map +1 -1
  88. package/esm/stdlib/behavior/index.d.ts +15 -0
  89. package/esm/stdlib/behavior/index.js +16 -0
  90. package/esm/stdlib/behavior/index.js.map +1 -0
  91. package/esm/stdlib/behavior/lasso-select.d.ts +7 -3
  92. package/esm/stdlib/behavior/lasso-select.js +2 -2
  93. package/esm/stdlib/behavior/lasso-select.js.map +1 -1
  94. package/esm/stdlib/behavior/orbit-canvas-3d.d.ts +2 -3
  95. package/esm/stdlib/behavior/orbit-canvas-3d.js +2 -2
  96. package/esm/stdlib/behavior/orbit-canvas-3d.js.map +1 -1
  97. package/esm/stdlib/behavior/rotate-canvas-3d.d.ts +1 -2
  98. package/esm/stdlib/behavior/rotate-canvas-3d.js +1 -1
  99. package/esm/stdlib/behavior/rotate-canvas-3d.js.map +1 -1
  100. package/esm/stdlib/behavior/track-canvas-3d.d.ts +2 -3
  101. package/esm/stdlib/behavior/track-canvas-3d.js +2 -2
  102. package/esm/stdlib/behavior/track-canvas-3d.js.map +1 -1
  103. package/esm/stdlib/behavior/types.d.ts +13 -0
  104. package/esm/stdlib/behavior/types.js +2 -0
  105. package/esm/stdlib/behavior/types.js.map +1 -0
  106. package/esm/stdlib/behavior/zoom-canvas-3d.d.ts +1 -2
  107. package/esm/stdlib/behavior/zoom-canvas-3d.js +7 -7
  108. package/esm/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
  109. package/esm/stdlib/behavior/zoom-canvas.d.ts +1 -2
  110. package/esm/stdlib/behavior/zoom-canvas.js +20 -18
  111. package/esm/stdlib/behavior/zoom-canvas.js.map +1 -1
  112. package/esm/stdlib/data/index.d.ts +3 -0
  113. package/esm/stdlib/data/index.js +4 -0
  114. package/esm/stdlib/data/index.js.map +1 -0
  115. package/esm/stdlib/data/mapNodeSize.d.ts +12 -0
  116. package/esm/stdlib/data/mapNodeSize.js +43 -0
  117. package/esm/stdlib/data/mapNodeSize.js.map +1 -0
  118. package/esm/stdlib/data/transformV4Data.d.ts +9 -0
  119. package/esm/stdlib/data/transformV4Data.js +142 -0
  120. package/esm/stdlib/data/transformV4Data.js.map +1 -0
  121. package/esm/stdlib/data/validateData.d.ts +9 -0
  122. package/esm/stdlib/data/validateData.js +98 -0
  123. package/esm/stdlib/data/validateData.js.map +1 -0
  124. package/esm/stdlib/index.d.ts +113 -69
  125. package/esm/stdlib/index.js +150 -53
  126. package/esm/stdlib/index.js.map +1 -1
  127. package/esm/stdlib/item/combo/index.d.ts +2 -0
  128. package/esm/stdlib/item/combo/index.js +3 -0
  129. package/esm/stdlib/item/combo/index.js.map +1 -0
  130. package/esm/stdlib/item/combo/rect.d.ts +31 -0
  131. package/esm/stdlib/item/combo/rect.js +65 -0
  132. package/esm/stdlib/item/combo/rect.js.map +1 -0
  133. package/esm/stdlib/item/edge/base.d.ts +10 -1
  134. package/esm/stdlib/item/edge/base.js +36 -5
  135. package/esm/stdlib/item/edge/base.js.map +1 -1
  136. package/{lib/stdlib/item/edge/cubic-horizon.d.ts → esm/stdlib/item/edge/cubic-horizontal.d.ts} +6 -7
  137. package/esm/stdlib/item/edge/{cubic-horizon.js → cubic-horizontal.js} +18 -33
  138. package/esm/stdlib/item/edge/cubic-horizontal.js.map +1 -0
  139. package/esm/stdlib/item/edge/cubic-vertical.d.ts +7 -8
  140. package/esm/stdlib/item/edge/cubic-vertical.js +17 -32
  141. package/esm/stdlib/item/edge/cubic-vertical.js.map +1 -1
  142. package/esm/stdlib/item/edge/cubic.d.ts +7 -8
  143. package/esm/stdlib/item/edge/cubic.js +22 -5
  144. package/esm/stdlib/item/edge/cubic.js.map +1 -1
  145. package/esm/stdlib/item/edge/index.d.ts +5 -0
  146. package/esm/stdlib/item/edge/index.js +5 -0
  147. package/esm/stdlib/item/edge/index.js.map +1 -1
  148. package/esm/stdlib/item/edge/line.d.ts +1 -1
  149. package/esm/stdlib/item/edge/line.js +16 -1
  150. package/esm/stdlib/item/edge/line.js.map +1 -1
  151. package/esm/stdlib/item/edge/loop.d.ts +32 -0
  152. package/esm/stdlib/item/edge/loop.js +115 -0
  153. package/esm/stdlib/item/edge/loop.js.map +1 -0
  154. package/esm/stdlib/item/edge/polyline.d.ts +44 -0
  155. package/esm/stdlib/item/edge/polyline.js +92 -0
  156. package/esm/stdlib/item/edge/polyline.js.map +1 -0
  157. package/esm/stdlib/item/edge/quadratic.d.ts +5 -6
  158. package/esm/stdlib/item/edge/quadratic.js +31 -19
  159. package/esm/stdlib/item/edge/quadratic.js.map +1 -1
  160. package/esm/stdlib/item/node/base.d.ts +45 -1
  161. package/esm/stdlib/item/node/base.js +97 -12
  162. package/esm/stdlib/item/node/base.js.map +1 -1
  163. package/esm/stdlib/item/node/base3d.js +1 -1
  164. package/esm/stdlib/item/node/base3d.js.map +1 -1
  165. package/esm/stdlib/item/node/circle.js +5 -5
  166. package/esm/stdlib/item/node/circle.js.map +1 -1
  167. package/esm/stdlib/item/node/diamond.d.ts +32 -0
  168. package/esm/stdlib/item/node/diamond.js +79 -0
  169. package/esm/stdlib/item/node/diamond.js.map +1 -0
  170. package/esm/stdlib/item/node/donut.d.ts +70 -0
  171. package/esm/stdlib/item/node/donut.js +207 -0
  172. package/esm/stdlib/item/node/donut.js.map +1 -0
  173. package/esm/stdlib/item/node/ellipse.d.ts +32 -0
  174. package/esm/stdlib/item/node/ellipse.js +71 -0
  175. package/esm/stdlib/item/node/ellipse.js.map +1 -0
  176. package/esm/stdlib/item/node/hexagon.d.ts +33 -0
  177. package/esm/stdlib/item/node/hexagon.js +102 -0
  178. package/esm/stdlib/item/node/hexagon.js.map +1 -0
  179. package/esm/stdlib/item/node/index.d.ts +7 -0
  180. package/esm/stdlib/item/node/index.js +7 -0
  181. package/esm/stdlib/item/node/index.js.map +1 -1
  182. package/esm/stdlib/item/node/modelRect.d.ts +61 -0
  183. package/esm/stdlib/item/node/modelRect.js +186 -0
  184. package/esm/stdlib/item/node/modelRect.js.map +1 -0
  185. package/esm/stdlib/item/node/rect.d.ts +1 -0
  186. package/esm/stdlib/item/node/rect.js +16 -0
  187. package/esm/stdlib/item/node/rect.js.map +1 -1
  188. package/esm/stdlib/item/node/star.d.ts +34 -0
  189. package/esm/stdlib/item/node/star.js +115 -0
  190. package/esm/stdlib/item/node/star.js.map +1 -0
  191. package/esm/stdlib/item/node/triangle.d.ts +44 -0
  192. package/esm/stdlib/item/node/triangle.js +177 -0
  193. package/esm/stdlib/item/node/triangle.js.map +1 -0
  194. package/esm/stdlib/plugin/fisheye/index.d.ts +32 -4
  195. package/esm/stdlib/plugin/fisheye/index.js +3 -2
  196. package/esm/stdlib/plugin/fisheye/index.js.map +1 -1
  197. package/esm/stdlib/plugin/grid/index.d.ts +36 -0
  198. package/esm/stdlib/plugin/grid/index.js +81 -0
  199. package/esm/stdlib/plugin/grid/index.js.map +1 -0
  200. package/esm/stdlib/plugin/history/combo-command.d.ts +9 -0
  201. package/esm/stdlib/plugin/history/combo-command.js +21 -0
  202. package/esm/stdlib/plugin/history/combo-command.js.map +1 -0
  203. package/esm/stdlib/plugin/history/command.d.ts +18 -0
  204. package/esm/stdlib/plugin/history/command.js +51 -0
  205. package/esm/stdlib/plugin/history/command.js.map +1 -0
  206. package/esm/stdlib/plugin/history/index.d.ts +112 -0
  207. package/esm/stdlib/plugin/history/index.js +275 -0
  208. package/esm/stdlib/plugin/history/index.js.map +1 -0
  209. package/esm/stdlib/plugin/history/item-data-command.d.ts +14 -0
  210. package/esm/stdlib/plugin/history/item-data-command.js +63 -0
  211. package/esm/stdlib/plugin/history/item-data-command.js.map +1 -0
  212. package/esm/stdlib/plugin/history/layer-updated-command.d.ts +9 -0
  213. package/esm/stdlib/plugin/history/layer-updated-command.js +21 -0
  214. package/esm/stdlib/plugin/history/layer-updated-command.js.map +1 -0
  215. package/esm/stdlib/plugin/history/state-updated-command.d.ts +9 -0
  216. package/esm/stdlib/plugin/history/state-updated-command.js +20 -0
  217. package/esm/stdlib/plugin/history/state-updated-command.js.map +1 -0
  218. package/esm/stdlib/plugin/history/visibility-updated-command.d.ts +10 -0
  219. package/esm/stdlib/plugin/history/visibility-updated-command.js +23 -0
  220. package/esm/stdlib/plugin/history/visibility-updated-command.js.map +1 -0
  221. package/esm/stdlib/plugin/hull/bubbleset.d.ts +9 -0
  222. package/esm/stdlib/plugin/hull/bubbleset.js +592 -0
  223. package/esm/stdlib/plugin/hull/bubbleset.js.map +1 -0
  224. package/esm/stdlib/plugin/hull/convexHull.d.ts +14 -0
  225. package/esm/stdlib/plugin/hull/convexHull.js +56 -0
  226. package/esm/stdlib/plugin/hull/convexHull.js.map +1 -0
  227. package/esm/stdlib/plugin/hull/hullComponent.d.ts +87 -0
  228. package/esm/stdlib/plugin/hull/hullComponent.js +382 -0
  229. package/esm/stdlib/plugin/hull/hullComponent.js.map +1 -0
  230. package/esm/stdlib/plugin/hull/index.d.ts +59 -0
  231. package/esm/stdlib/plugin/hull/index.js +161 -0
  232. package/esm/stdlib/plugin/hull/index.js.map +1 -0
  233. package/esm/stdlib/plugin/hull/types.d.ts +15 -0
  234. package/esm/stdlib/plugin/hull/types.js +2 -0
  235. package/esm/stdlib/plugin/hull/types.js.map +1 -0
  236. package/esm/stdlib/plugin/hull/util.d.ts +77 -0
  237. package/esm/stdlib/plugin/hull/util.js +401 -0
  238. package/esm/stdlib/plugin/hull/util.js.map +1 -0
  239. package/esm/stdlib/plugin/index.d.ts +8 -0
  240. package/esm/stdlib/plugin/index.js +9 -0
  241. package/esm/stdlib/plugin/index.js.map +1 -0
  242. package/esm/stdlib/plugin/legend/index.d.ts +45 -3
  243. package/esm/stdlib/plugin/legend/index.js +47 -42
  244. package/esm/stdlib/plugin/legend/index.js.map +1 -1
  245. package/esm/stdlib/plugin/menu/index.d.ts +18 -5
  246. package/esm/stdlib/plugin/menu/index.js +4 -3
  247. package/esm/stdlib/plugin/menu/index.js.map +1 -1
  248. package/esm/stdlib/plugin/minimap/index.d.ts +11 -3
  249. package/esm/stdlib/plugin/minimap/index.js +19 -21
  250. package/esm/stdlib/plugin/minimap/index.js.map +1 -1
  251. package/esm/stdlib/plugin/toolbar/index.d.ts +59 -0
  252. package/esm/stdlib/plugin/toolbar/index.js +215 -0
  253. package/esm/stdlib/plugin/toolbar/index.js.map +1 -0
  254. package/esm/stdlib/plugin/tooltip/index.d.ts +24 -3
  255. package/esm/stdlib/plugin/tooltip/index.js +13 -12
  256. package/esm/stdlib/plugin/tooltip/index.js.map +1 -1
  257. package/esm/stdlib/plugin/types.d.ts +8 -0
  258. package/esm/stdlib/plugin/types.js +2 -0
  259. package/esm/stdlib/plugin/types.js.map +1 -0
  260. package/esm/stdlib/theme/dark.d.ts +1 -2
  261. package/esm/stdlib/theme/dark.js +9 -1
  262. package/esm/stdlib/theme/dark.js.map +1 -1
  263. package/esm/stdlib/theme/index.d.ts +2 -0
  264. package/esm/stdlib/theme/index.js +3 -0
  265. package/esm/stdlib/theme/index.js.map +1 -0
  266. package/esm/stdlib/theme/light.d.ts +1 -2
  267. package/esm/stdlib/theme/light.js +12 -2
  268. package/esm/stdlib/theme/light.js.map +1 -1
  269. package/esm/stdlib/themeSolver/base.d.ts +1 -1
  270. package/esm/stdlib/themeSolver/base.js +1 -1
  271. package/esm/stdlib/themeSolver/base.js.map +1 -1
  272. package/esm/stdlib/themeSolver/index.d.ts +3 -0
  273. package/esm/stdlib/themeSolver/index.js +4 -0
  274. package/esm/stdlib/themeSolver/index.js.map +1 -0
  275. package/esm/stdlib/themeSolver/spec.d.ts +2 -4
  276. package/esm/stdlib/themeSolver/spec.js +2 -2
  277. package/esm/stdlib/themeSolver/spec.js.map +1 -1
  278. package/esm/stdlib/themeSolver/subject.d.ts +2 -4
  279. package/esm/stdlib/themeSolver/subject.js +2 -2
  280. package/esm/stdlib/themeSolver/subject.js.map +1 -1
  281. package/esm/types/behavior.js.map +1 -1
  282. package/esm/types/combo.d.ts +3 -4
  283. package/esm/types/common.d.ts +10 -0
  284. package/esm/types/data.d.ts +10 -4
  285. package/esm/types/edge.d.ts +17 -2
  286. package/esm/types/graph.d.ts +129 -16
  287. package/esm/types/history.d.ts +28 -0
  288. package/esm/types/history.js +6 -0
  289. package/esm/types/history.js.map +1 -0
  290. package/esm/types/hook.d.ts +25 -5
  291. package/esm/types/index.d.ts +11 -5
  292. package/esm/types/index.js.map +1 -1
  293. package/esm/types/item.d.ts +10 -4
  294. package/esm/types/item.js.map +1 -1
  295. package/esm/types/layout.d.ts +4 -1
  296. package/esm/types/loop.d.ts +21 -0
  297. package/esm/types/loop.js +12 -0
  298. package/esm/types/loop.js.map +1 -0
  299. package/esm/types/node.d.ts +87 -6
  300. package/esm/types/plugin.d.ts +4 -0
  301. package/esm/types/plugin.js +1 -1
  302. package/esm/types/plugin.js.map +1 -1
  303. package/esm/types/spec.d.ts +26 -9
  304. package/esm/types/theme.d.ts +76 -10
  305. package/esm/types/theme.js +1 -2
  306. package/esm/types/theme.js.map +1 -1
  307. package/esm/util/animate.d.ts +2 -2
  308. package/esm/util/animate.js +52 -17
  309. package/esm/util/animate.js.map +1 -1
  310. package/esm/util/array.d.ts +8 -0
  311. package/esm/util/array.js +11 -1
  312. package/esm/util/array.js.map +1 -1
  313. package/esm/util/arrow.d.ts +17 -0
  314. package/esm/util/arrow.js +56 -0
  315. package/esm/util/arrow.js.map +1 -0
  316. package/esm/util/bbox.d.ts +106 -0
  317. package/esm/util/bbox.js +255 -0
  318. package/esm/util/bbox.js.map +1 -0
  319. package/esm/util/behavior.d.ts +2 -0
  320. package/esm/util/behavior.js +12 -0
  321. package/esm/util/behavior.js.map +1 -0
  322. package/esm/util/canvas.d.ts +1 -2
  323. package/esm/util/canvas.js +3 -20
  324. package/esm/util/canvas.js.map +1 -1
  325. package/esm/util/data.d.ts +33 -2
  326. package/esm/util/data.js +117 -5
  327. package/esm/util/data.js.map +1 -1
  328. package/esm/util/event.d.ts +22 -2
  329. package/esm/util/event.js +54 -0
  330. package/esm/util/event.js.map +1 -1
  331. package/esm/util/extend.d.ts +8 -2
  332. package/esm/util/extend.js.map +1 -1
  333. package/esm/util/index.d.ts +41 -3
  334. package/esm/util/index.js +20 -1
  335. package/esm/util/index.js.map +1 -1
  336. package/esm/util/item.d.ts +1 -1
  337. package/esm/util/item.js +7 -5
  338. package/esm/util/item.js.map +1 -1
  339. package/esm/util/layout.d.ts +40 -0
  340. package/esm/util/layout.js +160 -0
  341. package/esm/util/layout.js.map +1 -0
  342. package/esm/util/loop.d.ts +37 -0
  343. package/esm/util/loop.js +104 -0
  344. package/esm/util/loop.js.map +1 -0
  345. package/esm/util/mapper.js +4 -9
  346. package/esm/util/mapper.js.map +1 -1
  347. package/esm/util/math.d.ts +15 -0
  348. package/esm/util/math.js +14 -0
  349. package/esm/util/math.js.map +1 -1
  350. package/esm/util/mock.d.ts +30 -0
  351. package/esm/util/mock.js +69 -0
  352. package/esm/util/mock.js.map +1 -0
  353. package/esm/util/path.d.ts +11 -0
  354. package/esm/util/path.js +44 -0
  355. package/esm/util/path.js.map +1 -0
  356. package/esm/util/point.d.ts +24 -2
  357. package/esm/util/point.js +27 -2
  358. package/esm/util/point.js.map +1 -1
  359. package/esm/util/polyline.d.ts +113 -0
  360. package/esm/util/polyline.js +505 -0
  361. package/esm/util/polyline.js.map +1 -0
  362. package/esm/util/router.d.ts +31 -0
  363. package/esm/util/router.js +380 -0
  364. package/esm/util/router.js.map +1 -0
  365. package/esm/util/shape.d.ts +3 -3
  366. package/esm/util/shape.js +19 -3
  367. package/esm/util/shape.js.map +1 -1
  368. package/esm/util/shape3d.d.ts +1 -1
  369. package/esm/util/shape3d.js +12 -6
  370. package/esm/util/shape3d.js.map +1 -1
  371. package/esm/util/type.d.ts +6 -0
  372. package/esm/util/type.js +7 -1
  373. package/esm/util/type.js.map +1 -1
  374. package/esm/util/zoom.d.ts +1 -1
  375. package/esm/util/zoom.js +6 -2
  376. package/esm/util/zoom.js.map +1 -1
  377. package/lib/api-doc/behaviors.d.ts +2 -0
  378. package/lib/api-doc/behaviors.js +18 -0
  379. package/lib/api-doc/behaviors.js.map +1 -0
  380. package/lib/api-doc/graph.d.ts +4 -0
  381. package/lib/api-doc/graph.js +11 -0
  382. package/lib/api-doc/graph.js.map +1 -0
  383. package/lib/api-doc/item.d.ts +9 -0
  384. package/lib/api-doc/item.js +21 -0
  385. package/lib/api-doc/item.js.map +1 -0
  386. package/lib/api-doc/layout.d.ts +1 -0
  387. package/lib/api-doc/layout.js +3 -0
  388. package/lib/api-doc/layout.js.map +1 -0
  389. package/lib/api-doc/plugins.d.ts +1 -0
  390. package/lib/api-doc/plugins.js +18 -0
  391. package/lib/api-doc/plugins.js.map +1 -0
  392. package/lib/api-doc/types.d.ts +0 -0
  393. package/lib/api-doc/types.js +3 -0
  394. package/lib/api-doc/types.js.map +1 -0
  395. package/lib/api-doc/util.d.ts +3 -0
  396. package/lib/api-doc/util.js +10 -0
  397. package/lib/api-doc/util.js.map +1 -0
  398. package/lib/constant/shape.d.ts +7 -14
  399. package/lib/constant/shape.js +1 -0
  400. package/lib/constant/shape.js.map +1 -1
  401. package/lib/index.d.ts +213 -113
  402. package/lib/index.js +13 -3
  403. package/lib/index.js.map +1 -1
  404. package/lib/item/combo.d.ts +13 -6
  405. package/lib/item/combo.js +72 -8
  406. package/lib/item/combo.js.map +1 -1
  407. package/lib/item/edge.d.ts +12 -9
  408. package/lib/item/edge.js +38 -11
  409. package/lib/item/edge.js.map +1 -1
  410. package/lib/item/item.d.ts +8 -6
  411. package/lib/item/item.js +123 -80
  412. package/lib/item/item.js.map +1 -1
  413. package/lib/item/node.d.ts +14 -9
  414. package/lib/item/node.js +63 -48
  415. package/lib/item/node.js.map +1 -1
  416. package/lib/runtime/controller/data.d.ts +17 -1
  417. package/lib/runtime/controller/data.js +318 -221
  418. package/lib/runtime/controller/data.js.map +1 -1
  419. package/lib/runtime/controller/interaction.d.ts +1 -0
  420. package/lib/runtime/controller/interaction.js +7 -4
  421. package/lib/runtime/controller/interaction.js.map +1 -1
  422. package/lib/runtime/controller/item.d.ts +37 -4
  423. package/lib/runtime/controller/item.js +474 -176
  424. package/lib/runtime/controller/item.js.map +1 -1
  425. package/lib/runtime/controller/layout.d.ts +4 -1
  426. package/lib/runtime/controller/layout.js +119 -14
  427. package/lib/runtime/controller/layout.js.map +1 -1
  428. package/lib/runtime/controller/plugin.d.ts +11 -0
  429. package/lib/runtime/controller/plugin.js +39 -6
  430. package/lib/runtime/controller/plugin.js.map +1 -1
  431. package/lib/runtime/controller/theme.js +8 -4
  432. package/lib/runtime/controller/theme.js.map +1 -1
  433. package/lib/runtime/graph.d.ts +181 -39
  434. package/lib/runtime/graph.js +560 -71
  435. package/lib/runtime/graph.js.map +1 -1
  436. package/lib/stdlib/behavior/activate-relations.d.ts +2 -3
  437. package/lib/stdlib/behavior/activate-relations.js +14 -9
  438. package/lib/stdlib/behavior/activate-relations.js.map +1 -1
  439. package/lib/stdlib/behavior/brush-select.d.ts +3 -4
  440. package/lib/stdlib/behavior/brush-select.js +3 -2
  441. package/lib/stdlib/behavior/brush-select.js.map +1 -1
  442. package/lib/stdlib/behavior/click-select.d.ts +2 -3
  443. package/lib/stdlib/behavior/click-select.js +9 -6
  444. package/lib/stdlib/behavior/click-select.js.map +1 -1
  445. package/lib/stdlib/behavior/collapse-expand-combo.d.ts +1 -2
  446. package/lib/stdlib/behavior/collapse-expand-combo.js +2 -1
  447. package/lib/stdlib/behavior/collapse-expand-combo.js.map +1 -1
  448. package/lib/stdlib/behavior/collapse-expand-tree.d.ts +44 -0
  449. package/lib/stdlib/behavior/collapse-expand-tree.js +73 -0
  450. package/lib/stdlib/behavior/collapse-expand-tree.js.map +1 -0
  451. package/lib/stdlib/behavior/drag-canvas.d.ts +1 -2
  452. package/lib/stdlib/behavior/drag-canvas.js +16 -11
  453. package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
  454. package/lib/stdlib/behavior/drag-combo.d.ts +16 -4
  455. package/lib/stdlib/behavior/drag-combo.js +70 -30
  456. package/lib/stdlib/behavior/drag-combo.js.map +1 -1
  457. package/lib/stdlib/behavior/drag-node.d.ts +20 -4
  458. package/lib/stdlib/behavior/drag-node.js +145 -56
  459. package/lib/stdlib/behavior/drag-node.js.map +1 -1
  460. package/lib/stdlib/behavior/hover-activate.d.ts +1 -2
  461. package/lib/stdlib/behavior/hover-activate.js +2 -1
  462. package/lib/stdlib/behavior/hover-activate.js.map +1 -1
  463. package/lib/stdlib/behavior/index.d.ts +15 -0
  464. package/lib/stdlib/behavior/index.js +32 -0
  465. package/lib/stdlib/behavior/index.js.map +1 -0
  466. package/lib/stdlib/behavior/lasso-select.d.ts +7 -3
  467. package/lib/stdlib/behavior/lasso-select.js +4 -6
  468. package/lib/stdlib/behavior/lasso-select.js.map +1 -1
  469. package/lib/stdlib/behavior/orbit-canvas-3d.d.ts +2 -3
  470. package/lib/stdlib/behavior/orbit-canvas-3d.js +4 -6
  471. package/lib/stdlib/behavior/orbit-canvas-3d.js.map +1 -1
  472. package/lib/stdlib/behavior/rotate-canvas-3d.d.ts +1 -2
  473. package/lib/stdlib/behavior/rotate-canvas-3d.js +2 -1
  474. package/lib/stdlib/behavior/rotate-canvas-3d.js.map +1 -1
  475. package/lib/stdlib/behavior/track-canvas-3d.d.ts +2 -3
  476. package/lib/stdlib/behavior/track-canvas-3d.js +4 -6
  477. package/lib/stdlib/behavior/track-canvas-3d.js.map +1 -1
  478. package/lib/stdlib/behavior/types.d.ts +13 -0
  479. package/lib/stdlib/behavior/types.js +3 -0
  480. package/lib/stdlib/behavior/types.js.map +1 -0
  481. package/lib/stdlib/behavior/zoom-canvas-3d.d.ts +1 -2
  482. package/lib/stdlib/behavior/zoom-canvas-3d.js +8 -7
  483. package/lib/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
  484. package/lib/stdlib/behavior/zoom-canvas.d.ts +1 -2
  485. package/lib/stdlib/behavior/zoom-canvas.js +21 -18
  486. package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
  487. package/lib/stdlib/data/index.d.ts +3 -0
  488. package/lib/stdlib/data/index.js +20 -0
  489. package/lib/stdlib/data/index.js.map +1 -0
  490. package/lib/stdlib/data/mapNodeSize.d.ts +12 -0
  491. package/lib/stdlib/data/mapNodeSize.js +47 -0
  492. package/lib/stdlib/data/mapNodeSize.js.map +1 -0
  493. package/lib/stdlib/data/transformV4Data.d.ts +9 -0
  494. package/lib/stdlib/data/transformV4Data.js +146 -0
  495. package/lib/stdlib/data/transformV4Data.js.map +1 -0
  496. package/lib/stdlib/data/validateData.d.ts +9 -0
  497. package/lib/stdlib/data/validateData.js +102 -0
  498. package/lib/stdlib/data/validateData.js.map +1 -0
  499. package/lib/stdlib/index.d.ts +113 -69
  500. package/lib/stdlib/index.js +188 -67
  501. package/lib/stdlib/index.js.map +1 -1
  502. package/lib/stdlib/item/combo/index.d.ts +2 -0
  503. package/lib/stdlib/item/combo/index.js +19 -0
  504. package/lib/stdlib/item/combo/index.js.map +1 -0
  505. package/lib/stdlib/item/combo/rect.d.ts +31 -0
  506. package/lib/stdlib/item/combo/rect.js +69 -0
  507. package/lib/stdlib/item/combo/rect.js.map +1 -0
  508. package/lib/stdlib/item/edge/base.d.ts +10 -1
  509. package/lib/stdlib/item/edge/base.js +35 -4
  510. package/lib/stdlib/item/edge/base.js.map +1 -1
  511. package/{esm/stdlib/item/edge/cubic-horizon.d.ts → lib/stdlib/item/edge/cubic-horizontal.d.ts} +6 -7
  512. package/lib/stdlib/item/edge/{cubic-horizon.js → cubic-horizontal.js} +20 -35
  513. package/lib/stdlib/item/edge/cubic-horizontal.js.map +1 -0
  514. package/lib/stdlib/item/edge/cubic-vertical.d.ts +7 -8
  515. package/lib/stdlib/item/edge/cubic-vertical.js +17 -32
  516. package/lib/stdlib/item/edge/cubic-vertical.js.map +1 -1
  517. package/lib/stdlib/item/edge/cubic.d.ts +7 -8
  518. package/lib/stdlib/item/edge/cubic.js +22 -5
  519. package/lib/stdlib/item/edge/cubic.js.map +1 -1
  520. package/lib/stdlib/item/edge/index.d.ts +5 -0
  521. package/lib/stdlib/item/edge/index.js +5 -0
  522. package/lib/stdlib/item/edge/index.js.map +1 -1
  523. package/lib/stdlib/item/edge/line.d.ts +1 -1
  524. package/lib/stdlib/item/edge/line.js +16 -1
  525. package/lib/stdlib/item/edge/line.js.map +1 -1
  526. package/lib/stdlib/item/edge/loop.d.ts +32 -0
  527. package/lib/stdlib/item/edge/loop.js +119 -0
  528. package/lib/stdlib/item/edge/loop.js.map +1 -0
  529. package/lib/stdlib/item/edge/polyline.d.ts +44 -0
  530. package/lib/stdlib/item/edge/polyline.js +96 -0
  531. package/lib/stdlib/item/edge/polyline.js.map +1 -0
  532. package/lib/stdlib/item/edge/quadratic.d.ts +5 -6
  533. package/lib/stdlib/item/edge/quadratic.js +33 -21
  534. package/lib/stdlib/item/edge/quadratic.js.map +1 -1
  535. package/lib/stdlib/item/node/base.d.ts +45 -1
  536. package/lib/stdlib/item/node/base.js +97 -12
  537. package/lib/stdlib/item/node/base.js.map +1 -1
  538. package/lib/stdlib/item/node/base3d.js +1 -1
  539. package/lib/stdlib/item/node/base3d.js.map +1 -1
  540. package/lib/stdlib/item/node/circle.js +5 -5
  541. package/lib/stdlib/item/node/circle.js.map +1 -1
  542. package/lib/stdlib/item/node/diamond.d.ts +32 -0
  543. package/lib/stdlib/item/node/diamond.js +83 -0
  544. package/lib/stdlib/item/node/diamond.js.map +1 -0
  545. package/lib/stdlib/item/node/donut.d.ts +70 -0
  546. package/lib/stdlib/item/node/donut.js +211 -0
  547. package/lib/stdlib/item/node/donut.js.map +1 -0
  548. package/lib/stdlib/item/node/ellipse.d.ts +32 -0
  549. package/lib/stdlib/item/node/ellipse.js +75 -0
  550. package/lib/stdlib/item/node/ellipse.js.map +1 -0
  551. package/lib/stdlib/item/node/hexagon.d.ts +33 -0
  552. package/lib/stdlib/item/node/hexagon.js +106 -0
  553. package/lib/stdlib/item/node/hexagon.js.map +1 -0
  554. package/lib/stdlib/item/node/index.d.ts +7 -0
  555. package/lib/stdlib/item/node/index.js +7 -0
  556. package/lib/stdlib/item/node/index.js.map +1 -1
  557. package/lib/stdlib/item/node/modelRect.d.ts +61 -0
  558. package/lib/stdlib/item/node/modelRect.js +190 -0
  559. package/lib/stdlib/item/node/modelRect.js.map +1 -0
  560. package/lib/stdlib/item/node/rect.d.ts +1 -0
  561. package/lib/stdlib/item/node/rect.js +16 -0
  562. package/lib/stdlib/item/node/rect.js.map +1 -1
  563. package/lib/stdlib/item/node/star.d.ts +34 -0
  564. package/lib/stdlib/item/node/star.js +119 -0
  565. package/lib/stdlib/item/node/star.js.map +1 -0
  566. package/lib/stdlib/item/node/triangle.d.ts +44 -0
  567. package/lib/stdlib/item/node/triangle.js +181 -0
  568. package/lib/stdlib/item/node/triangle.js.map +1 -0
  569. package/lib/stdlib/plugin/fisheye/index.d.ts +32 -4
  570. package/lib/stdlib/plugin/fisheye/index.js +3 -1
  571. package/lib/stdlib/plugin/fisheye/index.js.map +1 -1
  572. package/lib/stdlib/plugin/grid/index.d.ts +36 -0
  573. package/lib/stdlib/plugin/grid/index.js +85 -0
  574. package/lib/stdlib/plugin/grid/index.js.map +1 -0
  575. package/lib/stdlib/plugin/history/combo-command.d.ts +9 -0
  576. package/lib/stdlib/plugin/history/combo-command.js +25 -0
  577. package/lib/stdlib/plugin/history/combo-command.js.map +1 -0
  578. package/lib/stdlib/plugin/history/command.d.ts +18 -0
  579. package/lib/stdlib/plugin/history/command.js +54 -0
  580. package/lib/stdlib/plugin/history/command.js.map +1 -0
  581. package/lib/stdlib/plugin/history/index.d.ts +112 -0
  582. package/lib/stdlib/plugin/history/index.js +283 -0
  583. package/lib/stdlib/plugin/history/index.js.map +1 -0
  584. package/lib/stdlib/plugin/history/item-data-command.d.ts +14 -0
  585. package/lib/stdlib/plugin/history/item-data-command.js +67 -0
  586. package/lib/stdlib/plugin/history/item-data-command.js.map +1 -0
  587. package/lib/stdlib/plugin/history/layer-updated-command.d.ts +9 -0
  588. package/lib/stdlib/plugin/history/layer-updated-command.js +25 -0
  589. package/lib/stdlib/plugin/history/layer-updated-command.js.map +1 -0
  590. package/lib/stdlib/plugin/history/state-updated-command.d.ts +9 -0
  591. package/lib/stdlib/plugin/history/state-updated-command.js +24 -0
  592. package/lib/stdlib/plugin/history/state-updated-command.js.map +1 -0
  593. package/lib/stdlib/plugin/history/visibility-updated-command.d.ts +10 -0
  594. package/lib/stdlib/plugin/history/visibility-updated-command.js +27 -0
  595. package/lib/stdlib/plugin/history/visibility-updated-command.js.map +1 -0
  596. package/lib/stdlib/plugin/hull/bubbleset.d.ts +9 -0
  597. package/lib/stdlib/plugin/hull/bubbleset.js +596 -0
  598. package/lib/stdlib/plugin/hull/bubbleset.js.map +1 -0
  599. package/lib/stdlib/plugin/hull/convexHull.d.ts +14 -0
  600. package/lib/stdlib/plugin/hull/convexHull.js +61 -0
  601. package/lib/stdlib/plugin/hull/convexHull.js.map +1 -0
  602. package/lib/stdlib/plugin/hull/hullComponent.d.ts +87 -0
  603. package/lib/stdlib/plugin/hull/hullComponent.js +385 -0
  604. package/lib/stdlib/plugin/hull/hullComponent.js.map +1 -0
  605. package/lib/stdlib/plugin/hull/index.d.ts +59 -0
  606. package/lib/stdlib/plugin/hull/index.js +167 -0
  607. package/lib/stdlib/plugin/hull/index.js.map +1 -0
  608. package/lib/stdlib/plugin/hull/types.d.ts +15 -0
  609. package/lib/stdlib/plugin/hull/types.js +3 -0
  610. package/lib/stdlib/plugin/hull/types.js.map +1 -0
  611. package/lib/stdlib/plugin/hull/util.d.ts +77 -0
  612. package/lib/stdlib/plugin/hull/util.js +419 -0
  613. package/lib/stdlib/plugin/hull/util.js.map +1 -0
  614. package/lib/stdlib/plugin/index.d.ts +8 -0
  615. package/lib/stdlib/plugin/index.js +25 -0
  616. package/lib/stdlib/plugin/index.js.map +1 -0
  617. package/lib/stdlib/plugin/legend/index.d.ts +45 -3
  618. package/lib/stdlib/plugin/legend/index.js +46 -40
  619. package/lib/stdlib/plugin/legend/index.js.map +1 -1
  620. package/lib/stdlib/plugin/menu/index.d.ts +18 -5
  621. package/lib/stdlib/plugin/menu/index.js +5 -3
  622. package/lib/stdlib/plugin/menu/index.js.map +1 -1
  623. package/lib/stdlib/plugin/minimap/index.d.ts +11 -3
  624. package/lib/stdlib/plugin/minimap/index.js +19 -20
  625. package/lib/stdlib/plugin/minimap/index.js.map +1 -1
  626. package/lib/stdlib/plugin/toolbar/index.d.ts +59 -0
  627. package/lib/stdlib/plugin/toolbar/index.js +222 -0
  628. package/lib/stdlib/plugin/toolbar/index.js.map +1 -0
  629. package/lib/stdlib/plugin/tooltip/index.d.ts +24 -3
  630. package/lib/stdlib/plugin/tooltip/index.js +14 -12
  631. package/lib/stdlib/plugin/tooltip/index.js.map +1 -1
  632. package/lib/stdlib/plugin/types.d.ts +8 -0
  633. package/lib/stdlib/plugin/types.js +3 -0
  634. package/lib/stdlib/plugin/types.js.map +1 -0
  635. package/lib/stdlib/theme/dark.d.ts +1 -2
  636. package/lib/stdlib/theme/dark.js +10 -1
  637. package/lib/stdlib/theme/dark.js.map +1 -1
  638. package/lib/stdlib/theme/index.d.ts +2 -0
  639. package/lib/stdlib/theme/index.js +19 -0
  640. package/lib/stdlib/theme/index.js.map +1 -0
  641. package/lib/stdlib/theme/light.d.ts +1 -2
  642. package/lib/stdlib/theme/light.js +13 -2
  643. package/lib/stdlib/theme/light.js.map +1 -1
  644. package/lib/stdlib/themeSolver/base.d.ts +1 -1
  645. package/lib/stdlib/themeSolver/base.js +2 -1
  646. package/lib/stdlib/themeSolver/base.js.map +1 -1
  647. package/lib/stdlib/themeSolver/index.d.ts +3 -0
  648. package/lib/stdlib/themeSolver/index.js +20 -0
  649. package/lib/stdlib/themeSolver/index.js.map +1 -0
  650. package/lib/stdlib/themeSolver/spec.d.ts +2 -4
  651. package/lib/stdlib/themeSolver/spec.js +4 -6
  652. package/lib/stdlib/themeSolver/spec.js.map +1 -1
  653. package/lib/stdlib/themeSolver/subject.d.ts +2 -4
  654. package/lib/stdlib/themeSolver/subject.js +4 -4
  655. package/lib/stdlib/themeSolver/subject.js.map +1 -1
  656. package/lib/types/behavior.js.map +1 -1
  657. package/lib/types/combo.d.ts +3 -4
  658. package/lib/types/common.d.ts +10 -0
  659. package/lib/types/data.d.ts +10 -4
  660. package/lib/types/edge.d.ts +17 -2
  661. package/lib/types/graph.d.ts +129 -16
  662. package/lib/types/history.d.ts +28 -0
  663. package/lib/types/history.js +9 -0
  664. package/lib/types/history.js.map +1 -0
  665. package/lib/types/hook.d.ts +25 -5
  666. package/lib/types/index.d.ts +11 -5
  667. package/lib/types/index.js.map +1 -1
  668. package/lib/types/item.d.ts +10 -4
  669. package/lib/types/item.js.map +1 -1
  670. package/lib/types/layout.d.ts +4 -1
  671. package/lib/types/loop.d.ts +21 -0
  672. package/lib/types/loop.js +15 -0
  673. package/lib/types/loop.js.map +1 -0
  674. package/lib/types/node.d.ts +87 -6
  675. package/lib/types/plugin.d.ts +4 -0
  676. package/lib/types/plugin.js.map +1 -1
  677. package/lib/types/spec.d.ts +26 -9
  678. package/lib/types/theme.d.ts +76 -10
  679. package/lib/types/theme.js +1 -2
  680. package/lib/types/theme.js.map +1 -1
  681. package/lib/util/animate.d.ts +2 -2
  682. package/lib/util/animate.js +52 -17
  683. package/lib/util/animate.js.map +1 -1
  684. package/lib/util/array.d.ts +8 -0
  685. package/lib/util/array.js +13 -2
  686. package/lib/util/array.js.map +1 -1
  687. package/lib/util/arrow.d.ts +17 -0
  688. package/lib/util/arrow.js +60 -0
  689. package/lib/util/arrow.js.map +1 -0
  690. package/lib/util/bbox.d.ts +106 -0
  691. package/lib/util/bbox.js +273 -0
  692. package/lib/util/bbox.js.map +1 -0
  693. package/lib/util/behavior.d.ts +2 -0
  694. package/lib/util/behavior.js +16 -0
  695. package/lib/util/behavior.js.map +1 -0
  696. package/lib/util/canvas.d.ts +1 -2
  697. package/lib/util/canvas.js +3 -20
  698. package/lib/util/canvas.js.map +1 -1
  699. package/lib/util/data.d.ts +33 -2
  700. package/lib/util/data.js +121 -6
  701. package/lib/util/data.js.map +1 -1
  702. package/lib/util/event.d.ts +22 -2
  703. package/lib/util/event.js +56 -1
  704. package/lib/util/event.js.map +1 -1
  705. package/lib/util/extend.d.ts +8 -2
  706. package/lib/util/extend.js.map +1 -1
  707. package/lib/util/index.d.ts +41 -3
  708. package/lib/util/index.js +20 -1
  709. package/lib/util/index.js.map +1 -1
  710. package/lib/util/item.d.ts +1 -1
  711. package/lib/util/item.js +7 -5
  712. package/lib/util/item.js.map +1 -1
  713. package/lib/util/layout.d.ts +40 -0
  714. package/lib/util/layout.js +172 -0
  715. package/lib/util/layout.js.map +1 -0
  716. package/lib/util/loop.d.ts +37 -0
  717. package/lib/util/loop.js +111 -0
  718. package/lib/util/loop.js.map +1 -0
  719. package/lib/util/mapper.js +4 -9
  720. package/lib/util/mapper.js.map +1 -1
  721. package/lib/util/math.d.ts +15 -0
  722. package/lib/util/math.js +17 -1
  723. package/lib/util/math.js.map +1 -1
  724. package/lib/util/mock.d.ts +30 -0
  725. package/lib/util/mock.js +73 -0
  726. package/lib/util/mock.js.map +1 -0
  727. package/lib/util/path.d.ts +11 -0
  728. package/lib/util/path.js +49 -0
  729. package/lib/util/path.js.map +1 -0
  730. package/lib/util/point.d.ts +24 -2
  731. package/lib/util/point.js +31 -3
  732. package/lib/util/point.js.map +1 -1
  733. package/lib/util/polyline.d.ts +113 -0
  734. package/lib/util/polyline.js +524 -0
  735. package/lib/util/polyline.js.map +1 -0
  736. package/lib/util/router.d.ts +31 -0
  737. package/lib/util/router.js +384 -0
  738. package/lib/util/router.js.map +1 -0
  739. package/lib/util/shape.d.ts +3 -3
  740. package/lib/util/shape.js +19 -3
  741. package/lib/util/shape.js.map +1 -1
  742. package/lib/util/shape3d.d.ts +1 -1
  743. package/lib/util/shape3d.js +11 -5
  744. package/lib/util/shape3d.js.map +1 -1
  745. package/lib/util/type.d.ts +6 -0
  746. package/lib/util/type.js +9 -2
  747. package/lib/util/type.js.map +1 -1
  748. package/lib/util/zoom.d.ts +1 -1
  749. package/lib/util/zoom.js +6 -2
  750. package/lib/util/zoom.js.map +1 -1
  751. package/package.json +35 -15
  752. package/src/api-doc/behaviors.ts +2 -0
  753. package/src/api-doc/graph.ts +4 -0
  754. package/src/api-doc/item.ts +43 -0
  755. package/src/api-doc/layout.ts +13 -0
  756. package/src/api-doc/plugins.ts +1 -0
  757. package/src/api-doc/readme.md +59 -0
  758. package/src/api-doc/types.ts +2 -0
  759. package/src/api-doc/util.ts +3 -0
  760. package/src/constant/shape.ts +4 -1
  761. package/src/index.ts +14 -4
  762. package/src/item/combo.ts +105 -18
  763. package/src/item/edge.ts +68 -18
  764. package/src/item/item.ts +138 -82
  765. package/src/item/node.ts +100 -54
  766. package/src/runtime/controller/data.ts +410 -258
  767. package/src/runtime/controller/interaction.ts +8 -4
  768. package/src/runtime/controller/item.ts +690 -252
  769. package/src/runtime/controller/layout.ts +147 -14
  770. package/src/runtime/controller/plugin.ts +47 -10
  771. package/src/runtime/controller/theme.ts +8 -4
  772. package/src/runtime/graph.ts +721 -130
  773. package/src/stdlib/behavior/activate-relations.ts +14 -11
  774. package/src/stdlib/behavior/brush-select.ts +4 -5
  775. package/src/stdlib/behavior/click-select.ts +12 -10
  776. package/src/stdlib/behavior/collapse-expand-combo.ts +1 -3
  777. package/src/stdlib/behavior/collapse-expand-tree.ts +106 -0
  778. package/src/stdlib/behavior/drag-canvas.ts +15 -13
  779. package/src/stdlib/behavior/drag-combo.ts +109 -53
  780. package/src/stdlib/behavior/drag-node.ts +220 -83
  781. package/src/stdlib/behavior/hover-activate.ts +1 -2
  782. package/src/stdlib/behavior/index.ts +15 -0
  783. package/src/stdlib/behavior/lasso-select.ts +6 -2
  784. package/src/stdlib/behavior/orbit-canvas-3d.ts +2 -4
  785. package/src/stdlib/behavior/rotate-canvas-3d.ts +1 -3
  786. package/src/stdlib/behavior/track-canvas-3d.ts +2 -4
  787. package/src/stdlib/behavior/types.ts +15 -0
  788. package/src/stdlib/behavior/zoom-canvas-3d.ts +5 -7
  789. package/src/stdlib/behavior/zoom-canvas.ts +19 -19
  790. package/src/stdlib/data/index.ts +3 -0
  791. package/src/stdlib/data/mapNodeSize.ts +67 -0
  792. package/src/stdlib/data/transformV4Data.ts +207 -0
  793. package/src/stdlib/data/validateData.ts +146 -0
  794. package/src/stdlib/index.ts +215 -53
  795. package/src/stdlib/item/combo/index.ts +2 -0
  796. package/src/stdlib/item/combo/rect.ts +123 -0
  797. package/src/stdlib/item/edge/base.ts +66 -4
  798. package/src/stdlib/item/edge/{cubic-horizon.ts → cubic-horizontal.ts} +25 -53
  799. package/src/stdlib/item/edge/cubic-vertical.ts +24 -55
  800. package/src/stdlib/item/edge/cubic.ts +36 -36
  801. package/src/stdlib/item/edge/index.ts +5 -0
  802. package/src/stdlib/item/edge/line.ts +14 -15
  803. package/src/stdlib/item/edge/loop.ts +162 -0
  804. package/src/stdlib/item/edge/polyline.ts +161 -0
  805. package/src/stdlib/item/edge/quadratic.ts +34 -37
  806. package/src/stdlib/item/node/base.ts +116 -12
  807. package/src/stdlib/item/node/base3d.ts +2 -0
  808. package/src/stdlib/item/node/circle.ts +5 -5
  809. package/src/stdlib/item/node/diamond.ts +144 -0
  810. package/src/stdlib/item/node/donut.ts +368 -0
  811. package/src/stdlib/item/node/ellipse.ts +128 -0
  812. package/src/stdlib/item/node/hexagon.ts +168 -0
  813. package/src/stdlib/item/node/index.ts +7 -0
  814. package/src/stdlib/item/node/modelRect.ts +405 -0
  815. package/src/stdlib/item/node/rect.ts +17 -0
  816. package/src/stdlib/item/node/star.ts +181 -0
  817. package/src/stdlib/item/node/triangle.ts +265 -0
  818. package/src/stdlib/plugin/fisheye/index.ts +35 -6
  819. package/src/stdlib/plugin/grid/index.ts +125 -0
  820. package/src/stdlib/plugin/history/combo-command.ts +28 -0
  821. package/src/stdlib/plugin/history/command.ts +81 -0
  822. package/src/stdlib/plugin/history/index.ts +347 -0
  823. package/src/stdlib/plugin/history/item-data-command.ts +96 -0
  824. package/src/stdlib/plugin/history/layer-updated-command.ts +28 -0
  825. package/src/stdlib/plugin/history/state-updated-command.ts +36 -0
  826. package/src/stdlib/plugin/history/visibility-updated-command.ts +41 -0
  827. package/src/stdlib/plugin/hull/bubbleset.ts +828 -0
  828. package/src/stdlib/plugin/hull/convexHull.ts +68 -0
  829. package/src/stdlib/plugin/hull/hullComponent.ts +501 -0
  830. package/src/stdlib/plugin/hull/index.ts +234 -0
  831. package/src/stdlib/plugin/hull/types.ts +15 -0
  832. package/src/stdlib/plugin/hull/util.ts +511 -0
  833. package/src/stdlib/plugin/index.ts +8 -0
  834. package/src/stdlib/plugin/legend/index.ts +122 -61
  835. package/src/stdlib/plugin/menu/index.ts +21 -6
  836. package/src/stdlib/plugin/minimap/index.ts +35 -26
  837. package/src/stdlib/plugin/toolbar/index.ts +257 -0
  838. package/src/stdlib/plugin/tooltip/index.ts +38 -18
  839. package/src/stdlib/plugin/types.ts +8 -0
  840. package/src/stdlib/theme/dark.ts +9 -1
  841. package/src/stdlib/theme/index.ts +2 -0
  842. package/src/stdlib/theme/light.ts +13 -3
  843. package/src/stdlib/themeSolver/base.ts +1 -1
  844. package/src/stdlib/themeSolver/index.ts +3 -0
  845. package/src/stdlib/themeSolver/spec.ts +2 -5
  846. package/src/stdlib/themeSolver/subject.ts +2 -5
  847. package/src/types/behavior.ts +0 -1
  848. package/src/types/combo.ts +3 -4
  849. package/src/types/common.ts +13 -0
  850. package/src/types/data.ts +23 -4
  851. package/src/types/edge.ts +28 -4
  852. package/src/types/graph.ts +161 -11
  853. package/src/types/history.ts +30 -0
  854. package/src/types/hook.ts +29 -6
  855. package/src/types/index.ts +37 -12
  856. package/src/types/item.ts +15 -2
  857. package/src/types/layout.ts +20 -16
  858. package/src/types/loop.ts +23 -0
  859. package/src/types/node.ts +91 -11
  860. package/src/types/plugin.ts +7 -1
  861. package/src/types/spec.ts +30 -13
  862. package/src/types/theme.ts +80 -10
  863. package/src/util/animate.ts +58 -17
  864. package/src/util/array.ts +12 -1
  865. package/src/util/arrow.ts +62 -0
  866. package/src/util/bbox.ts +298 -0
  867. package/src/util/behavior.ts +14 -0
  868. package/src/util/canvas.ts +6 -24
  869. package/src/util/data.ts +134 -5
  870. package/src/util/event.ts +86 -2
  871. package/src/util/extend.ts +8 -2
  872. package/src/util/index.ts +31 -1
  873. package/src/util/item.ts +11 -8
  874. package/src/util/layout.ts +165 -0
  875. package/src/util/loop.ts +145 -0
  876. package/src/util/mapper.ts +10 -9
  877. package/src/util/math.ts +24 -0
  878. package/src/util/mock.ts +72 -0
  879. package/src/util/path.ts +52 -0
  880. package/src/util/point.ts +33 -2
  881. package/src/util/polyline.ts +676 -0
  882. package/src/util/router.ts +552 -0
  883. package/src/util/shape.ts +23 -7
  884. package/src/util/shape3d.ts +16 -11
  885. package/src/util/type.ts +8 -1
  886. package/src/util/zoom.ts +7 -3
  887. package/esm/stdlib/data/comboFromNode.d.ts +0 -9
  888. package/esm/stdlib/data/comboFromNode.js +0 -28
  889. package/esm/stdlib/data/comboFromNode.js.map +0 -1
  890. package/esm/stdlib/item/edge/cubic-horizon.js.map +0 -1
  891. package/lib/stdlib/data/comboFromNode.d.ts +0 -9
  892. package/lib/stdlib/data/comboFromNode.js +0 -32
  893. package/lib/stdlib/data/comboFromNode.js.map +0 -1
  894. package/lib/stdlib/item/edge/cubic-horizon.js.map +0 -1
  895. package/src/stdlib/data/comboFromNode.ts +0 -28
package/src/util/event.ts CHANGED
@@ -1,6 +1,18 @@
1
1
  import { IElement } from '@antv/g';
2
- import { ID } from '@antv/graphlib';
3
- import { IG6GraphEvent, IGraph } from 'types';
2
+ import {
3
+ EdgeAdded,
4
+ EdgeDataUpdated,
5
+ EdgeRemoved,
6
+ EdgeUpdated,
7
+ ID,
8
+ NodeAdded,
9
+ NodeDataUpdated,
10
+ NodeRemoved,
11
+ TreeStructureChanged,
12
+ } from '@antv/graphlib';
13
+ import { IG6GraphEvent, IGraph, NodeModelData } from '../types';
14
+ import { GraphCore } from '../types/data';
15
+ import { EdgeModelData } from '../types/edge';
4
16
 
5
17
  export type ItemInfo = {
6
18
  itemType: 'canvas' | 'node' | 'edge' | 'combo';
@@ -61,3 +73,75 @@ export const getContextMenuEventProps = (
61
73
  },
62
74
  };
63
75
  };
76
+
77
+ export type GroupedChanges = {
78
+ NodeRemoved: NodeRemoved<NodeModelData>[];
79
+ EdgeRemoved: EdgeRemoved<EdgeModelData>[];
80
+ NodeAdded: NodeAdded<NodeModelData>[];
81
+ EdgeAdded: EdgeAdded<EdgeModelData>[];
82
+ NodeDataUpdated: NodeDataUpdated<NodeModelData>[];
83
+ EdgeUpdated: EdgeUpdated<EdgeModelData>[];
84
+ EdgeDataUpdated: EdgeDataUpdated<EdgeModelData>[];
85
+ TreeStructureChanged: TreeStructureChanged[];
86
+ ComboStructureChanged: TreeStructureChanged[];
87
+ };
88
+
89
+ /**
90
+ * Group the changes with change types from graphCore's changes.
91
+ * @param graphCore
92
+ * @param changes
93
+ * @returns
94
+ */
95
+ export const getGroupedChanges = (
96
+ graphCore: GraphCore,
97
+ changes,
98
+ ): GroupedChanges => {
99
+ const groupedChanges: GroupedChanges = {
100
+ NodeRemoved: [],
101
+ EdgeRemoved: [],
102
+ NodeAdded: [],
103
+ EdgeAdded: [],
104
+ NodeDataUpdated: [],
105
+ EdgeUpdated: [],
106
+ EdgeDataUpdated: [],
107
+ TreeStructureChanged: [],
108
+ ComboStructureChanged: [],
109
+ };
110
+ changes.forEach((change) => {
111
+ const { type: changeType } = change;
112
+ if (
113
+ ['NodeDataUpdated', 'EdgeUpdated', 'EdgeDataUpdated'].includes(changeType)
114
+ ) {
115
+ const { id: oid } = change;
116
+ if (!graphCore.hasNode(oid) && !graphCore.hasEdge(oid)) {
117
+ const nid = Number(oid);
118
+ if ((!isNaN(nid) && graphCore.hasNode(nid)) || graphCore.hasEdge(nid)) {
119
+ groupedChanges[changeType].push({ ...change, id: nid });
120
+ }
121
+ return;
122
+ }
123
+ } else if (changeType === 'TreeStructureChanged') {
124
+ if (change.treeKey === 'combo')
125
+ groupedChanges.ComboStructureChanged.push(change);
126
+ else if (change.treeKey === 'tree')
127
+ groupedChanges.TreeStructureChanged.push(change);
128
+ return;
129
+ } else if (['NodeRemoved', 'EdgeRemoved'].includes(changeType)) {
130
+ groupedChanges[changeType].push(change);
131
+ } else {
132
+ const { id: oid } = change.value;
133
+ if (!graphCore.hasNode(oid) && !graphCore.hasEdge(oid)) {
134
+ const nid = Number(oid);
135
+ if ((!isNaN(nid) && graphCore.hasNode(nid)) || graphCore.hasEdge(nid)) {
136
+ groupedChanges[changeType].push({
137
+ ...change,
138
+ value: { ...change.value, id: nid },
139
+ });
140
+ }
141
+ return;
142
+ }
143
+ }
144
+ groupedChanges[changeType].push(change);
145
+ });
146
+ return groupedChanges;
147
+ };
@@ -1,5 +1,9 @@
1
1
  import { BehaviorRegistry } from '../types/behavior';
2
2
  import { ThemeRegistry } from '../types/theme';
3
+ import { NodeRegistry } from '../types/node';
4
+ import { EdgeRegistry } from '../types/edge';
5
+ import { LayoutRegistry } from '../types/layout';
6
+ import { PluginRegistry } from '../types/plugin';
3
7
  import Graph from '../runtime/graph';
4
8
  import registry from '../stdlib';
5
9
 
@@ -21,8 +25,10 @@ export const extend = <
21
25
  extendLibrary: {
22
26
  behaviors?: B1;
23
27
  themeSolvers?: T1;
24
- nodes?: any; // TODO
25
- edges?: any; // TODO
28
+ nodes?: NodeRegistry;
29
+ edges?: EdgeRegistry;
30
+ layouts?: LayoutRegistry;
31
+ plugins?: PluginRegistry;
26
32
  },
27
33
  ): typeof Graph<B1 & B2, T1 & T2> => {
28
34
  // merged the extendLibrary to useLib for global usage
package/src/util/index.ts CHANGED
@@ -1,4 +1,34 @@
1
1
  import { extend } from './extend';
2
+ import { mock } from './mock';
2
3
  import { isEncode } from './type';
3
- const Util = { extend, isEncode };
4
+ import { getArrowPath } from './arrow';
5
+ import {
6
+ graphCoreTreeDfs,
7
+ graphComboTreeDfs,
8
+ traverseAncestorsAndSucceeds,
9
+ traverseGraphAncestors,
10
+ traverseAncestors,
11
+ isSucceed,
12
+ treeData2GraphData,
13
+ graphData2TreeData,
14
+ traverse,
15
+ } from './data';
16
+ import { getEdgesBetween } from './item';
17
+
18
+ const Util = {
19
+ extend,
20
+ isEncode,
21
+ mock,
22
+ getArrowPath,
23
+ graphCoreTreeDfs,
24
+ graphComboTreeDfs,
25
+ traverseAncestorsAndSucceeds,
26
+ traverseGraphAncestors,
27
+ traverseAncestors,
28
+ isSucceed,
29
+ treeData2GraphData,
30
+ graphData2TreeData,
31
+ traverse,
32
+ getEdgesBetween,
33
+ };
4
34
  export default Util;
package/src/util/item.ts CHANGED
@@ -31,13 +31,13 @@ export const upsertTransientItem = (
31
31
  nodeGroup: Group,
32
32
  edgeGroup: Group,
33
33
  comboGroup: Group,
34
- transientItemMap: Record<string, Node | Edge | Combo | Group>,
35
- itemMap: Record<string, Node | Edge | Combo>,
34
+ transientItemMap: Map<ID, Node | Edge | Combo | Group>,
35
+ itemMap: Map<ID, Node | Edge | Combo>,
36
36
  graphCore?: GraphCore,
37
37
  onlyDrawKeyShape?: boolean,
38
38
  upsertAncestors = true,
39
39
  ) => {
40
- let transientItem = transientItemMap[item.model.id];
40
+ let transientItem = transientItemMap.get(item.model.id);
41
41
  if (transientItem) {
42
42
  return transientItem;
43
43
  }
@@ -78,7 +78,7 @@ export const upsertTransientItem = (
78
78
  const childItems = [];
79
79
  const children = graphCore.getChildren(item.model.id, 'combo');
80
80
  children.forEach((childModel) => {
81
- const childItem = itemMap[childModel.id];
81
+ const childItem = itemMap.get(childModel.id);
82
82
  if (childItem) {
83
83
  childItems.push(
84
84
  upsertTransientItem(
@@ -104,14 +104,18 @@ export const upsertTransientItem = (
104
104
  ) as Combo;
105
105
  transientItem.toBack();
106
106
  }
107
- transientItemMap[item.model.id] = transientItem;
107
+ transientItemMap.set(item.model.id, transientItem);
108
108
  transientItem.transient = true;
109
109
 
110
- if (item.type !== 'edge' && upsertAncestors) {
110
+ if (
111
+ item.type !== 'edge' &&
112
+ upsertAncestors &&
113
+ graphCore.hasTreeStructure('combo')
114
+ ) {
111
115
  // find the ancestors to upsert transients
112
116
  let currentAncestor = graphCore.getParent(item.model.id, 'combo');
113
117
  while (currentAncestor) {
114
- const ancestorItem = itemMap[currentAncestor.id];
118
+ const ancestorItem = itemMap.get(currentAncestor.id);
115
119
  if (ancestorItem) {
116
120
  const transientAncestor = upsertTransientItem(
117
121
  ancestorItem,
@@ -128,6 +132,5 @@ export const upsertTransientItem = (
128
132
  currentAncestor = graphCore.getParent(currentAncestor.id, 'combo');
129
133
  }
130
134
  }
131
-
132
135
  return transientItem;
133
136
  };
@@ -0,0 +1,165 @@
1
+ import Hierarchy from '@antv/hierarchy';
2
+
3
+ import { isArray, isNumber } from '@antv/util';
4
+ import { GraphData, ID, NodeModel } from 'types';
5
+ import { Point } from '../types/common';
6
+ import { traverse } from './data';
7
+ type TreeGraphData = any;
8
+ /**
9
+ * Judge the direction according to options of a tree layout.
10
+ * @param type Tree layout type.
11
+ * @param options Tree layout options.
12
+ * @returns
13
+ */
14
+ export const isTreeLayoutHorizontal = (type, options) => {
15
+ const { direction } = options;
16
+ switch (type) {
17
+ case 'compactBox':
18
+ case 'dendrogram':
19
+ return direction !== 'TB' && direction !== ' BT' && direction !== ' V';
20
+ case 'indented':
21
+ return true;
22
+ case 'mindmap':
23
+ return direction !== 'V';
24
+ }
25
+ };
26
+
27
+ /**
28
+ * Layout nodes on a single tree.
29
+ * @param treeData
30
+ * @param layoutType Tree layout type.
31
+ * @param layoutOptions Tree layout options.
32
+ * @param nodeMap
33
+ * @param nodePositions An array to store the result.
34
+ * @param begin The begin position for this tree, might be calculated from last tree.
35
+ * @returns Positions array.
36
+ */
37
+ export const layoutOneTree = (
38
+ treeData: TreeGraphData,
39
+ layoutType: string,
40
+ layoutOptions,
41
+ nodeMap,
42
+ nodePositions,
43
+ begin = [0, 0],
44
+ ) => {
45
+ const { treeGap = 50 } = layoutOptions;
46
+ const isHorizontal = isTreeLayoutHorizontal(layoutType, layoutOptions);
47
+ const layoutData = Hierarchy[layoutType](treeData, layoutOptions);
48
+ const range = [Infinity, -Infinity];
49
+ const treeNodeIds = [];
50
+ traverse(layoutData, (child) => {
51
+ const { id, x, y } = child;
52
+ treeNodeIds.push(id);
53
+ const dim = isHorizontal ? 'y' : 'x';
54
+ if (range[0] > child[dim]) range[0] = child[dim];
55
+ if (range[1] < child[dim]) range[1] = child[dim];
56
+ nodeMap.get(id).data = { x, y };
57
+ });
58
+ const diff = begin[isHorizontal ? 1 : 0] - range[0];
59
+ treeNodeIds.forEach((id) => {
60
+ const { x, y } = nodeMap.get(id).data;
61
+ nodePositions.push({
62
+ id,
63
+ data: isHorizontal ? { x, y: y + diff } : { x: x + diff, y },
64
+ });
65
+ });
66
+ begin[isHorizontal ? 1 : 0] += range[1] + diff + treeGap;
67
+ return nodePositions;
68
+ };
69
+
70
+ /**
71
+ * Whether the layout option is for combo layouts.
72
+ * @param options
73
+ * @returns
74
+ */
75
+ export const isComboLayout = (options) => {
76
+ const { type } = options;
77
+ if (['comboCombined', 'comboForce'].includes(type)) return true;
78
+ if (type === 'dagre' && options.sortByCombo) return true;
79
+ return false;
80
+ };
81
+
82
+ /**
83
+ * Whether the layout option is for tree layout.
84
+ * @param options
85
+ * @returns
86
+ */
87
+ export const isTreeLayout = (options) => {
88
+ const { type } = options;
89
+ return !!Hierarchy[type];
90
+ };
91
+
92
+ export const getNodeSizeFn = (options, defaultSize = 32) => {
93
+ if (options.nodeSize) return options.nodeSize;
94
+ return (node) => {
95
+ const { size, keyShape } = node.data;
96
+ if (isArray(size)) return Math.max(...size);
97
+ if (isNumber(size)) return size;
98
+ if (!keyShape) return defaultSize;
99
+ const { r, width, height } = keyShape;
100
+ if (!isNaN(r)) return r * 2;
101
+ const widthValid = !isNaN(width);
102
+ const heightValid = !isNaN(height);
103
+ if (widthValid && heightValid) return Math.max(width, height);
104
+ if (widthValid) return width;
105
+ if (heightValid) return height;
106
+ return defaultSize;
107
+ };
108
+ };
109
+
110
+ /**
111
+ *
112
+ * @param data Tree graph data
113
+ * @param layout
114
+ */
115
+ export const radialLayout = (
116
+ tree: TreeGraphData,
117
+ nodeMap: Map<ID, NodeModel>,
118
+ layout?: string,
119
+ ): GraphData => {
120
+ // 布局方式有 H / V / LR / RL / TB / BT
121
+ const VERTICAL_LAYOUTS: string[] = ['V', 'TB', 'BT'];
122
+ const min: Point = {
123
+ x: Infinity,
124
+ y: Infinity,
125
+ };
126
+
127
+ const max: Point = {
128
+ x: -Infinity,
129
+ y: -Infinity,
130
+ };
131
+ // 默认布局是垂直布局TB,此时x对应rad,y对应r
132
+ let rScale: 'x' | 'y' = 'x';
133
+ let radScale: 'x' | 'y' = 'y';
134
+ if (layout && VERTICAL_LAYOUTS.indexOf(layout) >= 0) {
135
+ // 若是水平布局,y对应rad,x对应r
136
+ radScale = 'x';
137
+ rScale = 'y';
138
+ }
139
+ let count = 0;
140
+ traverse(tree, (child) => {
141
+ count++;
142
+ const { x, y } = nodeMap.get(child.id).data;
143
+ if (x > max.x) max.x = x;
144
+ if (x < min.x) min.x = x;
145
+ if (y > max.y) max.y = y;
146
+ if (y < min.y) min.y = y;
147
+ });
148
+ const avgRad = (Math.PI * 2) / count;
149
+ const radDiff = max[radScale] - min[radScale];
150
+ if (radDiff === 0) return;
151
+
152
+ const root = nodeMap.get(tree.id);
153
+ traverse(tree, (child) => {
154
+ const node = nodeMap.get(child.id);
155
+ const radial =
156
+ ((node.data[radScale] - min[radScale]) / radDiff) *
157
+ (Math.PI * 2 - avgRad) +
158
+ avgRad;
159
+ const r = Math.abs(node.data[rScale] - root.data[rScale]);
160
+ node.data.x = r * Math.cos(radial);
161
+ node.data.y = r * Math.sin(radial);
162
+ return true;
163
+ });
164
+ return;
165
+ };
@@ -0,0 +1,145 @@
1
+ import { Tuple3Number } from '@antv/g';
2
+ import { vec2 } from '@antv/matrix-util';
3
+ import { LOOP_POSITION, LoopPosition } from '../types/loop';
4
+
5
+ const PI_OVER_8 = Math.PI / 8;
6
+
7
+ const radiansMap = {
8
+ [LOOP_POSITION.top]: [-5 * PI_OVER_8, -3 * PI_OVER_8],
9
+ [LOOP_POSITION['top-right']]: [-3 * PI_OVER_8, -PI_OVER_8],
10
+ [LOOP_POSITION.right]: [-PI_OVER_8, PI_OVER_8],
11
+ [LOOP_POSITION['bottom-right']]: [PI_OVER_8, 3 * PI_OVER_8],
12
+ [LOOP_POSITION.bottom]: [3 * PI_OVER_8, 5 * PI_OVER_8],
13
+ [LOOP_POSITION['bottom-left']]: [5 * PI_OVER_8, 7 * PI_OVER_8],
14
+ [LOOP_POSITION.left]: [7 * PI_OVER_8, 9 * PI_OVER_8],
15
+ [LOOP_POSITION['top-left']]: [-7 * PI_OVER_8, -5 * PI_OVER_8],
16
+ };
17
+
18
+ /**
19
+ * Calculates the start and end points of an ellipse based on the given position.
20
+ * @param {LoopPosition} position - The position of the ellipse (top, top-right, right, bottom-right, bottom, bottom-left, left, top-left).
21
+ * @param {Tuple3Number} center - The center coordinates.
22
+ * @param {number} halfOfWidth - Half of the width.
23
+ * @param {number} halfOfHeight - Half of the height.
24
+ * @returns {[vec2, vec2]} - An array containing the start and end points of the ellipse.
25
+ */
26
+ export const calculatePointForEllipse = (
27
+ position: LoopPosition,
28
+ center: Tuple3Number,
29
+ halfOfWidth: number,
30
+ halfOfHeight: number,
31
+ ): [vec2, vec2] => {
32
+ const [rstartX, rstartY, rendX, rendY] = getPointsOnEllipseAtAngles(
33
+ halfOfWidth,
34
+ halfOfHeight,
35
+ radiansMap[position]?.[0] || -PI_OVER_8,
36
+ radiansMap[position]?.[1] || PI_OVER_8,
37
+ );
38
+ return [
39
+ [center[0] + rstartX, center[1] + rstartY],
40
+ [center[0] + rendX, center[1] + rendY],
41
+ ];
42
+ };
43
+
44
+ /**
45
+ * Calculates the start and end points of a shape other than an ellipse based on the given position.
46
+ * @param {LoopPosition} position
47
+ * @param {Tuple3Number} center - The center coordinates.
48
+ * @param {number} halfOfWidth - Half of the width of keyShape.
49
+ * @param {number} halfOfHeight - Half of the height of keyShape.
50
+ * @param {number} customPointPadding - Optional custom padding for the point calculation.
51
+ */
52
+ export const calculatePointForOtherShapes = (
53
+ position: LoopPosition,
54
+ center: Tuple3Number,
55
+ halfOfWidth: number,
56
+ halfOfHeight: number,
57
+ customPointPadding?: number,
58
+ ): [vec2, vec2] => {
59
+ // For aesthetic considerations, pointPadding defaults to 1/4 of the minimum width and high school.
60
+ const defaultPointPadding = Math.min(halfOfHeight / 2, halfOfWidth / 2);
61
+ const maxPointPadding = Math.min(halfOfHeight, halfOfWidth);
62
+
63
+ const pointPadding = customPointPadding
64
+ ? Math.min(maxPointPadding, customPointPadding)
65
+ : defaultPointPadding;
66
+
67
+ const pointsPositionMap: Record<LoopPosition, [vec2, vec2]> = {
68
+ [LOOP_POSITION.top]: [
69
+ [center[0] - pointPadding, center[1] - halfOfHeight],
70
+ [center[0] + pointPadding, center[1] - halfOfHeight],
71
+ ],
72
+ [LOOP_POSITION['top-right']]: [
73
+ [center[0] + halfOfWidth - pointPadding, center[1] - halfOfHeight],
74
+ [center[0] + halfOfWidth, center[1] - halfOfHeight + pointPadding],
75
+ ],
76
+ [LOOP_POSITION.right]: [
77
+ [center[0] + halfOfWidth, center[1] - pointPadding],
78
+ [center[0] + halfOfWidth, center[1] + pointPadding],
79
+ ],
80
+ [LOOP_POSITION['bottom-right']]: [
81
+ [center[0] + halfOfWidth, center[1] + halfOfHeight - pointPadding],
82
+ [center[0] + halfOfWidth - pointPadding, center[1] + halfOfHeight],
83
+ ],
84
+ [LOOP_POSITION.bottom]: [
85
+ [center[0] + pointPadding, center[1] + halfOfHeight],
86
+ [center[0] - pointPadding, center[1] + halfOfHeight],
87
+ ],
88
+ [LOOP_POSITION['bottom-left']]: [
89
+ [center[0] - halfOfWidth + pointPadding, center[1] + halfOfHeight],
90
+ [center[0] - halfOfWidth, center[1] + halfOfHeight - pointPadding],
91
+ ],
92
+ [LOOP_POSITION.left]: [
93
+ [center[0] - halfOfWidth, center[1] + pointPadding],
94
+ [center[0] - halfOfWidth, center[1] - pointPadding],
95
+ ],
96
+ [LOOP_POSITION['top-left']]: [
97
+ [center[0] - halfOfWidth, center[1] - halfOfHeight + pointPadding],
98
+ [center[0] - halfOfWidth + pointPadding, center[1] - halfOfHeight],
99
+ ],
100
+ };
101
+ return pointsPositionMap[position] || pointsPositionMap[LOOP_POSITION.top];
102
+ };
103
+
104
+ /**
105
+ * Calculate the point on the ellipse at the given angle.
106
+ * @param {number} halfOfWidth - Half of the width of the ellipse.
107
+ * @param {number} halfOfHeight - Half of the height of the ellipse.
108
+ * @param {number} angleInRadians - The angle in radians.
109
+ * @returns {vec2} - The point on the ellipse at the given angle.
110
+ */
111
+ export const getPointOnEllipseAtAngle = (
112
+ halfOfWidth: number,
113
+ halfOfHeight: number,
114
+ angleInRadians: number,
115
+ ): vec2 => {
116
+ const x = halfOfWidth * Math.cos(angleInRadians);
117
+ const y = halfOfHeight * Math.sin(angleInRadians);
118
+ return [x, y];
119
+ };
120
+
121
+ /**
122
+ * Calculates an array of points on an ellipse at the given angles.
123
+ * @param {number} halfOfWidth - Half of the width of the ellipse.
124
+ * @param {number} halfOfHeight - Half of the height of the ellipse.
125
+ * @param {number} startAngle - The starting angle in radians.
126
+ * @param {number} endAngle - The ending angle in radians.
127
+ */
128
+ export const getPointsOnEllipseAtAngles = (
129
+ halfOfWidth: number,
130
+ halfOfHeight: number,
131
+ startAngle: number,
132
+ endAngle: number,
133
+ ) => {
134
+ const [rstartX, rstartY] = getPointOnEllipseAtAngle(
135
+ halfOfWidth,
136
+ halfOfHeight,
137
+ startAngle,
138
+ );
139
+ const [rendX, rendY] = getPointOnEllipseAtAngle(
140
+ halfOfWidth,
141
+ halfOfHeight,
142
+ endAngle,
143
+ );
144
+ return [rstartX, rstartY, rendX, rendY];
145
+ };
@@ -6,8 +6,11 @@ import { NodeDisplayModelData } from '../types/node';
6
6
  export const DEFAULT_MAPPER = {
7
7
  node: (innerNodeModel) => {
8
8
  const { id, data } = innerNodeModel;
9
- const { color, label, icon, badges, anchorPoints } = data;
10
- const resultData: NodeDisplayModelData = { ...data, keyShape: {} };
9
+ const { color, label, icon, badges, keyShape } = data;
10
+ const resultData: NodeDisplayModelData = {
11
+ ...data,
12
+ keyShape: { ...keyShape },
13
+ };
11
14
  if (color) {
12
15
  resultData.keyShape.fill = color;
13
16
  }
@@ -22,11 +25,6 @@ export const DEFAULT_MAPPER = {
22
25
  if (badges) {
23
26
  resultData.badgeShapes = badges;
24
27
  }
25
- if (anchorPoints) {
26
- resultData.anchorShapes = anchorPoints.map((point) => ({
27
- position: point,
28
- }));
29
- }
30
28
  return {
31
29
  id,
32
30
  data: resultData,
@@ -34,8 +32,11 @@ export const DEFAULT_MAPPER = {
34
32
  },
35
33
  edge: (innerEdgeModel) => {
36
34
  const { id, source, target, data } = innerEdgeModel;
37
- const { color, label, icon, badge } = data;
38
- const resultData: NodeDisplayModelData = { ...data, keyShape: {} };
35
+ const { color, label, icon, badge, keyShape } = data;
36
+ const resultData: NodeDisplayModelData = {
37
+ ...data,
38
+ keyShape: { ...keyShape },
39
+ };
39
40
  if (color) {
40
41
  resultData.keyShape.stroke = color;
41
42
  }
package/src/util/math.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { Point, PolyPoint } from 'types/common';
2
+
1
3
  /**
2
4
  * Whether the value is begween the range of [min, max]
3
5
  * @param {number} value the value to be judged
@@ -7,3 +9,25 @@
7
9
  */
8
10
  export const isBetween = (value: number, min: number, max: number) =>
9
11
  value >= min && value <= max;
12
+
13
+ /**
14
+ * Calculate the manhattan distance between two points
15
+ * @param p1 the first 2d point
16
+ * @param p2 the second 2d point
17
+ * @returns Sum of the absolute coordinate differences of two points
18
+ */
19
+ export const manhattanDist = (
20
+ p1: Point | PolyPoint,
21
+ p2: Point | PolyPoint,
22
+ ): number => Math.abs(p1.x - p2.x) + Math.abs(p1.y - p2.y);
23
+
24
+ /**
25
+ *
26
+ * @param p1
27
+ * @param p2
28
+ * @returns
29
+ */
30
+ export const eulerDist = (
31
+ p1: Point | PolyPoint,
32
+ p2: Point | PolyPoint,
33
+ ): number => Math.sqrt((p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2);
@@ -0,0 +1,72 @@
1
+ import { uniqueId } from '@antv/util';
2
+ /**
3
+ * mock graph data
4
+ * @param nodeCount node count
5
+ * @returns
6
+ */
7
+ export const mock = (nodeCount: number) => {
8
+ const nodeIds = [];
9
+ const nodes = Array.from({ length: nodeCount }).map((node, index) => {
10
+ const id = `node-${index}`;
11
+ nodeIds.push(id);
12
+ return {
13
+ id,
14
+ data: {},
15
+ };
16
+ });
17
+
18
+ const fullEdges = [];
19
+ for (let i = 0; i < nodeCount; i = i + 1) {
20
+ for (let j = 0; j < nodeCount - 1; j = j + 1) {
21
+ fullEdges.push({
22
+ source: `node-${i}`,
23
+ target: `node-${j}`,
24
+ id: uniqueId('edge_id_'),
25
+ data: {},
26
+ });
27
+ }
28
+ }
29
+
30
+ return {
31
+ /**
32
+ * circle graph
33
+ * @param centerId center id
34
+ * @returns
35
+ */
36
+ circle: (centerId = '') => {
37
+ let id = centerId;
38
+ if (nodeIds.indexOf(id) === -1) {
39
+ id = 'node-0';
40
+ }
41
+ const edges = fullEdges.filter((edge) => {
42
+ return edge.source === id || edge.target === id;
43
+ });
44
+ return {
45
+ nodes,
46
+ edges,
47
+ };
48
+ },
49
+ /**
50
+ * random graph
51
+ * @param ratio random sparsity, default 0.5
52
+ */
53
+ random: (ratio = 0.5) => {
54
+ const length: number = parseInt(String(nodeCount * ratio));
55
+
56
+ const randomArray: string[] = nodeIds
57
+ .sort(() => Math.random() - 0.5)
58
+ .slice(0, length);
59
+
60
+ const edges = fullEdges
61
+ .filter((edge) => {
62
+ return randomArray.indexOf(edge.target) !== -1;
63
+ })
64
+ .sort(() => Math.random() - 0.5)
65
+ .slice(0, length);
66
+ return {
67
+ nodes,
68
+ edges,
69
+ };
70
+ },
71
+ };
72
+ };