@antv/g6 5.0.0-alpha.9 → 5.0.0-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 (897) 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 +11 -0
  9. package/esm/api-doc/item.js +5 -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 +321 -224
  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 +22 -18
  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 +103 -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 +95 -5
  134. package/esm/stdlib/item/edge/base.js +106 -9
  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 +121 -3
  161. package/esm/stdlib/item/node/base.js +158 -15
  162. package/esm/stdlib/item/node/base.js.map +1 -1
  163. package/esm/stdlib/item/node/base3d.d.ts +23 -0
  164. package/esm/stdlib/item/node/base3d.js +24 -9
  165. package/esm/stdlib/item/node/base3d.js.map +1 -1
  166. package/esm/stdlib/item/node/circle.js +5 -5
  167. package/esm/stdlib/item/node/circle.js.map +1 -1
  168. package/esm/stdlib/item/node/diamond.d.ts +32 -0
  169. package/esm/stdlib/item/node/diamond.js +79 -0
  170. package/esm/stdlib/item/node/diamond.js.map +1 -0
  171. package/esm/stdlib/item/node/donut.d.ts +70 -0
  172. package/esm/stdlib/item/node/donut.js +207 -0
  173. package/esm/stdlib/item/node/donut.js.map +1 -0
  174. package/esm/stdlib/item/node/ellipse.d.ts +32 -0
  175. package/esm/stdlib/item/node/ellipse.js +71 -0
  176. package/esm/stdlib/item/node/ellipse.js.map +1 -0
  177. package/esm/stdlib/item/node/hexagon.d.ts +33 -0
  178. package/esm/stdlib/item/node/hexagon.js +102 -0
  179. package/esm/stdlib/item/node/hexagon.js.map +1 -0
  180. package/esm/stdlib/item/node/index.d.ts +7 -0
  181. package/esm/stdlib/item/node/index.js +7 -0
  182. package/esm/stdlib/item/node/index.js.map +1 -1
  183. package/esm/stdlib/item/node/modelRect.d.ts +61 -0
  184. package/esm/stdlib/item/node/modelRect.js +186 -0
  185. package/esm/stdlib/item/node/modelRect.js.map +1 -0
  186. package/esm/stdlib/item/node/rect.d.ts +1 -0
  187. package/esm/stdlib/item/node/rect.js +16 -0
  188. package/esm/stdlib/item/node/rect.js.map +1 -1
  189. package/esm/stdlib/item/node/star.d.ts +34 -0
  190. package/esm/stdlib/item/node/star.js +115 -0
  191. package/esm/stdlib/item/node/star.js.map +1 -0
  192. package/esm/stdlib/item/node/triangle.d.ts +44 -0
  193. package/esm/stdlib/item/node/triangle.js +177 -0
  194. package/esm/stdlib/item/node/triangle.js.map +1 -0
  195. package/esm/stdlib/plugin/fisheye/index.d.ts +32 -4
  196. package/esm/stdlib/plugin/fisheye/index.js +3 -2
  197. package/esm/stdlib/plugin/fisheye/index.js.map +1 -1
  198. package/esm/stdlib/plugin/grid/index.d.ts +36 -0
  199. package/esm/stdlib/plugin/grid/index.js +81 -0
  200. package/esm/stdlib/plugin/grid/index.js.map +1 -0
  201. package/esm/stdlib/plugin/history/combo-command.d.ts +9 -0
  202. package/esm/stdlib/plugin/history/combo-command.js +21 -0
  203. package/esm/stdlib/plugin/history/combo-command.js.map +1 -0
  204. package/esm/stdlib/plugin/history/command.d.ts +18 -0
  205. package/esm/stdlib/plugin/history/command.js +51 -0
  206. package/esm/stdlib/plugin/history/command.js.map +1 -0
  207. package/esm/stdlib/plugin/history/index.d.ts +112 -0
  208. package/esm/stdlib/plugin/history/index.js +275 -0
  209. package/esm/stdlib/plugin/history/index.js.map +1 -0
  210. package/esm/stdlib/plugin/history/item-data-command.d.ts +14 -0
  211. package/esm/stdlib/plugin/history/item-data-command.js +63 -0
  212. package/esm/stdlib/plugin/history/item-data-command.js.map +1 -0
  213. package/esm/stdlib/plugin/history/layer-updated-command.d.ts +9 -0
  214. package/esm/stdlib/plugin/history/layer-updated-command.js +21 -0
  215. package/esm/stdlib/plugin/history/layer-updated-command.js.map +1 -0
  216. package/esm/stdlib/plugin/history/state-updated-command.d.ts +9 -0
  217. package/esm/stdlib/plugin/history/state-updated-command.js +20 -0
  218. package/esm/stdlib/plugin/history/state-updated-command.js.map +1 -0
  219. package/esm/stdlib/plugin/history/visibility-updated-command.d.ts +10 -0
  220. package/esm/stdlib/plugin/history/visibility-updated-command.js +23 -0
  221. package/esm/stdlib/plugin/history/visibility-updated-command.js.map +1 -0
  222. package/esm/stdlib/plugin/hull/bubbleset.d.ts +9 -0
  223. package/esm/stdlib/plugin/hull/bubbleset.js +592 -0
  224. package/esm/stdlib/plugin/hull/bubbleset.js.map +1 -0
  225. package/esm/stdlib/plugin/hull/convexHull.d.ts +14 -0
  226. package/esm/stdlib/plugin/hull/convexHull.js +56 -0
  227. package/esm/stdlib/plugin/hull/convexHull.js.map +1 -0
  228. package/esm/stdlib/plugin/hull/hullComponent.d.ts +87 -0
  229. package/esm/stdlib/plugin/hull/hullComponent.js +382 -0
  230. package/esm/stdlib/plugin/hull/hullComponent.js.map +1 -0
  231. package/esm/stdlib/plugin/hull/index.d.ts +59 -0
  232. package/esm/stdlib/plugin/hull/index.js +161 -0
  233. package/esm/stdlib/plugin/hull/index.js.map +1 -0
  234. package/esm/stdlib/plugin/hull/types.d.ts +15 -0
  235. package/esm/stdlib/plugin/hull/types.js +2 -0
  236. package/esm/stdlib/plugin/hull/types.js.map +1 -0
  237. package/esm/stdlib/plugin/hull/util.d.ts +77 -0
  238. package/esm/stdlib/plugin/hull/util.js +401 -0
  239. package/esm/stdlib/plugin/hull/util.js.map +1 -0
  240. package/esm/stdlib/plugin/index.d.ts +8 -0
  241. package/esm/stdlib/plugin/index.js +9 -0
  242. package/esm/stdlib/plugin/index.js.map +1 -0
  243. package/esm/stdlib/plugin/legend/index.d.ts +45 -3
  244. package/esm/stdlib/plugin/legend/index.js +51 -44
  245. package/esm/stdlib/plugin/legend/index.js.map +1 -1
  246. package/esm/stdlib/plugin/menu/index.d.ts +18 -5
  247. package/esm/stdlib/plugin/menu/index.js +4 -3
  248. package/esm/stdlib/plugin/menu/index.js.map +1 -1
  249. package/esm/stdlib/plugin/minimap/index.d.ts +11 -3
  250. package/esm/stdlib/plugin/minimap/index.js +19 -21
  251. package/esm/stdlib/plugin/minimap/index.js.map +1 -1
  252. package/esm/stdlib/plugin/toolbar/index.d.ts +59 -0
  253. package/esm/stdlib/plugin/toolbar/index.js +215 -0
  254. package/esm/stdlib/plugin/toolbar/index.js.map +1 -0
  255. package/esm/stdlib/plugin/tooltip/index.d.ts +24 -3
  256. package/esm/stdlib/plugin/tooltip/index.js +13 -12
  257. package/esm/stdlib/plugin/tooltip/index.js.map +1 -1
  258. package/esm/stdlib/plugin/types.d.ts +8 -0
  259. package/esm/stdlib/plugin/types.js +2 -0
  260. package/esm/stdlib/plugin/types.js.map +1 -0
  261. package/esm/stdlib/theme/dark.d.ts +1 -2
  262. package/esm/stdlib/theme/dark.js +9 -1
  263. package/esm/stdlib/theme/dark.js.map +1 -1
  264. package/esm/stdlib/theme/index.d.ts +2 -0
  265. package/esm/stdlib/theme/index.js +3 -0
  266. package/esm/stdlib/theme/index.js.map +1 -0
  267. package/esm/stdlib/theme/light.d.ts +1 -2
  268. package/esm/stdlib/theme/light.js +12 -2
  269. package/esm/stdlib/theme/light.js.map +1 -1
  270. package/esm/stdlib/themeSolver/base.d.ts +1 -1
  271. package/esm/stdlib/themeSolver/base.js +1 -1
  272. package/esm/stdlib/themeSolver/base.js.map +1 -1
  273. package/esm/stdlib/themeSolver/index.d.ts +3 -0
  274. package/esm/stdlib/themeSolver/index.js +4 -0
  275. package/esm/stdlib/themeSolver/index.js.map +1 -0
  276. package/esm/stdlib/themeSolver/spec.d.ts +2 -4
  277. package/esm/stdlib/themeSolver/spec.js +2 -2
  278. package/esm/stdlib/themeSolver/spec.js.map +1 -1
  279. package/esm/stdlib/themeSolver/subject.d.ts +2 -4
  280. package/esm/stdlib/themeSolver/subject.js +2 -2
  281. package/esm/stdlib/themeSolver/subject.js.map +1 -1
  282. package/esm/types/behavior.js.map +1 -1
  283. package/esm/types/combo.d.ts +3 -4
  284. package/esm/types/common.d.ts +10 -0
  285. package/esm/types/data.d.ts +10 -4
  286. package/esm/types/edge.d.ts +17 -2
  287. package/esm/types/graph.d.ts +129 -16
  288. package/esm/types/history.d.ts +28 -0
  289. package/esm/types/history.js +6 -0
  290. package/esm/types/history.js.map +1 -0
  291. package/esm/types/hook.d.ts +25 -5
  292. package/esm/types/index.d.ts +11 -5
  293. package/esm/types/index.js.map +1 -1
  294. package/esm/types/item.d.ts +10 -4
  295. package/esm/types/item.js.map +1 -1
  296. package/esm/types/layout.d.ts +4 -1
  297. package/esm/types/loop.d.ts +21 -0
  298. package/esm/types/loop.js +12 -0
  299. package/esm/types/loop.js.map +1 -0
  300. package/esm/types/node.d.ts +87 -6
  301. package/esm/types/plugin.d.ts +4 -0
  302. package/esm/types/plugin.js +1 -1
  303. package/esm/types/plugin.js.map +1 -1
  304. package/esm/types/spec.d.ts +27 -10
  305. package/esm/types/theme.d.ts +76 -10
  306. package/esm/types/theme.js +1 -2
  307. package/esm/types/theme.js.map +1 -1
  308. package/esm/util/animate.d.ts +2 -2
  309. package/esm/util/animate.js +52 -17
  310. package/esm/util/animate.js.map +1 -1
  311. package/esm/util/array.d.ts +8 -0
  312. package/esm/util/array.js +11 -1
  313. package/esm/util/array.js.map +1 -1
  314. package/esm/util/arrow.d.ts +17 -0
  315. package/esm/util/arrow.js +56 -0
  316. package/esm/util/arrow.js.map +1 -0
  317. package/esm/util/bbox.d.ts +106 -0
  318. package/esm/util/bbox.js +255 -0
  319. package/esm/util/bbox.js.map +1 -0
  320. package/esm/util/behavior.d.ts +2 -0
  321. package/esm/util/behavior.js +12 -0
  322. package/esm/util/behavior.js.map +1 -0
  323. package/esm/util/canvas.d.ts +1 -2
  324. package/esm/util/canvas.js +3 -20
  325. package/esm/util/canvas.js.map +1 -1
  326. package/esm/util/data.d.ts +33 -2
  327. package/esm/util/data.js +117 -5
  328. package/esm/util/data.js.map +1 -1
  329. package/esm/util/event.d.ts +22 -2
  330. package/esm/util/event.js +54 -0
  331. package/esm/util/event.js.map +1 -1
  332. package/esm/util/extend.d.ts +8 -2
  333. package/esm/util/extend.js.map +1 -1
  334. package/esm/util/index.d.ts +41 -3
  335. package/esm/util/index.js +20 -1
  336. package/esm/util/index.js.map +1 -1
  337. package/esm/util/item.d.ts +1 -1
  338. package/esm/util/item.js +7 -5
  339. package/esm/util/item.js.map +1 -1
  340. package/esm/util/layout.d.ts +40 -0
  341. package/esm/util/layout.js +160 -0
  342. package/esm/util/layout.js.map +1 -0
  343. package/esm/util/loop.d.ts +37 -0
  344. package/esm/util/loop.js +104 -0
  345. package/esm/util/loop.js.map +1 -0
  346. package/esm/util/mapper.js +4 -9
  347. package/esm/util/mapper.js.map +1 -1
  348. package/esm/util/math.d.ts +15 -0
  349. package/esm/util/math.js +14 -0
  350. package/esm/util/math.js.map +1 -1
  351. package/esm/util/mock.d.ts +30 -0
  352. package/esm/util/mock.js +69 -0
  353. package/esm/util/mock.js.map +1 -0
  354. package/esm/util/path.d.ts +11 -0
  355. package/esm/util/path.js +44 -0
  356. package/esm/util/path.js.map +1 -0
  357. package/esm/util/point.d.ts +24 -2
  358. package/esm/util/point.js +27 -2
  359. package/esm/util/point.js.map +1 -1
  360. package/esm/util/polyline.d.ts +113 -0
  361. package/esm/util/polyline.js +505 -0
  362. package/esm/util/polyline.js.map +1 -0
  363. package/esm/util/router.d.ts +31 -0
  364. package/esm/util/router.js +380 -0
  365. package/esm/util/router.js.map +1 -0
  366. package/esm/util/shape.d.ts +3 -3
  367. package/esm/util/shape.js +19 -3
  368. package/esm/util/shape.js.map +1 -1
  369. package/esm/util/shape3d.d.ts +1 -1
  370. package/esm/util/shape3d.js +12 -6
  371. package/esm/util/shape3d.js.map +1 -1
  372. package/esm/util/type.d.ts +6 -0
  373. package/esm/util/type.js +7 -1
  374. package/esm/util/type.js.map +1 -1
  375. package/esm/util/zoom.d.ts +1 -1
  376. package/esm/util/zoom.js +6 -2
  377. package/esm/util/zoom.js.map +1 -1
  378. package/lib/api-doc/behaviors.d.ts +2 -0
  379. package/lib/api-doc/behaviors.js +18 -0
  380. package/lib/api-doc/behaviors.js.map +1 -0
  381. package/lib/api-doc/graph.d.ts +4 -0
  382. package/lib/api-doc/graph.js +11 -0
  383. package/lib/api-doc/graph.js.map +1 -0
  384. package/lib/api-doc/item.d.ts +11 -0
  385. package/lib/api-doc/item.js +25 -0
  386. package/lib/api-doc/item.js.map +1 -0
  387. package/lib/api-doc/layout.d.ts +1 -0
  388. package/lib/api-doc/layout.js +3 -0
  389. package/lib/api-doc/layout.js.map +1 -0
  390. package/lib/api-doc/plugins.d.ts +1 -0
  391. package/lib/api-doc/plugins.js +18 -0
  392. package/lib/api-doc/plugins.js.map +1 -0
  393. package/lib/api-doc/types.d.ts +0 -0
  394. package/lib/api-doc/types.js +3 -0
  395. package/lib/api-doc/types.js.map +1 -0
  396. package/lib/api-doc/util.d.ts +3 -0
  397. package/lib/api-doc/util.js +10 -0
  398. package/lib/api-doc/util.js.map +1 -0
  399. package/lib/constant/shape.d.ts +7 -14
  400. package/lib/constant/shape.js +1 -0
  401. package/lib/constant/shape.js.map +1 -1
  402. package/lib/index.d.ts +213 -113
  403. package/lib/index.js +13 -3
  404. package/lib/index.js.map +1 -1
  405. package/lib/item/combo.d.ts +13 -6
  406. package/lib/item/combo.js +72 -8
  407. package/lib/item/combo.js.map +1 -1
  408. package/lib/item/edge.d.ts +12 -9
  409. package/lib/item/edge.js +38 -11
  410. package/lib/item/edge.js.map +1 -1
  411. package/lib/item/item.d.ts +8 -6
  412. package/lib/item/item.js +123 -80
  413. package/lib/item/item.js.map +1 -1
  414. package/lib/item/node.d.ts +14 -9
  415. package/lib/item/node.js +63 -48
  416. package/lib/item/node.js.map +1 -1
  417. package/lib/runtime/controller/data.d.ts +17 -1
  418. package/lib/runtime/controller/data.js +319 -222
  419. package/lib/runtime/controller/data.js.map +1 -1
  420. package/lib/runtime/controller/interaction.d.ts +1 -0
  421. package/lib/runtime/controller/interaction.js +7 -4
  422. package/lib/runtime/controller/interaction.js.map +1 -1
  423. package/lib/runtime/controller/item.d.ts +37 -4
  424. package/lib/runtime/controller/item.js +474 -176
  425. package/lib/runtime/controller/item.js.map +1 -1
  426. package/lib/runtime/controller/layout.d.ts +4 -1
  427. package/lib/runtime/controller/layout.js +119 -14
  428. package/lib/runtime/controller/layout.js.map +1 -1
  429. package/lib/runtime/controller/plugin.d.ts +11 -0
  430. package/lib/runtime/controller/plugin.js +39 -6
  431. package/lib/runtime/controller/plugin.js.map +1 -1
  432. package/lib/runtime/controller/theme.js +8 -4
  433. package/lib/runtime/controller/theme.js.map +1 -1
  434. package/lib/runtime/graph.d.ts +181 -39
  435. package/lib/runtime/graph.js +560 -71
  436. package/lib/runtime/graph.js.map +1 -1
  437. package/lib/stdlib/behavior/activate-relations.d.ts +2 -3
  438. package/lib/stdlib/behavior/activate-relations.js +14 -9
  439. package/lib/stdlib/behavior/activate-relations.js.map +1 -1
  440. package/lib/stdlib/behavior/brush-select.d.ts +3 -4
  441. package/lib/stdlib/behavior/brush-select.js +3 -2
  442. package/lib/stdlib/behavior/brush-select.js.map +1 -1
  443. package/lib/stdlib/behavior/click-select.d.ts +2 -3
  444. package/lib/stdlib/behavior/click-select.js +9 -6
  445. package/lib/stdlib/behavior/click-select.js.map +1 -1
  446. package/lib/stdlib/behavior/collapse-expand-combo.d.ts +1 -2
  447. package/lib/stdlib/behavior/collapse-expand-combo.js +2 -1
  448. package/lib/stdlib/behavior/collapse-expand-combo.js.map +1 -1
  449. package/lib/stdlib/behavior/collapse-expand-tree.d.ts +44 -0
  450. package/lib/stdlib/behavior/collapse-expand-tree.js +73 -0
  451. package/lib/stdlib/behavior/collapse-expand-tree.js.map +1 -0
  452. package/lib/stdlib/behavior/drag-canvas.d.ts +1 -2
  453. package/lib/stdlib/behavior/drag-canvas.js +23 -18
  454. package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
  455. package/lib/stdlib/behavior/drag-combo.d.ts +16 -4
  456. package/lib/stdlib/behavior/drag-combo.js +70 -30
  457. package/lib/stdlib/behavior/drag-combo.js.map +1 -1
  458. package/lib/stdlib/behavior/drag-node.d.ts +20 -4
  459. package/lib/stdlib/behavior/drag-node.js +145 -56
  460. package/lib/stdlib/behavior/drag-node.js.map +1 -1
  461. package/lib/stdlib/behavior/hover-activate.d.ts +1 -2
  462. package/lib/stdlib/behavior/hover-activate.js +2 -1
  463. package/lib/stdlib/behavior/hover-activate.js.map +1 -1
  464. package/lib/stdlib/behavior/index.d.ts +15 -0
  465. package/lib/stdlib/behavior/index.js +32 -0
  466. package/lib/stdlib/behavior/index.js.map +1 -0
  467. package/lib/stdlib/behavior/lasso-select.d.ts +7 -3
  468. package/lib/stdlib/behavior/lasso-select.js +4 -6
  469. package/lib/stdlib/behavior/lasso-select.js.map +1 -1
  470. package/lib/stdlib/behavior/orbit-canvas-3d.d.ts +2 -3
  471. package/lib/stdlib/behavior/orbit-canvas-3d.js +4 -6
  472. package/lib/stdlib/behavior/orbit-canvas-3d.js.map +1 -1
  473. package/lib/stdlib/behavior/rotate-canvas-3d.d.ts +1 -2
  474. package/lib/stdlib/behavior/rotate-canvas-3d.js +2 -1
  475. package/lib/stdlib/behavior/rotate-canvas-3d.js.map +1 -1
  476. package/lib/stdlib/behavior/track-canvas-3d.d.ts +2 -3
  477. package/lib/stdlib/behavior/track-canvas-3d.js +4 -6
  478. package/lib/stdlib/behavior/track-canvas-3d.js.map +1 -1
  479. package/lib/stdlib/behavior/types.d.ts +13 -0
  480. package/lib/stdlib/behavior/types.js +3 -0
  481. package/lib/stdlib/behavior/types.js.map +1 -0
  482. package/lib/stdlib/behavior/zoom-canvas-3d.d.ts +1 -2
  483. package/lib/stdlib/behavior/zoom-canvas-3d.js +8 -7
  484. package/lib/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
  485. package/lib/stdlib/behavior/zoom-canvas.d.ts +1 -2
  486. package/lib/stdlib/behavior/zoom-canvas.js +21 -18
  487. package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
  488. package/lib/stdlib/data/index.d.ts +3 -0
  489. package/lib/stdlib/data/index.js +20 -0
  490. package/lib/stdlib/data/index.js.map +1 -0
  491. package/lib/stdlib/data/mapNodeSize.d.ts +12 -0
  492. package/lib/stdlib/data/mapNodeSize.js +47 -0
  493. package/lib/stdlib/data/mapNodeSize.js.map +1 -0
  494. package/lib/stdlib/data/transformV4Data.d.ts +9 -0
  495. package/lib/stdlib/data/transformV4Data.js +146 -0
  496. package/lib/stdlib/data/transformV4Data.js.map +1 -0
  497. package/lib/stdlib/data/validateData.d.ts +9 -0
  498. package/lib/stdlib/data/validateData.js +107 -0
  499. package/lib/stdlib/data/validateData.js.map +1 -0
  500. package/lib/stdlib/index.d.ts +113 -69
  501. package/lib/stdlib/index.js +188 -67
  502. package/lib/stdlib/index.js.map +1 -1
  503. package/lib/stdlib/item/combo/index.d.ts +2 -0
  504. package/lib/stdlib/item/combo/index.js +19 -0
  505. package/lib/stdlib/item/combo/index.js.map +1 -0
  506. package/lib/stdlib/item/combo/rect.d.ts +31 -0
  507. package/lib/stdlib/item/combo/rect.js +69 -0
  508. package/lib/stdlib/item/combo/rect.js.map +1 -0
  509. package/lib/stdlib/item/edge/base.d.ts +95 -5
  510. package/lib/stdlib/item/edge/base.js +105 -8
  511. package/lib/stdlib/item/edge/base.js.map +1 -1
  512. package/{esm/stdlib/item/edge/cubic-horizon.d.ts → lib/stdlib/item/edge/cubic-horizontal.d.ts} +6 -7
  513. package/lib/stdlib/item/edge/{cubic-horizon.js → cubic-horizontal.js} +20 -35
  514. package/lib/stdlib/item/edge/cubic-horizontal.js.map +1 -0
  515. package/lib/stdlib/item/edge/cubic-vertical.d.ts +7 -8
  516. package/lib/stdlib/item/edge/cubic-vertical.js +17 -32
  517. package/lib/stdlib/item/edge/cubic-vertical.js.map +1 -1
  518. package/lib/stdlib/item/edge/cubic.d.ts +7 -8
  519. package/lib/stdlib/item/edge/cubic.js +22 -5
  520. package/lib/stdlib/item/edge/cubic.js.map +1 -1
  521. package/lib/stdlib/item/edge/index.d.ts +5 -0
  522. package/lib/stdlib/item/edge/index.js +5 -0
  523. package/lib/stdlib/item/edge/index.js.map +1 -1
  524. package/lib/stdlib/item/edge/line.d.ts +1 -1
  525. package/lib/stdlib/item/edge/line.js +16 -1
  526. package/lib/stdlib/item/edge/line.js.map +1 -1
  527. package/lib/stdlib/item/edge/loop.d.ts +32 -0
  528. package/lib/stdlib/item/edge/loop.js +119 -0
  529. package/lib/stdlib/item/edge/loop.js.map +1 -0
  530. package/lib/stdlib/item/edge/polyline.d.ts +44 -0
  531. package/lib/stdlib/item/edge/polyline.js +96 -0
  532. package/lib/stdlib/item/edge/polyline.js.map +1 -0
  533. package/lib/stdlib/item/edge/quadratic.d.ts +5 -6
  534. package/lib/stdlib/item/edge/quadratic.js +33 -21
  535. package/lib/stdlib/item/edge/quadratic.js.map +1 -1
  536. package/lib/stdlib/item/node/base.d.ts +121 -3
  537. package/lib/stdlib/item/node/base.js +158 -15
  538. package/lib/stdlib/item/node/base.js.map +1 -1
  539. package/lib/stdlib/item/node/base3d.d.ts +23 -0
  540. package/lib/stdlib/item/node/base3d.js +24 -9
  541. package/lib/stdlib/item/node/base3d.js.map +1 -1
  542. package/lib/stdlib/item/node/circle.js +5 -5
  543. package/lib/stdlib/item/node/circle.js.map +1 -1
  544. package/lib/stdlib/item/node/diamond.d.ts +32 -0
  545. package/lib/stdlib/item/node/diamond.js +83 -0
  546. package/lib/stdlib/item/node/diamond.js.map +1 -0
  547. package/lib/stdlib/item/node/donut.d.ts +70 -0
  548. package/lib/stdlib/item/node/donut.js +211 -0
  549. package/lib/stdlib/item/node/donut.js.map +1 -0
  550. package/lib/stdlib/item/node/ellipse.d.ts +32 -0
  551. package/lib/stdlib/item/node/ellipse.js +75 -0
  552. package/lib/stdlib/item/node/ellipse.js.map +1 -0
  553. package/lib/stdlib/item/node/hexagon.d.ts +33 -0
  554. package/lib/stdlib/item/node/hexagon.js +106 -0
  555. package/lib/stdlib/item/node/hexagon.js.map +1 -0
  556. package/lib/stdlib/item/node/index.d.ts +7 -0
  557. package/lib/stdlib/item/node/index.js +7 -0
  558. package/lib/stdlib/item/node/index.js.map +1 -1
  559. package/lib/stdlib/item/node/modelRect.d.ts +61 -0
  560. package/lib/stdlib/item/node/modelRect.js +190 -0
  561. package/lib/stdlib/item/node/modelRect.js.map +1 -0
  562. package/lib/stdlib/item/node/rect.d.ts +1 -0
  563. package/lib/stdlib/item/node/rect.js +16 -0
  564. package/lib/stdlib/item/node/rect.js.map +1 -1
  565. package/lib/stdlib/item/node/star.d.ts +34 -0
  566. package/lib/stdlib/item/node/star.js +119 -0
  567. package/lib/stdlib/item/node/star.js.map +1 -0
  568. package/lib/stdlib/item/node/triangle.d.ts +44 -0
  569. package/lib/stdlib/item/node/triangle.js +181 -0
  570. package/lib/stdlib/item/node/triangle.js.map +1 -0
  571. package/lib/stdlib/plugin/fisheye/index.d.ts +32 -4
  572. package/lib/stdlib/plugin/fisheye/index.js +3 -1
  573. package/lib/stdlib/plugin/fisheye/index.js.map +1 -1
  574. package/lib/stdlib/plugin/grid/index.d.ts +36 -0
  575. package/lib/stdlib/plugin/grid/index.js +85 -0
  576. package/lib/stdlib/plugin/grid/index.js.map +1 -0
  577. package/lib/stdlib/plugin/history/combo-command.d.ts +9 -0
  578. package/lib/stdlib/plugin/history/combo-command.js +25 -0
  579. package/lib/stdlib/plugin/history/combo-command.js.map +1 -0
  580. package/lib/stdlib/plugin/history/command.d.ts +18 -0
  581. package/lib/stdlib/plugin/history/command.js +54 -0
  582. package/lib/stdlib/plugin/history/command.js.map +1 -0
  583. package/lib/stdlib/plugin/history/index.d.ts +112 -0
  584. package/lib/stdlib/plugin/history/index.js +283 -0
  585. package/lib/stdlib/plugin/history/index.js.map +1 -0
  586. package/lib/stdlib/plugin/history/item-data-command.d.ts +14 -0
  587. package/lib/stdlib/plugin/history/item-data-command.js +67 -0
  588. package/lib/stdlib/plugin/history/item-data-command.js.map +1 -0
  589. package/lib/stdlib/plugin/history/layer-updated-command.d.ts +9 -0
  590. package/lib/stdlib/plugin/history/layer-updated-command.js +25 -0
  591. package/lib/stdlib/plugin/history/layer-updated-command.js.map +1 -0
  592. package/lib/stdlib/plugin/history/state-updated-command.d.ts +9 -0
  593. package/lib/stdlib/plugin/history/state-updated-command.js +24 -0
  594. package/lib/stdlib/plugin/history/state-updated-command.js.map +1 -0
  595. package/lib/stdlib/plugin/history/visibility-updated-command.d.ts +10 -0
  596. package/lib/stdlib/plugin/history/visibility-updated-command.js +27 -0
  597. package/lib/stdlib/plugin/history/visibility-updated-command.js.map +1 -0
  598. package/lib/stdlib/plugin/hull/bubbleset.d.ts +9 -0
  599. package/lib/stdlib/plugin/hull/bubbleset.js +596 -0
  600. package/lib/stdlib/plugin/hull/bubbleset.js.map +1 -0
  601. package/lib/stdlib/plugin/hull/convexHull.d.ts +14 -0
  602. package/lib/stdlib/plugin/hull/convexHull.js +61 -0
  603. package/lib/stdlib/plugin/hull/convexHull.js.map +1 -0
  604. package/lib/stdlib/plugin/hull/hullComponent.d.ts +87 -0
  605. package/lib/stdlib/plugin/hull/hullComponent.js +385 -0
  606. package/lib/stdlib/plugin/hull/hullComponent.js.map +1 -0
  607. package/lib/stdlib/plugin/hull/index.d.ts +59 -0
  608. package/lib/stdlib/plugin/hull/index.js +167 -0
  609. package/lib/stdlib/plugin/hull/index.js.map +1 -0
  610. package/lib/stdlib/plugin/hull/types.d.ts +15 -0
  611. package/lib/stdlib/plugin/hull/types.js +3 -0
  612. package/lib/stdlib/plugin/hull/types.js.map +1 -0
  613. package/lib/stdlib/plugin/hull/util.d.ts +77 -0
  614. package/lib/stdlib/plugin/hull/util.js +419 -0
  615. package/lib/stdlib/plugin/hull/util.js.map +1 -0
  616. package/lib/stdlib/plugin/index.d.ts +8 -0
  617. package/lib/stdlib/plugin/index.js +25 -0
  618. package/lib/stdlib/plugin/index.js.map +1 -0
  619. package/lib/stdlib/plugin/legend/index.d.ts +45 -3
  620. package/lib/stdlib/plugin/legend/index.js +50 -42
  621. package/lib/stdlib/plugin/legend/index.js.map +1 -1
  622. package/lib/stdlib/plugin/menu/index.d.ts +18 -5
  623. package/lib/stdlib/plugin/menu/index.js +5 -3
  624. package/lib/stdlib/plugin/menu/index.js.map +1 -1
  625. package/lib/stdlib/plugin/minimap/index.d.ts +11 -3
  626. package/lib/stdlib/plugin/minimap/index.js +19 -20
  627. package/lib/stdlib/plugin/minimap/index.js.map +1 -1
  628. package/lib/stdlib/plugin/toolbar/index.d.ts +59 -0
  629. package/lib/stdlib/plugin/toolbar/index.js +222 -0
  630. package/lib/stdlib/plugin/toolbar/index.js.map +1 -0
  631. package/lib/stdlib/plugin/tooltip/index.d.ts +24 -3
  632. package/lib/stdlib/plugin/tooltip/index.js +14 -12
  633. package/lib/stdlib/plugin/tooltip/index.js.map +1 -1
  634. package/lib/stdlib/plugin/types.d.ts +8 -0
  635. package/lib/stdlib/plugin/types.js +3 -0
  636. package/lib/stdlib/plugin/types.js.map +1 -0
  637. package/lib/stdlib/theme/dark.d.ts +1 -2
  638. package/lib/stdlib/theme/dark.js +10 -1
  639. package/lib/stdlib/theme/dark.js.map +1 -1
  640. package/lib/stdlib/theme/index.d.ts +2 -0
  641. package/lib/stdlib/theme/index.js +19 -0
  642. package/lib/stdlib/theme/index.js.map +1 -0
  643. package/lib/stdlib/theme/light.d.ts +1 -2
  644. package/lib/stdlib/theme/light.js +13 -2
  645. package/lib/stdlib/theme/light.js.map +1 -1
  646. package/lib/stdlib/themeSolver/base.d.ts +1 -1
  647. package/lib/stdlib/themeSolver/base.js +2 -1
  648. package/lib/stdlib/themeSolver/base.js.map +1 -1
  649. package/lib/stdlib/themeSolver/index.d.ts +3 -0
  650. package/lib/stdlib/themeSolver/index.js +20 -0
  651. package/lib/stdlib/themeSolver/index.js.map +1 -0
  652. package/lib/stdlib/themeSolver/spec.d.ts +2 -4
  653. package/lib/stdlib/themeSolver/spec.js +4 -6
  654. package/lib/stdlib/themeSolver/spec.js.map +1 -1
  655. package/lib/stdlib/themeSolver/subject.d.ts +2 -4
  656. package/lib/stdlib/themeSolver/subject.js +4 -4
  657. package/lib/stdlib/themeSolver/subject.js.map +1 -1
  658. package/lib/types/behavior.js.map +1 -1
  659. package/lib/types/combo.d.ts +3 -4
  660. package/lib/types/common.d.ts +10 -0
  661. package/lib/types/data.d.ts +10 -4
  662. package/lib/types/edge.d.ts +17 -2
  663. package/lib/types/graph.d.ts +129 -16
  664. package/lib/types/history.d.ts +28 -0
  665. package/lib/types/history.js +9 -0
  666. package/lib/types/history.js.map +1 -0
  667. package/lib/types/hook.d.ts +25 -5
  668. package/lib/types/index.d.ts +11 -5
  669. package/lib/types/index.js.map +1 -1
  670. package/lib/types/item.d.ts +10 -4
  671. package/lib/types/item.js.map +1 -1
  672. package/lib/types/layout.d.ts +4 -1
  673. package/lib/types/loop.d.ts +21 -0
  674. package/lib/types/loop.js +15 -0
  675. package/lib/types/loop.js.map +1 -0
  676. package/lib/types/node.d.ts +87 -6
  677. package/lib/types/plugin.d.ts +4 -0
  678. package/lib/types/plugin.js.map +1 -1
  679. package/lib/types/spec.d.ts +27 -10
  680. package/lib/types/theme.d.ts +76 -10
  681. package/lib/types/theme.js +1 -2
  682. package/lib/types/theme.js.map +1 -1
  683. package/lib/util/animate.d.ts +2 -2
  684. package/lib/util/animate.js +52 -17
  685. package/lib/util/animate.js.map +1 -1
  686. package/lib/util/array.d.ts +8 -0
  687. package/lib/util/array.js +13 -2
  688. package/lib/util/array.js.map +1 -1
  689. package/lib/util/arrow.d.ts +17 -0
  690. package/lib/util/arrow.js +60 -0
  691. package/lib/util/arrow.js.map +1 -0
  692. package/lib/util/bbox.d.ts +106 -0
  693. package/lib/util/bbox.js +273 -0
  694. package/lib/util/bbox.js.map +1 -0
  695. package/lib/util/behavior.d.ts +2 -0
  696. package/lib/util/behavior.js +16 -0
  697. package/lib/util/behavior.js.map +1 -0
  698. package/lib/util/canvas.d.ts +1 -2
  699. package/lib/util/canvas.js +3 -20
  700. package/lib/util/canvas.js.map +1 -1
  701. package/lib/util/data.d.ts +33 -2
  702. package/lib/util/data.js +121 -6
  703. package/lib/util/data.js.map +1 -1
  704. package/lib/util/event.d.ts +22 -2
  705. package/lib/util/event.js +56 -1
  706. package/lib/util/event.js.map +1 -1
  707. package/lib/util/extend.d.ts +8 -2
  708. package/lib/util/extend.js.map +1 -1
  709. package/lib/util/index.d.ts +41 -3
  710. package/lib/util/index.js +20 -1
  711. package/lib/util/index.js.map +1 -1
  712. package/lib/util/item.d.ts +1 -1
  713. package/lib/util/item.js +7 -5
  714. package/lib/util/item.js.map +1 -1
  715. package/lib/util/layout.d.ts +40 -0
  716. package/lib/util/layout.js +172 -0
  717. package/lib/util/layout.js.map +1 -0
  718. package/lib/util/loop.d.ts +37 -0
  719. package/lib/util/loop.js +111 -0
  720. package/lib/util/loop.js.map +1 -0
  721. package/lib/util/mapper.js +4 -9
  722. package/lib/util/mapper.js.map +1 -1
  723. package/lib/util/math.d.ts +15 -0
  724. package/lib/util/math.js +17 -1
  725. package/lib/util/math.js.map +1 -1
  726. package/lib/util/mock.d.ts +30 -0
  727. package/lib/util/mock.js +73 -0
  728. package/lib/util/mock.js.map +1 -0
  729. package/lib/util/path.d.ts +11 -0
  730. package/lib/util/path.js +49 -0
  731. package/lib/util/path.js.map +1 -0
  732. package/lib/util/point.d.ts +24 -2
  733. package/lib/util/point.js +31 -3
  734. package/lib/util/point.js.map +1 -1
  735. package/lib/util/polyline.d.ts +113 -0
  736. package/lib/util/polyline.js +524 -0
  737. package/lib/util/polyline.js.map +1 -0
  738. package/lib/util/router.d.ts +31 -0
  739. package/lib/util/router.js +384 -0
  740. package/lib/util/router.js.map +1 -0
  741. package/lib/util/shape.d.ts +3 -3
  742. package/lib/util/shape.js +19 -3
  743. package/lib/util/shape.js.map +1 -1
  744. package/lib/util/shape3d.d.ts +1 -1
  745. package/lib/util/shape3d.js +11 -5
  746. package/lib/util/shape3d.js.map +1 -1
  747. package/lib/util/type.d.ts +6 -0
  748. package/lib/util/type.js +9 -2
  749. package/lib/util/type.js.map +1 -1
  750. package/lib/util/zoom.d.ts +1 -1
  751. package/lib/util/zoom.js +6 -2
  752. package/lib/util/zoom.js.map +1 -1
  753. package/package.json +35 -15
  754. package/src/api-doc/behaviors.ts +2 -0
  755. package/src/api-doc/graph.ts +4 -0
  756. package/src/api-doc/item.ts +45 -0
  757. package/src/api-doc/layout.ts +13 -0
  758. package/src/api-doc/plugins.ts +1 -0
  759. package/src/api-doc/readme.md +59 -0
  760. package/src/api-doc/types.ts +2 -0
  761. package/src/api-doc/util.ts +3 -0
  762. package/src/constant/shape.ts +4 -1
  763. package/src/index.ts +14 -4
  764. package/src/item/combo.ts +105 -18
  765. package/src/item/edge.ts +68 -18
  766. package/src/item/item.ts +138 -82
  767. package/src/item/node.ts +100 -54
  768. package/src/runtime/controller/data.ts +411 -259
  769. package/src/runtime/controller/interaction.ts +8 -4
  770. package/src/runtime/controller/item.ts +690 -252
  771. package/src/runtime/controller/layout.ts +147 -14
  772. package/src/runtime/controller/plugin.ts +59 -10
  773. package/src/runtime/controller/theme.ts +8 -4
  774. package/src/runtime/graph.ts +721 -130
  775. package/src/stdlib/behavior/activate-relations.ts +14 -11
  776. package/src/stdlib/behavior/brush-select.ts +4 -5
  777. package/src/stdlib/behavior/click-select.ts +12 -10
  778. package/src/stdlib/behavior/collapse-expand-combo.ts +1 -3
  779. package/src/stdlib/behavior/collapse-expand-tree.ts +106 -0
  780. package/src/stdlib/behavior/drag-canvas.ts +22 -20
  781. package/src/stdlib/behavior/drag-combo.ts +109 -53
  782. package/src/stdlib/behavior/drag-node.ts +220 -83
  783. package/src/stdlib/behavior/hover-activate.ts +1 -2
  784. package/src/stdlib/behavior/index.ts +15 -0
  785. package/src/stdlib/behavior/lasso-select.ts +6 -2
  786. package/src/stdlib/behavior/orbit-canvas-3d.ts +2 -4
  787. package/src/stdlib/behavior/rotate-canvas-3d.ts +1 -3
  788. package/src/stdlib/behavior/track-canvas-3d.ts +2 -4
  789. package/src/stdlib/behavior/types.ts +15 -0
  790. package/src/stdlib/behavior/zoom-canvas-3d.ts +5 -7
  791. package/src/stdlib/behavior/zoom-canvas.ts +19 -19
  792. package/src/stdlib/data/index.ts +3 -0
  793. package/src/stdlib/data/mapNodeSize.ts +67 -0
  794. package/src/stdlib/data/transformV4Data.ts +207 -0
  795. package/src/stdlib/data/validateData.ts +151 -0
  796. package/src/stdlib/index.ts +215 -53
  797. package/src/stdlib/item/combo/index.ts +2 -0
  798. package/src/stdlib/item/combo/rect.ts +123 -0
  799. package/src/stdlib/item/edge/base.ts +156 -8
  800. package/src/stdlib/item/edge/{cubic-horizon.ts → cubic-horizontal.ts} +25 -53
  801. package/src/stdlib/item/edge/cubic-vertical.ts +24 -55
  802. package/src/stdlib/item/edge/cubic.ts +36 -36
  803. package/src/stdlib/item/edge/index.ts +5 -0
  804. package/src/stdlib/item/edge/line.ts +14 -15
  805. package/src/stdlib/item/edge/loop.ts +162 -0
  806. package/src/stdlib/item/edge/polyline.ts +161 -0
  807. package/src/stdlib/item/edge/quadratic.ts +34 -37
  808. package/src/stdlib/item/node/base.ts +195 -15
  809. package/src/stdlib/item/node/base3d.ts +25 -9
  810. package/src/stdlib/item/node/circle.ts +5 -5
  811. package/src/stdlib/item/node/diamond.ts +144 -0
  812. package/src/stdlib/item/node/donut.ts +368 -0
  813. package/src/stdlib/item/node/ellipse.ts +128 -0
  814. package/src/stdlib/item/node/hexagon.ts +168 -0
  815. package/src/stdlib/item/node/index.ts +7 -0
  816. package/src/stdlib/item/node/modelRect.ts +405 -0
  817. package/src/stdlib/item/node/rect.ts +17 -0
  818. package/src/stdlib/item/node/star.ts +181 -0
  819. package/src/stdlib/item/node/triangle.ts +265 -0
  820. package/src/stdlib/plugin/fisheye/index.ts +35 -6
  821. package/src/stdlib/plugin/grid/index.ts +125 -0
  822. package/src/stdlib/plugin/history/combo-command.ts +28 -0
  823. package/src/stdlib/plugin/history/command.ts +81 -0
  824. package/src/stdlib/plugin/history/index.ts +347 -0
  825. package/src/stdlib/plugin/history/item-data-command.ts +96 -0
  826. package/src/stdlib/plugin/history/layer-updated-command.ts +28 -0
  827. package/src/stdlib/plugin/history/state-updated-command.ts +36 -0
  828. package/src/stdlib/plugin/history/visibility-updated-command.ts +41 -0
  829. package/src/stdlib/plugin/hull/bubbleset.ts +828 -0
  830. package/src/stdlib/plugin/hull/convexHull.ts +68 -0
  831. package/src/stdlib/plugin/hull/hullComponent.ts +501 -0
  832. package/src/stdlib/plugin/hull/index.ts +234 -0
  833. package/src/stdlib/plugin/hull/types.ts +15 -0
  834. package/src/stdlib/plugin/hull/util.ts +511 -0
  835. package/src/stdlib/plugin/index.ts +8 -0
  836. package/src/stdlib/plugin/legend/index.ts +126 -64
  837. package/src/stdlib/plugin/menu/index.ts +21 -6
  838. package/src/stdlib/plugin/minimap/index.ts +35 -26
  839. package/src/stdlib/plugin/toolbar/index.ts +257 -0
  840. package/src/stdlib/plugin/tooltip/index.ts +38 -18
  841. package/src/stdlib/plugin/types.ts +8 -0
  842. package/src/stdlib/theme/dark.ts +9 -1
  843. package/src/stdlib/theme/index.ts +2 -0
  844. package/src/stdlib/theme/light.ts +13 -3
  845. package/src/stdlib/themeSolver/base.ts +1 -1
  846. package/src/stdlib/themeSolver/index.ts +3 -0
  847. package/src/stdlib/themeSolver/spec.ts +2 -5
  848. package/src/stdlib/themeSolver/subject.ts +2 -5
  849. package/src/types/behavior.ts +0 -1
  850. package/src/types/combo.ts +3 -4
  851. package/src/types/common.ts +13 -0
  852. package/src/types/data.ts +23 -4
  853. package/src/types/edge.ts +28 -4
  854. package/src/types/graph.ts +161 -11
  855. package/src/types/history.ts +30 -0
  856. package/src/types/hook.ts +29 -6
  857. package/src/types/index.ts +37 -12
  858. package/src/types/item.ts +15 -2
  859. package/src/types/layout.ts +20 -16
  860. package/src/types/loop.ts +23 -0
  861. package/src/types/node.ts +91 -11
  862. package/src/types/plugin.ts +7 -1
  863. package/src/types/spec.ts +31 -14
  864. package/src/types/theme.ts +80 -10
  865. package/src/util/animate.ts +58 -17
  866. package/src/util/array.ts +12 -1
  867. package/src/util/arrow.ts +62 -0
  868. package/src/util/bbox.ts +298 -0
  869. package/src/util/behavior.ts +14 -0
  870. package/src/util/canvas.ts +6 -24
  871. package/src/util/data.ts +134 -5
  872. package/src/util/event.ts +86 -2
  873. package/src/util/extend.ts +8 -2
  874. package/src/util/index.ts +31 -1
  875. package/src/util/item.ts +11 -8
  876. package/src/util/layout.ts +165 -0
  877. package/src/util/loop.ts +145 -0
  878. package/src/util/mapper.ts +10 -9
  879. package/src/util/math.ts +24 -0
  880. package/src/util/mock.ts +72 -0
  881. package/src/util/path.ts +52 -0
  882. package/src/util/point.ts +33 -2
  883. package/src/util/polyline.ts +676 -0
  884. package/src/util/router.ts +552 -0
  885. package/src/util/shape.ts +23 -7
  886. package/src/util/shape3d.ts +16 -11
  887. package/src/util/type.ts +8 -1
  888. package/src/util/zoom.ts +7 -3
  889. package/esm/stdlib/data/comboFromNode.d.ts +0 -9
  890. package/esm/stdlib/data/comboFromNode.js +0 -28
  891. package/esm/stdlib/data/comboFromNode.js.map +0 -1
  892. package/esm/stdlib/item/edge/cubic-horizon.js.map +0 -1
  893. package/lib/stdlib/data/comboFromNode.d.ts +0 -9
  894. package/lib/stdlib/data/comboFromNode.js +0 -32
  895. package/lib/stdlib/data/comboFromNode.js.map +0 -1
  896. package/lib/stdlib/item/edge/cubic-horizon.js.map +0 -1
  897. package/src/stdlib/data/comboFromNode.ts +0 -28
