@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,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
13
  };
@@ -6,14 +15,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
15
  exports.ItemController = void 0;
7
16
  const g_1 = require("@antv/g");
8
17
  const util_1 = require("@antv/util");
18
+ const g_plugin_3d_1 = require("@antv/g-plugin-3d");
9
19
  const stdlib_1 = __importDefault(require("../../stdlib"));
10
20
  const node_1 = __importDefault(require("../../item/node"));
11
21
  const edge_1 = __importDefault(require("../../item/edge"));
22
+ const combo_1 = __importDefault(require("../../item/combo"));
12
23
  const shape_1 = require("../../util/shape");
13
24
  const extension_1 = require("../../util/extension");
14
25
  const item_1 = require("../../util/item");
15
- const g_plugin_3d_1 = require("@antv/g-plugin-3d");
16
26
  const zoom_1 = require("../../util/zoom");
27
+ const data_1 = require("../../util/data");
28
+ const event_1 = require("../../util/event");
29
+ const polyline_1 = require("../../util/polyline");
17
30
  /**
18
31
  * Manages and stores the node / edge / combo items.
19
32
  */
@@ -25,18 +38,18 @@ class ItemController {
25
38
  /**
26
39
  * Node / edge / combo items map
27
40
  */
28
- this.itemMap = {};
29
- // TODO: combo? not a independent group
41
+ this.itemMap = new Map();
30
42
  this.nodeDataTypeSet = new Set();
31
43
  this.edgeDataTypeSet = new Set();
44
+ this.comboDataTypeSet = new Set();
32
45
  // The G shapes or groups on transient map drawn by this controller
33
- this.transientObjectMap = {};
34
- this.transientItemMap = {};
46
+ this.transientObjectMap = new Map();
47
+ this.transientItemMap = new Map();
35
48
  this.onViewportChange = (0, util_1.debounce)(({ transform, effectTiming }) => {
36
49
  const { zoom } = transform;
37
50
  if (zoom) {
38
51
  const zoomRatio = this.graph.getZoom();
39
- Object.values(this.itemMap).forEach((item) => item.updateZoom(zoomRatio));
52
+ this.itemMap.forEach((item) => item.updateZoom(zoomRatio));
40
53
  this.zoom = zoomRatio;
41
54
  }
42
55
  }, 500, false);
@@ -45,7 +58,7 @@ class ItemController {
45
58
  return;
46
59
  const { nodeDataTypeSet, edgeDataTypeSet } = this;
47
60
  const { node: nodeTheme, edge: edgeTheme } = theme;
48
- Object.values(this.itemMap).forEach((item) => {
61
+ this.itemMap.forEach((item) => {
49
62
  const itemTye = item.getType();
50
63
  const usingTheme = itemTye === 'node' ? nodeTheme : edgeTheme;
51
64
  const usingTypeSet = itemTye === 'node' ? nodeDataTypeSet : edgeDataTypeSet;
@@ -59,10 +72,12 @@ class ItemController {
59
72
  };
60
73
  this.onDestroy = () => {
61
74
  Object.values(this.itemMap).forEach((item) => item.destroy());
75
+ // Fix OOM problem, since this map will hold all the refs of items.
76
+ this.itemMap.clear();
62
77
  };
63
78
  this.graph = graph;
64
79
  // get mapper for node / edge / combo
65
- const { node, edge, combo, nodeState, edgeState, comboState } = graph.getSpecification();
80
+ const { node, edge, combo, nodeState = {}, edgeState = {}, comboState = {}, } = graph.getSpecification();
66
81
  this.nodeMapper = node;
67
82
  this.edgeMapper = edge;
68
83
  this.comboMapper = combo;
@@ -84,9 +99,11 @@ class ItemController {
84
99
  this.graph.hooks.itemchange.tap(this.onChange.bind(this));
85
100
  this.graph.hooks.itemstatechange.tap(this.onItemStateChange.bind(this));
86
101
  this.graph.hooks.itemvisibilitychange.tap(this.onItemVisibilityChange.bind(this));
102
+ this.graph.hooks.itemzindexchange.tap(this.onItemZIndexChange.bind(this));
87
103
  this.graph.hooks.transientupdate.tap(this.onTransientUpdate.bind(this));
88
104
  this.graph.hooks.viewportchange.tap(this.onViewportChange.bind(this));
89
105
  this.graph.hooks.themechange.tap(this.onThemeChange.bind(this));
106
+ this.graph.hooks.treecollapseexpand.tap(this.onTreeCollapseExpand.bind(this));
90
107
  this.graph.hooks.destroy.tap(this.onDestroy.bind(this));
91
108
  }
92
109
  /**
@@ -95,9 +112,9 @@ class ItemController {
95
112
  getExtensions() {
96
113
  // TODO: user need to config using node/edge/combo types from useLib to spec?
97
114
  const { node, edge, combo } = this.graph.getSpecification();
98
- const nodeTypes = Object.keys(stdlib_1.default.useLib.nodes);
99
- const edgeTypes = Object.keys(stdlib_1.default.useLib.edges);
100
- const comboTypes = Object.keys(stdlib_1.default.useLib.combos);
115
+ const nodeTypes = Object.keys(stdlib_1.default.useLib.nodes || {});
116
+ const edgeTypes = Object.keys(stdlib_1.default.useLib.edges || {});
117
+ const comboTypes = Object.keys(stdlib_1.default.useLib.combos || {});
101
118
  return {
102
119
  node: nodeTypes
103
120
  .map((config) => (0, extension_1.getExtension)(config, stdlib_1.default.useLib, 'node'))
@@ -119,16 +136,21 @@ class ItemController {
119
136
  const { graph } = this;
120
137
  // 0. clear groups on canvas, and create new groups
121
138
  graph.canvas.removeChildren();
139
+ const comboGroup = new g_1.Group({ id: 'combo-group' });
122
140
  const edgeGroup = new g_1.Group({ id: 'edge-group' });
123
141
  const nodeGroup = new g_1.Group({ id: 'node-group' });
142
+ graph.canvas.appendChild(comboGroup);
124
143
  graph.canvas.appendChild(edgeGroup);
125
144
  graph.canvas.appendChild(nodeGroup);
126
145
  this.nodeGroup = nodeGroup;
127
146
  this.edgeGroup = edgeGroup;
147
+ this.comboGroup = comboGroup;
128
148
  // Also create transient groups on transient canvas.
129
149
  transientCanvas.removeChildren();
150
+ this.transientComboGroup = new g_1.Group({ id: 'combo-group' });
130
151
  this.transientEdgeGroup = new g_1.Group({ id: 'edge-group' });
131
152
  this.transientNodeGroup = new g_1.Group({ id: 'node-group' });
153
+ transientCanvas.appendChild(this.transientComboGroup);
132
154
  transientCanvas.appendChild(this.transientEdgeGroup);
133
155
  transientCanvas.appendChild(this.transientNodeGroup);
134
156
  // 1. create lights for webgl 3d rendering
@@ -146,134 +168,233 @@ class ItemController {
146
168
  intensity: Math.PI * 0.7,
147
169
  },
148
170
  });
171
+ // @ts-ignore
149
172
  graph.canvas.appendChild(ambientLight);
173
+ // @ts-ignore
150
174
  graph.canvas.appendChild(light);
151
175
  const { width, height } = graph.canvas.getConfig();
152
176
  graph.canvas.getCamera().setPerspective(0.1, 50000, 45, width / height);
153
177
  }
154
178
  // 2. create node / edge / combo items, classes from ../../item, and element drawing and updating fns from node/edge/comboExtensions
155
- const nodeModels = graphCore.getAllNodes();
156
- const edgeModels = graphCore.getAllEdges();
157
- // const combos = graphCore.getAllCombos();
158
- this.renderNodes(nodeModels, theme.node);
159
- this.renderEdges(edgeModels, theme.edge);
160
- // TODO: combo
179
+ const { nodes, edges, combos } = (0, data_1.deconstructData)({
180
+ nodes: graphCore.getAllNodes(),
181
+ edges: graphCore.getAllEdges(),
182
+ });
183
+ this.renderNodes(nodes, theme.node);
184
+ this.renderCombos(combos, theme.combo, graphCore);
185
+ this.renderEdges(edges, theme.edge);
186
+ this.sortByComboTree(graphCore);
187
+ // collapse the combos which has 'collapsed' in initial data
188
+ if (graphCore.hasTreeStructure('combo')) {
189
+ (0, data_1.graphCoreTreeDfs)(graphCore, graphCore.getRoots('combo'), (child) => {
190
+ if (child.data.collapsed)
191
+ this.collapseCombo(graphCore, child);
192
+ }, 'BT', 'combo');
193
+ }
194
+ // collapse the sub tree which has 'collapsed' in initial data
195
+ if (graphCore.hasTreeStructure('tree')) {
196
+ const collapseNodes = [];
197
+ (0, data_1.graphCoreTreeDfs)(graphCore, graphCore.getRoots('tree'), (child) => {
198
+ if (child.data.collapsed)
199
+ collapseNodes.push(child);
200
+ }, 'BT', 'tree');
201
+ this.collapseSubTree(collapseNodes, graphCore, false);
202
+ }
161
203
  }
162
204
  /**
163
205
  * Listener of runtime's itemchange lifecycle hook.
164
206
  * @param param
165
207
  */
166
208
  onChange(param) {
167
- const { changes, graphCore, theme = {}, action } = param;
168
- const groupedChanges = {
169
- NodeRemoved: [],
170
- EdgeRemoved: [],
171
- NodeAdded: [],
172
- EdgeAdded: [],
173
- NodeDataUpdated: [],
174
- EdgeUpdated: [],
175
- EdgeDataUpdated: [],
176
- };
177
- changes.forEach((change) => {
178
- const { type: changeType } = change;
179
- groupedChanges[changeType].push(change);
180
- });
209
+ const { changes, graphCore, action, animate = true, upsertAncestors = true, theme = {}, callback = () => { }, } = param;
210
+ const groupedChanges = (0, event_1.getGroupedChanges)(graphCore, changes);
181
211
  const { itemMap } = this;
182
212
  // change items according to the order of the keys in groupedChanges
183
213
  // === 1. remove edges; 2. remove nodes ===
184
- groupedChanges.EdgeRemoved.concat(groupedChanges.NodeRemoved).forEach(({ value }) => {
214
+ [...groupedChanges.EdgeRemoved, ...groupedChanges.NodeRemoved].forEach(({ value }) => {
185
215
  const { id } = value;
186
- const item = itemMap[id];
216
+ const item = itemMap.get(id);
187
217
  if (item) {
188
218
  item.destroy();
189
- delete itemMap[id];
219
+ itemMap.delete(id);
190
220
  }
191
221
  });
192
- const { node: nodeTheme = {}, edge: edgeTheme = {} } = theme;
222
+ const { node: nodeTheme = {}, edge: edgeTheme = {}, combo: comboTheme = {}, } = theme;
193
223
  // === 3. add nodes ===
194
224
  if (groupedChanges.NodeAdded.length) {
195
- this.renderNodes(groupedChanges.NodeAdded.map((change) => change.value), nodeTheme);
225
+ const newNodes = [];
226
+ const newCombos = [];
227
+ groupedChanges.NodeAdded.map((change) => change.value).forEach((model) => {
228
+ if (model.data._isCombo)
229
+ newCombos.push(model);
230
+ else
231
+ newNodes.push(model);
232
+ });
233
+ if (newNodes.length) {
234
+ this.renderNodes(newNodes, nodeTheme);
235
+ }
236
+ if (newCombos.length) {
237
+ this.renderCombos(newCombos, comboTheme, graphCore);
238
+ }
196
239
  }
197
240
  // === 4. add edges ===
198
241
  if (groupedChanges.EdgeAdded.length) {
199
242
  this.renderEdges(groupedChanges.EdgeAdded.map((change) => change.value), edgeTheme);
200
243
  }
201
244
  // === 5. update nodes's data ===
202
- // merge changes for each node
245
+ // merge changes for each node or combo
203
246
  if (groupedChanges.NodeDataUpdated.length) {
204
- const nodeUpdate = {};
247
+ const nodeComboUpdate = {};
205
248
  groupedChanges.NodeDataUpdated.forEach((change) => {
206
249
  const { id, propertyName, newValue, oldValue } = change;
207
- nodeUpdate[id] = nodeUpdate[id] || { previous: {}, current: {} };
250
+ nodeComboUpdate[id] = nodeComboUpdate[id] || {
251
+ id,
252
+ previous: {},
253
+ current: {},
254
+ };
208
255
  if (!propertyName) {
209
- nodeUpdate[id] = {
256
+ nodeComboUpdate[id] = {
257
+ id,
210
258
  isReplace: true,
211
259
  previous: oldValue,
212
260
  current: newValue,
213
261
  };
214
262
  }
215
263
  else {
216
- nodeUpdate[id].previous[propertyName] = oldValue;
217
- nodeUpdate[id].current[propertyName] = newValue;
264
+ nodeComboUpdate[id].previous[propertyName] = oldValue;
265
+ nodeComboUpdate[id].current[propertyName] = newValue;
218
266
  }
219
267
  });
220
268
  const { dataTypeField: nodeDataTypeField } = nodeTheme;
221
- const edgeToUpdate = {};
222
- const updateEdges = (0, util_1.throttle)((updateMap) => {
223
- Object.keys(updateMap || edgeToUpdate).forEach((id) => {
224
- const item = itemMap[id];
269
+ const edgeIdsToUpdate = new Set();
270
+ const comboIdsToUpdate = new Set();
271
+ const updateRelates = (edgeIds) => {
272
+ const ids = edgeIds
273
+ ? [...edgeIds]
274
+ : [...comboIdsToUpdate, ...edgeIdsToUpdate];
275
+ ids.forEach((nid) => {
276
+ const item = itemMap.get(nid);
225
277
  if (item && !item.destroyed)
226
278
  item.forceUpdate();
227
279
  });
228
- }, 16, {
229
- leading: true,
230
- trailing: true,
231
- });
232
- Object.keys(nodeUpdate).forEach((id) => {
233
- const { isReplace, previous, current } = nodeUpdate[id];
280
+ };
281
+ const debounceUpdateRelates = (0, util_1.debounce)(updateRelates, 16, false);
282
+ Object.values(nodeComboUpdate).forEach((updateObj) => {
283
+ var _a;
284
+ const { isReplace, previous, current, id } = updateObj;
285
+ if (!graphCore.hasNode(id))
286
+ return;
287
+ const onlyMove = action === 'updatePosition';
288
+ const item = itemMap.get(id);
289
+ if (!item || item.destroyed)
290
+ return;
291
+ const type = item.getType();
292
+ const innerModel = graphCore.getNode(id);
293
+ if (onlyMove &&
294
+ type === 'node' &&
295
+ isNaN(current.x) &&
296
+ isNaN(current.y)) {
297
+ callback(innerModel, true);
298
+ return;
299
+ }
300
+ const nodeRelatedIdsToUpdate = new Set();
301
+ // collapse and expand
302
+ if (graphCore.hasTreeStructure('combo')) {
303
+ if (type === 'combo' && current.collapsed !== previous.collapsed) {
304
+ if (current.collapsed) {
305
+ this.collapseCombo(graphCore, innerModel);
306
+ }
307
+ else if (current.collapsed === false) {
308
+ this.expandCombo(graphCore, innerModel);
309
+ }
310
+ }
311
+ const previousParentId = item.displayModel.data.parentId;
312
+ // update the current parent combo tree
313
+ // if the node has previous parent, related previous parent combo should be updated to
314
+ if (upsertAncestors) {
315
+ const begins = [innerModel];
316
+ if (previousParentId &&
317
+ previousParentId !== current.parentId &&
318
+ graphCore.hasNode(previousParentId)) {
319
+ begins.push(graphCore.getNode(previousParentId));
320
+ }
321
+ // ancestors and suceeds combos should be updated
322
+ (0, data_1.traverseAncestorsAndSucceeds)(this.graph, graphCore, begins, (treeItem) => {
323
+ if (treeItem.data._isCombo && treeItem.id !== innerModel.id)
324
+ comboIdsToUpdate.add(treeItem.id);
325
+ const relatedEdges = graphCore.getRelatedEdges(treeItem.id);
326
+ relatedEdges.forEach((edge) => {
327
+ edgeIdsToUpdate.add(edge.id);
328
+ nodeRelatedIdsToUpdate.add(edge.id);
329
+ });
330
+ });
331
+ }
332
+ else if (type === 'combo') {
333
+ // only the succeed combos should be updated
334
+ (0, data_1.graphComboTreeDfs)(this.graph, [innerModel], (child) => {
335
+ const relatedEdges = graphCore.getRelatedEdges(child.id);
336
+ relatedEdges.forEach((edge) => {
337
+ edgeIdsToUpdate.add(edge.id);
338
+ nodeRelatedIdsToUpdate.add(edge.id);
339
+ });
340
+ if (child.data._isCombo && child.id !== innerModel.id)
341
+ comboIdsToUpdate.add(child.id);
342
+ });
343
+ }
344
+ }
234
345
  // update the theme if the dataType value is changed
235
346
  let itemTheme;
236
347
  if (nodeDataTypeField &&
237
348
  previous[nodeDataTypeField] !== current[nodeDataTypeField]) {
238
349
  itemTheme = getItemTheme(this.nodeDataTypeSet, nodeDataTypeField, current[nodeDataTypeField], nodeTheme);
239
350
  }
240
- const node = itemMap[id];
241
- let innerModel;
242
- try {
243
- innerModel = graphCore.getNode(id);
244
- }
245
- catch (e) {
246
- innerModel = graphCore.getNode(Number(id));
247
- }
248
- let relatedEdgeInnerModels;
249
- try {
250
- relatedEdgeInnerModels = graphCore.getRelatedEdges(id);
251
- }
252
- catch (e) {
253
- relatedEdgeInnerModels = graphCore.getRelatedEdges(Number(id));
254
- }
255
- const nodeRelatedToUpdate = {};
351
+ const preventPolylineEdgeOverlap = ((_a = innerModel === null || innerModel === void 0 ? void 0 : innerModel.data) === null || _a === void 0 ? void 0 : _a.preventPolylineEdgeOverlap) || false;
352
+ const relatedEdgeInnerModels = preventPolylineEdgeOverlap
353
+ ? this.findNearEdgesByNode(id, graphCore).concat(graphCore.getRelatedEdges(id))
354
+ : graphCore.getRelatedEdges(id);
256
355
  relatedEdgeInnerModels.forEach((edge) => {
257
- edgeToUpdate[edge.id] = edge;
258
- nodeRelatedToUpdate[edge.id] = edge;
356
+ edgeIdsToUpdate.add(edge.id);
357
+ nodeRelatedIdsToUpdate.add(edge.id);
259
358
  });
260
- node.onframe = () => updateEdges(nodeRelatedToUpdate);
261
- node.update(innerModel, { previous, current }, isReplace, itemTheme, action === 'updateNodePosition',
359
+ item.onframe = () => updateRelates(nodeRelatedIdsToUpdate);
360
+ let statesCache;
361
+ if (innerModel.data._isCombo &&
362
+ previous.collapsed !== current.collapsed) {
363
+ statesCache = this.graph.getItemAllStates(id);
364
+ this.graph.clearItemState(id);
365
+ }
366
+ item.update(innerModel, { previous, current }, isReplace, itemTheme, onlyMove, animate,
262
367
  // call after updating finished
263
- () => {
264
- node.onframe = undefined;
265
- });
368
+ (0, util_1.throttle)((_, canceled) => {
369
+ var _a;
370
+ (_a = item.onframe) === null || _a === void 0 ? void 0 : _a.call(item, true);
371
+ item.onframe = undefined;
372
+ if (statesCache) {
373
+ statesCache.forEach((state) => this.graph.setItemState(id, state, true));
374
+ }
375
+ callback(innerModel, canceled);
376
+ }, 500, {
377
+ leading: false,
378
+ trailing: true,
379
+ }));
380
+ const parentItem = this.itemMap.get(current.parentId);
381
+ if (current.parentId && (parentItem === null || parentItem === void 0 ? void 0 : parentItem.model.data.collapsed)) {
382
+ this.graph.executeWithoutStacking(() => {
383
+ this.graph.hideItem(innerModel.id, false);
384
+ });
385
+ }
266
386
  });
267
- updateEdges();
387
+ debounceUpdateRelates();
268
388
  }
269
389
  // === 6. update edges' data ===
270
390
  if (groupedChanges.EdgeDataUpdated.length) {
271
391
  const edgeUpdate = {};
272
392
  groupedChanges.EdgeDataUpdated.forEach((change) => {
273
393
  const { id, propertyName, newValue, oldValue } = change;
274
- edgeUpdate[id] = edgeUpdate[id] || { previous: {}, current: {} };
394
+ edgeUpdate[id] = edgeUpdate[id] || { id, previous: {}, current: {} };
275
395
  if (!propertyName) {
276
396
  edgeUpdate[id] = {
397
+ id,
277
398
  isReplace: true,
278
399
  previous: oldValue,
279
400
  current: newValue,
@@ -284,17 +405,19 @@ class ItemController {
284
405
  edgeUpdate[id].current[propertyName] = newValue;
285
406
  }
286
407
  });
287
- const { dataTypeField: edgeDataTypeField } = edgeTheme;
288
- Object.keys(edgeUpdate).forEach((id) => {
289
- const { isReplace, current, previous } = edgeUpdate[id];
408
+ const { dataTypeField: edgeDataTypeField = '' } = edgeTheme;
409
+ Object.values(edgeUpdate).forEach((updateObj) => {
410
+ const { isReplace, current, previous, id } = updateObj;
290
411
  // update the theme if the dataType value is changed
291
412
  let itemTheme;
292
413
  if (previous[edgeDataTypeField] !== current[edgeDataTypeField]) {
293
414
  itemTheme = getItemTheme(this.edgeDataTypeSet, edgeDataTypeField, current[edgeDataTypeField], edgeTheme);
294
415
  }
295
- const item = itemMap[id];
416
+ const item = itemMap.get(id);
296
417
  const innerModel = graphCore.getEdge(id);
297
- item.update(innerModel, { current, previous }, isReplace, itemTheme);
418
+ if (!item || item.destroyed)
419
+ return;
420
+ item.update(innerModel, { current, previous }, isReplace, itemTheme, undefined, animate, (_, canceled) => callback(innerModel, canceled));
298
421
  });
299
422
  }
300
423
  // === 7. update edges' source target ===
@@ -303,16 +426,35 @@ class ItemController {
303
426
  groupedChanges.EdgeUpdated.forEach((change) => {
304
427
  // propertyName is 'source' or 'target'
305
428
  const { id, propertyName, newValue } = change;
306
- edgeUpdate[id] = edgeUpdate[id] || {};
429
+ edgeUpdate[id] = edgeUpdate[id] || { id };
307
430
  edgeUpdate[id][propertyName] = newValue;
308
431
  });
309
- Object.keys(edgeUpdate).forEach((id) => {
310
- const { source, target } = edgeUpdate[id];
311
- const item = itemMap[id];
432
+ Object.values(edgeUpdate).forEach((updateObj) => {
433
+ const { source, target, id } = updateObj;
434
+ const item = itemMap.get(id);
312
435
  if (source !== undefined)
313
- item.updateEnd('source', this.itemMap[source]);
436
+ item.updateEnd('source', this.itemMap.get(source));
314
437
  if (target !== undefined)
315
- item.updateEnd('target', this.itemMap[target]);
438
+ item.updateEnd('target', this.itemMap.get(target));
439
+ });
440
+ }
441
+ // === 8. combo tree structure change, resort the shapes ===
442
+ if (groupedChanges.ComboStructureChanged.length) {
443
+ this.sortByComboTree(graphCore);
444
+ }
445
+ // === 9. tree data structure change, hide the new node and edge while one of the ancestor is collapsed ===
446
+ if (groupedChanges.TreeStructureChanged.length) {
447
+ groupedChanges.TreeStructureChanged.forEach((change) => {
448
+ const { nodeId } = change;
449
+ // hide it when an ancestor is collapsed
450
+ let parent = graphCore.getParent(nodeId, 'tree');
451
+ while (parent) {
452
+ if (parent.data.collapsed) {
453
+ this.graph.hideItem(nodeId, true);
454
+ break;
455
+ }
456
+ parent = graphCore.getParent(parent.id, 'tree');
457
+ }
316
458
  });
317
459
  }
318
460
  }
@@ -328,7 +470,7 @@ class ItemController {
328
470
  onItemStateChange(param) {
329
471
  const { ids, states, value } = param;
330
472
  ids.forEach((id) => {
331
- const item = this.itemMap[id];
473
+ const item = this.itemMap.get(id);
332
474
  if (!item) {
333
475
  console.warn(`Fail to set state for item ${id}, which is not exist.`);
334
476
  return;
@@ -343,56 +485,122 @@ class ItemController {
343
485
  });
344
486
  }
345
487
  onItemVisibilityChange(param) {
346
- const { ids, value, animate = true } = param;
488
+ const { ids, value, graphCore, animate = true } = param;
347
489
  ids.forEach((id) => {
348
- const item = this.itemMap[id];
490
+ const item = this.itemMap.get(id);
349
491
  if (!item) {
350
492
  console.warn(`Fail to set visibility for item ${id}, which is not exist.`);
351
493
  return;
352
494
  }
495
+ const type = item.getType();
353
496
  if (value) {
354
- item.show(animate);
497
+ if (type === 'edge') {
498
+ item.show(animate);
499
+ }
500
+ else {
501
+ if (graphCore.hasTreeStructure('combo')) {
502
+ let anccestorCollapsed = false;
503
+ (0, data_1.traverseAncestors)(graphCore, [item.model], (model) => {
504
+ if (model.data.collapsed)
505
+ anccestorCollapsed = true;
506
+ return anccestorCollapsed;
507
+ });
508
+ if (anccestorCollapsed)
509
+ return;
510
+ }
511
+ const relatedEdges = graphCore.getRelatedEdges(id);
512
+ item.show(animate);
513
+ relatedEdges.forEach(({ id: edgeId, source, target }) => {
514
+ var _a;
515
+ if (this.getItemVisible(source) && this.getItemVisible(target))
516
+ (_a = this.itemMap.get(edgeId)) === null || _a === void 0 ? void 0 : _a.show(animate);
517
+ });
518
+ }
355
519
  }
356
520
  else {
357
521
  item.hide(animate);
522
+ if (type !== 'edge') {
523
+ const relatedEdges = graphCore.getRelatedEdges(id);
524
+ relatedEdges.forEach(({ id: edgeId }) => {
525
+ var _a;
526
+ (_a = this.itemMap.get(edgeId)) === null || _a === void 0 ? void 0 : _a.hide(animate);
527
+ });
528
+ }
529
+ }
530
+ });
531
+ }
532
+ onItemZIndexChange(params) {
533
+ const { ids = [], action, graphCore } = params;
534
+ ids.forEach((id) => {
535
+ const item = this.itemMap.get(id);
536
+ if (!item)
537
+ return;
538
+ if (action === 'front') {
539
+ item.toFront();
540
+ if (graphCore.hasTreeStructure('combo')) {
541
+ (0, data_1.graphComboTreeDfs)(this.graph, [item.model], (model) => {
542
+ if (model.data._isCombo) {
543
+ const subCombo = this.itemMap.get(model.id);
544
+ subCombo && subCombo.toFront();
545
+ }
546
+ }, 'TB');
547
+ }
548
+ }
549
+ else {
550
+ item.toBack();
551
+ if (graphCore.hasTreeStructure('combo')) {
552
+ (0, data_1.traverseGraphAncestors)(this.graph, [item.model], (model) => {
553
+ var _a;
554
+ (_a = this.itemMap.get(model.id)) === null || _a === void 0 ? void 0 : _a.toBack();
555
+ });
556
+ }
358
557
  }
359
558
  });
360
559
  }
361
560
  onTransientUpdate(param) {
362
561
  const { transientObjectMap } = this;
363
- const { type, id, config = {}, canvas } = param;
364
- const { style = {}, data = {}, capture, action, onlyDrawKeyShape, } = config;
562
+ const { type, id, config = {}, canvas, graphCore } = param;
563
+ const { style = {}, data = {}, capture, action, onlyDrawKeyShape, upsertAncestors, } = config;
365
564
  const isItemType = type === 'node' || type === 'edge' || type === 'combo';
366
565
  // Removing
367
566
  if (action === 'remove') {
368
567
  if (isItemType) {
369
- const transientItem = this.transientItemMap[id];
568
+ const transientItem = this.transientItemMap.get(id);
569
+ if (type === 'combo') {
570
+ // remove children from bottom to top
571
+ (0, data_1.graphCoreTreeDfs)(graphCore, [graphCore.getNode(id)], (child) => {
572
+ const transientChild = this.transientItemMap.get(child.id);
573
+ if (transientChild && !transientChild.destroyed) {
574
+ transientChild.destroy();
575
+ }
576
+ this.transientItemMap.delete(child.id);
577
+ }, 'BT');
578
+ }
370
579
  if (transientItem && !transientItem.destroyed) {
371
580
  transientItem.destroy();
372
581
  }
373
- delete this.transientItemMap[id];
582
+ this.transientItemMap.delete(id);
374
583
  return;
375
584
  }
376
585
  else {
377
- const preObj = transientObjectMap[id];
378
- if (preObj && !preObj.destroyed) {
586
+ const preObj = transientObjectMap.get(id);
587
+ if (preObj && !preObj.destroyed)
379
588
  preObj.destroy();
380
- }
381
- delete transientObjectMap[id];
589
+ transientObjectMap.delete(id);
382
590
  return;
383
591
  }
384
592
  }
385
593
  // Adding / Updating
386
594
  if (isItemType) {
387
- const item = this.itemMap[id];
595
+ const item = this.itemMap.get(id);
388
596
  if (!item) {
389
597
  console.warn(`Fail to draw transient item of ${id}, which is not exist.`);
390
598
  return;
391
599
  }
392
- const transientItem = (0, item_1.upsertTransientItem)(item, this.transientNodeGroup, this.transientEdgeGroup, this.transientItemMap, onlyDrawKeyShape);
600
+ const transientItem = (0, item_1.upsertTransientItem)(item, this.transientNodeGroup, this.transientEdgeGroup, this.transientComboGroup, this.transientItemMap, this.itemMap, graphCore, onlyDrawKeyShape, upsertAncestors);
393
601
  if (onlyDrawKeyShape) {
394
602
  // only update node positions to cloned node container(group)
395
- if (type === 'node' &&
603
+ if ((type === 'node' || type === 'combo') &&
396
604
  data.hasOwnProperty('x') &&
397
605
  data.hasOwnProperty('y')) {
398
606
  const { x, y } = data;
@@ -402,16 +610,54 @@ class ItemController {
402
610
  }
403
611
  else {
404
612
  const transItem = transientItem;
613
+ const positionChanged = data.hasOwnProperty('x') && data.hasOwnProperty('y');
614
+ if (type === 'combo' && positionChanged) {
615
+ const { x, y } = data;
616
+ const { x: ox = x, y: oy = y } = transItem.displayModel.data;
617
+ const dx = x - ox;
618
+ const dy = y - oy;
619
+ // move combo = move children nodes from bottom to top
620
+ (0, data_1.graphCoreTreeDfs)(graphCore, [transItem.model], (node) => {
621
+ const transChild = this.transientItemMap.get(node.id);
622
+ if (!transChild)
623
+ return;
624
+ const { x: childX = 0, y: childY = 0 } = transChild.model
625
+ .data;
626
+ transChild === null || transChild === void 0 ? void 0 : transChild.update(Object.assign(Object.assign({}, transChild.model), { data: Object.assign(Object.assign({}, transChild.model.data), { x: childX + dx, y: childY + dy }) }));
627
+ }, 'BT');
628
+ }
629
+ if (graphCore.hasTreeStructure('combo') &&
630
+ type !== 'edge' &&
631
+ positionChanged) {
632
+ // force update ancestor combos in the sametime
633
+ let currentAncestor = graphCore.getParent(transItem.model.id, 'combo');
634
+ while (currentAncestor) {
635
+ const ancestorItem = this.transientItemMap.get(currentAncestor.id);
636
+ if (ancestorItem)
637
+ ancestorItem.forceUpdate();
638
+ currentAncestor = graphCore.getParent(currentAncestor.id, 'combo');
639
+ }
640
+ }
641
+ // Update the target combo's posiiton and other props
405
642
  transItem.update(Object.assign(Object.assign({}, transItem.model), { data: Object.assign(Object.assign({}, transItem.model.data), data) }));
406
643
  }
407
644
  return;
408
645
  }
409
- const shape = (0, shape_1.upsertShape)(type, String(id), style, transientObjectMap);
646
+ const idStr = String(id);
647
+ const shape = (0, shape_1.upsertShape)(type, idStr, style, Object.fromEntries(transientObjectMap));
648
+ transientObjectMap.set(idStr, shape);
410
649
  shape.style.pointerEvents = capture ? 'auto' : 'none';
411
650
  canvas.getRoot().appendChild(shape);
412
651
  }
413
652
  getTransient(id) {
414
- return this.transientObjectMap[id];
653
+ return this.transientObjectMap.get(id);
654
+ }
655
+ getTransientItem(id) {
656
+ return this.transientItemMap[id];
657
+ }
658
+ findDisplayModel(id) {
659
+ var _a;
660
+ return (_a = this.itemMap.get(id)) === null || _a === void 0 ? void 0 : _a.displayModel;
415
661
  }
416
662
  /**
417
663
  * Create nodes with inner data to canvas.
@@ -419,7 +665,7 @@ class ItemController {
419
665
  */
420
666
  renderNodes(models, nodeTheme = {}) {
421
667
  const { nodeExtensions, nodeGroup, nodeDataTypeSet, graph } = this;
422
- const { dataTypeField } = nodeTheme;
668
+ const { dataTypeField = '' } = nodeTheme;
423
669
  const zoom = graph.getZoom();
424
670
  models.forEach((node) => {
425
671
  // get the base styles from theme
@@ -427,7 +673,7 @@ class ItemController {
427
673
  if (dataTypeField)
428
674
  dataType = node.data[dataTypeField];
429
675
  const itemTheme = getItemTheme(nodeDataTypeSet, dataTypeField, dataType, nodeTheme);
430
- this.itemMap[node.id] = new node_1.default({
676
+ this.itemMap.set(node.id, new node_1.default({
431
677
  model: node,
432
678
  renderExtensions: nodeExtensions,
433
679
  containerGroup: nodeGroup,
@@ -439,7 +685,50 @@ class ItemController {
439
685
  ? // TODO: G type
440
686
  graph.canvas.context.deviceRendererPlugin.getDevice()
441
687
  : undefined,
688
+ }));
689
+ });
690
+ }
691
+ renderCombos(models, comboTheme = {}, graphCore) {
692
+ const { comboExtensions, comboGroup, comboDataTypeSet, graph, itemMap } = this;
693
+ const { dataTypeField = '' } = comboTheme;
694
+ const zoom = graph.getZoom();
695
+ models.forEach((combo) => {
696
+ // get the base styles from theme
697
+ let dataType;
698
+ if (dataTypeField)
699
+ dataType = combo.data[dataTypeField];
700
+ const itemTheme = getItemTheme(comboDataTypeSet, dataTypeField, dataType, comboTheme);
701
+ const getCombinedBounds = () => {
702
+ // calculate the position of the combo according to its children
703
+ return (0, shape_1.getCombinedBoundsByData)(graph, graphCore
704
+ .getChildren(combo.id, 'combo')
705
+ .map(({ id }) => itemMap.get(id))
706
+ .filter(Boolean));
707
+ };
708
+ const getChildren = () => {
709
+ const childModels = graphCore.getChildren(combo.id, 'combo');
710
+ return childModels.map(({ id }) => itemMap.get(id));
711
+ };
712
+ const comboItem = new combo_1.default({
713
+ model: combo,
714
+ getCombinedBounds,
715
+ getChildren,
716
+ renderExtensions: comboExtensions,
717
+ containerGroup: comboGroup,
718
+ mapper: this.comboMapper,
719
+ stateMapper: this.comboStateMapper,
720
+ zoom,
721
+ theme: itemTheme,
722
+ device: graph.rendererType === 'webgl-3d'
723
+ ? graph.canvas.context.deviceRendererPlugin.getDevice()
724
+ : undefined,
442
725
  });
726
+ // ------- for integration tests -------
727
+ comboItem.getCombinedBounds = getCombinedBounds;
728
+ comboItem.getChildren = getChildren;
729
+ comboItem.type = 'combo';
730
+ // ------- for integration tests end-------
731
+ itemMap.set(combo.id, comboItem);
443
732
  });
444
733
  }
445
734
  /**
@@ -448,24 +737,27 @@ class ItemController {
448
737
  */
449
738
  renderEdges(models, edgeTheme = {}) {
450
739
  const { edgeExtensions, edgeGroup, itemMap, edgeDataTypeSet, graph } = this;
451
- const { dataTypeField } = edgeTheme;
740
+ const { dataTypeField = '' } = edgeTheme;
452
741
  const zoom = graph.getZoom();
742
+ const nodeMap = filterItemMapByType(itemMap, 'node');
453
743
  models.forEach((edge) => {
454
744
  const { source, target, id } = edge;
455
- const sourceItem = itemMap[source];
456
- const targetItem = itemMap[target];
745
+ const sourceItem = itemMap.get(source);
746
+ const targetItem = itemMap.get(target);
457
747
  if (!sourceItem) {
458
748
  console.warn(`The source node ${source} is not exist in the graph for edge ${id}, please add the node first`);
749
+ return;
459
750
  }
460
751
  if (!targetItem) {
461
752
  console.warn(`The source node ${source} is not exist in the graph for edge ${id}, please add the node first`);
753
+ return;
462
754
  }
463
755
  // get the base styles from theme
464
756
  let dataType;
465
757
  if (dataTypeField)
466
758
  dataType = edge.data[dataTypeField];
467
759
  const itemTheme = getItemTheme(edgeDataTypeSet, dataTypeField, dataType, edgeTheme);
468
- itemMap[id] = new edge_1.default({
760
+ itemMap.set(id, new edge_1.default({
469
761
  model: edge,
470
762
  renderExtensions: edgeExtensions,
471
763
  containerGroup: edgeGroup,
@@ -473,9 +765,10 @@ class ItemController {
473
765
  stateMapper: this.edgeStateMapper,
474
766
  sourceItem,
475
767
  targetItem,
768
+ nodeMap,
476
769
  zoom,
477
770
  theme: itemTheme,
478
- });
771
+ }));
479
772
  });
480
773
  }
481
774
  /**
@@ -487,7 +780,7 @@ class ItemController {
487
780
  */
488
781
  findIdByState(itemType, state, value = true) {
489
782
  const ids = [];
490
- Object.values(this.itemMap).forEach((item) => {
783
+ this.itemMap.forEach((item) => {
491
784
  if (item.getType() !== itemType)
492
785
  return;
493
786
  if (item.hasState(state) === value)
@@ -502,36 +795,291 @@ class ItemController {
502
795
  * @returns {boolean | string} the state value
503
796
  */
504
797
  getItemState(id, state) {
505
- const item = this.itemMap[id];
798
+ const item = this.itemMap.get(id);
506
799
  if (!item) {
507
800
  console.warn(`Fail to get item state, the item with id ${id} does not exist.`);
508
801
  return false;
509
802
  }
510
803
  return item.hasState(state);
511
804
  }
805
+ getItemAllStates(id) {
806
+ const item = this.itemMap.get(id);
807
+ if (!item) {
808
+ console.warn(`Fail to get item state, the item with id ${id} does not exist.`);
809
+ return [];
810
+ }
811
+ return item
812
+ .getStates()
813
+ .filter(({ value }) => value)
814
+ .map(({ name }) => name);
815
+ }
512
816
  getItemById(id) {
513
- return this.itemMap[id];
817
+ return this.itemMap.get(id);
514
818
  }
515
- getItemBBox(id, isKeyShape = false) {
516
- const item = this.itemMap[id];
819
+ getItemBBox(id, isKeyShape = false, isTransient = false) {
820
+ const item = isTransient
821
+ ? this.transientItemMap.get(id)
822
+ : this.itemMap.get(id);
517
823
  if (!item) {
518
824
  console.warn(`Fail to get item bbox, the item with id ${id} does not exist.`);
519
825
  return false;
520
826
  }
827
+ if (item instanceof g_1.Group)
828
+ return item.getRenderBounds();
521
829
  return isKeyShape ? item.getKeyBBox() : item.getBBox();
522
830
  }
523
831
  getItemVisible(id) {
524
- const item = this.itemMap[id];
832
+ const item = this.itemMap.get(id);
525
833
  if (!item) {
526
834
  console.warn(`Fail to get item visible, the item with id ${id} does not exist.`);
527
835
  return false;
528
836
  }
529
837
  return item.isVisible();
530
838
  }
839
+ /**
840
+ * Identify edges that are intersected by a particular node
841
+ * @param nodeId node id
842
+ * @param graphCore
843
+ * @returns
844
+ */
845
+ findNearEdgesByNode(nodeId, graphCore) {
846
+ var _a;
847
+ const edges = graphCore.getAllEdges();
848
+ const canvasBBox = this.graph.getRenderBBox(undefined);
849
+ const quadTree = new polyline_1.QuadTree(canvasBBox, 4);
850
+ (0, util_1.each)(edges, (edge) => {
851
+ const { data: { x: sourceX, y: sourceY }, } = graphCore.getNode(edge.source);
852
+ const { data: { x: targetX, y: targetY }, } = graphCore.getNode(edge.target);
853
+ quadTree.insert({
854
+ id: edge.id,
855
+ p1: { x: sourceX, y: sourceY },
856
+ p2: { x: targetX, y: targetY },
857
+ bbox: this.graph.getRenderBBox(edge.id),
858
+ });
859
+ });
860
+ // update node position
861
+ const node = (this.getTransientItem(nodeId) ||
862
+ this.getItemById(nodeId));
863
+ const nodeBBox = this.graph.getRenderBBox(nodeId);
864
+ const nodeData = (_a = node === null || node === void 0 ? void 0 : node.model) === null || _a === void 0 ? void 0 : _a.data;
865
+ if (nodeData) {
866
+ nodeBBox.update([nodeData.x, nodeData.y, 0], nodeBBox.halfExtents);
867
+ }
868
+ const checker = new polyline_1.EdgeCollisionChecker(quadTree);
869
+ const collisions = checker.getCollidingEdges(nodeBBox);
870
+ const collidingEdges = (0, util_1.map)(collisions, (collision) => graphCore.getEdge(collision.id));
871
+ return collidingEdges;
872
+ }
873
+ sortByComboTree(graphCore) {
874
+ if (!graphCore.hasTreeStructure('combo'))
875
+ return;
876
+ (0, data_1.graphCoreTreeDfs)(graphCore, graphCore.getRoots('combo'), (node) => {
877
+ const nodeItem = this.itemMap.get(node.id);
878
+ if (node.data._isCombo && nodeItem) {
879
+ nodeItem.toFront();
880
+ }
881
+ });
882
+ }
883
+ collapseCombo(graphCore, comboModel) {
884
+ let relatedEdges = [];
885
+ const succeedIds = [];
886
+ // find the succeeds in collapsed
887
+ (0, data_1.graphComboTreeDfs)(this.graph, [comboModel], (child) => {
888
+ if (child.id !== comboModel.id) {
889
+ this.graph.executeWithoutStacking(() => {
890
+ this.graph.hideItem(child.id, false);
891
+ });
892
+ }
893
+ relatedEdges = relatedEdges.concat(graphCore.getRelatedEdges(child.id));
894
+ succeedIds.push(child.id);
895
+ });
896
+ const pairs = [];
897
+ (0, util_1.uniq)(relatedEdges).forEach((edge) => {
898
+ const { id, source: s, target: t } = edge;
899
+ if (!this.graph.getItemVisible(id))
900
+ return;
901
+ const sourceIsSucceed = succeedIds.includes(s);
902
+ const targetIsSucceed = succeedIds.includes(t);
903
+ // do not add virtual edge if the source and target are both the succeed
904
+ if (sourceIsSucceed && targetIsSucceed)
905
+ return;
906
+ const source = sourceIsSucceed ? comboModel.id : s;
907
+ const target = targetIsSucceed ? comboModel.id : t;
908
+ pairs.push({ source, target });
909
+ });
910
+ // each item in groupedEdges is a virtual edge
911
+ this.graph.executeWithoutStacking(() => {
912
+ this.graph.addData('edge', groupVirtualEdges(pairs));
913
+ });
914
+ }
915
+ expandCombo(graphCore, comboModel) {
916
+ let isAncestorCollapsed = false;
917
+ (0, data_1.traverseAncestors)(graphCore, [comboModel], (anccestor) => {
918
+ if (anccestor.data.collapsed) {
919
+ isAncestorCollapsed = true;
920
+ return true;
921
+ }
922
+ return false;
923
+ });
924
+ if (isAncestorCollapsed)
925
+ return;
926
+ const relatedVirtualEdgeIds = [];
927
+ let edgesToShow = [];
928
+ const nodesToShow = [];
929
+ // show the succeeds and remove the related virtual edges, including the succeeds' related edges
930
+ (0, data_1.graphComboTreeDfs)(this.graph, [comboModel], (child) => {
931
+ graphCore.getRelatedEdges(child.id).forEach((edge) => {
932
+ if (edge.data._virtual)
933
+ relatedVirtualEdgeIds.push(edge.id);
934
+ else
935
+ edgesToShow.push(edge.id);
936
+ });
937
+ if (child.id !== comboModel.id) {
938
+ if (!graphCore.getNode(child.data.parentId).data.collapsed) {
939
+ nodesToShow.push(child.id);
940
+ }
941
+ // re-add collapsed succeeds' virtual edges by calling collapseCombo
942
+ if (child.data._isCombo && child.data.collapsed) {
943
+ this.collapseCombo(graphCore, child);
944
+ }
945
+ }
946
+ });
947
+ const virtualPairs = [];
948
+ const visibleAncestorMap = new Map();
949
+ edgesToShow = (0, util_1.uniq)(edgesToShow.filter((eid) => {
950
+ const { source, target } = graphCore.getEdge(eid);
951
+ const ends = { source, target };
952
+ const endsVisible = {
953
+ source: this.graph.getItemVisible(source) || nodesToShow.includes(source),
954
+ target: this.graph.getItemVisible(target) || nodesToShow.includes(target),
955
+ };
956
+ // actual edges to show
957
+ if (endsVisible.source && endsVisible.target)
958
+ return true;
959
+ // add virtual edges by finding the visible ancestor
960
+ const virtualEnds = { source: undefined, target: undefined };
961
+ Object.keys(virtualEnds).forEach((end) => {
962
+ if (!endsVisible[end]) {
963
+ if (!visibleAncestorMap.get(ends[end])) {
964
+ (0, data_1.traverseAncestors)(graphCore, [graphCore.getNode(ends[end])], (ancestor) => {
965
+ if (visibleAncestorMap.has(ends[end]))
966
+ return;
967
+ if (this.graph.getItemVisible(ancestor.id) ||
968
+ nodesToShow.includes(ancestor.id))
969
+ visibleAncestorMap.set(ends[end], ancestor.id);
970
+ });
971
+ }
972
+ virtualEnds[end] = visibleAncestorMap.get(ends[end]);
973
+ }
974
+ else {
975
+ virtualEnds[end] = ends[end];
976
+ }
977
+ });
978
+ if (virtualEnds.source !== undefined &&
979
+ virtualEnds.target !== undefined) {
980
+ virtualPairs.push(virtualEnds);
981
+ }
982
+ return false;
983
+ }));
984
+ // remove related virtual edges
985
+ this.graph.executeWithoutStacking(() => {
986
+ this.graph.removeData('edge', (0, util_1.uniq)(relatedVirtualEdgeIds));
987
+ this.graph.showItem(edgesToShow.concat(nodesToShow));
988
+ // add virtual edges by grouping visible ancestor edges
989
+ this.graph.addData('edge', groupVirtualEdges(virtualPairs));
990
+ });
991
+ }
992
+ /**
993
+ * Collapse or expand a sub tree according to action
994
+ * @param params
995
+ */
996
+ onTreeCollapseExpand(params) {
997
+ const { ids, animate, action, graphCore } = params;
998
+ const rootModels = ids.map((id) => graphCore.getNode(id));
999
+ switch (action) {
1000
+ case 'collapse':
1001
+ this.collapseSubTree(rootModels, graphCore, animate);
1002
+ break;
1003
+ case 'expand':
1004
+ default:
1005
+ this.expandSubTree(rootModels, graphCore, animate);
1006
+ break;
1007
+ }
1008
+ }
1009
+ /**
1010
+ * Collapse sub tree(s).
1011
+ * @param rootModels The root node models of sub trees
1012
+ * @param graphCore
1013
+ * @param animate Whether enable animations for expanding, true by default
1014
+ * @returns
1015
+ */
1016
+ collapseSubTree(rootModels, graphCore, animate = true) {
1017
+ let positions = [];
1018
+ rootModels.forEach((root) => {
1019
+ let shouldCollapse = true;
1020
+ const nodes = [];
1021
+ (0, data_1.graphCoreTreeDfs)(graphCore, [root], (node) => {
1022
+ var _a;
1023
+ if (node.id === root.id)
1024
+ return;
1025
+ const neighbors = graphCore.getNeighbors(node.id);
1026
+ if (!((_a = graphCore.getChildren(node.id, 'tree')) === null || _a === void 0 ? void 0 : _a.length) &&
1027
+ neighbors.length > 1) {
1028
+ shouldCollapse = false;
1029
+ }
1030
+ nodes.push(node);
1031
+ }, 'TB', 'tree', {
1032
+ stopAllFn: () => !shouldCollapse,
1033
+ });
1034
+ if (shouldCollapse) {
1035
+ positions = positions.concat(nodes.map((node) => ({
1036
+ id: node.id,
1037
+ data: { x: root.data.x, y: root.data.y },
1038
+ })));
1039
+ }
1040
+ });
1041
+ if (!positions.length)
1042
+ return;
1043
+ this.graph.updateNodePosition(positions, undefined, !animate, (model, canceled) => {
1044
+ this.graph.hideItem(model.id, canceled);
1045
+ }, undefined);
1046
+ }
1047
+ /**
1048
+ * Expand sub tree(s).
1049
+ * @param rootModels The root node models of sub trees.
1050
+ * @param graphCore
1051
+ * @param animate Whether enable animations for expanding, true by default.
1052
+ * @returns
1053
+ */
1054
+ expandSubTree(rootModels, graphCore, animate = true) {
1055
+ return __awaiter(this, void 0, void 0, function* () {
1056
+ let allNodeIds = [];
1057
+ let allEdgeIds = [];
1058
+ rootModels.forEach((root) => {
1059
+ const nodeIds = [];
1060
+ (0, data_1.graphCoreTreeDfs)(graphCore, [root], (node) => nodeIds.push(node.id), 'TB', 'tree', {
1061
+ stopBranchFn: (node) => {
1062
+ const shouldStop = node.id !== root.id && node.data.collapsed;
1063
+ if (shouldStop)
1064
+ nodeIds.push(node.id);
1065
+ return shouldStop;
1066
+ },
1067
+ });
1068
+ allEdgeIds = allEdgeIds.concat(graphCore
1069
+ .getAllEdges()
1070
+ .filter((edge) => nodeIds.includes(edge.source) && nodeIds.includes(edge.target))
1071
+ .map((edge) => edge.id));
1072
+ allNodeIds = allNodeIds.concat(nodeIds.filter((id) => id !== root.id));
1073
+ });
1074
+ const ids = (0, util_1.uniq)(allNodeIds.concat(allEdgeIds));
1075
+ this.graph.showItem(ids, !animate);
1076
+ yield this.graph.layout(undefined, !animate);
1077
+ });
1078
+ }
531
1079
  }
532
1080
  exports.ItemController = ItemController;
533
1081
  const getItemTheme = (dataTypeSet, dataTypeField, dataType, itemTheme) => {
534
- const { styles: themeStyles, lodStrategy } = itemTheme;
1082
+ const { styles: themeStyles = [], lodStrategy } = itemTheme;
535
1083
  const formattedLodStrategy = (0, zoom_1.formatLodStrategy)(lodStrategy);
536
1084
  if (!dataTypeField) {
537
1085
  // dataType field is not assigned
@@ -548,11 +1096,53 @@ const getItemTheme = (dataTypeSet, dataTypeField, dataType, itemTheme) => {
548
1096
  themeStyle = themeStyles[idx % themeStylesLength];
549
1097
  }
550
1098
  else if ((0, util_1.isObject)(themeStyles)) {
551
- themeStyle = themeStyles[dataType] || themeStyles.others;
1099
+ themeStyle =
1100
+ themeStyles[dataType] ||
1101
+ themeStyles.others;
552
1102
  }
553
1103
  return {
554
1104
  styles: themeStyle,
555
1105
  lodStrategy: formattedLodStrategy,
556
1106
  };
557
1107
  };
1108
+ const filterItemMapByType = (itemMap, type) => {
1109
+ const filteredMap = new Map();
1110
+ itemMap.forEach((value, key) => {
1111
+ if (value.type === type) {
1112
+ filteredMap.set(key, value);
1113
+ }
1114
+ });
1115
+ return filteredMap;
1116
+ };
1117
+ const groupVirtualEdges = (pairs) => {
1118
+ const groupedVirtualEdges = new Map();
1119
+ pairs.forEach((edge) => {
1120
+ const { source, target } = edge;
1121
+ const key = `${source}_${target}`;
1122
+ const group = groupedVirtualEdges.get(key) || {
1123
+ edges: [],
1124
+ source,
1125
+ target,
1126
+ };
1127
+ group.edges.push(edge);
1128
+ groupedVirtualEdges.set(key, group);
1129
+ });
1130
+ // each item in groupedEdges is a virtual edge
1131
+ const virtualEdges = [];
1132
+ groupedVirtualEdges.forEach((group) => {
1133
+ const { source, target, edges } = group;
1134
+ virtualEdges.push({
1135
+ id: `virtual-${(0, util_1.uniqueId)()}`,
1136
+ source,
1137
+ target,
1138
+ data: {
1139
+ _virtual: true,
1140
+ keyShape: {
1141
+ lineWidth: edges.length,
1142
+ },
1143
+ },
1144
+ });
1145
+ });
1146
+ return virtualEdges;
1147
+ };
558
1148
  //# sourceMappingURL=item.js.map