@antv/g6 5.0.0-alpha.8 → 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 (908) hide show
  1. package/dist/g6.min.js +6 -19
  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 +215 -95
  27. package/esm/index.js +11 -4
  28. package/esm/index.js.map +1 -1
  29. package/esm/item/combo.d.ts +79 -2
  30. package/esm/item/combo.js +186 -2
  31. package/esm/item/combo.js.map +1 -1
  32. package/esm/item/edge.d.ts +15 -12
  33. package/esm/item/edge.js +40 -14
  34. package/esm/item/edge.js.map +1 -1
  35. package/esm/item/item.d.ts +12 -10
  36. package/esm/item/item.js +155 -83
  37. package/esm/item/item.js.map +1 -1
  38. package/esm/item/node.d.ts +32 -23
  39. package/esm/item/node.js +70 -49
  40. package/esm/item/node.js.map +1 -1
  41. package/esm/runtime/controller/data.d.ts +28 -4
  42. package/esm/runtime/controller/data.js +562 -173
  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 +23 -8
  46. package/esm/runtime/controller/interaction.js.map +1 -1
  47. package/esm/runtime/controller/item.d.ts +47 -5
  48. package/esm/runtime/controller/item.js +712 -122
  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 +109 -13
  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 +226 -47
  59. package/esm/runtime/graph.js +710 -90
  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 +5 -3
  68. package/esm/stdlib/behavior/click-select.js +21 -7
  69. package/esm/stdlib/behavior/click-select.js.map +1 -1
  70. package/esm/stdlib/behavior/collapse-expand-combo.d.ts +28 -0
  71. package/esm/stdlib/behavior/collapse-expand-combo.js +35 -0
  72. package/esm/stdlib/behavior/collapse-expand-combo.js.map +1 -0
  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 +111 -0
  80. package/esm/stdlib/behavior/drag-combo.js +380 -0
  81. package/esm/stdlib/behavior/drag-combo.js.map +1 -0
  82. package/esm/stdlib/behavior/drag-node.d.ts +33 -13
  83. package/esm/stdlib/behavior/drag-node.js +252 -67
  84. package/esm/stdlib/behavior/drag-node.js.map +1 -1
  85. package/esm/stdlib/behavior/hover-activate.d.ts +2 -1
  86. package/esm/stdlib/behavior/hover-activate.js +2 -0
  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 +115 -49
  125. package/esm/stdlib/index.js +156 -37
  126. package/esm/stdlib/index.js.map +1 -1
  127. package/esm/stdlib/item/combo/circle.d.ts +29 -0
  128. package/esm/stdlib/item/combo/circle.js +56 -0
  129. package/esm/stdlib/item/combo/circle.js.map +1 -0
  130. package/esm/stdlib/item/combo/index.d.ts +2 -0
  131. package/esm/stdlib/item/combo/index.js +3 -0
  132. package/esm/stdlib/item/combo/index.js.map +1 -0
  133. package/esm/stdlib/item/combo/rect.d.ts +31 -0
  134. package/esm/stdlib/item/combo/rect.js +65 -0
  135. package/esm/stdlib/item/combo/rect.js.map +1 -0
  136. package/esm/stdlib/item/edge/base.d.ts +12 -3
  137. package/esm/stdlib/item/edge/base.js +39 -5
  138. package/esm/stdlib/item/edge/base.js.map +1 -1
  139. package/esm/stdlib/item/edge/cubic-horizontal.d.ts +36 -0
  140. package/esm/stdlib/item/edge/cubic-horizontal.js +56 -0
  141. package/esm/stdlib/item/edge/cubic-horizontal.js.map +1 -0
  142. package/esm/stdlib/item/edge/cubic-vertical.d.ts +36 -0
  143. package/esm/stdlib/item/edge/cubic-vertical.js +56 -0
  144. package/esm/stdlib/item/edge/cubic-vertical.js.map +1 -0
  145. package/esm/stdlib/item/edge/cubic.d.ts +59 -0
  146. package/esm/stdlib/item/edge/cubic.js +116 -0
  147. package/esm/stdlib/item/edge/cubic.js.map +1 -0
  148. package/esm/stdlib/item/edge/index.d.ts +6 -0
  149. package/esm/stdlib/item/edge/index.js +6 -0
  150. package/esm/stdlib/item/edge/index.js.map +1 -1
  151. package/esm/stdlib/item/edge/line.d.ts +1 -1
  152. package/esm/stdlib/item/edge/line.js +16 -1
  153. package/esm/stdlib/item/edge/line.js.map +1 -1
  154. package/esm/stdlib/item/edge/loop.d.ts +32 -0
  155. package/esm/stdlib/item/edge/loop.js +115 -0
  156. package/esm/stdlib/item/edge/loop.js.map +1 -0
  157. package/esm/stdlib/item/edge/polyline.d.ts +44 -0
  158. package/esm/stdlib/item/edge/polyline.js +92 -0
  159. package/esm/stdlib/item/edge/polyline.js.map +1 -0
  160. package/esm/stdlib/item/edge/quadratic.d.ts +40 -0
  161. package/esm/stdlib/item/edge/quadratic.js +78 -0
  162. package/esm/stdlib/item/edge/quadratic.js.map +1 -0
  163. package/esm/stdlib/item/node/base.d.ts +83 -38
  164. package/esm/stdlib/item/node/base.js +100 -15
  165. package/esm/stdlib/item/node/base.js.map +1 -1
  166. package/esm/stdlib/item/node/base3d.js +1 -1
  167. package/esm/stdlib/item/node/base3d.js.map +1 -1
  168. package/esm/stdlib/item/node/circle.js +5 -5
  169. package/esm/stdlib/item/node/circle.js.map +1 -1
  170. package/esm/stdlib/item/node/diamond.d.ts +32 -0
  171. package/esm/stdlib/item/node/diamond.js +79 -0
  172. package/esm/stdlib/item/node/diamond.js.map +1 -0
  173. package/esm/stdlib/item/node/donut.d.ts +70 -0
  174. package/esm/stdlib/item/node/donut.js +207 -0
  175. package/esm/stdlib/item/node/donut.js.map +1 -0
  176. package/esm/stdlib/item/node/ellipse.d.ts +32 -0
  177. package/esm/stdlib/item/node/ellipse.js +71 -0
  178. package/esm/stdlib/item/node/ellipse.js.map +1 -0
  179. package/esm/stdlib/item/node/hexagon.d.ts +33 -0
  180. package/esm/stdlib/item/node/hexagon.js +102 -0
  181. package/esm/stdlib/item/node/hexagon.js.map +1 -0
  182. package/esm/stdlib/item/node/index.d.ts +8 -0
  183. package/esm/stdlib/item/node/index.js +8 -0
  184. package/esm/stdlib/item/node/index.js.map +1 -1
  185. package/esm/stdlib/item/node/modelRect.d.ts +61 -0
  186. package/esm/stdlib/item/node/modelRect.js +186 -0
  187. package/esm/stdlib/item/node/modelRect.js.map +1 -0
  188. package/esm/stdlib/item/node/rect.d.ts +32 -0
  189. package/esm/stdlib/item/node/rect.js +75 -0
  190. package/esm/stdlib/item/node/rect.js.map +1 -0
  191. package/esm/stdlib/item/node/star.d.ts +34 -0
  192. package/esm/stdlib/item/node/star.js +115 -0
  193. package/esm/stdlib/item/node/star.js.map +1 -0
  194. package/esm/stdlib/item/node/triangle.d.ts +44 -0
  195. package/esm/stdlib/item/node/triangle.js +177 -0
  196. package/esm/stdlib/item/node/triangle.js.map +1 -0
  197. package/esm/stdlib/plugin/fisheye/index.d.ts +130 -0
  198. package/esm/stdlib/plugin/fisheye/index.js +488 -0
  199. package/esm/stdlib/plugin/fisheye/index.js.map +1 -0
  200. package/esm/stdlib/plugin/grid/index.d.ts +36 -0
  201. package/esm/stdlib/plugin/grid/index.js +81 -0
  202. package/esm/stdlib/plugin/grid/index.js.map +1 -0
  203. package/esm/stdlib/plugin/history/combo-command.d.ts +9 -0
  204. package/esm/stdlib/plugin/history/combo-command.js +21 -0
  205. package/esm/stdlib/plugin/history/combo-command.js.map +1 -0
  206. package/esm/stdlib/plugin/history/command.d.ts +18 -0
  207. package/esm/stdlib/plugin/history/command.js +51 -0
  208. package/esm/stdlib/plugin/history/command.js.map +1 -0
  209. package/esm/stdlib/plugin/history/index.d.ts +112 -0
  210. package/esm/stdlib/plugin/history/index.js +275 -0
  211. package/esm/stdlib/plugin/history/index.js.map +1 -0
  212. package/esm/stdlib/plugin/history/item-data-command.d.ts +14 -0
  213. package/esm/stdlib/plugin/history/item-data-command.js +63 -0
  214. package/esm/stdlib/plugin/history/item-data-command.js.map +1 -0
  215. package/esm/stdlib/plugin/history/layer-updated-command.d.ts +9 -0
  216. package/esm/stdlib/plugin/history/layer-updated-command.js +21 -0
  217. package/esm/stdlib/plugin/history/layer-updated-command.js.map +1 -0
  218. package/esm/stdlib/plugin/history/state-updated-command.d.ts +9 -0
  219. package/esm/stdlib/plugin/history/state-updated-command.js +20 -0
  220. package/esm/stdlib/plugin/history/state-updated-command.js.map +1 -0
  221. package/esm/stdlib/plugin/history/visibility-updated-command.d.ts +10 -0
  222. package/esm/stdlib/plugin/history/visibility-updated-command.js +23 -0
  223. package/esm/stdlib/plugin/history/visibility-updated-command.js.map +1 -0
  224. package/esm/stdlib/plugin/hull/bubbleset.d.ts +9 -0
  225. package/esm/stdlib/plugin/hull/bubbleset.js +592 -0
  226. package/esm/stdlib/plugin/hull/bubbleset.js.map +1 -0
  227. package/esm/stdlib/plugin/hull/convexHull.d.ts +14 -0
  228. package/esm/stdlib/plugin/hull/convexHull.js +56 -0
  229. package/esm/stdlib/plugin/hull/convexHull.js.map +1 -0
  230. package/esm/stdlib/plugin/hull/hullComponent.d.ts +87 -0
  231. package/esm/stdlib/plugin/hull/hullComponent.js +382 -0
  232. package/esm/stdlib/plugin/hull/hullComponent.js.map +1 -0
  233. package/esm/stdlib/plugin/hull/index.d.ts +59 -0
  234. package/esm/stdlib/plugin/hull/index.js +161 -0
  235. package/esm/stdlib/plugin/hull/index.js.map +1 -0
  236. package/esm/stdlib/plugin/hull/types.d.ts +15 -0
  237. package/esm/stdlib/plugin/hull/types.js +2 -0
  238. package/esm/stdlib/plugin/hull/types.js.map +1 -0
  239. package/esm/stdlib/plugin/hull/util.d.ts +77 -0
  240. package/esm/stdlib/plugin/hull/util.js +401 -0
  241. package/esm/stdlib/plugin/hull/util.js.map +1 -0
  242. package/esm/stdlib/plugin/index.d.ts +8 -0
  243. package/esm/stdlib/plugin/index.js +9 -0
  244. package/esm/stdlib/plugin/index.js.map +1 -0
  245. package/esm/stdlib/plugin/legend/index.d.ts +45 -3
  246. package/esm/stdlib/plugin/legend/index.js +47 -42
  247. package/esm/stdlib/plugin/legend/index.js.map +1 -1
  248. package/esm/stdlib/plugin/menu/index.d.ts +55 -0
  249. package/esm/stdlib/plugin/menu/index.js +237 -0
  250. package/esm/stdlib/plugin/menu/index.js.map +1 -0
  251. package/esm/stdlib/plugin/minimap/index.d.ts +11 -3
  252. package/esm/stdlib/plugin/minimap/index.js +19 -21
  253. package/esm/stdlib/plugin/minimap/index.js.map +1 -1
  254. package/esm/stdlib/plugin/toolbar/index.d.ts +59 -0
  255. package/esm/stdlib/plugin/toolbar/index.js +215 -0
  256. package/esm/stdlib/plugin/toolbar/index.js.map +1 -0
  257. package/esm/stdlib/plugin/tooltip/index.d.ts +96 -0
  258. package/esm/stdlib/plugin/tooltip/index.js +378 -0
  259. package/esm/stdlib/plugin/tooltip/index.js.map +1 -0
  260. package/esm/stdlib/plugin/types.d.ts +8 -0
  261. package/esm/stdlib/plugin/types.js +2 -0
  262. package/esm/stdlib/plugin/types.js.map +1 -0
  263. package/esm/stdlib/theme/dark.d.ts +1 -2
  264. package/esm/stdlib/theme/dark.js +13 -1
  265. package/esm/stdlib/theme/dark.js.map +1 -1
  266. package/esm/stdlib/theme/index.d.ts +2 -0
  267. package/esm/stdlib/theme/index.js +3 -0
  268. package/esm/stdlib/theme/index.js.map +1 -0
  269. package/esm/stdlib/theme/light.d.ts +1 -2
  270. package/esm/stdlib/theme/light.js +65 -10
  271. package/esm/stdlib/theme/light.js.map +1 -1
  272. package/esm/stdlib/themeSolver/base.d.ts +1 -1
  273. package/esm/stdlib/themeSolver/base.js +1 -1
  274. package/esm/stdlib/themeSolver/base.js.map +1 -1
  275. package/esm/stdlib/themeSolver/index.d.ts +3 -0
  276. package/esm/stdlib/themeSolver/index.js +4 -0
  277. package/esm/stdlib/themeSolver/index.js.map +1 -0
  278. package/esm/stdlib/themeSolver/spec.d.ts +2 -4
  279. package/esm/stdlib/themeSolver/spec.js +2 -2
  280. package/esm/stdlib/themeSolver/spec.js.map +1 -1
  281. package/esm/stdlib/themeSolver/subject.d.ts +2 -4
  282. package/esm/stdlib/themeSolver/subject.js +2 -2
  283. package/esm/stdlib/themeSolver/subject.js.map +1 -1
  284. package/esm/types/behavior.js.map +1 -1
  285. package/esm/types/combo.d.ts +51 -3
  286. package/esm/types/common.d.ts +10 -0
  287. package/esm/types/data.d.ts +13 -7
  288. package/esm/types/edge.d.ts +19 -5
  289. package/esm/types/event.d.ts +9 -1
  290. package/esm/types/event.js +8 -8
  291. package/esm/types/event.js.map +1 -1
  292. package/esm/types/graph.d.ts +169 -20
  293. package/esm/types/history.d.ts +28 -0
  294. package/esm/types/history.js +6 -0
  295. package/esm/types/history.js.map +1 -0
  296. package/esm/types/hook.d.ts +33 -6
  297. package/esm/types/index.d.ts +11 -5
  298. package/esm/types/index.js.map +1 -1
  299. package/esm/types/item.d.ts +14 -8
  300. package/esm/types/item.js.map +1 -1
  301. package/esm/types/layout.d.ts +4 -1
  302. package/esm/types/loop.d.ts +21 -0
  303. package/esm/types/loop.js +12 -0
  304. package/esm/types/loop.js.map +1 -0
  305. package/esm/types/node.d.ts +90 -10
  306. package/esm/types/plugin.d.ts +4 -0
  307. package/esm/types/plugin.js +1 -1
  308. package/esm/types/plugin.js.map +1 -1
  309. package/esm/types/spec.d.ts +26 -9
  310. package/esm/types/theme.d.ts +76 -10
  311. package/esm/types/theme.js +1 -2
  312. package/esm/types/theme.js.map +1 -1
  313. package/esm/util/animate.d.ts +2 -2
  314. package/esm/util/animate.js +52 -17
  315. package/esm/util/animate.js.map +1 -1
  316. package/esm/util/array.d.ts +8 -0
  317. package/esm/util/array.js +11 -1
  318. package/esm/util/array.js.map +1 -1
  319. package/esm/util/arrow.d.ts +17 -0
  320. package/esm/util/arrow.js +56 -0
  321. package/esm/util/arrow.js.map +1 -0
  322. package/esm/util/bbox.d.ts +106 -0
  323. package/esm/util/bbox.js +255 -0
  324. package/esm/util/bbox.js.map +1 -0
  325. package/esm/util/behavior.d.ts +2 -0
  326. package/esm/util/behavior.js +12 -0
  327. package/esm/util/behavior.js.map +1 -0
  328. package/esm/util/canvas.d.ts +1 -2
  329. package/esm/util/canvas.js +11 -20
  330. package/esm/util/canvas.js.map +1 -1
  331. package/esm/util/data.d.ts +96 -0
  332. package/esm/util/data.js +262 -0
  333. package/esm/util/data.js.map +1 -0
  334. package/esm/util/event.d.ts +29 -1
  335. package/esm/util/event.js +70 -0
  336. package/esm/util/event.js.map +1 -1
  337. package/esm/util/extend.d.ts +8 -2
  338. package/esm/util/extend.js.map +1 -1
  339. package/esm/util/index.d.ts +41 -3
  340. package/esm/util/index.js +20 -1
  341. package/esm/util/index.js.map +1 -1
  342. package/esm/util/item.d.ts +2 -1
  343. package/esm/util/item.js +38 -13
  344. package/esm/util/item.js.map +1 -1
  345. package/esm/util/layout.d.ts +40 -0
  346. package/esm/util/layout.js +160 -0
  347. package/esm/util/layout.js.map +1 -0
  348. package/esm/util/loop.d.ts +37 -0
  349. package/esm/util/loop.js +104 -0
  350. package/esm/util/loop.js.map +1 -0
  351. package/esm/util/mapper.js +4 -9
  352. package/esm/util/mapper.js.map +1 -1
  353. package/esm/util/math.d.ts +15 -0
  354. package/esm/util/math.js +14 -0
  355. package/esm/util/math.js.map +1 -1
  356. package/esm/util/mock.d.ts +30 -0
  357. package/esm/util/mock.js +69 -0
  358. package/esm/util/mock.js.map +1 -0
  359. package/esm/util/path.d.ts +11 -0
  360. package/esm/util/path.js +44 -0
  361. package/esm/util/path.js.map +1 -0
  362. package/esm/util/point.d.ts +24 -2
  363. package/esm/util/point.js +27 -2
  364. package/esm/util/point.js.map +1 -1
  365. package/esm/util/polyline.d.ts +113 -0
  366. package/esm/util/polyline.js +505 -0
  367. package/esm/util/polyline.js.map +1 -0
  368. package/esm/util/router.d.ts +31 -0
  369. package/esm/util/router.js +380 -0
  370. package/esm/util/router.js.map +1 -0
  371. package/esm/util/shape.d.ts +39 -4
  372. package/esm/util/shape.js +118 -2
  373. package/esm/util/shape.js.map +1 -1
  374. package/esm/util/shape3d.d.ts +1 -1
  375. package/esm/util/shape3d.js +12 -6
  376. package/esm/util/shape3d.js.map +1 -1
  377. package/esm/util/type.d.ts +6 -0
  378. package/esm/util/type.js +7 -1
  379. package/esm/util/type.js.map +1 -1
  380. package/esm/util/zoom.d.ts +2 -2
  381. package/esm/util/zoom.js +6 -2
  382. package/esm/util/zoom.js.map +1 -1
  383. package/lib/api-doc/behaviors.d.ts +2 -0
  384. package/lib/api-doc/behaviors.js +18 -0
  385. package/lib/api-doc/behaviors.js.map +1 -0
  386. package/lib/api-doc/graph.d.ts +4 -0
  387. package/lib/api-doc/graph.js +11 -0
  388. package/lib/api-doc/graph.js.map +1 -0
  389. package/lib/api-doc/item.d.ts +9 -0
  390. package/lib/api-doc/item.js +21 -0
  391. package/lib/api-doc/item.js.map +1 -0
  392. package/lib/api-doc/layout.d.ts +1 -0
  393. package/lib/api-doc/layout.js +3 -0
  394. package/lib/api-doc/layout.js.map +1 -0
  395. package/lib/api-doc/plugins.d.ts +1 -0
  396. package/lib/api-doc/plugins.js +18 -0
  397. package/lib/api-doc/plugins.js.map +1 -0
  398. package/lib/api-doc/types.d.ts +0 -0
  399. package/lib/api-doc/types.js +3 -0
  400. package/lib/api-doc/types.js.map +1 -0
  401. package/lib/api-doc/util.d.ts +3 -0
  402. package/lib/api-doc/util.js +10 -0
  403. package/lib/api-doc/util.js.map +1 -0
  404. package/lib/constant/shape.d.ts +7 -14
  405. package/lib/constant/shape.js +1 -0
  406. package/lib/constant/shape.js.map +1 -1
  407. package/lib/index.d.ts +215 -95
  408. package/lib/index.js +13 -3
  409. package/lib/index.js.map +1 -1
  410. package/lib/item/combo.d.ts +79 -2
  411. package/lib/item/combo.js +186 -2
  412. package/lib/item/combo.js.map +1 -1
  413. package/lib/item/edge.d.ts +15 -12
  414. package/lib/item/edge.js +40 -14
  415. package/lib/item/edge.js.map +1 -1
  416. package/lib/item/item.d.ts +12 -10
  417. package/lib/item/item.js +153 -81
  418. package/lib/item/item.js.map +1 -1
  419. package/lib/item/node.d.ts +32 -23
  420. package/lib/item/node.js +70 -49
  421. package/lib/item/node.js.map +1 -1
  422. package/lib/runtime/controller/data.d.ts +28 -4
  423. package/lib/runtime/controller/data.js +561 -172
  424. package/lib/runtime/controller/data.js.map +1 -1
  425. package/lib/runtime/controller/interaction.d.ts +1 -0
  426. package/lib/runtime/controller/interaction.js +22 -7
  427. package/lib/runtime/controller/interaction.js.map +1 -1
  428. package/lib/runtime/controller/item.d.ts +47 -5
  429. package/lib/runtime/controller/item.js +710 -120
  430. package/lib/runtime/controller/item.js.map +1 -1
  431. package/lib/runtime/controller/layout.d.ts +4 -1
  432. package/lib/runtime/controller/layout.js +132 -13
  433. package/lib/runtime/controller/layout.js.map +1 -1
  434. package/lib/runtime/controller/plugin.d.ts +11 -0
  435. package/lib/runtime/controller/plugin.js +39 -6
  436. package/lib/runtime/controller/plugin.js.map +1 -1
  437. package/lib/runtime/controller/theme.js +8 -4
  438. package/lib/runtime/controller/theme.js.map +1 -1
  439. package/lib/runtime/graph.d.ts +226 -47
  440. package/lib/runtime/graph.js +709 -89
  441. package/lib/runtime/graph.js.map +1 -1
  442. package/lib/stdlib/behavior/activate-relations.d.ts +2 -3
  443. package/lib/stdlib/behavior/activate-relations.js +14 -9
  444. package/lib/stdlib/behavior/activate-relations.js.map +1 -1
  445. package/lib/stdlib/behavior/brush-select.d.ts +3 -4
  446. package/lib/stdlib/behavior/brush-select.js +3 -2
  447. package/lib/stdlib/behavior/brush-select.js.map +1 -1
  448. package/lib/stdlib/behavior/click-select.d.ts +5 -3
  449. package/lib/stdlib/behavior/click-select.js +22 -7
  450. package/lib/stdlib/behavior/click-select.js.map +1 -1
  451. package/lib/stdlib/behavior/collapse-expand-combo.d.ts +28 -0
  452. package/lib/stdlib/behavior/collapse-expand-combo.js +39 -0
  453. package/lib/stdlib/behavior/collapse-expand-combo.js.map +1 -0
  454. package/lib/stdlib/behavior/collapse-expand-tree.d.ts +44 -0
  455. package/lib/stdlib/behavior/collapse-expand-tree.js +73 -0
  456. package/lib/stdlib/behavior/collapse-expand-tree.js.map +1 -0
  457. package/lib/stdlib/behavior/drag-canvas.d.ts +1 -2
  458. package/lib/stdlib/behavior/drag-canvas.js +16 -11
  459. package/lib/stdlib/behavior/drag-canvas.js.map +1 -1
  460. package/lib/stdlib/behavior/drag-combo.d.ts +111 -0
  461. package/lib/stdlib/behavior/drag-combo.js +384 -0
  462. package/lib/stdlib/behavior/drag-combo.js.map +1 -0
  463. package/lib/stdlib/behavior/drag-node.d.ts +33 -13
  464. package/lib/stdlib/behavior/drag-node.js +252 -66
  465. package/lib/stdlib/behavior/drag-node.js.map +1 -1
  466. package/lib/stdlib/behavior/hover-activate.d.ts +2 -1
  467. package/lib/stdlib/behavior/hover-activate.js +2 -0
  468. package/lib/stdlib/behavior/hover-activate.js.map +1 -1
  469. package/lib/stdlib/behavior/index.d.ts +15 -0
  470. package/lib/stdlib/behavior/index.js +32 -0
  471. package/lib/stdlib/behavior/index.js.map +1 -0
  472. package/lib/stdlib/behavior/lasso-select.d.ts +7 -3
  473. package/lib/stdlib/behavior/lasso-select.js +4 -6
  474. package/lib/stdlib/behavior/lasso-select.js.map +1 -1
  475. package/lib/stdlib/behavior/orbit-canvas-3d.d.ts +2 -3
  476. package/lib/stdlib/behavior/orbit-canvas-3d.js +4 -6
  477. package/lib/stdlib/behavior/orbit-canvas-3d.js.map +1 -1
  478. package/lib/stdlib/behavior/rotate-canvas-3d.d.ts +1 -2
  479. package/lib/stdlib/behavior/rotate-canvas-3d.js +2 -1
  480. package/lib/stdlib/behavior/rotate-canvas-3d.js.map +1 -1
  481. package/lib/stdlib/behavior/track-canvas-3d.d.ts +2 -3
  482. package/lib/stdlib/behavior/track-canvas-3d.js +4 -6
  483. package/lib/stdlib/behavior/track-canvas-3d.js.map +1 -1
  484. package/lib/stdlib/behavior/types.d.ts +13 -0
  485. package/lib/stdlib/behavior/types.js +3 -0
  486. package/lib/stdlib/behavior/types.js.map +1 -0
  487. package/lib/stdlib/behavior/zoom-canvas-3d.d.ts +1 -2
  488. package/lib/stdlib/behavior/zoom-canvas-3d.js +8 -7
  489. package/lib/stdlib/behavior/zoom-canvas-3d.js.map +1 -1
  490. package/lib/stdlib/behavior/zoom-canvas.d.ts +1 -2
  491. package/lib/stdlib/behavior/zoom-canvas.js +21 -18
  492. package/lib/stdlib/behavior/zoom-canvas.js.map +1 -1
  493. package/lib/stdlib/data/index.d.ts +3 -0
  494. package/lib/stdlib/data/index.js +20 -0
  495. package/lib/stdlib/data/index.js.map +1 -0
  496. package/lib/stdlib/data/mapNodeSize.d.ts +12 -0
  497. package/lib/stdlib/data/mapNodeSize.js +47 -0
  498. package/lib/stdlib/data/mapNodeSize.js.map +1 -0
  499. package/lib/stdlib/data/transformV4Data.d.ts +9 -0
  500. package/lib/stdlib/data/transformV4Data.js +146 -0
  501. package/lib/stdlib/data/transformV4Data.js.map +1 -0
  502. package/lib/stdlib/data/validateData.d.ts +9 -0
  503. package/lib/stdlib/data/validateData.js +102 -0
  504. package/lib/stdlib/data/validateData.js.map +1 -0
  505. package/lib/stdlib/index.d.ts +115 -49
  506. package/lib/stdlib/index.js +190 -47
  507. package/lib/stdlib/index.js.map +1 -1
  508. package/lib/stdlib/item/combo/circle.d.ts +29 -0
  509. package/lib/stdlib/item/combo/circle.js +60 -0
  510. package/lib/stdlib/item/combo/circle.js.map +1 -0
  511. package/lib/stdlib/item/combo/index.d.ts +2 -0
  512. package/lib/stdlib/item/combo/index.js +19 -0
  513. package/lib/stdlib/item/combo/index.js.map +1 -0
  514. package/lib/stdlib/item/combo/rect.d.ts +31 -0
  515. package/lib/stdlib/item/combo/rect.js +69 -0
  516. package/lib/stdlib/item/combo/rect.js.map +1 -0
  517. package/lib/stdlib/item/edge/base.d.ts +12 -3
  518. package/lib/stdlib/item/edge/base.js +38 -4
  519. package/lib/stdlib/item/edge/base.js.map +1 -1
  520. package/lib/stdlib/item/edge/cubic-horizontal.d.ts +36 -0
  521. package/lib/stdlib/item/edge/cubic-horizontal.js +60 -0
  522. package/lib/stdlib/item/edge/cubic-horizontal.js.map +1 -0
  523. package/lib/stdlib/item/edge/cubic-vertical.d.ts +36 -0
  524. package/lib/stdlib/item/edge/cubic-vertical.js +60 -0
  525. package/lib/stdlib/item/edge/cubic-vertical.js.map +1 -0
  526. package/lib/stdlib/item/edge/cubic.d.ts +59 -0
  527. package/lib/stdlib/item/edge/cubic.js +120 -0
  528. package/lib/stdlib/item/edge/cubic.js.map +1 -0
  529. package/lib/stdlib/item/edge/index.d.ts +6 -0
  530. package/lib/stdlib/item/edge/index.js +6 -0
  531. package/lib/stdlib/item/edge/index.js.map +1 -1
  532. package/lib/stdlib/item/edge/line.d.ts +1 -1
  533. package/lib/stdlib/item/edge/line.js +16 -1
  534. package/lib/stdlib/item/edge/line.js.map +1 -1
  535. package/lib/stdlib/item/edge/loop.d.ts +32 -0
  536. package/lib/stdlib/item/edge/loop.js +119 -0
  537. package/lib/stdlib/item/edge/loop.js.map +1 -0
  538. package/lib/stdlib/item/edge/polyline.d.ts +44 -0
  539. package/lib/stdlib/item/edge/polyline.js +96 -0
  540. package/lib/stdlib/item/edge/polyline.js.map +1 -0
  541. package/lib/stdlib/item/edge/quadratic.d.ts +40 -0
  542. package/lib/stdlib/item/edge/quadratic.js +82 -0
  543. package/lib/stdlib/item/edge/quadratic.js.map +1 -0
  544. package/lib/stdlib/item/node/base.d.ts +83 -38
  545. package/lib/stdlib/item/node/base.js +100 -15
  546. package/lib/stdlib/item/node/base.js.map +1 -1
  547. package/lib/stdlib/item/node/base3d.js +1 -1
  548. package/lib/stdlib/item/node/base3d.js.map +1 -1
  549. package/lib/stdlib/item/node/circle.js +5 -5
  550. package/lib/stdlib/item/node/circle.js.map +1 -1
  551. package/lib/stdlib/item/node/diamond.d.ts +32 -0
  552. package/lib/stdlib/item/node/diamond.js +83 -0
  553. package/lib/stdlib/item/node/diamond.js.map +1 -0
  554. package/lib/stdlib/item/node/donut.d.ts +70 -0
  555. package/lib/stdlib/item/node/donut.js +211 -0
  556. package/lib/stdlib/item/node/donut.js.map +1 -0
  557. package/lib/stdlib/item/node/ellipse.d.ts +32 -0
  558. package/lib/stdlib/item/node/ellipse.js +75 -0
  559. package/lib/stdlib/item/node/ellipse.js.map +1 -0
  560. package/lib/stdlib/item/node/hexagon.d.ts +33 -0
  561. package/lib/stdlib/item/node/hexagon.js +106 -0
  562. package/lib/stdlib/item/node/hexagon.js.map +1 -0
  563. package/lib/stdlib/item/node/index.d.ts +8 -0
  564. package/lib/stdlib/item/node/index.js +8 -0
  565. package/lib/stdlib/item/node/index.js.map +1 -1
  566. package/lib/stdlib/item/node/modelRect.d.ts +61 -0
  567. package/lib/stdlib/item/node/modelRect.js +190 -0
  568. package/lib/stdlib/item/node/modelRect.js.map +1 -0
  569. package/lib/stdlib/item/node/rect.d.ts +32 -0
  570. package/lib/stdlib/item/node/rect.js +79 -0
  571. package/lib/stdlib/item/node/rect.js.map +1 -0
  572. package/lib/stdlib/item/node/star.d.ts +34 -0
  573. package/lib/stdlib/item/node/star.js +119 -0
  574. package/lib/stdlib/item/node/star.js.map +1 -0
  575. package/lib/stdlib/item/node/triangle.d.ts +44 -0
  576. package/lib/stdlib/item/node/triangle.js +181 -0
  577. package/lib/stdlib/item/node/triangle.js.map +1 -0
  578. package/lib/stdlib/plugin/fisheye/index.d.ts +130 -0
  579. package/lib/stdlib/plugin/fisheye/index.js +492 -0
  580. package/lib/stdlib/plugin/fisheye/index.js.map +1 -0
  581. package/lib/stdlib/plugin/grid/index.d.ts +36 -0
  582. package/lib/stdlib/plugin/grid/index.js +85 -0
  583. package/lib/stdlib/plugin/grid/index.js.map +1 -0
  584. package/lib/stdlib/plugin/history/combo-command.d.ts +9 -0
  585. package/lib/stdlib/plugin/history/combo-command.js +25 -0
  586. package/lib/stdlib/plugin/history/combo-command.js.map +1 -0
  587. package/lib/stdlib/plugin/history/command.d.ts +18 -0
  588. package/lib/stdlib/plugin/history/command.js +54 -0
  589. package/lib/stdlib/plugin/history/command.js.map +1 -0
  590. package/lib/stdlib/plugin/history/index.d.ts +112 -0
  591. package/lib/stdlib/plugin/history/index.js +283 -0
  592. package/lib/stdlib/plugin/history/index.js.map +1 -0
  593. package/lib/stdlib/plugin/history/item-data-command.d.ts +14 -0
  594. package/lib/stdlib/plugin/history/item-data-command.js +67 -0
  595. package/lib/stdlib/plugin/history/item-data-command.js.map +1 -0
  596. package/lib/stdlib/plugin/history/layer-updated-command.d.ts +9 -0
  597. package/lib/stdlib/plugin/history/layer-updated-command.js +25 -0
  598. package/lib/stdlib/plugin/history/layer-updated-command.js.map +1 -0
  599. package/lib/stdlib/plugin/history/state-updated-command.d.ts +9 -0
  600. package/lib/stdlib/plugin/history/state-updated-command.js +24 -0
  601. package/lib/stdlib/plugin/history/state-updated-command.js.map +1 -0
  602. package/lib/stdlib/plugin/history/visibility-updated-command.d.ts +10 -0
  603. package/lib/stdlib/plugin/history/visibility-updated-command.js +27 -0
  604. package/lib/stdlib/plugin/history/visibility-updated-command.js.map +1 -0
  605. package/lib/stdlib/plugin/hull/bubbleset.d.ts +9 -0
  606. package/lib/stdlib/plugin/hull/bubbleset.js +596 -0
  607. package/lib/stdlib/plugin/hull/bubbleset.js.map +1 -0
  608. package/lib/stdlib/plugin/hull/convexHull.d.ts +14 -0
  609. package/lib/stdlib/plugin/hull/convexHull.js +61 -0
  610. package/lib/stdlib/plugin/hull/convexHull.js.map +1 -0
  611. package/lib/stdlib/plugin/hull/hullComponent.d.ts +87 -0
  612. package/lib/stdlib/plugin/hull/hullComponent.js +385 -0
  613. package/lib/stdlib/plugin/hull/hullComponent.js.map +1 -0
  614. package/lib/stdlib/plugin/hull/index.d.ts +59 -0
  615. package/lib/stdlib/plugin/hull/index.js +167 -0
  616. package/lib/stdlib/plugin/hull/index.js.map +1 -0
  617. package/lib/stdlib/plugin/hull/types.d.ts +15 -0
  618. package/lib/stdlib/plugin/hull/types.js +3 -0
  619. package/lib/stdlib/plugin/hull/types.js.map +1 -0
  620. package/lib/stdlib/plugin/hull/util.d.ts +77 -0
  621. package/lib/stdlib/plugin/hull/util.js +419 -0
  622. package/lib/stdlib/plugin/hull/util.js.map +1 -0
  623. package/lib/stdlib/plugin/index.d.ts +8 -0
  624. package/lib/stdlib/plugin/index.js +25 -0
  625. package/lib/stdlib/plugin/index.js.map +1 -0
  626. package/lib/stdlib/plugin/legend/index.d.ts +45 -3
  627. package/lib/stdlib/plugin/legend/index.js +46 -40
  628. package/lib/stdlib/plugin/legend/index.js.map +1 -1
  629. package/lib/stdlib/plugin/menu/index.d.ts +55 -0
  630. package/lib/stdlib/plugin/menu/index.js +244 -0
  631. package/lib/stdlib/plugin/menu/index.js.map +1 -0
  632. package/lib/stdlib/plugin/minimap/index.d.ts +11 -3
  633. package/lib/stdlib/plugin/minimap/index.js +19 -20
  634. package/lib/stdlib/plugin/minimap/index.js.map +1 -1
  635. package/lib/stdlib/plugin/toolbar/index.d.ts +59 -0
  636. package/lib/stdlib/plugin/toolbar/index.js +222 -0
  637. package/lib/stdlib/plugin/toolbar/index.js.map +1 -0
  638. package/lib/stdlib/plugin/tooltip/index.d.ts +96 -0
  639. package/lib/stdlib/plugin/tooltip/index.js +385 -0
  640. package/lib/stdlib/plugin/tooltip/index.js.map +1 -0
  641. package/lib/stdlib/plugin/types.d.ts +8 -0
  642. package/lib/stdlib/plugin/types.js +3 -0
  643. package/lib/stdlib/plugin/types.js.map +1 -0
  644. package/lib/stdlib/theme/dark.d.ts +1 -2
  645. package/lib/stdlib/theme/dark.js +14 -1
  646. package/lib/stdlib/theme/dark.js.map +1 -1
  647. package/lib/stdlib/theme/index.d.ts +2 -0
  648. package/lib/stdlib/theme/index.js +19 -0
  649. package/lib/stdlib/theme/index.js.map +1 -0
  650. package/lib/stdlib/theme/light.d.ts +1 -2
  651. package/lib/stdlib/theme/light.js +66 -10
  652. package/lib/stdlib/theme/light.js.map +1 -1
  653. package/lib/stdlib/themeSolver/base.d.ts +1 -1
  654. package/lib/stdlib/themeSolver/base.js +2 -1
  655. package/lib/stdlib/themeSolver/base.js.map +1 -1
  656. package/lib/stdlib/themeSolver/index.d.ts +3 -0
  657. package/lib/stdlib/themeSolver/index.js +20 -0
  658. package/lib/stdlib/themeSolver/index.js.map +1 -0
  659. package/lib/stdlib/themeSolver/spec.d.ts +2 -4
  660. package/lib/stdlib/themeSolver/spec.js +4 -6
  661. package/lib/stdlib/themeSolver/spec.js.map +1 -1
  662. package/lib/stdlib/themeSolver/subject.d.ts +2 -4
  663. package/lib/stdlib/themeSolver/subject.js +4 -4
  664. package/lib/stdlib/themeSolver/subject.js.map +1 -1
  665. package/lib/types/behavior.js.map +1 -1
  666. package/lib/types/combo.d.ts +51 -3
  667. package/lib/types/common.d.ts +10 -0
  668. package/lib/types/data.d.ts +13 -7
  669. package/lib/types/edge.d.ts +19 -5
  670. package/lib/types/event.d.ts +9 -1
  671. package/lib/types/event.js +10 -10
  672. package/lib/types/event.js.map +1 -1
  673. package/lib/types/graph.d.ts +169 -20
  674. package/lib/types/history.d.ts +28 -0
  675. package/lib/types/history.js +9 -0
  676. package/lib/types/history.js.map +1 -0
  677. package/lib/types/hook.d.ts +33 -6
  678. package/lib/types/index.d.ts +11 -5
  679. package/lib/types/index.js.map +1 -1
  680. package/lib/types/item.d.ts +14 -8
  681. package/lib/types/item.js +1 -1
  682. package/lib/types/item.js.map +1 -1
  683. package/lib/types/layout.d.ts +4 -1
  684. package/lib/types/loop.d.ts +21 -0
  685. package/lib/types/loop.js +15 -0
  686. package/lib/types/loop.js.map +1 -0
  687. package/lib/types/node.d.ts +90 -10
  688. package/lib/types/plugin.d.ts +4 -0
  689. package/lib/types/plugin.js.map +1 -1
  690. package/lib/types/spec.d.ts +26 -9
  691. package/lib/types/theme.d.ts +76 -10
  692. package/lib/types/theme.js +1 -2
  693. package/lib/types/theme.js.map +1 -1
  694. package/lib/util/animate.d.ts +2 -2
  695. package/lib/util/animate.js +52 -17
  696. package/lib/util/animate.js.map +1 -1
  697. package/lib/util/array.d.ts +8 -0
  698. package/lib/util/array.js +13 -2
  699. package/lib/util/array.js.map +1 -1
  700. package/lib/util/arrow.d.ts +17 -0
  701. package/lib/util/arrow.js +60 -0
  702. package/lib/util/arrow.js.map +1 -0
  703. package/lib/util/bbox.d.ts +106 -0
  704. package/lib/util/bbox.js +273 -0
  705. package/lib/util/bbox.js.map +1 -0
  706. package/lib/util/behavior.d.ts +2 -0
  707. package/lib/util/behavior.js +16 -0
  708. package/lib/util/behavior.js.map +1 -0
  709. package/lib/util/canvas.d.ts +1 -2
  710. package/lib/util/canvas.js +11 -20
  711. package/lib/util/canvas.js.map +1 -1
  712. package/lib/util/data.d.ts +96 -0
  713. package/lib/util/data.js +276 -0
  714. package/lib/util/data.js.map +1 -0
  715. package/lib/util/event.d.ts +29 -1
  716. package/lib/util/event.js +73 -1
  717. package/lib/util/event.js.map +1 -1
  718. package/lib/util/extend.d.ts +8 -2
  719. package/lib/util/extend.js.map +1 -1
  720. package/lib/util/index.d.ts +41 -3
  721. package/lib/util/index.js +20 -1
  722. package/lib/util/index.js.map +1 -1
  723. package/lib/util/item.d.ts +2 -1
  724. package/lib/util/item.js +38 -13
  725. package/lib/util/item.js.map +1 -1
  726. package/lib/util/layout.d.ts +40 -0
  727. package/lib/util/layout.js +172 -0
  728. package/lib/util/layout.js.map +1 -0
  729. package/lib/util/loop.d.ts +37 -0
  730. package/lib/util/loop.js +111 -0
  731. package/lib/util/loop.js.map +1 -0
  732. package/lib/util/mapper.js +4 -9
  733. package/lib/util/mapper.js.map +1 -1
  734. package/lib/util/math.d.ts +15 -0
  735. package/lib/util/math.js +17 -1
  736. package/lib/util/math.js.map +1 -1
  737. package/lib/util/mock.d.ts +30 -0
  738. package/lib/util/mock.js +73 -0
  739. package/lib/util/mock.js.map +1 -0
  740. package/lib/util/path.d.ts +11 -0
  741. package/lib/util/path.js +49 -0
  742. package/lib/util/path.js.map +1 -0
  743. package/lib/util/point.d.ts +24 -2
  744. package/lib/util/point.js +31 -3
  745. package/lib/util/point.js.map +1 -1
  746. package/lib/util/polyline.d.ts +113 -0
  747. package/lib/util/polyline.js +524 -0
  748. package/lib/util/polyline.js.map +1 -0
  749. package/lib/util/router.d.ts +31 -0
  750. package/lib/util/router.js +384 -0
  751. package/lib/util/router.js.map +1 -0
  752. package/lib/util/shape.d.ts +39 -4
  753. package/lib/util/shape.js +122 -3
  754. package/lib/util/shape.js.map +1 -1
  755. package/lib/util/shape3d.d.ts +1 -1
  756. package/lib/util/shape3d.js +11 -5
  757. package/lib/util/shape3d.js.map +1 -1
  758. package/lib/util/type.d.ts +6 -0
  759. package/lib/util/type.js +9 -2
  760. package/lib/util/type.js.map +1 -1
  761. package/lib/util/zoom.d.ts +2 -2
  762. package/lib/util/zoom.js +6 -2
  763. package/lib/util/zoom.js.map +1 -1
  764. package/package.json +42 -22
  765. package/src/api-doc/behaviors.ts +2 -0
  766. package/src/api-doc/graph.ts +4 -0
  767. package/src/api-doc/item.ts +43 -0
  768. package/src/api-doc/layout.ts +13 -0
  769. package/src/api-doc/plugins.ts +1 -0
  770. package/src/api-doc/readme.md +59 -0
  771. package/src/api-doc/types.ts +2 -0
  772. package/src/api-doc/util.ts +3 -0
  773. package/src/constant/shape.ts +4 -1
  774. package/src/index.ts +14 -4
  775. package/src/item/combo.ts +307 -2
  776. package/src/item/edge.ts +73 -24
  777. package/src/item/item.ts +184 -85
  778. package/src/item/node.ts +138 -69
  779. package/src/runtime/controller/data.ts +665 -191
  780. package/src/runtime/controller/interaction.ts +31 -7
  781. package/src/runtime/controller/item.ts +990 -172
  782. package/src/runtime/controller/layout.ts +165 -13
  783. package/src/runtime/controller/plugin.ts +47 -10
  784. package/src/runtime/controller/theme.ts +8 -4
  785. package/src/runtime/graph.ts +922 -144
  786. package/src/stdlib/behavior/activate-relations.ts +14 -11
  787. package/src/stdlib/behavior/brush-select.ts +4 -5
  788. package/src/stdlib/behavior/click-select.ts +26 -11
  789. package/src/stdlib/behavior/collapse-expand-combo.ts +57 -0
  790. package/src/stdlib/behavior/collapse-expand-tree.ts +106 -0
  791. package/src/stdlib/behavior/drag-canvas.ts +15 -13
  792. package/src/stdlib/behavior/drag-combo.ts +589 -0
  793. package/src/stdlib/behavior/drag-node.ts +380 -110
  794. package/src/stdlib/behavior/hover-activate.ts +3 -5
  795. package/src/stdlib/behavior/index.ts +15 -0
  796. package/src/stdlib/behavior/lasso-select.ts +6 -2
  797. package/src/stdlib/behavior/orbit-canvas-3d.ts +3 -5
  798. package/src/stdlib/behavior/rotate-canvas-3d.ts +1 -3
  799. package/src/stdlib/behavior/track-canvas-3d.ts +3 -5
  800. package/src/stdlib/behavior/types.ts +15 -0
  801. package/src/stdlib/behavior/zoom-canvas-3d.ts +5 -7
  802. package/src/stdlib/behavior/zoom-canvas.ts +19 -19
  803. package/src/stdlib/data/index.ts +3 -0
  804. package/src/stdlib/data/mapNodeSize.ts +67 -0
  805. package/src/stdlib/data/transformV4Data.ts +207 -0
  806. package/src/stdlib/data/validateData.ts +146 -0
  807. package/src/stdlib/index.ts +221 -37
  808. package/src/stdlib/item/combo/circle.ts +113 -0
  809. package/src/stdlib/item/combo/index.ts +2 -0
  810. package/src/stdlib/item/combo/rect.ts +123 -0
  811. package/src/stdlib/item/edge/base.ts +71 -6
  812. package/src/stdlib/item/edge/cubic-horizontal.ts +86 -0
  813. package/src/stdlib/item/edge/cubic-vertical.ts +85 -0
  814. package/src/stdlib/item/edge/cubic.ts +198 -0
  815. package/src/stdlib/item/edge/index.ts +6 -0
  816. package/src/stdlib/item/edge/line.ts +14 -15
  817. package/src/stdlib/item/edge/loop.ts +162 -0
  818. package/src/stdlib/item/edge/polyline.ts +161 -0
  819. package/src/stdlib/item/edge/quadratic.ts +133 -0
  820. package/src/stdlib/item/node/base.ts +195 -53
  821. package/src/stdlib/item/node/base3d.ts +2 -0
  822. package/src/stdlib/item/node/circle.ts +5 -5
  823. package/src/stdlib/item/node/diamond.ts +144 -0
  824. package/src/stdlib/item/node/donut.ts +368 -0
  825. package/src/stdlib/item/node/ellipse.ts +128 -0
  826. package/src/stdlib/item/node/hexagon.ts +168 -0
  827. package/src/stdlib/item/node/index.ts +8 -0
  828. package/src/stdlib/item/node/modelRect.ts +405 -0
  829. package/src/stdlib/item/node/rect.ts +141 -0
  830. package/src/stdlib/item/node/star.ts +181 -0
  831. package/src/stdlib/item/node/triangle.ts +265 -0
  832. package/src/stdlib/plugin/fisheye/index.ts +607 -0
  833. package/src/stdlib/plugin/grid/index.ts +125 -0
  834. package/src/stdlib/plugin/history/combo-command.ts +28 -0
  835. package/src/stdlib/plugin/history/command.ts +81 -0
  836. package/src/stdlib/plugin/history/index.ts +347 -0
  837. package/src/stdlib/plugin/history/item-data-command.ts +96 -0
  838. package/src/stdlib/plugin/history/layer-updated-command.ts +28 -0
  839. package/src/stdlib/plugin/history/state-updated-command.ts +36 -0
  840. package/src/stdlib/plugin/history/visibility-updated-command.ts +41 -0
  841. package/src/stdlib/plugin/hull/bubbleset.ts +828 -0
  842. package/src/stdlib/plugin/hull/convexHull.ts +68 -0
  843. package/src/stdlib/plugin/hull/hullComponent.ts +501 -0
  844. package/src/stdlib/plugin/hull/index.ts +234 -0
  845. package/src/stdlib/plugin/hull/types.ts +15 -0
  846. package/src/stdlib/plugin/hull/util.ts +511 -0
  847. package/src/stdlib/plugin/index.ts +8 -0
  848. package/src/stdlib/plugin/legend/index.ts +122 -61
  849. package/src/stdlib/plugin/menu/index.ts +275 -0
  850. package/src/stdlib/plugin/minimap/index.ts +35 -26
  851. package/src/stdlib/plugin/toolbar/index.ts +257 -0
  852. package/src/stdlib/plugin/tooltip/index.ts +444 -0
  853. package/src/stdlib/plugin/types.ts +8 -0
  854. package/src/stdlib/theme/dark.ts +13 -1
  855. package/src/stdlib/theme/index.ts +2 -0
  856. package/src/stdlib/theme/light.ts +88 -10
  857. package/src/stdlib/themeSolver/base.ts +1 -1
  858. package/src/stdlib/themeSolver/index.ts +3 -0
  859. package/src/stdlib/themeSolver/spec.ts +2 -5
  860. package/src/stdlib/themeSolver/subject.ts +2 -5
  861. package/src/types/behavior.ts +0 -1
  862. package/src/types/combo.ts +61 -4
  863. package/src/types/common.ts +13 -0
  864. package/src/types/data.ts +28 -7
  865. package/src/types/edge.ts +30 -6
  866. package/src/types/event.ts +8 -8
  867. package/src/types/graph.ts +232 -25
  868. package/src/types/history.ts +30 -0
  869. package/src/types/hook.ts +37 -7
  870. package/src/types/index.ts +37 -12
  871. package/src/types/item.ts +25 -11
  872. package/src/types/layout.ts +20 -16
  873. package/src/types/loop.ts +23 -0
  874. package/src/types/node.ts +94 -14
  875. package/src/types/plugin.ts +7 -1
  876. package/src/types/spec.ts +30 -13
  877. package/src/types/theme.ts +80 -10
  878. package/src/util/animate.ts +60 -20
  879. package/src/util/array.ts +12 -1
  880. package/src/util/arrow.ts +62 -0
  881. package/src/util/bbox.ts +298 -0
  882. package/src/util/behavior.ts +14 -0
  883. package/src/util/canvas.ts +16 -24
  884. package/src/util/data.ts +307 -0
  885. package/src/util/event.ts +114 -1
  886. package/src/util/extend.ts +8 -2
  887. package/src/util/index.ts +31 -1
  888. package/src/util/item.ts +79 -13
  889. package/src/util/layout.ts +165 -0
  890. package/src/util/loop.ts +145 -0
  891. package/src/util/mapper.ts +10 -9
  892. package/src/util/math.ts +24 -0
  893. package/src/util/mock.ts +72 -0
  894. package/src/util/path.ts +52 -0
  895. package/src/util/point.ts +33 -2
  896. package/src/util/polyline.ts +676 -0
  897. package/src/util/router.ts +552 -0
  898. package/src/util/shape.ts +159 -6
  899. package/src/util/shape3d.ts +16 -11
  900. package/src/util/type.ts +8 -1
  901. package/src/util/zoom.ts +8 -4
  902. package/esm/stdlib/data/comboFromNode.d.ts +0 -9
  903. package/esm/stdlib/data/comboFromNode.js +0 -28
  904. package/esm/stdlib/data/comboFromNode.js.map +0 -1
  905. package/lib/stdlib/data/comboFromNode.d.ts +0 -9
  906. package/lib/stdlib/data/comboFromNode.js +0 -32
  907. package/lib/stdlib/data/comboFromNode.js.map +0 -1
  908. package/src/stdlib/data/comboFromNode.ts +0 -28