@@ -1,16 +1,16 @@
1
- import { Graph as GraphLib, GraphView, ID } from '@antv/graphlib';
2
- import {
3
- clone,
4
- isArray,
5
- isFunction,
6
- isNumber,
7
- isObject,
8
- isString,
9
- } from '@antv/util';
1
+ import { Graph as GraphLib, ID } from '@antv/graphlib';
2
+ import { clone, isArray, isObject } from '@antv/util';
10
3
  import { registery as registry } from '../../stdlib';
11
4
  import { ComboModel, ComboUserModel, GraphData, IGraph } from '../../types';
12
5
  import { ComboUserModelData } from '../../types/combo';
13
- import { DataChangeType, GraphCore } from '../../types/data';
6
+ import {
7
+ DataChangeType,
8
+ DataConfig,
9
+ FetchDataConfig,
10
+ GraphCore,
11
+ InlineGraphDataConfig,
12
+ InlineTreeDataConfig,
13
+ } from '../../types/data';
14
14
  import {
15
15
  EdgeModel,
16
16
  EdgeModelData,
@@ -24,14 +24,18 @@ import {
24
24
  NodeUserModel,
25
25
  NodeUserModelData,
26
26
  } from '../../types/node';
27
- import { getExtension } from '../../util/extension';
28
27
  import {
29
28
  deconstructData,
30
29
  graphComboTreeDfs,
31
- graphCoreTreeDfs,
32
- isSucceed,
30
+ graphData2TreeData,
31
+ traverse,
32
+ treeData2GraphData,
33
33
  validateComboStrucutre,
34
34
  } from '../../util/data';
35
+ import { getExtension } from '../../util/extension';
36
+ import { convertToNumber } from '../../util/type';
37
+ import { isTreeLayout } from '../../util/layout';
38
+ import { hasTreeBehaviors } from '../../util/behavior';
35
39
 
36
40
  /**
37
41
  * Manages the data transform extensions;
@@ -49,7 +53,10 @@ export class DataController {
49
53
  */
50
54
  public graphCore: GraphCore;
51
55
 
52
- private comboTreeView: GraphView<any, any>;
56
+ /**
57
+ * A flag to note whether the tree data structure should be recalculated and establish.
58
+ */
59
+ private treeDirtyFlag: boolean;
53
60
 
54
61
  constructor(graph: IGraph<any, any>) {
55
62
  this.graph = graph;
@@ -142,14 +149,25 @@ export class DataController {
142
149
  private tap() {
143
150
  this.extensions = this.getExtensions();
144
151
  this.graph.hooks.datachange.tap(this.onDataChange.bind(this));
152
+ this.graph.hooks.treecollapseexpand.tap(
153
+ this.onTreeCollapseExpand.bind(this),
154
+ );
155
+
156
+ // check whether use tree layout or behaviors
157
+ // if so, establish tree structure for graph
158
+ this.graph.hooks.layout.tap(this.onLayout.bind(this));
159
+ this.graph.hooks.init.tap(this.onGraphInit.bind(this));
160
+ this.graph.hooks.behaviorchange.tap(this.onBehaviorChange.bind(this));
161
+ this.graph.hooks.modechange.tap(this.onModeChange.bind(this));
145
162
  }
146
163
 
147
164
  /**
148
165
  * Get the extensions from useLib.
149
166
  */
150
167
  private getExtensions() {
151
- const { transform = [] } = this.graph.getSpecification();
152
- return transform
168
+ const { transforms = [] } = this.graph.getSpecification();
169
+ const requiredTransformers = ['validate-data'];
170
+ return [...transforms, ...requiredTransformers]
153
171
  .map((config) => ({
154
172
  config,
155
173
  func: getExtension(config, registry.useLib, 'transform'),
@@ -161,29 +179,29 @@ export class DataController {
161
179
  * Listener of graph's datachange hook.
162
180
  * @param param contains new graph data and type of data change
163
181
  */
164
- private onDataChange(param: { data: GraphData; type: DataChangeType }) {
182
+ private onDataChange(param: { data: DataConfig; type: DataChangeType }) {
165
183
  const { data, type: changeType } = param;
184
+ const { userGraphCore } = this;
166
185
  const change = () => {
167
186
  switch (changeType) {
168
187
  case 'remove':
169
- this.removeData(data);
188
+ this.removeData(data as GraphData);
170
189
  break;
171
190
  case 'update':
172
191
  this.updateData(data);
173
192
  break;
174
193
  case 'moveCombo':
175
- this.moveCombo(data);
194
+ this.moveCombo(data as GraphData);
176
195
  break;
177
196
  case 'addCombo':
178
- this.addCombo(data);
197
+ this.addCombo(data as GraphData);
179
198
  break;
180
199
  default:
181
- // 'replace' | 'mergeReplace' | 'union'
200
+ // changeType is 'replace' | 'mergeReplace' | 'union'
182
201
  this.changeData(data, changeType);
183
202
  break;
184
203
  }
185
204
  };
186
- const { userGraphCore } = this;
187
205
  if (userGraphCore) {
188
206
  userGraphCore.batch(change);
189
207
  } else {
@@ -191,30 +209,88 @@ export class DataController {
191
209
  }
192
210
  }
193
211
 
212
+ private onTreeCollapseExpand(params: {
213
+ ids: ID[];
214
+ action: 'collapse' | 'expand';
215
+ }) {
216
+ const { ids, action } = params;
217
+ ids.forEach((id) => {
218
+ this.userGraphCore.mergeNodeData(id, {
219
+ collapsed: action === 'collapse',
220
+ });
221
+ });
222
+ }
223
+
224
+ private onLayout({ options }) {
225
+ if (this.treeDirtyFlag && isTreeLayout(options)) {
226
+ this.establishUserGraphCoreTree();
227
+ }
228
+ }
229
+
230
+ private onGraphInit() {
231
+ const { modes = {} } = this.graph.getSpecification();
232
+ const mode = this.graph.getMode() || 'default';
233
+ if (hasTreeBehaviors(modes[mode])) {
234
+ this.establishUserGraphCoreTree();
235
+ }
236
+ }
237
+
238
+ private onBehaviorChange(param: {
239
+ action: 'update' | 'add' | 'remove';
240
+ modes: string[];
241
+ behaviors: (string | { type: string; key: string })[];
242
+ }) {
243
+ const { action, modes, behaviors } = param;
244
+ const mode = this.graph.getMode() || 'default';
245
+ if (action !== 'add' || !modes.includes(mode)) return;
246
+ if (hasTreeBehaviors(behaviors)) {
247
+ this.establishUserGraphCoreTree();
248
+ }
249
+ }
250
+
251
+ private onModeChange(param: { mode: string }) {
252
+ const { modes = {} } = this.graph.getSpecification();
253
+ if (hasTreeBehaviors(modes[param.mode])) {
254
+ this.establishUserGraphCoreTree();
255
+ }
256
+ }
257
+
258
+ private establishUserGraphCoreTree() {
259
+ if (!this.treeDirtyFlag) return;
260
+ const nodes = this.userGraphCore.getAllNodes();
261
+ const edges = this.userGraphCore.getAllEdges();
262
+ this.userGraphCore.batch(() => {
263
+ // graph data to tree structure and storing
264
+ const rootIds = nodes
265
+ .filter((node) => node.data.isRoot)
266
+ .map((node) => node.id);
267
+ graphData2TreeData({}, { nodes, edges }, rootIds).forEach((tree) => {
268
+ traverse(tree, (node) => {
269
+ node.children?.forEach((child) => {
270
+ this.userGraphCore.setParent(child.id, node.id, 'tree');
271
+ });
272
+ });
273
+ });
274
+ });
275
+ this.treeDirtyFlag = false;
276
+ }
277
+
194
278
  /**
195
279
  * Change data by replace, merge repalce, or union.
196
280
  * @param data new data
197
281
  * @param changeType type of data change, 'replace' means discard the old data. 'mergeReplace' means merge the common part. 'union' means merge whole sets of old and new one
198
282
  */
199
283
  private changeData(
200
- data: GraphData,
284
+ dataConfig: DataConfig,
201
285
  changeType: 'replace' | 'mergeReplace' | 'union',
202
286
  ) {
203
- const { userGraphCore } = this;
287
+ const { type: dataType, data } = this.formatData(dataConfig) || {};
288
+ if (!dataType) return;
289
+
290
+ const { nodes = [], edges = [], combos = [] } = this.transformData(data);
291
+
204
292
  if (changeType === 'replace') {
205
293
  this.userGraphCore = new GraphLib<NodeUserModelData, EdgeUserModelData>({
206
- nodes: data.nodes.concat(
207
- data.combos?.map((combo) => ({
208
- id: combo.id,
209
- data: { ...combo.data, _isCombo: true },
210
- })) || [],
211
- ),
212
- edges: data.edges,
213
- onChanged: (event) => this.updateGraphCore(event),
214
- });
215
- const { data: transformedData } = this.transformData();
216
- const { nodes = [], edges = [], combos = [] } = transformedData;
217
- this.graphCore = new GraphLib<NodeModelData, EdgeModelData>({
218
294
  nodes: nodes.concat(
219
295
  combos?.map((combo) => ({
220
296
  id: combo.id,
@@ -222,12 +298,20 @@ export class DataController {
222
298
  })) || [],
223
299
  ),
224
300
  edges,
301
+ onChanged: (event) => this.updateGraphCore(event),
225
302
  });
303
+ this.graphCore = new GraphLib<NodeModelData, EdgeModelData>(
304
+ clone({
305
+ nodes: nodes.concat(
306
+ combos?.map((combo) => ({
307
+ id: combo.id,
308
+ data: { ...combo.data, _isCombo: true },
309
+ })) || [],
310
+ ),
311
+ edges,
312
+ }),
313
+ );
226
314
  if (combos?.length) {
227
- this.comboTreeView = new GraphView<NodeModelData, EdgeModelData>({
228
- graph: this.graphCore,
229
- cache: 'manual',
230
- });
231
315
  this.graphCore.attachTreeStructure('combo');
232
316
  nodes.forEach((node) => {
233
317
  if (node.data.parentId) {
@@ -257,11 +341,11 @@ export class DataController {
257
341
  });
258
342
  }
259
343
  } else {
344
+ const { userGraphCore } = this;
260
345
  const prevData = deconstructData({
261
346
  nodes: userGraphCore.getAllNodes(),
262
- edges: userGraphCore.getAllEdges(),
347
+ edges: [],
263
348
  });
264
- const { nodes = [], edges = [], combos = [] } = data;
265
349
  const nodesAndCombos = nodes.concat(
266
350
  combos.map((combo) => ({
267
351
  id: combo.id,
@@ -294,6 +378,7 @@ export class DataController {
294
378
  }
295
379
 
296
380
  // =========== edge ============
381
+ prevData.edges = userGraphCore.getAllEdges();
297
382
  if (!prevData.edges.length) {
298
383
  userGraphCore.addEdges(edges);
299
384
  } else {
@@ -317,6 +402,15 @@ export class DataController {
317
402
  });
318
403
  }
319
404
  }
405
+
406
+ if (data.edges?.length) {
407
+ const { userGraphCore } = this;
408
+ // convert and store tree structure to graphCore
409
+ this.updateTreeGraph(dataType, {
410
+ nodes: userGraphCore.getAllNodes(),
411
+ edges: userGraphCore.getAllEdges(),
412
+ });
413
+ }
320
414
  }
321
415
 
322
416
  /**
@@ -331,12 +425,14 @@ export class DataController {
331
425
  const prevEdges = userGraphCore.getAllEdges();
332
426
  if (prevNodesAndCombos.length && nodesAndCombos.length) {
333
427
  // update the parentId
334
- nodesAndCombos.forEach((item) => {
335
- const { parentId } = item.data;
336
- this.graphCore.getChildren(item.id, 'combo').forEach((child) => {
337
- userGraphCore.mergeNodeData(child.id, { parentId });
428
+ if (this.graphCore.hasTreeStructure('combo')) {
429
+ nodesAndCombos.forEach((item) => {
430
+ const { parentId } = item.data;
431
+ this.graphCore.getChildren(item.id, 'combo').forEach((child) => {
432
+ userGraphCore.mergeNodeData(child.id, { parentId });
433
+ });
338
434
  });
339
- });
435
+ }
340
436
  // remove the node
341
437
  userGraphCore.removeNodes(nodesAndCombos.map((node) => node.id));
342
438
  }
@@ -353,9 +449,11 @@ export class DataController {
353
449
  * Update part of old data.
354
450
  * @param data data to be updated which is part of old one
355
451
  */
356
- private updateData(data: GraphData) {
452
+ private updateData(dataConfig: DataConfig) {
357
453
  const { userGraphCore } = this;
358
- const { nodes = [], edges = [], combos = [] } = data;
454
+ const { type: dataType, data } = this.formatData(dataConfig);
455
+ if (!dataType) return;
456
+ const { nodes = [], edges = [], combos = [] } = data; //this.transformData(data as GraphData);
359
457
  const {
360
458
  nodes: prevNodes,
361
459
  edges: prevEdges,
@@ -453,6 +551,47 @@ export class DataController {
453
551
  userGraphCore.mergeNodeData(id, data);
454
552
  });
455
553
  }
554
+
555
+ if (
556
+ edges?.filter(
557
+ (edge) =>
558
+ edge.hasOwnProperty('source') || edge.hasOwnProperty('target'),
559
+ ).length
560
+ ) {
561
+ // convert and store tree structure to graphCore
562
+ this.updateTreeGraph(dataType, {
563
+ nodes: this.userGraphCore.getAllNodes(),
564
+ edges: this.userGraphCore.getAllEdges(),
565
+ });
566
+ }
567
+ }
568
+
569
+ private formatData(dataConfig: DataConfig): {
570
+ data: GraphData;
571
+ type: 'graphData' | 'treeData' | 'fetch';
572
+ } {
573
+ const { type, value } = dataConfig as
574
+ | InlineGraphDataConfig
575
+ | InlineTreeDataConfig
576
+ | FetchDataConfig;
577
+ let data = value;
578
+ if (!type) {
579
+ data = dataConfig as GraphData;
580
+ } else if (type === 'treeData') {
581
+ data = treeData2GraphData(value);
582
+ } else if (type === 'fetch') {
583
+ // TODO: fetch
584
+ } else if (!(data as GraphData).nodes) {
585
+ console.warn(
586
+ 'Input data type is invalid, the type shuold be "graphData", "treeData", or "fetch".',
587
+ );
588
+ return;
589
+ }
590
+
591
+ return {
592
+ type: type || 'graphData',
593
+ data: data as GraphData,
594
+ };
456
595
  }
457
596
 
458
597
  /**
@@ -548,10 +687,14 @@ export class DataController {
548
687
  private updateGraphCore(event) {
549
688
  const { graphCore } = this;
550
689
 
551
- // === step 1: clone data from userGraphCore (userData) ===
552
- // === step 2: transform the data with transform extensions, output innerData and idMaps ===
553
- const { data: transformedData, idMaps } = this.transformData();
554
- const { nodes = [], edges = [], combos = [] } = transformedData;
690
+ const {
691
+ nodes = [],
692
+ edges = [],
693
+ combos = [],
694
+ } = deconstructData({
695
+ nodes: this.userGraphCore.getAllNodes(),
696
+ edges: this.userGraphCore.getAllEdges(),
697
+ });
555
698
 
556
699
  const prevNodesAndCombos = graphCore.getAllNodes();
557
700
 
@@ -564,9 +707,10 @@ export class DataController {
564
707
  diff = [],
565
708
  ) => {
566
709
  if (isNodeOrCombo) {
567
- if (newValue.data) graphCore.updateNodeData(id, newValue.data);
710
+ if (newValue.data) graphCore.updateNodeData(id, { ...newValue.data });
568
711
  } else {
569
- if (diff.includes('data')) graphCore.updateEdgeData(id, newValue.data);
712
+ if (diff.includes('data'))
713
+ graphCore.updateEdgeData(id, { ...newValue.data });
570
714
  // source and target may be changed
571
715
  if (diff.includes('source'))
572
716
  graphCore.updateEdgeSource(id, newValue.source);
@@ -577,201 +721,196 @@ export class DataController {
577
721
 
578
722
  graphCore.batch(() => {
579
723
  // === step 3: sync to graphCore according to the changes in userGraphCore ==
580
- if (!idMaps?.length || idMaps.length !== this.extensions.length) {
581
- // situation 1: not every extension has corresponding idMap, use default mapping: suppose id is not changed by transforms
582
- // and diff the value in graphCore whose id is not in userGraphCore
583
- const newModelMap: {
584
- [id: string]: {
585
- type: 'node' | 'edge' | 'combo';
586
- model: NodeModel | EdgeModel | ComboModel;
724
+ const newModelMap: {
725
+ [id: string]: {
726
+ type: 'node' | 'edge' | 'combo';
727
+ model: NodeModel | EdgeModel | ComboModel;
728
+ };
729
+ } = {};
730
+ const parentMap: {
731
+ [id: string]: {
732
+ new: ID;
733
+ old?: ID;
734
+ };
735
+ } = {};
736
+ const changeMap: {
737
+ [id: string]: boolean;
738
+ } = {};
739
+ const treeChanges = [];
740
+ event.changes.forEach((change) => {
741
+ const id = change.id || change.value?.id;
742
+ if (id !== undefined) {
743
+ changeMap[id] = true;
744
+ return;
745
+ }
746
+ if (
747
+ [
748
+ 'TreeStructureAttached',
749
+ 'TreeStructureChanged',
750
+ 'TreeStructureChanged',
751
+ ].includes(change.type)
752
+ ) {
753
+ treeChanges.push(change);
754
+ }
755
+ });
756
+ nodes.forEach((model) => {
757
+ newModelMap[model.id] = { type: 'node', model };
758
+ if (model.data.hasOwnProperty('parentId')) {
759
+ parentMap[model.id] = {
760
+ new: model.data.parentId,
761
+ old: undefined,
587
762
  };
588
- } = {};
589
- const parentMap: {
590
- [id: string]: { new: ID; old?: ID };
591
- } = {};
592
- const changeMap: {
593
- [id: string]: boolean;
594
- } = {};
595
- event.changes.forEach((change) => {
596
- const { value, id } = change;
597
- changeMap[id || value.id] = true;
598
- });
599
- nodes.forEach((model) => {
600
- newModelMap[model.id] = { type: 'node', model };
601
- if (model.data.hasOwnProperty('parentId')) {
602
- parentMap[model.id] = {
603
- new: model.data.parentId,
604
- old: undefined,
605
- };
606
- }
607
- });
608
- edges.forEach(
609
- (model) => (newModelMap[model.id] = { type: 'edge', model }),
610
- );
611
- combos.forEach((model) => {
612
- newModelMap[model.id] = { type: 'combo', model };
613
- if (model.data.hasOwnProperty('parentId')) {
614
- parentMap[model.id] = {
615
- new: model.data.parentId,
616
- old: undefined,
617
- };
618
- }
619
- });
620
- prevNodesAndCombos.forEach((prevModel) => {
621
- const { id } = prevModel;
622
- if (
623
- parentMap[id]?.new !== undefined ||
624
- prevModel.data.parentId !== undefined
625
- ) {
626
- parentMap[id] = {
627
- new: parentMap[id]?.new,
628
- old: prevModel.data.parentId,
629
- };
630
- } else {
631
- delete parentMap[id];
632
- }
633
- const { model: newModel } = newModelMap[id] || {};
634
- // remove
635
- if (!newModel) {
636
- if (prevModel.data._isCombo) {
637
- graphCore.getChildren(id, 'combo').forEach((child) => {
638
- parentMap[child.id] = {
639
- ...parentMap[child.id],
640
- new: prevModel.data.parentId,
641
- };
642
- });
643
- }
644
- if (prevModel.data.parentId) {
645
- graphCore.setParent(id, undefined, 'combo');
646
- }
647
- graphCore.removeNode(id);
648
- delete parentMap[prevModel.id];
649
- }
650
- // update
651
- else if (diffAt(newModel, prevModel, true)?.length || changeMap[id])
652
- syncUpdateToGraphCore(id, newModel, prevModel, true);
653
- // delete from the map indicates this model is visited
654
- delete newModelMap[id];
655
- });
656
- graphCore.getAllEdges().forEach((prevEdge) => {
657
- const { id } = prevEdge;
658
- const { model: newModel } = newModelMap[id] || {};
659
- // remove
660
- if (!newModel) graphCore.removeEdge(id);
661
- // update
662
- else {
663
- const diff = diffAt(newModel, prevEdge, false);
664
- if (diff?.length)
665
- syncUpdateToGraphCore(id, newModel, prevEdge, false, diff);
763
+ }
764
+ });
765
+ edges.forEach(
766
+ (model) => (newModelMap[model.id] = { type: 'edge', model }),
767
+ );
768
+ combos.forEach((model) => {
769
+ newModelMap[model.id] = { type: 'combo', model };
770
+ if (model.data.hasOwnProperty('parentId')) {
771
+ parentMap[model.id] = {
772
+ new: model.data.parentId,
773
+ old: undefined,
774
+ };
775
+ }
776
+ });
777
+ prevNodesAndCombos.forEach((prevModel) => {
778
+ const { id } = prevModel;
779
+ if (
780
+ parentMap[id]?.new !== undefined ||
781
+ prevModel.data.parentId !== undefined
782
+ ) {
783
+ parentMap[id] = {
784
+ new: parentMap[id]?.new,
785
+ old: prevModel.data.parentId,
786
+ };
787
+ } else {
788
+ delete parentMap[id];
789
+ }
790
+ const { model: newModel } = newModelMap[id] || {};
791
+ // remove
792
+ if (!newModel) {
793
+ // remove a combo, put the children to upper parent
794
+ if (prevModel.data._isCombo) {
795
+ graphCore.getChildren(id, 'combo').forEach((child) => {
796
+ parentMap[child.id] = {
797
+ ...parentMap[child.id],
798
+ new: prevModel.data.parentId,
799
+ };
800
+ });
666
801
  }
667
- // delete from the map indicates this model is visited
668
- delete newModelMap[id];
669
- });
670
- // add
671
- Object.values(newModelMap).forEach(({ type, model }) => {
672
- if (type === 'node' || type === 'combo') graphCore.addNode(model);
673
- else if (type === 'edge') graphCore.addEdge(model as EdgeModel);
674
- });
675
- // update parents after adding all items
676
- Object.keys(parentMap).forEach((id) => {
677
- if (parentMap[id].new === parentMap[id].old) return;
678
- if (!validateComboStrucutre(this.graph, id, parentMap[id].new)) {
679
- graphCore.mergeNodeData(id, { parentId: parentMap[id].old });
680
- return;
802
+ // if it has combo parent, remove it from the parent's children list
803
+ if (prevModel.data.parentId) {
804
+ graphCore.setParent(id, undefined, 'combo');
681
805
  }
682
- graphCore.mergeNodeData(id, { parentId: parentMap[id].new });
683
- graphCore.setParent(id, parentMap[id].new, 'combo');
684
- });
685
- } else {
686
- // situation 2: idMaps is complete
687
- // calculate the final idMap which maps the ids from final transformed data to their comes from ids in userData
688
- const finalIdMap = {};
689
- const newModelMap = {};
690
- const prevModelMap = {};
691
- nodes
692
- .concat(edges)
693
- .concat(combos)
694
- .forEach((model) => {
695
- finalIdMap[model.id] = getComesFromLinkedList(model.id, idMaps);
696
- newModelMap[model.id] = model;
697
- });
698
- prevNodesAndCombos.concat(graphCore.getAllEdges()).forEach((model) => {
699
- prevModelMap[model.id] = model;
700
- });
701
806
 
702
- // map changes for search
703
- const changeMap = {};
704
- const { changes } = event;
705
- changes.forEach((change) => {
706
- const { value, id, type } = change;
707
- // TODO: temporary skip. how to handle tree change events?
708
- if (
709
- [
710
- 'TreeStructureAttached',
711
- 'TreeStructureDetached',
712
- 'TreeStructureChanged',
713
- ].includes(type)
714
- )
715
- return;
716
- const dataId = id || value.id;
717
- changeMap[dataId] = changeMap[dataId] || [];
718
- changeMap[dataId].push(type.toLawerCase());
719
- });
807
+ // for tree graph view, show the succeed nodes and edges
808
+ const succeedIds = [];
809
+ if (graphCore.hasTreeStructure('tree')) {
810
+ graphCore.dfsTree(
811
+ id,
812
+ (child) => {
813
+ succeedIds.push(child.id);
814
+ },
815
+ 'tree',
816
+ );
817
+ const succeedEdgeIds = graphCore
818
+ .getAllEdges()
819
+ .filter(
820
+ ({ source, target }) =>
821
+ succeedIds.includes(source) && succeedIds.includes(target),
822
+ )
823
+ .map((edge) => edge.id);
824
+ this.graph.showItem(
825
+ succeedIds
826
+ .filter((succeedId) => succeedId !== id)
827
+ .concat(succeedEdgeIds),
828
+ );
720
829
 
721
- // 1. remove or add model to userGraphCore according the existence
722
- // 2. update or keep unchanged according to the source models' changes in userGraphCore
723
- // if source models have any change, update the data in graphcore. Kepp unchanged otherwise
724
- Object.keys(newModelMap).forEach((newId) => {
725
- const comesFromIds = finalIdMap[newId];
726
- const newValue = newModelMap[newId];
727
- const oldValue = prevModelMap[newId];
728
- const isNodeOrCombo = graphCore.hasNode(newId);
729
- if (newValue && !oldValue) {
730
- const addFunc = isNodeOrCombo
731
- ? graphCore.addNode
732
- : graphCore.addEdge;
733
- addFunc(newValue);
734
- } else if (!newValue && oldValue) {
735
- const removeFunc = isNodeOrCombo
736
- ? graphCore.removeNode
737
- : graphCore.removeEdge;
738
- removeFunc(newId);
739
- } else {
740
- if (!comesFromIds?.length) {
741
- // no comesForm, find same id in userGraphCore to follow the change, if it not found, diff new and old data value of graphCore (inner data)
742
- const diff = diffAt(newValue, oldValue, isNodeOrCombo);
743
- if (diff?.length)
744
- syncUpdateToGraphCore(
745
- newId,
746
- newValue,
747
- oldValue,
748
- isNodeOrCombo,
749
- diff,
750
- );
751
- } else {
752
- // follow the corresponding data event in userGraphCore
753
- const comesFromChanges = changeMap[comesFromIds[0]];
754
- if (comesFromChanges?.length)
755
- syncUpdateToGraphCore(newId, newValue, oldValue, isNodeOrCombo);
756
- }
830
+ // for tree graph view, remove the node from the parent's children list
831
+ graphCore.setParent(id, undefined, 'tree');
832
+ // for tree graph view, make the its children to be roots
833
+ graphCore
834
+ .getChildren(id, 'tree')
835
+ .forEach((child) =>
836
+ graphCore.setParent(child.id, undefined, 'tree'),
837
+ );
757
838
  }
758
- });
759
-
760
- // update parents after updating all items
761
- graphCore.getAllNodes().forEach((node) => {
762
- if (
763
- !validateComboStrucutre(this.graph, node.id, node.data.parentId)
764
- ) {
765
- // restore if the new parent is invalid
766
- graphCore.mergeNodeData(node.id, {
767
- parentId: prevModelMap[node.id].data.parentId,
839
+ // remove the node data
840
+ graphCore.removeNode(id);
841
+ delete parentMap[prevModel.id];
842
+ }
843
+ // update
844
+ // || diffAt(newModel, prevModel, true)?.length
845
+ else if (changeMap[id])
846
+ syncUpdateToGraphCore(id, newModel, prevModel, true);
847
+ // delete from the map indicates this model is visited
848
+ delete newModelMap[id];
849
+ });
850
+ graphCore.getAllEdges().forEach((prevEdge) => {
851
+ const { id } = prevEdge;
852
+ const { model: newModel } = newModelMap[id] || {};
853
+ // remove
854
+ if (!newModel) graphCore.removeEdge(id);
855
+ // update
856
+ else {
857
+ const diff = diffAt(newModel, prevEdge, false);
858
+ if (diff?.length)
859
+ syncUpdateToGraphCore(id, newModel, prevEdge, false, diff);
860
+ }
861
+ // delete from the map indicates this model is visited
862
+ delete newModelMap[id];
863
+ });
864
+ // add
865
+ Object.values(newModelMap).forEach(({ type, model }) => {
866
+ if (type === 'node' || type === 'combo') graphCore.addNode(model);
867
+ else if (type === 'edge') graphCore.addEdge(model as EdgeModel);
868
+ });
869
+ // update parents after adding all items
870
+ Object.keys(parentMap).forEach((id) => {
871
+ if (parentMap[id].new === parentMap[id].old) return;
872
+ if (!validateComboStrucutre(this.graph, id, parentMap[id].new)) {
873
+ graphCore.mergeNodeData(id, { parentId: parentMap[id].old });
874
+ return;
875
+ }
876
+ graphCore.mergeNodeData(id, { parentId: parentMap[id].new });
877
+ graphCore.setParent(id, parentMap[id].new, 'combo');
878
+ // after remove from parent's children list, check whether the parent is empty
879
+ // if so, update parent's position to be the child's
880
+ if (parentMap[id].old !== undefined) {
881
+ const parentChildren = graphCore.getChildren(
882
+ parentMap[id].old,
883
+ 'combo',
884
+ );
885
+ const {
886
+ x = 0,
887
+ y = 0,
888
+ z = 0,
889
+ } = this.graph.getDisplayModel(parentMap[id].old)?.data;
890
+ if (!parentChildren.length) {
891
+ graphCore.mergeNodeData(parentMap[id].old, {
892
+ x: convertToNumber(x),
893
+ y: convertToNumber(y),
894
+ z: convertToNumber(z),
768
895
  });
769
- return;
770
896
  }
771
- graphCore.setParent(node.id, node.data.parentId as ID, 'combo');
772
- });
773
- }
774
- this.comboTreeView?.refreshCache();
897
+ }
898
+ });
899
+
900
+ // update tree structure
901
+ treeChanges.forEach((change) => {
902
+ const { type, treeKey, nodeId, newParentId } = change;
903
+ if (type === 'TreeStructureAttached') {
904
+ graphCore.attachTreeStructure(treeKey);
905
+ return;
906
+ } else if (type === 'TreeStructureChanged') {
907
+ graphCore.setParent(nodeId, newParentId, treeKey);
908
+ return;
909
+ } else if (type === 'TreeStructureDetached') {
910
+ graphCore.detachTreeStructure(treeKey);
911
+ return;
912
+ }
913
+ });
775
914
  });
776
915
  }
777
916
 
@@ -779,24 +918,31 @@ export class DataController {
779
918
  * Clone data from userGraphCore, and run transforms
780
919
  * @returns transformed data and the id map list
781
920
  */
782
- private transformData() {
783
- const { userGraphCore } = this;
784
- // === step 1: clone data from userGraphCore (userData) ===
785
- const userData = deconstructData({
786
- nodes: userGraphCore.getAllNodes(),
787
- edges: userGraphCore.getAllEdges(),
788
- });
789
- let dataCloned: GraphData = clone(userData);
790
-
791
- // === step 2: transform the data with transform extensions, output innerData and idMaps ===
792
- const idMaps = [];
921
+ private transformData(data): GraphData {
922
+ let dataCloned: GraphData = clone(data);
923
+ // transform the data with transform extensions, output innerData and idMaps ===
793
924
  this.extensions.forEach(({ func, config }) => {
794
- const result = func(dataCloned, config);
795
- dataCloned = result.data;
796
- const idMap = result.idMap;
797
- if (idMap) idMaps.push(idMap);
925
+ dataCloned = func(dataCloned, config, this.userGraphCore);
798
926
  });
799
- return { data: dataCloned, idMaps };
927
+ return dataCloned;
928
+ }
929
+
930
+ /**
931
+ * convert and store tree structure to graphCore
932
+ * @param dataType
933
+ * @param data
934
+ */
935
+ private updateTreeGraph(dataType, data) {
936
+ this.userGraphCore.attachTreeStructure('tree');
937
+ if (dataType === 'treeData') {
938
+ // tree structure storing
939
+ data.edges.forEach((edge) => {
940
+ const { source, target } = edge;
941
+ this.userGraphCore.setParent(target, source, 'tree');
942
+ });
943
+ } else {
944
+ this.treeDirtyFlag = true;
945
+ }
800
946
  }
801
947
  }
802
948
 
@@ -859,7 +1005,13 @@ const diffAt = (
859
1005
  return diff.concat('data');
860
1006
  else continue;
861
1007
  }
862
- if (isNaN(newValue) && isNaN(oldValue)) continue;
1008
+ if (
1009
+ typeof newValue === 'number' &&
1010
+ typeof oldValue === 'number' &&
1011
+ isNaN(newValue) &&
1012
+ isNaN(oldValue)
1013
+ )
1014
+ return;
863
1015
  if (newValue !== oldValue) return diff.concat('data');
864
1016
  }
865
1017
  return diff;