@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,10 +1,25 @@
1
1
  "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.DataController = void 0;
4
15
  const graphlib_1 = require("@antv/graphlib");
5
16
  const util_1 = require("@antv/util");
6
17
  const stdlib_1 = require("../../stdlib");
18
+ const data_1 = require("../../util/data");
7
19
  const extension_1 = require("../../util/extension");
20
+ const type_1 = require("../../util/type");
21
+ const layout_1 = require("../../util/layout");
22
+ const behavior_1 = require("../../util/behavior");
8
23
  /**
9
24
  * Manages the data transform extensions;
10
25
  * Storages user data and inner data.
@@ -25,12 +40,25 @@ class DataController {
25
40
  const ids = conditionIsArray ? condition : [condition];
26
41
  switch (type) {
27
42
  case 'node':
28
- return ids.map((id) => graphCore.hasNode(id) ? graphCore.getNode(id) : undefined);
43
+ return ids.map((id) => {
44
+ if (!graphCore.hasNode(id))
45
+ return undefined;
46
+ const model = graphCore.getNode(id);
47
+ if (model.data._isCombo)
48
+ return undefined;
49
+ return model;
50
+ });
29
51
  case 'edge':
30
52
  return ids.map((id) => graphCore.hasEdge(id) ? graphCore.getEdge(id) : undefined);
31
53
  case 'combo':
32
- // TODO;
33
- return;
54
+ return ids.map((id) => {
55
+ if (!graphCore.hasNode(id))
56
+ return undefined;
57
+ const model = graphCore.getNode(id);
58
+ if (!model.data._isCombo)
59
+ return undefined;
60
+ return model;
61
+ });
34
62
  }
35
63
  }
36
64
  else if (conditionType === 'function') {
@@ -56,29 +84,42 @@ class DataController {
56
84
  return [];
57
85
  }
58
86
  }
59
- findRelatedEdgeIds(nodeId, direction = 'both') {
87
+ findRelatedEdges(nodeId, direction = 'both') {
60
88
  return this.graphCore.getRelatedEdges(nodeId, direction);
61
89
  }
62
- findNeighborNodeIds(nodeId, direction = 'both') {
90
+ findNeighborNodes(nodeId, direction = 'both') {
63
91
  if (direction === 'in')
64
92
  return this.graphCore.getAncestors(nodeId);
65
93
  if (direction === 'out')
66
94
  return this.graphCore.getSuccessors(nodeId);
67
95
  return this.graphCore.getNeighbors(nodeId);
68
96
  }
97
+ findChildren(comboId, treeKey) {
98
+ if (!this.graphCore.hasNode(comboId))
99
+ return;
100
+ return this.graphCore.getChildren(comboId, treeKey);
101
+ }
69
102
  /**
70
103
  * Subscribe the lifecycle of graph.
71
104
  */
72
105
  tap() {
73
106
  this.extensions = this.getExtensions();
74
107
  this.graph.hooks.datachange.tap(this.onDataChange.bind(this));
108
+ this.graph.hooks.treecollapseexpand.tap(this.onTreeCollapseExpand.bind(this));
109
+ // check whether use tree layout or behaviors
110
+ // if so, establish tree structure for graph
111
+ this.graph.hooks.layout.tap(this.onLayout.bind(this));
112
+ this.graph.hooks.init.tap(this.onGraphInit.bind(this));
113
+ this.graph.hooks.behaviorchange.tap(this.onBehaviorChange.bind(this));
114
+ this.graph.hooks.modechange.tap(this.onModeChange.bind(this));
75
115
  }
76
116
  /**
77
117
  * Get the extensions from useLib.
78
118
  */