@@ -1,6 +1,16 @@
1
1
  import { AABB, Canvas, DisplayObject, Group } from '@antv/g';
2
2
  import { GraphChange, ID } from '@antv/graphlib';
3
- import { debounce, isArray, isObject, throttle } from '@antv/util';
3
+ import {
4
+ debounce,
5
+ each,
6
+ isArray,
7
+ isObject,
8
+ map,
9
+ throttle,
10
+ uniq,
11
+ uniqueId,
12
+ } from '@antv/util';
13
+ import { DirectionalLight, AmbientLight } from '@antv/g-plugin-3d';
4
14
  import registry from '../../stdlib';
5
15
  import {
6
16
  ComboModel,
@@ -21,14 +31,15 @@ import {
21
31
  import Node from '../../item/node';
22
32
  import Edge from '../../item/edge';
23
33
  import Combo from '../../item/combo';
24
- import { upsertShape } from '../../util/shape';
34
+ import { getCombinedBoundsByData, upsertShape } from '../../util/shape';
25
35
  import { getExtension } from '../../util/extension';
26
36
  import { upsertTransientItem } from '../../util/item';
27
37
  import {
28
38
  ITEM_TYPE,
29
39
  ShapeStyle,
30
40
  SHAPE_TYPE,
31
- lodStrategyObj,
41
+ LodStrategyObj,
42
+ DisplayMapper,
32
43
  } from '../../types/item';
33
44
  import {
34
45
  ThemeSpecification,
@@ -36,33 +47,58 @@ import {
36
47
  EdgeThemeSpecifications,
37
48
  NodeStyleSet,
38
49
  EdgeStyleSet,
50
+ ComboThemeSpecifications,
51
+ ComboStyleSet,
39
52
  } from '../../types/theme';
40
- import { DirectionalLight, AmbientLight } from '@antv/g-plugin-3d';
41
53
  import { ViewportChangeHookParams } from '../../types/hook';
42
54
  import { formatLodStrategy } from '../../util/zoom';
55
+ import {
56
+ deconstructData,
57
+ graphComboTreeDfs,
58
+ graphCoreTreeDfs,
59
+ traverseAncestors,
60
+ traverseAncestorsAndSucceeds,
61
+ traverseGraphAncestors,
62
+ } from '../../util/data';
63
+ import { getGroupedChanges } from '../../util/event';
64
+ import { BaseNode } from '../../stdlib/item/node/base';
65
+ import { BaseEdge } from '../../stdlib/item/edge/base';
66
+ import { EdgeCollisionChecker, QuadTree } from '../../util/polyline';
43
67
 
44
68
  /**
45
69
  * Manages and stores the node / edge / combo items.
46
70
  */
47
71
  export class ItemController {
48
72
  public graph: IGraph;
49
- public nodeExtensions = [];
50
- public edgeExtensions = [];
51
- public comboExtensions = [];
73
+ public nodeExtensions: BaseNode[] = [];
74
+ public edgeExtensions: BaseEdge[] = [];
75
+ public comboExtensions: BaseNode[] = [];
52
76
 
53
77
  public zoom: number;
54
78
 
55
79
  /**
56
80
  * Node / edge / combo items map
57
81
  */
58
- private itemMap: { [id: ID]: Node | Edge | Combo } = {};
82
+ private itemMap: Map<ID, Node | Edge | Combo> = new Map<
83
+ ID,
84
+ Node | Edge | Combo
85
+ >();
59
86
 
60
87
  /**
61
88
  * node / edge / combo 's mapper in graph config
62
89
  */
63
- private nodeMapper: ((data: NodeModel) => NodeDisplayModel) | NodeEncode;
64
- private edgeMapper: ((data: EdgeModel) => EdgeDisplayModel) | EdgeEncode;
65
- private comboMapper: ((data: ComboModel) => ComboDisplayModel) | ComboEncode;
90
+ private nodeMapper:
91
+ | ((data: NodeModel) => NodeDisplayModel)
92
+ | NodeEncode
93
+ | undefined;
94
+ private edgeMapper:
95
+ | ((data: EdgeModel) => EdgeDisplayModel)
96
+ | EdgeEncode
97
+ | undefined;
98
+ private comboMapper:
99
+ | ((data: ComboModel) => ComboDisplayModel)
100
+ | ComboEncode
101
+ | undefined;
66
102
 
67
103
  private nodeStateMapper: {
68
104
  [stateName: string]: ((data: NodeModel) => NodeDisplayModel) | NodeEncode;
@@ -76,28 +112,39 @@ export class ItemController {
76
112
  | ComboEncode;
77
113
  };
78
114
 
115
+ // if the graph has combos, nodeGroup/edgeGroup/comboGroup point to the same group, so as transient groups.
79
116
  private nodeGroup: Group;
80
117
  private edgeGroup: Group;
118
+ private comboGroup: Group;
81
119
  private transientNodeGroup: Group;
82
120
  private transientEdgeGroup: Group;
83
- // TODO: combo? not a independent group
121
+ private transientComboGroup: Group;
84
122
 
85
123
  private nodeDataTypeSet: Set<string> = new Set();
86
124
  private edgeDataTypeSet: Set<string> = new Set();
125
+ private comboDataTypeSet: Set<string> = new Set();
87
126
 
88
127
  // The G shapes or groups on transient map drawn by this controller
89
- private transientObjectMap: {
90
- [id: string]: DisplayObject;
91
- } = {};
92
- private transientItemMap: {
93
- [id: string]: Node | Edge | Combo | Group;
94
- } = {};
128
+ private transientObjectMap: Map<ID, DisplayObject> = new Map<
129
+ ID,
130
+ DisplayObject
131
+ >();
132
+ private transientItemMap: Map<ID, Node | Edge | Combo | Group> = new Map<
133
+ ID,
134
+ Node | Edge | Combo | Group
135
+ >();
95
136
 
96
137
  constructor(graph: IGraph<any, any>) {
97
138
  this.graph = graph;
98
139
  // get mapper for node / edge / combo
99
- const { node, edge, combo, nodeState, edgeState, comboState } =
100
- graph.getSpecification();
140
+ const {
141
+ node,
142
+ edge,
143
+ combo,
144
+ nodeState = {},
145
+ edgeState = {},
146
+ comboState = {},
147
+ } = graph.getSpecification();
101
148
  this.nodeMapper = node;
102
149
  this.edgeMapper = edge;
103
150
  this.comboMapper = combo;
@@ -123,9 +170,13 @@ export class ItemController {
123
170
  this.graph.hooks.itemvisibilitychange.tap(
124
171
  this.onItemVisibilityChange.bind(this),
125
172
  );
173
+ this.graph.hooks.itemzindexchange.tap(this.onItemZIndexChange.bind(this));
126
174
  this.graph.hooks.transientupdate.tap(this.onTransientUpdate.bind(this));
127
175
  this.graph.hooks.viewportchange.tap(this.onViewportChange.bind(this));
128
176
  this.graph.hooks.themechange.tap(this.onThemeChange.bind(this));
177
+ this.graph.hooks.treecollapseexpand.tap(
178
+ this.onTreeCollapseExpand.bind(this),
179
+ );
129
180
  this.graph.hooks.destroy.tap(this.onDestroy.bind(this));
130
181
  }
131
182
 
@@ -136,9 +187,9 @@ export class ItemController {
136
187
  // TODO: user need to config using node/edge/combo types from useLib to spec?
137
188
  const { node, edge, combo } = this.graph.getSpecification();
138
189
 
139
- const nodeTypes = Object.keys(registry.useLib.nodes);
140
- const edgeTypes = Object.keys(registry.useLib.edges);
141
- const comboTypes = Object.keys(registry.useLib.combos);
190
+ const nodeTypes = Object.keys(registry.useLib.nodes || {});
191
+ const edgeTypes = Object.keys(registry.useLib.edges || {});
192
+ const comboTypes = Object.keys(registry.useLib.combos || {});
142
193
  return {
143
194
  node: nodeTypes
144
195
  .map((config) => getExtension(config, registry.useLib, 'node'))
@@ -166,17 +217,22 @@ export class ItemController {
166
217
 
167
218
  // 0. clear groups on canvas, and create new groups
168
219
  graph.canvas.removeChildren();
220
+ const comboGroup = new Group({ id: 'combo-group' });
169
221
  const edgeGroup = new Group({ id: 'edge-group' });
170
222
  const nodeGroup = new Group({ id: 'node-group' });
223
+ graph.canvas.appendChild(comboGroup);
171
224
  graph.canvas.appendChild(edgeGroup);
172
225
  graph.canvas.appendChild(nodeGroup);
173
226
  this.nodeGroup = nodeGroup;
174
227
  this.edgeGroup = edgeGroup;
228
+ this.comboGroup = comboGroup;
175
229
 
176
230
  // Also create transient groups on transient canvas.
177
231
  transientCanvas.removeChildren();
232
+ this.transientComboGroup = new Group({ id: 'combo-group' });
178
233
  this.transientEdgeGroup = new Group({ id: 'edge-group' });
179
234
  this.transientNodeGroup = new Group({ id: 'node-group' });
235
+ transientCanvas.appendChild(this.transientComboGroup);
180
236
  transientCanvas.appendChild(this.transientEdgeGroup);
181
237
  transientCanvas.appendChild(this.transientNodeGroup);
182
238
 
@@ -195,20 +251,50 @@ export class ItemController {
195
251
  intensity: Math.PI * 0.7,
196
252
  },
197
253
  });
254
+ // @ts-ignore
198
255
  graph.canvas.appendChild(ambientLight);
256
+ // @ts-ignore
199
257
  graph.canvas.appendChild(light);
200
258
  const { width, height } = graph.canvas.getConfig();
201
259
  graph.canvas.getCamera().setPerspective(0.1, 50000, 45, width / height);
202
260
  }
203
261
 
204
262
  // 2. create node / edge / combo items, classes from ../../item, and element drawing and updating fns from node/edge/comboExtensions
205
- const nodeModels = graphCore.getAllNodes();
206
- const edgeModels = graphCore.getAllEdges();
207
- // const combos = graphCore.getAllCombos();
263
+ const { nodes, edges, combos } = deconstructData({
264
+ nodes: graphCore.getAllNodes(),
265
+ edges: graphCore.getAllEdges(),
266
+ });
208
267
 
209
- this.renderNodes(nodeModels, theme.node);
210
- this.renderEdges(edgeModels, theme.edge);
211
- // TODO: combo
268
+ this.renderNodes(nodes, theme.node);
269
+ this.renderCombos(combos, theme.combo, graphCore);
270
+ this.renderEdges(edges, theme.edge);
271
+ this.sortByComboTree(graphCore);
272
+ // collapse the combos which has 'collapsed' in initial data
273
+ if (graphCore.hasTreeStructure('combo')) {
274
+ graphCoreTreeDfs(
275
+ graphCore,
276
+ graphCore.getRoots('combo'),
277
+ (child) => {
278
+ if (child.data.collapsed) this.collapseCombo(graphCore, child);
279
+ },
280
+ 'BT',
281
+ 'combo',
282
+ );
283
+ }
284
+ // collapse the sub tree which has 'collapsed' in initial data
285
+ if (graphCore.hasTreeStructure('tree')) {
286
+ const collapseNodes = [];
287
+ graphCoreTreeDfs(
288
+ graphCore,
289
+ graphCore.getRoots('tree'),
290
+ (child) => {
291
+ if (child.data.collapsed) collapseNodes.push(child);
292
+ },
293
+ 'BT',
294
+ 'tree',
295
+ );
296
+ this.collapseSubTree(collapseNodes, graphCore, false);
297
+ }
212
298
  }
213
299
 
214
300
  /**
@@ -220,45 +306,61 @@ export class ItemController {
220
306
  changes: GraphChange<NodeModelData, EdgeModelData>[];
221
307
  graphCore: GraphCore;
222
308
  theme: ThemeSpecification;
223
- action?: 'updateNodePosition';
309
+ upsertAncestors?: boolean;
310
+ animate?: boolean;
311
+ action?: 'updatePosition';
312
+ callback?: (
313
+ model: NodeModel | EdgeModel | ComboModel,
314
+ canceled?: boolean,
315
+ ) => void;
224
316
  }) {
225
- const { changes, graphCore, theme = {}, action } = param;
226
- const groupedChanges = {
227
- NodeRemoved: [],
228
- EdgeRemoved: [],
229
- NodeAdded: [],
230
- EdgeAdded: [],
231
- NodeDataUpdated: [],
232
- EdgeUpdated: [],
233
- EdgeDataUpdated: [],
234
- };
235
- changes.forEach((change) => {
236
- const { type: changeType } = change;
237
- groupedChanges[changeType].push(change);
238
- });
317
+ const {
318
+ changes,
319
+ graphCore,
320
+ action,
321
+ animate = true,
322
+ upsertAncestors = true,
323
+ theme = {},
324
+ callback = () => {},
325
+ } = param;
326
+ const groupedChanges = getGroupedChanges(graphCore, changes);
239
327
  const { itemMap } = this;
240
328
  // change items according to the order of the keys in groupedChanges
241
329
 
242
330
  // === 1. remove edges; 2. remove nodes ===
243
- groupedChanges.EdgeRemoved.concat(groupedChanges.NodeRemoved).forEach(
331
+ [...groupedChanges.EdgeRemoved, ...groupedChanges.NodeRemoved].forEach(
244
332
  ({ value }) => {
245
333
  const { id } = value;
246
- const item = itemMap[id];
334
+ const item = itemMap.get(id);
247
335
  if (item) {
248
336
  item.destroy();
249
- delete itemMap[id];
337
+ itemMap.delete(id);
250
338
  }
251
339
  },
252
340
  );
253
341
 
254
- const { node: nodeTheme = {}, edge: edgeTheme = {} } = theme;
342
+ const {
343
+ node: nodeTheme = {},
344
+ edge: edgeTheme = {},
345
+ combo: comboTheme = {},
346
+ } = theme;
255
347
 
256
348
  // === 3. add nodes ===
257
349
  if (groupedChanges.NodeAdded.length) {
258
- this.renderNodes(
259
- groupedChanges.NodeAdded.map((change) => change.value),
260
- nodeTheme,
350
+ const newNodes: NodeModel[] = [];
351
+ const newCombos: ComboModel[] = [];
352
+ groupedChanges.NodeAdded.map((change) => change.value).forEach(
353
+ (model) => {
354
+ if (model.data._isCombo) newCombos.push(model as ComboModel);
355
+ else newNodes.push(model);
356
+ },
261
357
  );
358
+ if (newNodes.length) {
359
+ this.renderNodes(newNodes, nodeTheme);
360
+ }
361
+ if (newCombos.length) {
362
+ this.renderCombos(newCombos, comboTheme, graphCore);
363
+ }
262
364
  }
263
365
  // === 4. add edges ===
264
366
  if (groupedChanges.EdgeAdded.length) {
@@ -269,40 +371,111 @@ export class ItemController {
269
371
  }
270
372
 
271
373
  // === 5. update nodes's data ===
272
- // merge changes for each node
374
+ // merge changes for each node or combo
273
375
  if (groupedChanges.NodeDataUpdated.length) {
274
- const nodeUpdate = {};
376
+ const nodeComboUpdate: any = {};
275
377
  groupedChanges.NodeDataUpdated.forEach((change) => {
276
378
  const { id, propertyName, newValue, oldValue } = change;
277
- nodeUpdate[id] = nodeUpdate[id] || { previous: {}, current: {} };
379
+ nodeComboUpdate[id] = nodeComboUpdate[id] || {
380
+ id,
381
+ previous: {},
382
+ current: {},
383
+ };
278
384
  if (!propertyName) {
279
- nodeUpdate[id] = {
385
+ nodeComboUpdate[id] = {
386
+ id,
280
387
  isReplace: true, // whether replace the whole data
281
388
  previous: oldValue,
282
389
  current: newValue,
283
390
  };
284
391
  } else {
285
- nodeUpdate[id].previous[propertyName] = oldValue;
286
- nodeUpdate[id].current[propertyName] = newValue;
392
+ nodeComboUpdate[id].previous[propertyName] = oldValue;
393
+ nodeComboUpdate[id].current[propertyName] = newValue;
287
394
  }
288
395
  });
289
396
  const { dataTypeField: nodeDataTypeField } = nodeTheme;
290
- const edgeToUpdate = {};
291
- const updateEdges = throttle(
292
- (updateMap) => {
293
- Object.keys(updateMap || edgeToUpdate).forEach((id) => {
294
- const item = itemMap[id] as Edge;
295
- if (item && !item.destroyed) item.forceUpdate();
296
- });
297
- },
298
- 16,
299
- {
300
- leading: true,
301
- trailing: true,
302
- },
303
- );
304
- Object.keys(nodeUpdate).forEach((id) => {
305
- const { isReplace, previous, current } = nodeUpdate[id];
397
+ const edgeIdsToUpdate: Set<ID> = new Set<ID>();
398
+ const comboIdsToUpdate: Set<ID> = new Set<ID>();
399
+ const updateRelates = (edgeIds?: Set<ID>) => {
400
+ const ids = edgeIds
401
+ ? [...edgeIds]
402
+ : [...comboIdsToUpdate, ...edgeIdsToUpdate];
403
+ ids.forEach((nid) => {
404
+ const item = itemMap.get(nid) as Edge | Combo;
405
+ if (item && !item.destroyed) item.forceUpdate();
406
+ });
407
+ };
408
+ const debounceUpdateRelates = debounce(updateRelates, 16, false);
409
+
410
+ Object.values(nodeComboUpdate).forEach((updateObj: any) => {
411
+ const { isReplace, previous, current, id } = updateObj;
412
+ if (!graphCore.hasNode(id)) return;
413
+ const onlyMove = action === 'updatePosition';
414
+ const item = itemMap.get(id) as Node | Combo;
415
+ if (!item || item.destroyed) return;
416
+ const type = item.getType();
417
+ const innerModel = graphCore.getNode(id);
418
+ if (
419
+ onlyMove &&
420
+ type === 'node' &&
421
+ isNaN(current.x) &&
422
+ isNaN(current.y)
423
+ ) {
424
+ callback(innerModel, true);
425
+ return;
426
+ }
427
+
428
+ const nodeRelatedIdsToUpdate: Set<ID> = new Set<ID>();
429
+ // collapse and expand
430
+ if (graphCore.hasTreeStructure('combo')) {
431
+ if (type === 'combo' && current.collapsed !== previous.collapsed) {
432
+ if (current.collapsed) {
433
+ this.collapseCombo(graphCore, innerModel as ComboModel);
434
+ } else if (current.collapsed === false) {
435
+ this.expandCombo(graphCore, innerModel as ComboModel);
436
+ }
437
+ }
438
+ const previousParentId = item.displayModel.data.parentId;
439
+ // update the current parent combo tree
440
+ // if the node has previous parent, related previous parent combo should be updated to
441
+ if (upsertAncestors) {
442
+ const begins = [innerModel];
443
+ if (
444
+ previousParentId &&
445
+ previousParentId !== current.parentId &&
446
+ graphCore.hasNode(previousParentId as ID)
447
+ ) {
448
+ begins.push(graphCore.getNode(previousParentId as ID));
449
+ }
450
+ // ancestors and suceeds combos should be updated
451
+ traverseAncestorsAndSucceeds(
452
+ this.graph,
453
+ graphCore,
454
+ begins,
455
+ (treeItem) => {
456
+ if (treeItem.data._isCombo && treeItem.id !== innerModel.id)
457
+ comboIdsToUpdate.add(treeItem.id);
458
+ const relatedEdges = graphCore.getRelatedEdges(treeItem.id);
459
+ relatedEdges.forEach((edge) => {
460
+ edgeIdsToUpdate.add(edge.id);
461
+ nodeRelatedIdsToUpdate.add(edge.id);
462
+ });
463
+ },
464
+ );
465
+ } else if (type === 'combo') {
466
+ // only the succeed combos should be updated
467
+ graphComboTreeDfs(this.graph, [innerModel], (child) => {
468
+ const relatedEdges = graphCore.getRelatedEdges(child.id);
469
+ relatedEdges.forEach((edge) => {
470
+ edgeIdsToUpdate.add(edge.id);
471
+ nodeRelatedIdsToUpdate.add(edge.id);
472
+ });
473
+ if (child.data._isCombo && child.id !== innerModel.id)
474
+ comboIdsToUpdate.add(child.id);
475
+ });
476
+ }
477
+ }
478
+
306
479
  // update the theme if the dataType value is changed
307
480
  let itemTheme;
308
481
  if (
@@ -316,49 +489,74 @@ export class ItemController {
316
489
  nodeTheme,
317
490
  );
318
491
  }
319
- const node = itemMap[id] as Node;
320
- let innerModel;
321
- try {
322
- innerModel = graphCore.getNode(id);
323
- } catch (e) {
324
- innerModel = graphCore.getNode(Number(id));
325
- }
326
- let relatedEdgeInnerModels;
327
- try {
328
- relatedEdgeInnerModels = graphCore.getRelatedEdges(id);
329
- } catch (e) {
330
- relatedEdgeInnerModels = graphCore.getRelatedEdges(Number(id));
331
- }
332
- const nodeRelatedToUpdate = {};
492
+
493
+ const preventPolylineEdgeOverlap =
494
+ innerModel?.data?.preventPolylineEdgeOverlap || false;
495
+ const relatedEdgeInnerModels = preventPolylineEdgeOverlap
496
+ ? this.findNearEdgesByNode(id, graphCore).concat(
497
+ graphCore.getRelatedEdges(id),
498
+ )
499
+ : graphCore.getRelatedEdges(id);
500
+
333
501
  relatedEdgeInnerModels.forEach((edge) => {
334
- edgeToUpdate[edge.id] = edge;
335
- nodeRelatedToUpdate[edge.id] = edge;
502
+ edgeIdsToUpdate.add(edge.id);
503
+ nodeRelatedIdsToUpdate.add(edge.id);
336
504
  });
337
505
 
338
- node.onframe = () => updateEdges(nodeRelatedToUpdate);
339
- node.update(
506
+ item.onframe = () => updateRelates(nodeRelatedIdsToUpdate);
507
+ let statesCache;
508
+ if (
509
+ innerModel.data._isCombo &&
510
+ previous.collapsed !== current.collapsed
511
+ ) {
512
+ statesCache = this.graph.getItemAllStates(id);
513
+ this.graph.clearItemState(id);
514
+ }
515
+ item.update(
340
516
  innerModel,
341
517
  { previous, current },
342
518
  isReplace,
343
519
  itemTheme,
344
- action === 'updateNodePosition',
520
+ onlyMove,
521
+ animate,
345
522
  // call after updating finished
346
- () => {
347
- node.onframe = undefined;
348
- },
523
+ throttle(
524
+ (_, canceled) => {
525
+ item.onframe?.(true);
526
+ item.onframe = undefined;
527
+ if (statesCache) {
528
+ statesCache.forEach((state) =>
529
+ this.graph.setItemState(id, state, true),
530
+ );
531
+ }
532
+ callback(innerModel, canceled);
533
+ },
534
+ 500,
535
+ {
536
+ leading: false,
537
+ trailing: true,
538
+ },
539
+ ),
349
540
  );
541
+
542
+ const parentItem = this.itemMap.get(current.parentId);
543
+ if (current.parentId && parentItem?.model.data.collapsed) {
544
+ this.graph.executeWithoutStacking(() => {
545
+ this.graph.hideItem(innerModel.id, false);
546
+ });
547
+ }
350
548
  });
351
- updateEdges();
549
+ debounceUpdateRelates();
352
550
  }
353
-
354
551
  // === 6. update edges' data ===
355
552
  if (groupedChanges.EdgeDataUpdated.length) {
356
553
  const edgeUpdate = {};
357
554
  groupedChanges.EdgeDataUpdated.forEach((change) => {
358
555
  const { id, propertyName, newValue, oldValue } = change;
359
- edgeUpdate[id] = edgeUpdate[id] || { previous: {}, current: {} };
556
+ edgeUpdate[id] = edgeUpdate[id] || { id, previous: {}, current: {} };
360
557
  if (!propertyName) {
361
558
  edgeUpdate[id] = {
559
+ id,
362
560
  isReplace: true, // whether replace the whole data
363
561
  previous: oldValue,
364
562
  current: newValue,
@@ -369,9 +567,9 @@ export class ItemController {
369
567
  }
370
568
  });
371
569
 
372
- const { dataTypeField: edgeDataTypeField } = edgeTheme;
373
- Object.keys(edgeUpdate).forEach((id) => {
374
- const { isReplace, current, previous } = edgeUpdate[id];
570
+ const { dataTypeField: edgeDataTypeField = '' } = edgeTheme;
571
+ Object.values(edgeUpdate).forEach((updateObj: any) => {
572
+ const { isReplace, current, previous, id } = updateObj;
375
573
  // update the theme if the dataType value is changed
376
574
  let itemTheme;
377
575
  if (previous[edgeDataTypeField] !== current[edgeDataTypeField]) {
@@ -382,29 +580,56 @@ export class ItemController {
382
580
  edgeTheme,
383
581
  );
384
582
  }
385
- const item = itemMap[id];
583
+ const item = itemMap.get(id);
386
584
  const innerModel = graphCore.getEdge(id);
387
- item.update(innerModel, { current, previous }, isReplace, itemTheme);
585
+ if (!item || item.destroyed) return;
586
+ item.update(
587
+ innerModel,
588
+ { current, previous },
589
+ isReplace,
590
+ itemTheme,
591
+ undefined,
592
+ animate,
593
+ (_, canceled) => callback(innerModel, canceled),
594
+ );
388
595
  });
389
596
  }
390
-
391
597
  // === 7. update edges' source target ===
392
598
  if (groupedChanges.EdgeUpdated.length) {
393
599
  const edgeUpdate = {};
394
600
  groupedChanges.EdgeUpdated.forEach((change) => {
395
601
  // propertyName is 'source' or 'target'
396
602
  const { id, propertyName, newValue } = change;
397
- edgeUpdate[id] = edgeUpdate[id] || {};
603
+ edgeUpdate[id] = edgeUpdate[id] || { id };
398
604
  edgeUpdate[id][propertyName] = newValue;
399
605
  });
400
606
 
401
- Object.keys(edgeUpdate).forEach((id) => {
402
- const { source, target } = edgeUpdate[id];
403
- const item = itemMap[id] as Edge;
607
+ Object.values(edgeUpdate).forEach((updateObj: any) => {
608
+ const { source, target, id } = updateObj;
609
+ const item = itemMap.get(id) as Edge;
404
610
  if (source !== undefined)
405
- item.updateEnd('source', this.itemMap[source] as Node);
611
+ item.updateEnd('source', this.itemMap.get(source) as Node);
406
612
  if (target !== undefined)
407
- item.updateEnd('target', this.itemMap[target] as Node);
613
+ item.updateEnd('target', this.itemMap.get(target) as Node);
614
+ });
615
+ }
616
+ // === 8. combo tree structure change, resort the shapes ===
617
+ if (groupedChanges.ComboStructureChanged.length) {
618
+ this.sortByComboTree(graphCore);
619
+ }
620
+ // === 9. tree data structure change, hide the new node and edge while one of the ancestor is collapsed ===
621
+ if (groupedChanges.TreeStructureChanged.length) {
622
+ groupedChanges.TreeStructureChanged.forEach((change) => {
623
+ const { nodeId } = change;
624
+ // hide it when an ancestor is collapsed
625
+ let parent = graphCore.getParent(nodeId, 'tree');
626
+ while (parent) {
627
+ if (parent.data.collapsed) {
628
+ this.graph.hideItem(nodeId, true);
629
+ break;
630
+ }
631
+ parent = graphCore.getParent(parent.id, 'tree');
632
+ }
408
633
  });
409
634
  }
410
635
  }
@@ -425,7 +650,7 @@ export class ItemController {
425
650
  }) {
426
651
  const { ids, states, value } = param;
427
652
  ids.forEach((id) => {
428
- const item = this.itemMap[id];
653
+ const item = this.itemMap.get(id);
429
654
  if (!item) {
430
655
  console.warn(`Fail to set state for item ${id}, which is not exist.`);
431
656
  return;
@@ -442,21 +667,81 @@ export class ItemController {
442
667
  private onItemVisibilityChange(param: {
443
668
  ids: ID[];
444
669
  value: boolean;
670
+ graphCore: GraphCore;
445
671
  animate?: boolean;
446
672
  }) {
447
- const { ids, value, animate = true } = param;
673
+ const { ids, value, graphCore, animate = true } = param;
448
674
  ids.forEach((id) => {
449
- const item = this.itemMap[id];
675
+ const item = this.itemMap.get(id);
450
676
  if (!item) {
451
677
  console.warn(
452
678
  `Fail to set visibility for item ${id}, which is not exist.`,
453
679
  );
454
680
  return;
455
681
  }
682
+ const type = item.getType();
456
683
  if (value) {
457
- item.show(animate);
684
+ if (type === 'edge') {
685
+ item.show(animate);
686
+ } else {
687
+ if (graphCore.hasTreeStructure('combo')) {
688
+ let anccestorCollapsed = false;
689
+ traverseAncestors(graphCore, [item.model], (model) => {
690
+ if (model.data.collapsed) anccestorCollapsed = true;
691
+ return anccestorCollapsed;
692
+ });
693
+ if (anccestorCollapsed) return;
694
+ }
695
+ const relatedEdges = graphCore.getRelatedEdges(id);
696
+ item.show(animate);
697
+ relatedEdges.forEach(({ id: edgeId, source, target }) => {
698
+ if (this.getItemVisible(source) && this.getItemVisible(target))
699
+ this.itemMap.get(edgeId)?.show(animate);
700
+ });
701
+ }
458
702
  } else {
459
703
  item.hide(animate);
704
+ if (type !== 'edge') {
705
+ const relatedEdges = graphCore.getRelatedEdges(id);
706
+ relatedEdges.forEach(({ id: edgeId }) => {
707
+ this.itemMap.get(edgeId)?.hide(animate);
708
+ });
709
+ }
710
+ }
711
+ });
712
+ }
713
+
714
+ private onItemZIndexChange(params: {
715
+ ids: ID[];
716
+ action: 'front' | 'back';
717
+ graphCore: GraphCore;
718
+ }) {
719
+ const { ids = [], action, graphCore } = params;
720
+ ids.forEach((id) => {
721
+ const item = this.itemMap.get(id);
722
+ if (!item) return;
723
+ if (action === 'front') {
724
+ item.toFront();
725
+ if (graphCore.hasTreeStructure('combo')) {
726
+ graphComboTreeDfs(
727
+ this.graph,
728
+ [item.model],
729
+ (model) => {
730
+ if (model.data._isCombo) {
731
+ const subCombo = this.itemMap.get(model.id);
732
+ subCombo && subCombo.toFront();
733
+ }
734
+ },
735
+ 'TB',
736
+ );
737
+ }
738
+ } else {
739
+ item.toBack();
740
+ if (graphCore.hasTreeStructure('combo')) {
741
+ traverseGraphAncestors(this.graph, [item.model], (model) => {
742
+ this.itemMap.get(model.id)?.toBack();
743
+ });
744
+ }
460
745
  }
461
746
  });
462
747
  }
@@ -466,9 +751,7 @@ export class ItemController {
466
751
  const { zoom } = transform;
467
752
  if (zoom) {
468
753
  const zoomRatio = this.graph.getZoom();
469
- Object.values(this.itemMap).forEach((item) =>
470
- item.updateZoom(zoomRatio),
471
- );
754
+ this.itemMap.forEach((item) => item.updateZoom(zoomRatio));
472
755
  this.zoom = zoomRatio;
473
756
  }
474
757
  },
@@ -480,7 +763,7 @@ export class ItemController {
480
763
  if (!theme) return;
481
764
  const { nodeDataTypeSet, edgeDataTypeSet } = this;
482
765
  const { node: nodeTheme, edge: edgeTheme } = theme;
483
- Object.values(this.itemMap).forEach((item) => {
766
+ this.itemMap.forEach((item) => {
484
767
  const itemTye = item.getType();
485
768
  const usingTheme = itemTye === 'node' ? nodeTheme : edgeTheme;
486
769
  const usingTypeSet =
@@ -500,7 +783,7 @@ export class ItemController {
500
783
  false,
501
784
  itemTheme as {
502
785
  styles: NodeStyleSet;
503
- lodStrategy: lodStrategyObj;
786
+ lodStrategy: LodStrategyObj;
504
787
  },
505
788
  );
506
789
  });
@@ -508,6 +791,8 @@ export class ItemController {
508
791
 
509
792
  private onDestroy = () => {
510
793
  Object.values(this.itemMap).forEach((item) => item.destroy());
794
+ // Fix OOM problem, since this map will hold all the refs of items.
795
+ this.itemMap.clear();
511
796
  };
512
797
 
513
798
  private onTransientUpdate(param: {
@@ -519,43 +804,57 @@ export class ItemController {
519
804
  data?: Record<string, any>;
520
805
  action: 'remove' | 'add' | 'update' | undefined;
521
806
  onlyDrawKeyShape?: boolean;
807
+ upsertAncestors?: boolean;
522
808
  [shapeConfig: string]: unknown;
523
809
  };
524
810
  canvas: Canvas;
811
+ graphCore: GraphCore;
525
812
  }) {
526
813
  const { transientObjectMap } = this;
527
- const { type, id, config = {}, canvas } = param;
814
+ const { type, id, config = {}, canvas, graphCore } = param;
528
815
  const {
529
816
  style = {},
530
817
  data = {},
531
818
  capture,
532
819
  action,
533
820
  onlyDrawKeyShape,
821
+ upsertAncestors,
534
822
  } = config as any;
535
823
  const isItemType = type === 'node' || type === 'edge' || type === 'combo';
536
-
537
824
  // Removing
538
825
  if (action === 'remove') {
539
826
  if (isItemType) {
540
- const transientItem = this.transientItemMap[id];
827
+ const transientItem = this.transientItemMap.get(id);
828
+ if (type === 'combo') {
829
+ // remove children from bottom to top
830
+ graphCoreTreeDfs(
831
+ graphCore,
832
+ [graphCore.getNode(id)],
833
+ (child) => {
834
+ const transientChild = this.transientItemMap.get(child.id);
835
+ if (transientChild && !transientChild.destroyed) {
836
+ transientChild.destroy();
837
+ }
838
+ this.transientItemMap.delete(child.id);
839
+ },
840
+ 'BT',
841
+ );
842
+ }
541
843
  if (transientItem && !transientItem.destroyed) {
542
844
  transientItem.destroy();
543
845
  }
544
- delete this.transientItemMap[id];
846
+ this.transientItemMap.delete(id);
545
847
  return;
546
848
  } else {
547
- const preObj = transientObjectMap[id];
548
- if (preObj && !preObj.destroyed) {
549
- preObj.destroy();
550
- }
551
- delete transientObjectMap[id];
849
+ const preObj = transientObjectMap.get(id);
850
+ if (preObj && !preObj.destroyed) preObj.destroy();
851
+ transientObjectMap.delete(id);
552
852
  return;
553
853
  }
554
854
  }
555
-
556
855
  // Adding / Updating
557
856
  if (isItemType) {
558
- const item = this.itemMap[id];
857
+ const item = this.itemMap.get(id);
559
858
  if (!item) {
560
859
  console.warn(
561
860
  `Fail to draw transient item of ${id}, which is not exist.`,
@@ -566,13 +865,18 @@ export class ItemController {
566
865
  item,
567
866
  this.transientNodeGroup,
568
867
  this.transientEdgeGroup,
868
+ this.transientComboGroup,
569
869
  this.transientItemMap,
870
+ this.itemMap,
871
+ graphCore,
570
872
  onlyDrawKeyShape,
873
+ upsertAncestors,
571
874
  );
875
+
572
876
  if (onlyDrawKeyShape) {
573
877
  // only update node positions to cloned node container(group)
574
878
  if (
575
- type === 'node' &&
879
+ (type === 'node' || type === 'combo') &&
576
880
  data.hasOwnProperty('x') &&
577
881
  data.hasOwnProperty('y')
578
882
  ) {
@@ -582,6 +886,54 @@ export class ItemController {
582
886
  // TODO: edge onlyDrawKeyShape?
583
887
  } else {
584
888
  const transItem = transientItem as Node | Edge | Combo;
889
+ const positionChanged =
890
+ data.hasOwnProperty('x') && data.hasOwnProperty('y');
891
+ if (type === 'combo' && positionChanged) {
892
+ const { x, y } = data;
893
+ const { x: ox = x, y: oy = y } = transItem.displayModel.data;
894
+ const dx = x - ox;
895
+ const dy = y - oy;
896
+ // move combo = move children nodes from bottom to top
897
+ graphCoreTreeDfs(
898
+ graphCore,
899
+ [transItem.model],
900
+ (node) => {
901
+ const transChild = this.transientItemMap.get(node.id) as Node;
902
+ if (!transChild) return;
903
+ const { x: childX = 0, y: childY = 0 } = transChild.model
904
+ .data as NodeModelData;
905
+
906
+ transChild?.update({
907
+ ...transChild.model,
908
+ data: {
909
+ ...transChild.model.data,
910
+ x: childX + dx,
911
+ y: childY + dy,
912
+ },
913
+ });
914
+ },
915
+ 'BT',
916
+ );
917
+ }
918
+
919
+ if (
920
+ graphCore.hasTreeStructure('combo') &&
921
+ type !== 'edge' &&
922
+ positionChanged
923
+ ) {
924
+ // force update ancestor combos in the sametime
925
+ let currentAncestor = graphCore.getParent(
926
+ transItem.model.id,
927
+ 'combo',
928
+ );
929
+ while (currentAncestor) {
930
+ const ancestorItem = this.transientItemMap.get(currentAncestor.id);
931
+ if (ancestorItem) (ancestorItem as Combo).forceUpdate();
932
+ currentAncestor = graphCore.getParent(currentAncestor.id, 'combo');
933
+ }
934
+ }
935
+
936
+ // Update the target combo's posiiton and other props
585
937
  transItem.update({
586
938
  ...transItem.model,
587
939
  data: {
@@ -593,12 +945,27 @@ export class ItemController {
593
945
  return;
594
946
  }
595
947
 
596
- const shape = upsertShape(type, String(id), style, transientObjectMap);
948
+ const idStr = String(id);
949
+ const shape = upsertShape(
950
+ type,
951
+ idStr,
952
+ style,
953
+ Object.fromEntries(transientObjectMap),
954
+ );
955
+ transientObjectMap.set(idStr, shape);
597
956
  shape.style.pointerEvents = capture ? 'auto' : 'none';
598
957
  canvas.getRoot().appendChild(shape);
599
958
  }
600
959
  public getTransient(id: string) {
601
- return this.transientObjectMap[id];
960
+ return this.transientObjectMap.get(id);
961
+ }
962
+
963
+ public getTransientItem(id: ID) {
964
+ return this.transientItemMap[id];
965
+ }
966
+
967
+ public findDisplayModel(id: ID) {
968
+ return this.itemMap.get(id)?.displayModel;
602
969
  }
603
970
 
604
971
  /**
@@ -610,7 +977,7 @@ export class ItemController {
610
977
  nodeTheme: NodeThemeSpecifications = {},
611
978
  ) {
612
979
  const { nodeExtensions, nodeGroup, nodeDataTypeSet, graph } = this;
613
- const { dataTypeField } = nodeTheme;
980
+ const { dataTypeField = '' } = nodeTheme;
614
981
  const zoom = graph.getZoom();
615
982
  models.forEach((node) => {
616
983
  // get the base styles from theme
@@ -623,23 +990,90 @@ export class ItemController {
623
990
  nodeTheme,
624
991
  );
625
992
 
626
- this.itemMap[node.id] = new Node({
627
- model: node,
628
- renderExtensions: nodeExtensions,
629
- containerGroup: nodeGroup,
630
- mapper: this.nodeMapper,
631
- stateMapper: this.nodeStateMapper,
993
+ this.itemMap.set(
994
+ node.id,
995
+ new Node({
996
+ model: node,
997
+ renderExtensions: nodeExtensions,
998
+ containerGroup: nodeGroup,
999
+ mapper: this.nodeMapper,
1000
+ stateMapper: this.nodeStateMapper,
1001
+ zoom,
1002
+ theme: itemTheme as {
1003
+ styles: NodeStyleSet;
1004
+ lodStrategy: LodStrategyObj;
1005
+ },
1006
+ device:
1007
+ graph.rendererType === 'webgl-3d'
1008
+ ? // TODO: G type
1009
+ (graph.canvas.context as any).deviceRendererPlugin.getDevice()
1010
+ : undefined,
1011
+ }),
1012
+ );
1013
+ });
1014
+ }
1015
+
1016
+ private renderCombos(
1017
+ models: ComboModel[],
1018
+ comboTheme: ComboThemeSpecifications = {},
1019
+ graphCore: GraphCore,
1020
+ ) {
1021
+ const { comboExtensions, comboGroup, comboDataTypeSet, graph, itemMap } =
1022
+ this;
1023
+ const { dataTypeField = '' } = comboTheme;
1024
+ const zoom = graph.getZoom();
1025
+ models.forEach((combo) => {
1026
+ // get the base styles from theme
1027
+ let dataType;
1028
+ if (dataTypeField) dataType = combo.data[dataTypeField] as string;
1029
+ const itemTheme = getItemTheme(
1030
+ comboDataTypeSet,
1031
+ dataTypeField,
1032
+ dataType,
1033
+ comboTheme,
1034
+ );
1035
+
1036
+ const getCombinedBounds = () => {
1037
+ // calculate the position of the combo according to its children
1038
+ return getCombinedBoundsByData(
1039
+ graph,
1040
+ graphCore
1041
+ .getChildren(combo.id, 'combo')
1042
+ .map(({ id }) => itemMap.get(id))
1043
+ .filter(Boolean) as (Node | Combo)[],
1044
+ );
1045
+ };
1046
+ const getChildren = () => {
1047
+ const childModels = graphCore.getChildren(combo.id, 'combo');
1048
+ return childModels.map(({ id }) => itemMap.get(id)) as (Node | Combo)[];
1049
+ };
1050
+ const comboItem = new Combo({
1051
+ model: combo,
1052
+ getCombinedBounds,
1053
+ getChildren,
1054
+ renderExtensions: comboExtensions,
1055
+ containerGroup: comboGroup,
1056
+ mapper: this.comboMapper as DisplayMapper,
1057
+ stateMapper: this.comboStateMapper as {
1058
+ [stateName: string]: DisplayMapper;
1059
+ },
632
1060
  zoom,
633
1061
  theme: itemTheme as {
634
- styles: NodeStyleSet;
635
- lodStrategy: lodStrategyObj;
1062
+ styles: ComboStyleSet;
1063
+ lodStrategy: LodStrategyObj;
636
1064
  },
637
1065
  device:
638
1066
  graph.rendererType === 'webgl-3d'
639
- ? // TODO: G type
640
- (graph.canvas.context as any).deviceRendererPlugin.getDevice()
1067
+ ? (graph.canvas.context as any).deviceRendererPlugin.getDevice()
641
1068
  : undefined,
642
1069
  });
1070
+ // ------- for integration tests -------
1071
+ comboItem.getCombinedBounds = getCombinedBounds;
1072
+ comboItem.getChildren = getChildren;
1073
+ comboItem.type = 'combo';
1074
+ // ------- for integration tests end-------
1075
+
1076
+ itemMap.set(combo.id, comboItem);
643
1077
  });
644
1078
  }
645
1079
 
@@ -652,21 +1086,24 @@ export class ItemController {
652
1086
  edgeTheme: EdgeThemeSpecifications = {},
653
1087
  ) {
654
1088
  const { edgeExtensions, edgeGroup, itemMap, edgeDataTypeSet, graph } = this;
655
- const { dataTypeField } = edgeTheme;
1089
+ const { dataTypeField = '' } = edgeTheme;
656
1090
  const zoom = graph.getZoom();
1091
+ const nodeMap = filterItemMapByType(itemMap, 'node') as Map<ID, Node>;
657
1092
  models.forEach((edge) => {
658
1093
  const { source, target, id } = edge;
659
- const sourceItem = itemMap[source] as Node;
660
- const targetItem = itemMap[target] as Node;
1094
+ const sourceItem = itemMap.get(source) as Node;
1095
+ const targetItem = itemMap.get(target) as Node;
661
1096
  if (!sourceItem) {
662
1097
  console.warn(
663
1098
  `The source node ${source} is not exist in the graph for edge ${id}, please add the node first`,
664
1099
  );
1100
+ return;
665
1101
  }
666
1102
  if (!targetItem) {
667
1103
  console.warn(
668
1104
  `The source node ${source} is not exist in the graph for edge ${id}, please add the node first`,
669
1105
  );
1106
+ return;
670
1107
  }
671
1108
  // get the base styles from theme
672
1109
  let dataType;
@@ -678,20 +1115,26 @@ export class ItemController {
678
1115
  edgeTheme,
679
1116
  );
680
1117
 
681
- itemMap[id] = new Edge({
682
- model: edge,
683
- renderExtensions: edgeExtensions,
684
- containerGroup: edgeGroup,
685
- mapper: this.edgeMapper,
686
- stateMapper: this.edgeStateMapper,
687
- sourceItem,
688
- targetItem,
689
- zoom,
690
- theme: itemTheme as {
691
- styles: EdgeStyleSet;
692
- lodStrategy: lodStrategyObj;
693
- },
694
- });
1118
+ itemMap.set(
1119
+ id,
1120
+ new Edge({
1121
+ model: edge,
1122
+ renderExtensions: edgeExtensions,
1123
+ containerGroup: edgeGroup,
1124
+ mapper: this.edgeMapper as DisplayMapper,
1125
+ stateMapper: this.edgeStateMapper as {
1126
+ [stateName: string]: DisplayMapper;
1127
+ },
1128
+ sourceItem,
1129
+ targetItem,
1130
+ nodeMap,
1131
+ zoom,
1132
+ theme: itemTheme as {
1133
+ styles: EdgeStyleSet;
1134
+ lodStrategy: LodStrategyObj;
1135
+ },
1136
+ }),
1137
+ );
695
1138
  });
696
1139
  }
697
1140
 
@@ -708,7 +1151,7 @@ export class ItemController {
708
1151
  value: string | boolean = true,
709
1152
  ): ID[] {
710
1153
  const ids: ID[] = [];
711
- Object.values(this.itemMap).forEach((item) => {
1154
+ this.itemMap.forEach((item) => {
712
1155
  if (item.getType() !== itemType) return;
713
1156
  if (item.hasState(state) === value) ids.push(item.getID());
714
1157
  });
@@ -722,7 +1165,7 @@ export class ItemController {
722
1165
  * @returns {boolean | string} the state value
723
1166
  */
724
1167
  public getItemState(id: ID, state: string) {
725
- const item = this.itemMap[id];
1168
+ const item = this.itemMap.get(id);
726
1169
  if (!item) {
727
1170
  console.warn(
728
1171
  `Fail to get item state, the item with id ${id} does not exist.`,
@@ -732,23 +1175,44 @@ export class ItemController {
732
1175
  return item.hasState(state);
733
1176
  }
734
1177
 
1178
+ public getItemAllStates(id: ID): string[] {
1179
+ const item = this.itemMap.get(id);
1180
+ if (!item) {
1181
+ console.warn(
1182
+ `Fail to get item state, the item with id ${id} does not exist.`,
1183
+ );
1184
+ return [];
1185
+ }
1186
+ return item
1187
+ .getStates()
1188
+ .filter(({ value }) => value)
1189
+ .map(({ name }) => name);
1190
+ }
1191
+
735
1192
  public getItemById(id: ID) {
736
- return this.itemMap[id];
1193
+ return this.itemMap.get(id);
737
1194
  }
738
1195
 
739
- public getItemBBox(id: ID, isKeyShape = false): AABB | false {
740
- const item = this.itemMap[id];
1196
+ public getItemBBox(
1197
+ id: ID,
1198
+ isKeyShape = false,
1199
+ isTransient = false,
1200
+ ): AABB | false {
1201
+ const item = isTransient
1202
+ ? this.transientItemMap.get(id)
1203
+ : this.itemMap.get(id);
741
1204
  if (!item) {
742
1205
  console.warn(
743
1206
  `Fail to get item bbox, the item with id ${id} does not exist.`,
744
1207
  );
745
1208
  return false;
746
1209
  }
1210
+ if (item instanceof Group) return item.getRenderBounds();
747
1211
  return isKeyShape ? item.getKeyBBox() : item.getBBox();
748
1212
  }
749
1213
 
750
1214
  public getItemVisible(id: ID) {
751
- const item = this.itemMap[id];
1215
+ const item = this.itemMap.get(id);
752
1216
  if (!item) {
753
1217
  console.warn(
754
1218
  `Fail to get item visible, the item with id ${id} does not exist.`,
@@ -757,18 +1221,325 @@ export class ItemController {
757
1221
  }
758
1222
  return item.isVisible();
759
1223
  }
1224
+
1225
+ /**
1226
+ * Identify edges that are intersected by a particular node
1227
+ * @param nodeId node id
1228
+ * @param graphCore
1229
+ * @returns
1230
+ */
1231
+ public findNearEdgesByNode(nodeId: ID, graphCore: GraphCore) {
1232
+ const edges = graphCore.getAllEdges();
1233
+
1234
+ const canvasBBox = this.graph.getRenderBBox(undefined) as AABB;
1235
+ const quadTree = new QuadTree(canvasBBox, 4);
1236
+
1237
+ each(edges, (edge) => {
1238
+ const {
1239
+ data: { x: sourceX, y: sourceY },
1240
+ } = graphCore.getNode(edge.source);
1241
+ const {
1242
+ data: { x: targetX, y: targetY },
1243
+ } = graphCore.getNode(edge.target);
1244
+
1245
+ quadTree.insert({
1246
+ id: edge.id,
1247
+ p1: { x: sourceX, y: sourceY },
1248
+ p2: { x: targetX, y: targetY },
1249
+ bbox: this.graph.getRenderBBox(edge.id) as AABB,
1250
+ });
1251
+ });
1252
+
1253
+ // update node position
1254
+ const node = (this.getTransientItem(nodeId) ||
1255
+ this.getItemById(nodeId)) as Node;
1256
+ const nodeBBox = this.graph.getRenderBBox(nodeId) as AABB;
1257
+ const nodeData = node?.model?.data;
1258
+ if (nodeData) {
1259
+ nodeBBox.update(
1260
+ [nodeData.x as number, nodeData.y as number, 0],
1261
+ nodeBBox.halfExtents,
1262
+ );
1263
+ }
1264
+
1265
+ const checker = new EdgeCollisionChecker(quadTree);
1266
+ const collisions = checker.getCollidingEdges(nodeBBox);
1267
+
1268
+ const collidingEdges = map(collisions, (collision) =>
1269
+ graphCore.getEdge(collision.id),
1270
+ );
1271
+
1272
+ return collidingEdges;
1273
+ }
1274
+
1275
+ public sortByComboTree(graphCore: GraphCore) {
1276
+ if (!graphCore.hasTreeStructure('combo')) return;
1277
+ graphCoreTreeDfs(graphCore, graphCore.getRoots('combo'), (node) => {
1278
+ const nodeItem = this.itemMap.get(node.id);
1279
+ if (node.data._isCombo && nodeItem) {
1280
+ nodeItem.toFront();
1281
+ }
1282
+ });
1283
+ }
1284
+
1285
+ private collapseCombo(graphCore: GraphCore, comboModel: ComboModel) {
1286
+ let relatedEdges: EdgeModel[] = [];
1287
+ const succeedIds: ID[] = [];
1288
+ // find the succeeds in collapsed
1289
+ graphComboTreeDfs(this.graph, [comboModel], (child) => {
1290
+ if (child.id !== comboModel.id) {
1291
+ this.graph.executeWithoutStacking(() => {
1292
+ this.graph.hideItem(child.id, false);
1293
+ });
1294
+ }
1295
+ relatedEdges = relatedEdges.concat(graphCore.getRelatedEdges(child.id));
1296
+ succeedIds.push(child.id);
1297
+ });
1298
+ const pairs = [];
1299
+ uniq(relatedEdges).forEach((edge) => {
1300
+ const { id, source: s, target: t } = edge;
1301
+ if (!this.graph.getItemVisible(id)) return;
1302
+ const sourceIsSucceed = succeedIds.includes(s);
1303
+ const targetIsSucceed = succeedIds.includes(t);
1304
+ // do not add virtual edge if the source and target are both the succeed
1305
+ if (sourceIsSucceed && targetIsSucceed) return;
1306
+ const source = sourceIsSucceed ? comboModel.id : s;
1307
+ const target = targetIsSucceed ? comboModel.id : t;
1308
+ pairs.push({ source, target });
1309
+ });
1310
+ // each item in groupedEdges is a virtual edge
1311
+ this.graph.executeWithoutStacking(() => {
1312
+ this.graph.addData('edge', groupVirtualEdges(pairs));
1313
+ });
1314
+ }
1315
+
1316
+ private expandCombo(graphCore: GraphCore, comboModel: ComboModel) {
1317
+ let isAncestorCollapsed = false;
1318
+ traverseAncestors(graphCore, [comboModel], (anccestor) => {
1319
+ if (anccestor.data.collapsed) {
1320
+ isAncestorCollapsed = true;
1321
+ return true;
1322
+ }
1323
+ return false;
1324
+ });
1325
+ if (isAncestorCollapsed) return;
1326
+ const relatedVirtualEdgeIds: ID[] = [];
1327
+ let edgesToShow: ID[] = [];
1328
+ const nodesToShow: ID[] = [];
1329
+ // show the succeeds and remove the related virtual edges, including the succeeds' related edges
1330
+ graphComboTreeDfs(this.graph, [comboModel], (child) => {
1331
+ graphCore.getRelatedEdges(child.id).forEach((edge) => {
1332
+ if (edge.data._virtual) relatedVirtualEdgeIds.push(edge.id);
1333
+ else edgesToShow.push(edge.id);
1334
+ });
1335
+ if (child.id !== comboModel.id) {
1336
+ if (!graphCore.getNode(child.data.parentId).data.collapsed) {
1337
+ nodesToShow.push(child.id);
1338
+ }
1339
+ // re-add collapsed succeeds' virtual edges by calling collapseCombo
1340
+ if (child.data._isCombo && child.data.collapsed) {
1341
+ this.collapseCombo(graphCore, child);
1342
+ }
1343
+ }
1344
+ });
1345
+ const virtualPairs = [];
1346
+ const visibleAncestorMap = new Map();
1347
+ edgesToShow = uniq(
1348
+ edgesToShow.filter((eid) => {
1349
+ const { source, target } = graphCore.getEdge(eid);
1350
+ const ends = { source, target };
1351
+ const endsVisible = {
1352
+ source:
1353
+ this.graph.getItemVisible(source) || nodesToShow.includes(source),
1354
+ target:
1355
+ this.graph.getItemVisible(target) || nodesToShow.includes(target),
1356
+ };
1357
+ // actual edges to show
1358
+ if (endsVisible.source && endsVisible.target) return true;
1359
+
1360
+ // add virtual edges by finding the visible ancestor
1361
+ const virtualEnds = { source: undefined, target: undefined };
1362
+ Object.keys(virtualEnds).forEach((end) => {
1363
+ if (!endsVisible[end]) {
1364
+ if (!visibleAncestorMap.get(ends[end])) {
1365
+ traverseAncestors(
1366
+ graphCore,
1367
+ [graphCore.getNode(ends[end])],
1368
+ (ancestor) => {
1369
+ if (visibleAncestorMap.has(ends[end])) return;
1370
+ if (
1371
+ this.graph.getItemVisible(ancestor.id) ||
1372
+ nodesToShow.includes(ancestor.id)
1373
+ )
1374
+ visibleAncestorMap.set(ends[end], ancestor.id);
1375
+ },
1376
+ );
1377
+ }
1378
+ virtualEnds[end] = visibleAncestorMap.get(ends[end]);
1379
+ } else {
1380
+ virtualEnds[end] = ends[end];
1381
+ }
1382
+ });
1383
+ if (
1384
+ virtualEnds.source !== undefined &&
1385
+ virtualEnds.target !== undefined
1386
+ ) {
1387
+ virtualPairs.push(virtualEnds);
1388
+ }
1389
+ return false;
1390
+ }),
1391
+ );
1392
+
1393
+ // remove related virtual edges
1394
+ this.graph.executeWithoutStacking(() => {
1395
+ this.graph.removeData('edge', uniq(relatedVirtualEdgeIds));
1396
+ this.graph.showItem(edgesToShow.concat(nodesToShow));
1397
+ // add virtual edges by grouping visible ancestor edges
1398
+ this.graph.addData('edge', groupVirtualEdges(virtualPairs));
1399
+ });
1400
+ }
1401
+
1402
+ /**
1403
+ * Collapse or expand a sub tree according to action
1404
+ * @param params
1405
+ */
1406
+ private onTreeCollapseExpand(params: {
1407
+ ids: ID[];
1408
+ animate: boolean;
1409
+ action: 'collapse' | 'expand';
1410
+ graphCore: GraphCore;
1411
+ }) {
1412
+ const { ids, animate, action, graphCore } = params;
1413
+ const rootModels = ids.map((id) => graphCore.getNode(id));
1414
+ switch (action) {
1415
+ case 'collapse':
1416
+ this.collapseSubTree(rootModels, graphCore, animate);
1417
+ break;
1418
+ case 'expand':
1419
+ default:
1420
+ this.expandSubTree(rootModels, graphCore, animate);
1421
+ break;
1422
+ }
1423
+ }
1424
+
1425
+ /**
1426
+ * Collapse sub tree(s).
1427
+ * @param rootModels The root node models of sub trees
1428
+ * @param graphCore
1429
+ * @param animate Whether enable animations for expanding, true by default
1430
+ * @returns
1431
+ */
1432
+ private collapseSubTree(
1433
+ rootModels: NodeModel[],
1434
+ graphCore: GraphCore,
1435
+ animate = true,
1436
+ ) {
1437
+ let positions = [];
1438
+ rootModels.forEach((root) => {
1439
+ let shouldCollapse = true;
1440
+ const nodes = [];
1441
+ graphCoreTreeDfs(
1442
+ graphCore,
1443
+ [root],
1444
+ (node) => {
1445
+ if (node.id === root.id) return;
1446
+ const neighbors = graphCore.getNeighbors(node.id);
1447
+ if (
1448
+ !graphCore.getChildren(node.id, 'tree')?.length &&
1449
+ neighbors.length > 1
1450
+ ) {
1451
+ shouldCollapse = false;
1452
+ }
1453
+ nodes.push(node);
1454
+ },
1455
+ 'TB',
1456
+ 'tree',
1457
+ {
1458
+ stopAllFn: () => !shouldCollapse,
1459
+ },
1460
+ );
1461
+ if (shouldCollapse) {
1462
+ positions = positions.concat(
1463
+ nodes.map((node) => ({
1464
+ id: node.id,
1465
+ data: { x: root.data.x, y: root.data.y },
1466
+ })),
1467
+ );
1468
+ }
1469
+ });
1470
+ if (!positions.length) return;
1471
+ this.graph.updateNodePosition(
1472
+ positions,
1473
+ undefined,
1474
+ !animate,
1475
+ (model, canceled) => {
1476
+ this.graph.hideItem(model.id, canceled);
1477
+ },
1478
+ undefined,
1479
+ );
1480
+ }
1481
+
1482
+ /**
1483
+ * Expand sub tree(s).
1484
+ * @param rootModels The root node models of sub trees.
1485
+ * @param graphCore
1486
+ * @param animate Whether enable animations for expanding, true by default.
1487
+ * @returns
1488
+ */
1489
+ private async expandSubTree(
1490
+ rootModels: NodeModel[],
1491
+ graphCore: GraphCore,
1492
+ animate = true,
1493
+ ) {
1494
+ let allNodeIds = [];
1495
+ let allEdgeIds = [];
1496
+ rootModels.forEach((root) => {
1497
+ const nodeIds = [];
1498
+ graphCoreTreeDfs(
1499
+ graphCore,
1500
+ [root],
1501
+ (node) => nodeIds.push(node.id),
1502
+ 'TB',
1503
+ 'tree',
1504
+ {
1505
+ stopBranchFn: (node) => {
1506
+ const shouldStop =
1507
+ node.id !== root.id && (node.data.collapsed as boolean);
1508
+ if (shouldStop) nodeIds.push(node.id);
1509
+ return shouldStop;
1510
+ },
1511
+ },
1512
+ );
1513
+ allEdgeIds = allEdgeIds.concat(
1514
+ graphCore
1515
+ .getAllEdges()
1516
+ .filter(
1517
+ (edge) =>
1518
+ nodeIds.includes(edge.source) && nodeIds.includes(edge.target),
1519
+ )
1520
+ .map((edge) => edge.id),
1521
+ );
1522
+ allNodeIds = allNodeIds.concat(nodeIds.filter((id) => id !== root.id));
1523
+ });
1524
+ const ids = uniq(allNodeIds.concat(allEdgeIds));
1525
+ this.graph.showItem(ids, !animate);
1526
+ await this.graph.layout(undefined, !animate);
1527
+ }
760
1528
  }
761
1529
 
762
1530
  const getItemTheme = (
763
1531
  dataTypeSet: Set<string>,
764
1532
  dataTypeField: string,
765
1533
  dataType: string,
766
- itemTheme: NodeThemeSpecifications | EdgeThemeSpecifications,
1534
+ itemTheme:
1535
+ | NodeThemeSpecifications
1536
+ | EdgeThemeSpecifications
1537
+ | ComboThemeSpecifications,
767
1538
  ): {
768
1539
  styles: NodeStyleSet | EdgeStyleSet;
769
- lodStrategy: lodStrategyObj;
1540
+ lodStrategy?: LodStrategyObj;
770
1541
  } => {
771
- const { styles: themeStyles, lodStrategy } = itemTheme;
1542
+ const { styles: themeStyles = [], lodStrategy } = itemTheme;
772
1543
  const formattedLodStrategy = formatLodStrategy(lodStrategy);
773
1544
  if (!dataTypeField) {
774
1545
  // dataType field is not assigned
@@ -780,14 +1551,61 @@ const getItemTheme = (
780
1551
  dataTypeSet.add(dataType as string);
781
1552
  let themeStyle;
782
1553
  if (isArray(themeStyles)) {
783
- const themeStylesLength = themeStyles.length;
1554
+ const themeStylesLength = themeStyles.length as number;
784
1555
  const idx = Array.from(dataTypeSet).indexOf(dataType);
785
1556
  themeStyle = themeStyles[idx % themeStylesLength];
786
1557
  } else if (isObject(themeStyles)) {
787
- themeStyle = themeStyles[dataType] || themeStyles.others;
1558
+ themeStyle =
1559
+ themeStyles[dataType] ||
1560
+ (themeStyles as { [dataTypeValue: string]: NodeStyleSet }).others;
788
1561
  }
789
1562
  return {
790
1563
  styles: themeStyle,
791
1564
  lodStrategy: formattedLodStrategy,
792
1565
  };
793
1566
  };
1567
+
1568
+ const filterItemMapByType = (
1569
+ itemMap: Map<ID, Node | Edge | Combo>,
1570
+ type: ITEM_TYPE | ITEM_TYPE[],
1571
+ ): Map<ID, Node | Edge | Combo | Group> => {
1572
+ const filteredMap = new Map<ID, Node | Edge | Combo | Group>();
1573
+ itemMap.forEach((value, key) => {
1574
+ if (value.type === type) {
1575
+ filteredMap.set(key, value);
1576
+ }
1577
+ });
1578
+ return filteredMap;
1579
+ };
1580
+
1581
+ const groupVirtualEdges = (pairs) => {
1582
+ const groupedVirtualEdges = new Map();
1583
+ pairs.forEach((edge) => {
1584
+ const { source, target } = edge;
1585
+ const key = `${source}_${target}`;
1586
+ const group = groupedVirtualEdges.get(key) || {
1587
+ edges: [],
1588
+ source,
1589
+ target,
1590
+ };
1591
+ group.edges.push(edge);
1592
+ groupedVirtualEdges.set(key, group);
1593
+ });
1594
+ // each item in groupedEdges is a virtual edge
1595
+ const virtualEdges: EdgeModel[] = [];
1596
+ groupedVirtualEdges.forEach((group) => {
1597
+ const { source, target, edges } = group;
1598
+ virtualEdges.push({
1599
+ id: `virtual-${uniqueId()}`,
1600
+ source,
1601
+ target,
1602
+ data: {
1603
+ _virtual: true,
1604
+ keyShape: {
1605
+ lineWidth: edges.length,
1606
+ },
1607
+ },
1608
+ });
1609
+ });
1610
+ return virtualEdges;
1611
+ };