79
119
  getExtensions() {
80
120
  const { transform = [] } = this.graph.getSpecification();
81
- return transform
121
+ const requiredTransformers = ['validate-data'];
122
+ return [...transform, ...requiredTransformers]
82
123
  .map((config) => ({
83
124
  config,
84
125
  func: (0, extension_1.getExtension)(config, stdlib_1.registery.useLib, 'transform'),
@@ -91,6 +132,7 @@ class DataController {
91
132
  */
92
133
  onDataChange(param) {
93
134
  const { data, type: changeType } = param;
135
+ const { userGraphCore } = this;
94
136
  const change = () => {
95
137
  switch (changeType) {
96
138
  case 'remove':
@@ -99,13 +141,18 @@ class DataController {
99
141
  case 'update':
100
142
  this.updateData(data);
101
143
  break;
144
+ case 'moveCombo':
145
+ this.moveCombo(data);
146
+ break;
147
+ case 'addCombo':
148
+ this.addCombo(data);
149
+ break;
102
150
  default:
103
- // 'replace' | 'mergeReplace' | 'union'
151
+ // changeType is 'replace' | 'mergeReplace' | 'union'
104
152
  this.changeData(data, changeType);
105
153
  break;
106
154
  }
107
155
  };
108
- const { userGraphCore } = this;
109
156
  if (userGraphCore) {
110
157
  userGraphCore.batch(change);
111
158
  }
@@ -113,55 +160,158 @@ class DataController {
113
160
  change();
114
161
  }
115
162
  }
163
+ onTreeCollapseExpand(params) {
164
+ const { ids, action } = params;
165
+ ids.forEach((id) => {
166
+ this.userGraphCore.mergeNodeData(id, {
167
+ collapsed: action === 'collapse',
168
+ });
169
+ });
170
+ }
171
+ onLayout({ options }) {
172
+ if (this.treeDirtyFlag && (0, layout_1.isTreeLayout)(options)) {
173
+ this.establishUserGraphCoreTree();
174
+ }
175
+ }
176
+ onGraphInit() {
177
+ const { modes = {} } = this.graph.getSpecification();
178
+ const mode = this.graph.getMode() || 'default';
179
+ if ((0, behavior_1.hasTreeBehaviors)(modes[mode])) {
180
+ this.establishUserGraphCoreTree();
181
+ }
182
+ }
183
+ onBehaviorChange(param) {
184
+ const { action, modes, behaviors } = param;
185
+ const mode = this.graph.getMode() || 'default';
186
+ if (action !== 'add' || !modes.includes(mode))
187
+ return;
188
+ if ((0, behavior_1.hasTreeBehaviors)(behaviors)) {
189
+ this.establishUserGraphCoreTree();
190
+ }
191
+ }
192
+ onModeChange(param) {
193
+ const { modes = {} } = this.graph.getSpecification();
194
+ if ((0, behavior_1.hasTreeBehaviors)(modes[param.mode])) {
195
+ this.establishUserGraphCoreTree();
196
+ }
197
+ }
198
+ establishUserGraphCoreTree() {
199
+ if (!this.treeDirtyFlag)
200
+ return;
201
+ const nodes = this.userGraphCore.getAllNodes();
202
+ const edges = this.userGraphCore.getAllEdges();
203
+ this.userGraphCore.batch(() => {
204
+ // graph data to tree structure and storing
205
+ const rootIds = nodes
206
+ .filter((node) => node.data.isRoot)
207
+ .map((node) => node.id);
208
+ (0, data_1.graphData2TreeData)({}, { nodes, edges }, rootIds).forEach((tree) => {
209
+ (0, data_1.traverse)(tree, (node) => {
210
+ var _a;
211
+ (_a = node.children) === null || _a === void 0 ? void 0 : _a.forEach((child) => {
212
+ this.userGraphCore.setParent(child.id, node.id, 'tree');
213
+ });
214
+ });
215
+ });
216
+ });
217
+ this.treeDirtyFlag = false;
218
+ }
116
219
  /**
117
220
  * Change data by replace, merge repalce, or union.
118
221
  * @param data new data
119
222
  * @param changeType type of data change, 'replace' means discard the old data. 'mergeReplace' means merge the common part. 'union' means merge whole sets of old and new one
120
223
  */
121
- changeData(data, changeType) {
122
- const { userGraphCore } = this;
224
+ changeData(dataConfig, changeType) {
225
+ var _a;
226
+ const { type: dataType, data } = this.formatData(dataConfig) || {};
227
+ if (!dataType)
228
+ return;
229
+ const { nodes = [], edges = [], combos = [] } = this.transformData(data);
123
230
  if (changeType === 'replace') {
124
- this.userGraphCore = new graphlib_1.Graph(Object.assign(Object.assign({}, data), { onChanged: (event) => this.updateGraphCore(event) }));
125
- const { data: transformedData } = this.transformData();
126
- this.graphCore = new graphlib_1.Graph(Object.assign({}, transformedData));
231
+ this.userGraphCore = new graphlib_1.Graph({
232
+ nodes: nodes.concat((combos === null || combos === void 0 ? void 0 : combos.map((combo) => ({
233
+ id: combo.id,
234
+ data: Object.assign(Object.assign({}, combo.data), { _isCombo: true }),
235
+ }))) || []),
236
+ edges,
237
+ onChanged: (event) => this.updateGraphCore(event),
238
+ });
239
+ this.graphCore = new graphlib_1.Graph((0, util_1.clone)({
240
+ nodes: nodes.concat((combos === null || combos === void 0 ? void 0 : combos.map((combo) => ({
241
+ id: combo.id,
242
+ data: Object.assign(Object.assign({}, combo.data), { _isCombo: true }),
243
+ }))) || []),
244
+ edges,
245
+ }));
246
+ if (combos === null || combos === void 0 ? void 0 : combos.length) {
247
+ this.graphCore.attachTreeStructure('combo');
248
+ nodes.forEach((node) => {
249
+ if (node.data.parentId) {
250
+ if ((0, data_1.validateComboStrucutre)(this.graph, node.id, node.data.parentId)) {
251
+ this.graphCore.setParent(node.id, node.data.parentId, 'combo');
252
+ }
253
+ else {
254
+ this.graphCore.mergeNodeData(node.id, { parentId: undefined });
255
+ }
256
+ }
257
+ });
258
+ combos.forEach((combo) => {
259
+ if (combo.data.parentId) {
260
+ if ((0, data_1.validateComboStrucutre)(this.graph, combo.id, combo.data.parentId)) {
261
+ this.graphCore.setParent(combo.id, combo.data.parentId, 'combo');
262
+ }
263
+ else {
264
+ this.graphCore.mergeNodeData(combo.id, { parentId: undefined });
265
+ }
266
+ }
267
+ });
268
+ }
127
269
  }
128
270
  else {
129
- const prevNodes = userGraphCore.getAllNodes();
130
- const { nodes, edges, combos } = data;
131
- // TODO: distinguish combos
132
- if (!prevNodes.length) {
133
- userGraphCore.addNodes(nodes);
271
+ const { userGraphCore } = this;
272
+ const prevData = (0, data_1.deconstructData)({
273
+ nodes: userGraphCore.getAllNodes(),
274
+ edges: [],
275
+ });
276
+ const nodesAndCombos = nodes.concat(combos.map((combo) => ({
277
+ id: combo.id,
278
+ data: Object.assign(Object.assign({}, combo.data), { _isCombo: true }),
279
+ })));
280
+ // =========== node & combos ============
281
+ if (!prevData.nodes.length) {
282
+ userGraphCore.addNodes(nodesAndCombos);
134
283
  }
135
284
  else {
136
285
  if (changeType === 'mergeReplace') {
137
286
  // remove the nodes which are not in data but in userGraphCore
138
- const nodeIds = nodes.map((node) => node.id);
139
- prevNodes.forEach((prevNode) => {
140
- if (!nodeIds.includes(prevNode.id))
287
+ const nodeAndComboIds = nodesAndCombos.map((node) => node.id);
288
+ prevData.nodes.forEach((prevNode) => {
289
+ if (!nodeAndComboIds.includes(prevNode.id))
141
290
  userGraphCore.removeNode(prevNode.id);
142
291
  });
143
292
  }
144
293
  // add or update node
145
- nodes.forEach((node) => {
146
- if (userGraphCore.hasNode(node.id)) {
294
+ nodesAndCombos.forEach((item) => {
295
+ if (userGraphCore.hasNode(item.id)) {
147
296
  // update node which is in the graphCore
148
- userGraphCore.mergeNodeData(node.id, node.data);
297
+ userGraphCore.mergeNodeData(item.id, item.data);
149
298
  }
150
299
  else {
151
300
  // add node which is in data but not in graphCore
152
- userGraphCore.addNode(node);
301
+ userGraphCore.addNode(item);
153
302
  }
154
303
  });
155
304
  }
156
- const prevEdges = userGraphCore.getAllEdges();
157
- if (!prevEdges.length) {
305
+ // =========== edge ============
306
+ prevData.edges = userGraphCore.getAllEdges();
307
+ if (!prevData.edges.length) {
158
308
  userGraphCore.addEdges(edges);
159
309
  }
160
310
  else {
161
311
  if (changeType === 'mergeReplace') {
162
312
  // remove the edges which are not in data but in userGraphCore
163
313
  const edgeIds = edges.map((edge) => edge.id);
164
- prevEdges.forEach((prevEdge) => {
314
+ prevData.edges.forEach((prevEdge) => {
165
315
  if (!edgeIds.includes(prevEdge.id))
166
316
  userGraphCore.removeEdge(prevEdge.id);
167
317
  });
@@ -179,6 +329,14 @@ class DataController {
179
329
  });
180
330
  }
181
331
  }
332
+ if ((_a = data.edges) === null || _a === void 0 ? void 0 : _a.length) {
333
+ const { userGraphCore } = this;
334
+ // convert and store tree structure to graphCore
335
+ this.updateTreeGraph(dataType, {
336
+ nodes: userGraphCore.getAllNodes(),
337
+ edges: userGraphCore.getAllEdges(),
338
+ });
339
+ }
182
340
  }
183
341
  /**
184
342
  * Remove part of old data.
@@ -186,30 +344,45 @@ class DataController {
186
344
  */
187
345
  removeData(data) {
188
346
  const { userGraphCore } = this;
189
- const { nodes, edges, combos } = data;
190
- const prevNodes = userGraphCore.getAllNodes();
347
+ const { nodes = [], edges = [], combos = [] } = data;
348
+ const nodesAndCombos = nodes.concat(combos);
349
+ const prevNodesAndCombos = userGraphCore.getAllNodes();
191
350
  const prevEdges = userGraphCore.getAllEdges();
192
- // TODO: distinguish combos
193
- if (prevNodes.length && nodes.length) {
351
+ if (prevNodesAndCombos.length && nodesAndCombos.length) {
352
+ // update the parentId
353
+ if (this.graphCore.hasTreeStructure('combo')) {
354
+ nodesAndCombos.forEach((item) => {
355
+ const { parentId } = item.data;
356
+ this.graphCore.getChildren(item.id, 'combo').forEach((child) => {
357
+ userGraphCore.mergeNodeData(child.id, { parentId });
358
+ });
359
+ });
360
+ }
194
361
  // remove the node
195
- userGraphCore.removeNodes(nodes.map((node) => node.id));
362
+ userGraphCore.removeNodes(nodesAndCombos.map((node) => node.id));
196
363
  }
197
364
  if (prevEdges.length && edges.length) {
198
365
  // add or update edge
199
- userGraphCore.removeEdges(edges.map((edge) => edge.id));
366
+ const ids = edges
367
+ .map((edge) => edge.id)
368
+ .filter((id) => userGraphCore.hasEdge(id));
369
+ userGraphCore.removeEdges(ids);
200
370
  }
201
- // TODO: combo
202
371
  }
203
372
  /**
204
373
  * Update part of old data.
205
374
  * @param data data to be updated which is part of old one
206
375
  */
207
- updateData(data) {
376
+ updateData(dataConfig) {
208
377
  const { userGraphCore } = this;
209
- const { nodes, edges, combos } = data;
210
- const prevNodes = userGraphCore.getAllNodes();
211
- const prevEdges = userGraphCore.getAllEdges();
212
- // TODO: distinguish combos
378
+ const { type: dataType, data } = this.formatData(dataConfig);
379
+ if (!dataType)
380
+ return;
381
+ const { nodes = [], edges = [], combos = [] } = data; //this.transformData(data as GraphData);
382
+ const { nodes: prevNodes, edges: prevEdges, combos: prevCombos, } = (0, data_1.deconstructData)({
383
+ nodes: userGraphCore.getAllNodes(),
384
+ edges: userGraphCore.getAllEdges(),
385
+ });
213
386
  if (prevNodes.length) {
214
387
  // update node
215
388
  nodes.forEach((newModel) => {
@@ -237,170 +410,381 @@ class DataController {
237
410
  }
238
411
  });
239
412
  }
240
- // TODO: combo
413
+ if (prevCombos.length) {
414
+ // update combos
415
+ const modelsToMove = [];
416
+ combos.forEach((newModel) => {
417
+ const { id, data } = newModel;
418
+ const { x: comboNewX, y: comboNewY } = data, others = __rest(data, ["x", "y"]);
419
+ if (comboNewX !== undefined || comboNewY !== undefined) {
420
+ if (this.graphCore.getChildren(id, 'combo').length) {
421
+ // combo's position is updated, update the succeed nodes' positions
422
+ const oldBounds = this.graph.getRenderBBox(id, true);
423
+ if (!oldBounds)
424
+ return;
425
+ const [comboOldX, comboOldY] = oldBounds.center;
426
+ const dx = comboNewX - comboOldX;
427
+ const dy = comboNewY - comboOldY;
428
+ (0, data_1.graphComboTreeDfs)(this.graph, [newModel], (succeed) => {
429
+ const { x, y, _isCombo } = succeed.data;
430
+ if (!_isCombo) {
431
+ modelsToMove.push({
432
+ id: succeed.id,
433
+ data: {
434
+ x: x + dx,
435
+ y: y + dy,
436
+ },
437
+ });
438
+ }
439
+ }, 'BT');
440
+ }
441
+ else {
442
+ // empty combo, modify the position directly
443
+ modelsToMove.push({
444
+ id,
445
+ data: {
446
+ x: comboNewX,
447
+ y: comboNewY,
448
+ },
449
+ });
450
+ }
451
+ }
452
+ // update other properties
453
+ if (Object.keys(others).length) {
454
+ const mergedData = mergeOneLevelData(userGraphCore.getNode(id), {
455
+ id,
456
+ data: others,
457
+ });
458
+ userGraphCore.mergeNodeData(id, mergedData);
459
+ }
460
+ });
461
+ // update succeed nodes
462
+ modelsToMove.forEach((newModel) => {
463
+ const { id, data } = newModel;
464
+ userGraphCore.mergeNodeData(id, data);
465
+ });
466
+ }
467
+ if (edges === null || edges === void 0 ? void 0 : edges.filter((edge) => edge.hasOwnProperty('source') || edge.hasOwnProperty('target')).length) {
468
+ // convert and store tree structure to graphCore
469
+ this.updateTreeGraph(dataType, {
470
+ nodes: this.userGraphCore.getAllNodes(),
471
+ edges: this.userGraphCore.getAllEdges(),
472
+ });
473
+ }
474
+ }
475
+ formatData(dataConfig) {
476
+ const { type, value } = dataConfig;
477
+ let data = value;
478
+ if (!type) {
479
+ data = dataConfig;
480
+ }
481
+ else if (type === 'treeData') {
482
+ data = (0, data_1.treeData2GraphData)(value);
483
+ }
484
+ else if (type === 'fetch') {
485
+ // TODO: fetch
486
+ }
487
+ else if (!data.nodes) {
488
+ console.warn('Input data type is invalid, the type shuold be "graphData", "treeData", or "fetch".');
489
+ return;
490
+ }
491
+ return {
492
+ type: type || 'graphData',
493
+ data: data,
494
+ };
495
+ }
496
+ /**
497
+ * Relatively move the position of combo a dinstance (dx and dy in combo data).
498
+ * @param data graph data which contains the combo dx dy info
499
+ */
500
+ moveCombo(data) {
501
+ const { combos = [] } = data;
502
+ const succeedNodesModels = [];
503
+ combos.forEach((newModel) => {
504
+ const { dx = 0, dy = 0 } = newModel.data;
505
+ if (!dx && !dy)
506
+ return;
507
+ if (this.graphCore.getChildren(newModel.id, 'combo').length) {
508
+ // combo's position is updated, update the succeed nodes' positions
509
+ (0, data_1.graphComboTreeDfs)(this.graph, [newModel], (succeed) => {
510
+ const { x, y, _isCombo } = succeed.data;
511
+ if (!_isCombo ||
512
+ !this.graphCore.getChildren(succeed.id, 'combo').length) {
513
+ succeedNodesModels.push({
514
+ id: succeed.id,
515
+ data: {
516
+ x: x + dx,
517
+ y: y + dy,
518
+ },
519
+ });
520
+ }
521
+ }, 'BT');
522
+ }
523
+ else {
524
+ // empty combo, move it directly
525
+ const comboModel = this.graphCore.getNode(newModel.id);
526
+ const { x = 0, y = 0 } = comboModel.data;
527
+ succeedNodesModels.push({
528
+ id: newModel.id,
529
+ data: {
530
+ x: x + dx,
531
+ y: y + dy,
532
+ },
533
+ });
534
+ }
535
+ });
536
+ // update succeed nodes
537
+ const { userGraphCore } = this;
538
+ succeedNodesModels.forEach((newModel) => {
539
+ const { id, data } = newModel;
540
+ if (data) {
541
+ const mergedData = mergeOneLevelData(userGraphCore.getNode(id), newModel);
542
+ userGraphCore.mergeNodeData(id, mergedData);
543
+ }
544
+ });
545
+ }
546
+ addCombo(data) {
547
+ const { combos = [] } = data;
548
+ if (!(combos === null || combos === void 0 ? void 0 : combos.length))
549
+ return;
550
+ const { userGraphCore } = this;
551
+ const { id, data: comboData } = combos[0];
552
+ const { _children = [] } = comboData, others = __rest(comboData, ["_children"]);
553
+ // add or update combo
554
+ if (userGraphCore.hasNode(id)) {
555
+ // update node which is in the graphCore
556
+ userGraphCore.mergeNodeData(id, Object.assign(Object.assign({}, others), { _isCombo: true }));
557
+ }
558
+ else {
559
+ // add node which is in data but not in graphCore
560
+ userGraphCore.addNode({ id, data: Object.assign(Object.assign({}, others), { _isCombo: true }) });
561
+ }
562
+ // update strucutre
563
+ _children.forEach((childId) => {
564
+ if (!this.graphCore.hasNode(childId)) {
565
+ console.warn(`Adding child ${childId} to combo ${id} failed. The child ${childId} does not exist`);
566
+ return;
567
+ }
568
+ userGraphCore.mergeNodeData(childId, { parentId: id });
569
+ });
241
570
  }
242
571
  /**
243
572
  * Update graphCore with transformed userGraphCore data.
244
573
  */
245
574
  updateGraphCore(event) {
246
575
  const { graphCore } = this;
247
- // === step 1: clone data from userGraphCore (userData) ===
248
- // === step 2: transform the data with transform extensions, output innerData and idMaps ===
249
- const { data: transformedData, idMaps } = this.transformData();
250
- const { nodes, edges, combos } = transformedData;
251
- const prevNodes = graphCore.getAllNodes();
576
+ const { nodes = [], edges = [], combos = [], } = (0, data_1.deconstructData)({
577
+ nodes: this.userGraphCore.getAllNodes(),
578
+ edges: this.userGraphCore.getAllEdges(),
579
+ });
580
+ const prevNodesAndCombos = graphCore.getAllNodes();
252
581
  // function to update one data in graphCore with different model type ('node' or 'edge')
253
- const syncUpdateToGraphCore = (id, newValue, oldValue, isNode, diff = []) => {
254
- if (isNode) {
582
+ const syncUpdateToGraphCore = (id, newValue, oldValue, isNodeOrCombo, diff = []) => {
583
+ if (isNodeOrCombo) {
255
584
  if (newValue.data)
256
- graphCore.updateNodeData(id, newValue.data);
585
+ graphCore.updateNodeData(id, Object.assign({}, newValue.data));
257
586
  }
258
587
  else {
259
588
  if (diff.includes('data'))
260
- graphCore.updateEdgeData(id, newValue.data);
589
+ graphCore.updateEdgeData(id, Object.assign({}, newValue.data));
261
590
  // source and target may be changed
262
591
  if (diff.includes('source'))
263
592
  graphCore.updateEdgeSource(id, newValue.source);
264
593
  if (diff.includes('target'))
265
594
  graphCore.updateEdgeTarget(id, newValue.target);
266
595
  }
267
- // TODO: combo
268
596
  };
269
597
  graphCore.batch(() => {
270
598
  // === step 3: sync to graphCore according to the changes in userGraphCore ==
271
- if (!(idMaps === null || idMaps === void 0 ? void 0 : idMaps.length) || idMaps.length !== this.extensions.length) {
272
- // situation 1: not every extension has corresponding idMap, use default mapping: suppose id is not changed by transforms
273
- // and diff the value in graphCore whose id is not in userGraphCore
274
- const newModelMap = {};
275
- nodes.forEach((model) => (newModelMap[model.id] = { type: 'node', model }));
276
- edges.forEach((model) => (newModelMap[model.id] = { type: 'edge', model }));
277
- prevNodes.forEach((prevNode) => {
278
- var _a;
279
- const { id } = prevNode;
280
- const { model: newModel } = newModelMap[id] || {};
281
- // remove
282
- if (!newModel)
283
- graphCore.removeNode(id);
284
- // update
285
- else if ((_a = diffAt(newModel, prevNode, true)) === null || _a === void 0 ? void 0 : _a.length)
286
- syncUpdateToGraphCore(id, newModel, prevNode, true);
287
- // delete from the map indicates this model is visited
288
- delete newModelMap[id];
289
- });
290
- graphCore.getAllEdges().forEach((prevEdge) => {
291
- const { id } = prevEdge;
292
- const { model: newModel } = newModelMap[id] || {};
293
- // remove
294
- if (!newModel)
295
- graphCore.removeEdge(id);
296
- // update
297
- else {
298
- const diff = diffAt(newModel, prevEdge, false);
299
- if (diff === null || diff === void 0 ? void 0 : diff.length)
300
- syncUpdateToGraphCore(id, newModel, prevEdge, false, diff);
599
+ const newModelMap = {};
600
+ const parentMap = {};
601
+ const changeMap = {};
602
+ const treeChanges = [];
603
+ event.changes.forEach((change) => {
604
+ var _a;
605
+ const id = change.id || ((_a = change.value) === null || _a === void 0 ? void 0 : _a.id);
606
+ if (id !== undefined) {
607
+ changeMap[id] = true;
608
+ return;
609
+ }
610
+ if ([
611
+ 'TreeStructureAttached',
612
+ 'TreeStructureChanged',
613
+ 'TreeStructureChanged',
614
+ ].includes(change.type)) {
615
+ treeChanges.push(change);
616
+ }
617
+ });
618
+ nodes.forEach((model) => {
619
+ newModelMap[model.id] = { type: 'node', model };
620
+ if (model.data.hasOwnProperty('parentId')) {
621
+ parentMap[model.id] = {
622
+ new: model.data.parentId,
623
+ old: undefined,
624
+ };
625
+ }
626
+ });
627
+ edges.forEach((model) => (newModelMap[model.id] = { type: 'edge', model }));
628
+ combos.forEach((model) => {
629
+ newModelMap[model.id] = { type: 'combo', model };
630
+ if (model.data.hasOwnProperty('parentId')) {
631
+ parentMap[model.id] = {
632
+ new: model.data.parentId,
633
+ old: undefined,
634
+ };
635
+ }
636
+ });
637
+ prevNodesAndCombos.forEach((prevModel) => {
638
+ var _a, _b;
639
+ const { id } = prevModel;
640
+ if (((_a = parentMap[id]) === null || _a === void 0 ? void 0 : _a.new) !== undefined ||
641
+ prevModel.data.parentId !== undefined) {
642
+ parentMap[id] = {
643
+ new: (_b = parentMap[id]) === null || _b === void 0 ? void 0 : _b.new,
644
+ old: prevModel.data.parentId,
645
+ };
646
+ }
647
+ else {
648
+ delete parentMap[id];
649
+ }
650
+ const { model: newModel } = newModelMap[id] || {};
651
+ // remove
652
+ if (!newModel) {
653
+ // remove a combo, put the children to upper parent
654
+ if (prevModel.data._isCombo) {
655
+ graphCore.getChildren(id, 'combo').forEach((child) => {
656
+ parentMap[child.id] = Object.assign(Object.assign({}, parentMap[child.id]), { new: prevModel.data.parentId });
657
+ });
301
658
  }
302
- // delete from the map indicates this model is visited
303
- delete newModelMap[id];
304
- });
305
- // add
306
- Object.values(newModelMap).forEach(({ type, model }) => {
307
- if (type === 'node')
308
- graphCore.addNode(model);
309
- else if (type === 'edge')
310
- graphCore.addEdge(model);
311
- // TODO: combo
312
- });
313
- }
314
- else {
315
- // situation 2: idMaps is complete
316
- // calculate the final idMap which maps the ids from final transformed data to their comes from ids in userData
317
- const finalIdMap = {};
318
- const newModelMap = {};
319
- const prevModelMap = {};
320
- nodes.concat(edges).forEach((model) => {
321
- finalIdMap[model.id] = getComesFromLinkedList(model.id, idMaps);
322
- newModelMap[model.id] = model;
323
- });
324
- prevNodes.concat(graphCore.getAllEdges()).forEach((model) => {
325
- prevModelMap[model.id] = model;
326
- });
327
- // TODO: combo
328
- // map changes for search
329
- const changeMap = {};
330
- const { changes } = event;
331
- changes.forEach((change) => {
332
- const { value, id, type } = change;
333
- // TODO: temporary skip. how to handle tree change events?
334
- if ([
335
- 'TreeStructureAttached',
336
- 'TreeStructureDetached',
337
- 'TreeStructureChanged',
338
- ].includes(type))
339
- return;
340
- const dataId = id || value.id;
341
- changeMap[dataId] = changeMap[dataId] || [];
342
- changeMap[dataId].push(type.toLawerCase());
343
- });
344
- // 1. remove or add model to userGraphCore according the existence
345
- // 2. update or keep unchanged according to the source models' changes in userGraphCore
346
- // if source models have any change, update the data in graphcore. Kepp unchanged otherwise
347
- Object.keys(newModelMap).forEach((newId) => {
348
- const comesFromIds = finalIdMap[newId];
349
- const newValue = newModelMap[newId];
350
- const oldValue = prevModelMap[newId];
351
- const isNode = graphCore.hasNode(newId);
352
- if (newValue && !oldValue) {
353
- const addFunc = isNode ? graphCore.addNode : graphCore.addEdge;
354
- addFunc(newValue);
659
+ // if it has combo parent, remove it from the parent's children list
660
+ if (prevModel.data.parentId) {
661
+ graphCore.setParent(id, undefined, 'combo');
355
662
  }
356
- else if (!newValue && oldValue) {
357
- const removeFunc = isNode
358
- ? graphCore.removeNode
359
- : graphCore.removeEdge;
360
- removeFunc(newId);
663
+ // for tree graph view, show the succeed nodes and edges
664
+ const succeedIds = [];
665
+ if (graphCore.hasTreeStructure('tree')) {
666
+ graphCore.dfsTree(id, (child) => {
667
+ succeedIds.push(child.id);
668
+ }, 'tree');
669
+ const succeedEdgeIds = graphCore
670
+ .getAllEdges()
671
+ .filter(({ source, target }) => succeedIds.includes(source) && succeedIds.includes(target))
672
+ .map((edge) => edge.id);
673
+ this.graph.showItem(succeedIds
674
+ .filter((succeedId) => succeedId !== id)
675
+ .concat(succeedEdgeIds));
676
+ // for tree graph view, remove the node from the parent's children list
677
+ graphCore.setParent(id, undefined, 'tree');
678
+ // for tree graph view, make the its children to be roots
679
+ graphCore
680
+ .getChildren(id, 'tree')
681
+ .forEach((child) => graphCore.setParent(child.id, undefined, 'tree'));
361
682
  }
362
- else {
363
- if (!(comesFromIds === null || comesFromIds === void 0 ? void 0 : comesFromIds.length)) {
364
- // no comesForm, find same id in userGraphCore to follow the change, if it not found, diff new and old data value of graphCore (inner data)
365
- const diff = diffAt(newValue, oldValue, isNode);
366
- if (diff === null || diff === void 0 ? void 0 : diff.length)
367
- syncUpdateToGraphCore(newId, newValue, oldValue, isNode, diff);
368
- }
369
- else {
370
- // follow the corresponding data event in userGraphCore
371
- const comesFromChanges = changeMap[comesFromIds[0]];
372
- if (comesFromChanges === null || comesFromChanges === void 0 ? void 0 : comesFromChanges.length)
373
- syncUpdateToGraphCore(newId, newValue, oldValue, isNode);
374
- }
683
+ // remove the node data
684
+ graphCore.removeNode(id);
685
+ delete parentMap[prevModel.id];
686
+ }
687
+ // update
688
+ // || diffAt(newModel, prevModel, true)?.length
689
+ else if (changeMap[id])
690
+ syncUpdateToGraphCore(id, newModel, prevModel, true);
691
+ // delete from the map indicates this model is visited
692
+ delete newModelMap[id];
693
+ });
694
+ graphCore.getAllEdges().forEach((prevEdge) => {
695
+ const { id } = prevEdge;
696
+ const { model: newModel } = newModelMap[id] || {};
697
+ // remove
698
+ if (!newModel)
699
+ graphCore.removeEdge(id);
700
+ // update
701
+ else {
702
+ const diff = diffAt(newModel, prevEdge, false);
703
+ if (diff === null || diff === void 0 ? void 0 : diff.length)
704
+ syncUpdateToGraphCore(id, newModel, prevEdge, false, diff);
705
+ }
706
+ // delete from the map indicates this model is visited
707
+ delete newModelMap[id];
708
+ });
709
+ // add
710
+ Object.values(newModelMap).forEach(({ type, model }) => {
711
+ if (type === 'node' || type === 'combo')
712
+ graphCore.addNode(model);
713
+ else if (type === 'edge')
714
+ graphCore.addEdge(model);
715
+ });
716
+ // update parents after adding all items
717
+ Object.keys(parentMap).forEach((id) => {
718
+ var _a;
719
+ if (parentMap[id].new === parentMap[id].old)
720
+ return;
721
+ if (!(0, data_1.validateComboStrucutre)(this.graph, id, parentMap[id].new)) {
722
+ graphCore.mergeNodeData(id, { parentId: parentMap[id].old });
723
+ return;
724
+ }
725
+ graphCore.mergeNodeData(id, { parentId: parentMap[id].new });
726
+ graphCore.setParent(id, parentMap[id].new, 'combo');
727
+ // after remove from parent's children list, check whether the parent is empty
728
+ // if so, update parent's position to be the child's
729
+ if (parentMap[id].old !== undefined) {
730
+ const parentChildren = graphCore.getChildren(parentMap[id].old, 'combo');
731
+ const { x = 0, y = 0, z = 0, } = (_a = this.graph.getDisplayModel(parentMap[id].old)) === null || _a === void 0 ? void 0 : _a.data;
732
+ if (!parentChildren.length) {
733
+ graphCore.mergeNodeData(parentMap[id].old, {
734
+ x: (0, type_1.convertToNumber)(x),
735
+ y: (0, type_1.convertToNumber)(y),
736
+ z: (0, type_1.convertToNumber)(z),
737
+ });
375
738
  }
376
- });
377
- }
739
+ }
740
+ });
741
+ // update tree structure
742
+ treeChanges.forEach((change) => {
743
+ const { type, treeKey, nodeId, newParentId } = change;
744
+ if (type === 'TreeStructureAttached') {
745
+ graphCore.attachTreeStructure(treeKey);
746
+ return;
747
+ }
748
+ else if (type === 'TreeStructureChanged') {
749
+ graphCore.setParent(nodeId, newParentId, treeKey);
750
+ return;
751
+ }
752
+ else if (type === 'TreeStructureDetached') {
753
+ graphCore.detachTreeStructure(treeKey);
754
+ return;
755
+ }
756
+ });
378
757
  });
379
758
  }
380
759
  /**
381
760
  * Clone data from userGraphCore, and run transforms
382
761
  * @returns transformed data and the id map list
383
762
  */
384
- transformData() {
385
- const { userGraphCore } = this;
386
- // === step 1: clone data from userGraphCore (userData) ===
387
- const userData = {
388
- // TODO: should be deepClone
389
- nodes: userGraphCore.getAllNodes(),
390
- edges: userGraphCore.getAllEdges(),
391
- // combos:
392
- };
393
- let dataCloned = (0, util_1.clone)(userData);
394
- // === step 2: transform the data with transform extensions, output innerData and idMaps ===
395
- const idMaps = [];
763
+ transformData(data) {
764
+ let dataCloned = (0, util_1.clone)(data);
765
+ // transform the data with transform extensions, output innerData and idMaps ===
396
766
  this.extensions.forEach(({ func, config }) => {
397
- const result = func(dataCloned, config);
398
- dataCloned = result.data;
399
- const idMap = result.idMap;
400
- if (idMap)
401
- idMaps.push(idMap);
767
+ dataCloned = func(dataCloned, config, this.userGraphCore);
402
768
  });
403
- return { data: dataCloned, idMaps };
769
+ return dataCloned;
770
+ }
771
+ /**
772
+ * convert and store tree structure to graphCore
773
+ * @param dataType
774
+ * @param data
775
+ */
776
+ updateTreeGraph(dataType, data) {
777
+ this.userGraphCore.attachTreeStructure('tree');
778
+ if (dataType === 'treeData') {
779
+ // tree structure storing
780
+ data.edges.forEach((edge) => {
781
+ const { source, target } = edge;
782
+ this.userGraphCore.setParent(target, source, 'tree');
783
+ });
784
+ }
785
+ else {
786
+ this.treeDirtyFlag = true;
787
+ }
404
788
  }
405
789
  }
406
790
  exports.DataController = DataController;
@@ -461,6 +845,11 @@ const diffAt = (newModel, oldModel, isNode) => {
461
845
  else
462
846
  continue;
463
847
  }
848
+ if (typeof newValue === 'number' &&
849
+ typeof oldValue === 'number' &&
850
+ isNaN(newValue) &&
851
+ isNaN(oldValue))
852
+ return;
464
853
  if (newValue !== oldValue)
465
854
  return diff.concat('data');
466
855
  }