@antv/g6 5.0.0-beta.4 → 5.0.0-beta.40

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 (2684) hide show
  1. package/LICENSE +21 -0
  2. package/dist/g6.min.js +2 -2
  3. package/dist/lib/animations/executor.d.ts +11 -0
  4. package/dist/lib/animations/index.d.ts +32 -0
  5. package/dist/lib/animations/types.d.ts +113 -0
  6. package/dist/lib/behaviors/base-behavior.d.ts +6 -0
  7. package/dist/lib/behaviors/brush-select.d.ts +189 -0
  8. package/dist/lib/behaviors/click-select.d.ts +116 -0
  9. package/dist/lib/behaviors/collapse-expand.d.ts +64 -0
  10. package/dist/lib/behaviors/create-edge.d.ts +75 -0
  11. package/dist/lib/behaviors/drag-canvas.d.ts +83 -0
  12. package/dist/lib/behaviors/drag-element-force.d.ts +53 -0
  13. package/dist/lib/behaviors/drag-element.d.ts +182 -0
  14. package/dist/lib/behaviors/focus-element.d.ts +42 -0
  15. package/dist/lib/behaviors/hover-activate.d.ts +84 -0
  16. package/dist/lib/behaviors/index.d.ts +26 -0
  17. package/dist/lib/behaviors/lasso-select.d.ts +41 -0
  18. package/dist/lib/behaviors/scroll-canvas.d.ts +85 -0
  19. package/dist/lib/behaviors/types.d.ts +6 -0
  20. package/dist/lib/behaviors/zoom-canvas.d.ts +98 -0
  21. package/dist/lib/constants/animation.d.ts +3 -0
  22. package/dist/lib/constants/change.d.ts +64 -0
  23. package/dist/lib/constants/element.d.ts +7 -0
  24. package/dist/lib/constants/events/animation.d.ts +6 -0
  25. package/dist/lib/constants/events/canvas.d.ts +115 -0
  26. package/dist/lib/constants/events/combo.d.ts +109 -0
  27. package/dist/lib/constants/events/common.d.ts +122 -0
  28. package/dist/lib/constants/events/container.d.ts +14 -0
  29. package/dist/lib/constants/events/edge.d.ts +91 -0
  30. package/dist/lib/constants/events/graph.d.ts +158 -0
  31. package/dist/lib/constants/events/history.d.ts +38 -0
  32. package/dist/lib/constants/events/index.d.ts +9 -0
  33. package/dist/lib/constants/events/node.d.ts +109 -0
  34. package/dist/lib/constants/graphlib.d.ts +2 -0
  35. package/dist/lib/constants/index.d.ts +5 -0
  36. package/dist/lib/constants/registry.d.ts +62 -0
  37. package/dist/lib/elements/base-element.d.ts +35 -0
  38. package/dist/lib/elements/combos/base-combo.d.ts +91 -0
  39. package/dist/lib/elements/combos/circle.d.ts +25 -0
  40. package/dist/lib/elements/combos/index.d.ts +6 -0
  41. package/dist/lib/elements/combos/rect.d.ts +21 -0
  42. package/dist/lib/elements/edges/base-edge.d.ts +155 -0
  43. package/dist/lib/elements/edges/cubic-horizontal.d.ts +39 -0
  44. package/dist/lib/elements/edges/cubic-vertical.d.ts +39 -0
  45. package/dist/lib/elements/edges/cubic.d.ts +48 -0
  46. package/dist/lib/elements/edges/index.d.ts +14 -0
  47. package/dist/lib/elements/edges/line.d.ts +25 -0
  48. package/dist/lib/elements/edges/polyline.d.ts +63 -0
  49. package/dist/lib/elements/edges/quadratic.d.ts +44 -0
  50. package/dist/lib/elements/index.d.ts +3 -0
  51. package/dist/lib/elements/nodes/base-node.d.ts +193 -0
  52. package/dist/lib/elements/nodes/circle.d.ts +26 -0
  53. package/dist/lib/elements/nodes/diamond.d.ts +21 -0
  54. package/dist/lib/elements/nodes/donut.d.ts +45 -0
  55. package/dist/lib/elements/nodes/ellipse.d.ts +26 -0
  56. package/dist/lib/elements/nodes/hexagon.d.ts +28 -0
  57. package/dist/lib/elements/nodes/html.d.ts +41 -0
  58. package/dist/lib/elements/nodes/image.d.ts +38 -0
  59. package/dist/lib/elements/nodes/index.d.ts +22 -0
  60. package/dist/lib/elements/nodes/rect.d.ts +26 -0
  61. package/dist/lib/elements/nodes/star.d.ts +30 -0
  62. package/dist/lib/elements/nodes/triangle.d.ts +31 -0
  63. package/dist/lib/elements/shapes/badge.d.ts +14 -0
  64. package/dist/lib/elements/shapes/base-shape.d.ts +63 -0
  65. package/dist/lib/elements/shapes/contour.d.ts +66 -0
  66. package/dist/lib/elements/shapes/icon.d.ts +13 -0
  67. package/dist/lib/elements/shapes/index.d.ts +16 -0
  68. package/dist/lib/elements/shapes/label.d.ts +31 -0
  69. package/dist/lib/elements/shapes/polygon.d.ts +30 -0
  70. package/dist/lib/exports.d.ts +40 -0
  71. package/dist/lib/index.d.ts +3 -0
  72. package/dist/lib/layouts/base-layout.d.ts +10 -0
  73. package/dist/lib/layouts/index.d.ts +4 -0
  74. package/dist/lib/layouts/types.d.ts +84 -0
  75. package/dist/lib/palettes/index.d.ts +10 -0
  76. package/dist/lib/palettes/types.d.ts +5 -0
  77. package/dist/lib/plugins/background/index.d.ts +38 -0
  78. package/dist/lib/plugins/base-plugin.d.ts +6 -0
  79. package/dist/lib/plugins/bubble-sets.d.ts +116 -0
  80. package/dist/lib/plugins/camera-setting.d.ts +111 -0
  81. package/dist/lib/plugins/contextmenu/index.d.ts +115 -0
  82. package/dist/lib/plugins/contextmenu/util.d.ts +26 -0
  83. package/dist/lib/plugins/grid-line.d.ts +106 -0
  84. package/dist/lib/plugins/history/index.d.ts +120 -0
  85. package/dist/lib/plugins/history/util.d.ts +21 -0
  86. package/dist/lib/plugins/hull/index.d.ts +114 -0
  87. package/dist/lib/plugins/hull/util.d.ts +12 -0
  88. package/dist/lib/plugins/index.d.ts +26 -0
  89. package/dist/lib/plugins/legend.d.ts +129 -0
  90. package/dist/lib/plugins/timebar.d.ts +234 -0
  91. package/dist/lib/plugins/toolbar/index.d.ts +69 -0
  92. package/dist/lib/plugins/toolbar/util.d.ts +33 -0
  93. package/dist/lib/plugins/tooltip.d.ts +116 -0
  94. package/dist/lib/plugins/types.d.ts +4 -0
  95. package/dist/lib/plugins/watermark/index.d.ts +191 -0
  96. package/dist/lib/plugins/watermark/util.d.ts +18 -0
  97. package/dist/lib/preset.d.ts +1 -0
  98. package/dist/lib/registry/build-in.d.ts +6 -0
  99. package/dist/lib/registry/extension/index.d.ts +33 -0
  100. package/dist/lib/registry/extension/types.d.ts +38 -0
  101. package/dist/lib/registry/index.d.ts +59 -0
  102. package/dist/lib/registry/types.d.ts +39 -0
  103. package/dist/lib/runtime/animation.d.ts +54 -0
  104. package/dist/lib/runtime/batch.d.ts +11 -0
  105. package/dist/lib/runtime/behavior.d.ts +19 -0
  106. package/dist/lib/runtime/canvas.d.ts +60 -0
  107. package/dist/lib/runtime/data.d.ts +202 -0
  108. package/dist/lib/runtime/element.d.ts +102 -0
  109. package/dist/lib/runtime/graph.d.ts +1011 -0
  110. package/dist/lib/runtime/layout.d.ts +38 -0
  111. package/dist/lib/runtime/plugin.d.ts +10 -0
  112. package/dist/lib/runtime/transform.d.ts +12 -0
  113. package/dist/lib/runtime/types.d.ts +90 -0
  114. package/dist/lib/runtime/viewport.d.ts +58 -0
  115. package/dist/lib/spec/behavior.d.ts +30 -0
  116. package/dist/lib/spec/canvas.d.ts +53 -0
  117. package/dist/lib/spec/data.d.ts +222 -0
  118. package/dist/lib/spec/element/animation.d.ts +6 -0
  119. package/dist/lib/spec/element/combo.d.ts +52 -0
  120. package/dist/lib/spec/element/edge.d.ts +52 -0
  121. package/dist/lib/spec/element/node.d.ts +52 -0
  122. package/dist/lib/spec/element/palette.d.ts +53 -0
  123. package/dist/lib/spec/graph.d.ts +91 -0
  124. package/dist/lib/spec/index.d.ts +12 -0
  125. package/dist/lib/spec/layout.d.ts +4 -0
  126. package/dist/lib/spec/plugin.d.ts +32 -0
  127. package/dist/lib/spec/theme.d.ts +7 -0
  128. package/dist/lib/spec/transform.d.ts +12 -0
  129. package/dist/lib/spec/viewport.d.ts +82 -0
  130. package/dist/lib/themes/base.d.ts +28 -0
  131. package/dist/lib/themes/dark.d.ts +2 -0
  132. package/dist/lib/themes/index.d.ts +2 -0
  133. package/dist/lib/themes/light.d.ts +2 -0
  134. package/dist/lib/themes/types.d.ts +9 -0
  135. package/dist/lib/transforms/arrange-draw-order.d.ts +10 -0
  136. package/dist/lib/transforms/base-transform.d.ts +8 -0
  137. package/dist/lib/transforms/collapse-expand-combo.d.ts +11 -0
  138. package/dist/lib/transforms/collapse-expand-node.d.ts +12 -0
  139. package/dist/lib/transforms/get-edge-actual-ends.d.ts +13 -0
  140. package/dist/lib/transforms/index.d.ts +8 -0
  141. package/dist/lib/transforms/process-parallel-edges.d.ts +85 -0
  142. package/dist/lib/transforms/types.d.ts +20 -0
  143. package/dist/lib/transforms/update-related-edge.d.ts +10 -0
  144. package/dist/lib/transforms/utils.d.ts +13 -0
  145. package/dist/lib/types/anchor.d.ts +3 -0
  146. package/dist/lib/types/animation.d.ts +5 -0
  147. package/dist/lib/types/callable.d.ts +30 -0
  148. package/dist/lib/types/canvas.d.ts +1 -0
  149. package/dist/lib/types/change.d.ts +68 -0
  150. package/dist/lib/types/combo.d.ts +23 -0
  151. package/dist/lib/types/data.d.ts +44 -0
  152. package/dist/lib/types/edge.d.ts +98 -0
  153. package/dist/lib/types/element.d.ts +18 -0
  154. package/dist/lib/types/enum.d.ts +1 -0
  155. package/dist/lib/types/event.d.ts +55 -0
  156. package/dist/lib/types/graphlib.d.ts +16 -0
  157. package/dist/lib/types/history.d.ts +51 -0
  158. package/dist/lib/types/id.d.ts +1 -0
  159. package/dist/lib/types/index.d.ts +26 -0
  160. package/dist/lib/types/layout.d.ts +9 -0
  161. package/dist/lib/types/node.d.ts +144 -0
  162. package/dist/lib/types/padding.d.ts +2 -0
  163. package/dist/lib/types/placement.d.ts +5 -0
  164. package/dist/lib/types/plugin.d.ts +5 -0
  165. package/dist/lib/types/point.d.ts +2 -0
  166. package/dist/lib/types/position.d.ts +2 -0
  167. package/dist/lib/types/prefix.d.ts +17 -0
  168. package/dist/lib/types/size.d.ts +3 -0
  169. package/dist/lib/types/state.d.ts +1 -0
  170. package/dist/lib/types/style.d.ts +9 -0
  171. package/dist/lib/types/tree.d.ts +5 -0
  172. package/dist/lib/types/vector.d.ts +2 -0
  173. package/dist/lib/types/viewport.d.ts +36 -0
  174. package/dist/lib/utils/anchor.d.ts +9 -0
  175. package/dist/lib/utils/animation.d.ts +47 -0
  176. package/dist/lib/utils/array.d.ts +9 -0
  177. package/dist/lib/utils/bbox.d.ts +108 -0
  178. package/dist/lib/utils/cache.d.ts +36 -0
  179. package/dist/lib/utils/change.d.ts +17 -0
  180. package/dist/lib/utils/collapsibility.d.ts +9 -0
  181. package/dist/lib/utils/data.d.ts +34 -0
  182. package/dist/lib/utils/diff.d.ts +15 -0
  183. package/dist/lib/utils/dom.d.ts +29 -0
  184. package/dist/lib/utils/edge.d.ts +171 -0
  185. package/dist/lib/utils/element.d.ts +231 -0
  186. package/dist/lib/utils/event/events.d.ts +26 -0
  187. package/dist/lib/utils/event/index.d.ts +29 -0
  188. package/dist/lib/utils/extension.d.ts +10 -0
  189. package/dist/lib/utils/graphlib.d.ts +14 -0
  190. package/dist/lib/utils/id.d.ts +20 -0
  191. package/dist/lib/utils/is.d.ts +34 -0
  192. package/dist/lib/utils/layout.d.ts +70 -0
  193. package/dist/lib/utils/line.d.ts +21 -0
  194. package/dist/lib/utils/math.d.ts +10 -0
  195. package/dist/lib/utils/padding.d.ts +9 -0
  196. package/dist/lib/utils/palette.d.ts +32 -0
  197. package/dist/lib/utils/path.d.ts +35 -0
  198. package/dist/lib/utils/placement.d.ts +9 -0
  199. package/dist/lib/utils/point.d.ts +192 -0
  200. package/dist/lib/utils/polygon.d.ts +17 -0
  201. package/dist/lib/utils/position.d.ts +50 -0
  202. package/dist/lib/utils/prefix.d.ts +66 -0
  203. package/dist/lib/utils/relation.d.ts +33 -0
  204. package/dist/lib/utils/router/orth.d.ts +103 -0
  205. package/dist/lib/utils/shape.d.ts +9 -0
  206. package/dist/lib/utils/shortcut.d.ts +31 -0
  207. package/dist/lib/utils/size.d.ts +7 -0
  208. package/dist/lib/utils/style.d.ts +30 -0
  209. package/dist/lib/utils/symbol.d.ts +30 -0
  210. package/dist/lib/utils/text.d.ts +26 -0
  211. package/dist/lib/utils/theme.d.ts +9 -0
  212. package/dist/lib/utils/transform.d.ts +24 -0
  213. package/dist/lib/utils/traverse.d.ts +23 -0
  214. package/dist/lib/utils/tree.d.ts +17 -0
  215. package/dist/lib/utils/vector.d.ts +143 -0
  216. package/dist/lib/utils/visibility.d.ts +13 -0
  217. package/esm/animations/executor.d.ts +11 -0
  218. package/esm/animations/executor.js +70 -0
  219. package/esm/animations/executor.js.map +1 -0
  220. package/esm/animations/index.d.ts +32 -0
  221. package/esm/animations/index.js +15 -0
  222. package/esm/animations/index.js.map +1 -0
  223. package/esm/animations/types.d.ts +113 -0
  224. package/esm/animations/types.js.map +1 -0
  225. package/esm/behaviors/base-behavior.d.ts +6 -0
  226. package/esm/behaviors/base-behavior.js +4 -0
  227. package/esm/behaviors/base-behavior.js.map +1 -0
  228. package/esm/behaviors/brush-select.d.ts +189 -0
  229. package/esm/behaviors/brush-select.js +273 -0
  230. package/esm/behaviors/brush-select.js.map +1 -0
  231. package/esm/behaviors/click-select.d.ts +116 -0
  232. package/esm/behaviors/click-select.js +133 -0
  233. package/esm/behaviors/click-select.js.map +1 -0
  234. package/esm/behaviors/collapse-expand.d.ts +64 -0
  235. package/esm/behaviors/collapse-expand.js +76 -0
  236. package/esm/behaviors/collapse-expand.js.map +1 -0
  237. package/esm/behaviors/create-edge.d.ts +75 -0
  238. package/esm/behaviors/create-edge.js +155 -0
  239. package/esm/behaviors/create-edge.js.map +1 -0
  240. package/esm/behaviors/drag-canvas.d.ts +83 -0
  241. package/esm/behaviors/drag-canvas.js +97 -0
  242. package/esm/behaviors/drag-canvas.js.map +1 -0
  243. package/esm/behaviors/drag-element-force.d.ts +53 -0
  244. package/esm/behaviors/drag-element-force.js +94 -0
  245. package/esm/behaviors/drag-element-force.js.map +1 -0
  246. package/esm/behaviors/drag-element.d.ts +182 -0
  247. package/esm/behaviors/drag-element.js +283 -0
  248. package/esm/behaviors/drag-element.js.map +1 -0
  249. package/esm/behaviors/focus-element.d.ts +42 -0
  250. package/esm/behaviors/focus-element.js +58 -0
  251. package/esm/behaviors/focus-element.js.map +1 -0
  252. package/esm/behaviors/hover-activate.d.ts +84 -0
  253. package/esm/behaviors/hover-activate.js +104 -0
  254. package/esm/behaviors/hover-activate.js.map +1 -0
  255. package/esm/behaviors/index.d.ts +26 -0
  256. package/esm/behaviors/index.js +14 -0
  257. package/esm/behaviors/index.js.map +1 -0
  258. package/esm/behaviors/lasso-select.d.ts +41 -0
  259. package/esm/behaviors/lasso-select.js +66 -0
  260. package/esm/behaviors/lasso-select.js.map +1 -0
  261. package/esm/behaviors/scroll-canvas.d.ts +85 -0
  262. package/esm/behaviors/scroll-canvas.js +100 -0
  263. package/esm/behaviors/scroll-canvas.js.map +1 -0
  264. package/esm/behaviors/types.d.ts +6 -0
  265. package/esm/behaviors/types.js.map +1 -0
  266. package/esm/behaviors/zoom-canvas.d.ts +98 -0
  267. package/esm/behaviors/zoom-canvas.js +110 -0
  268. package/esm/behaviors/zoom-canvas.js.map +1 -0
  269. package/esm/constants/animation.d.ts +3 -0
  270. package/esm/constants/animation.js +10 -0
  271. package/esm/constants/animation.js.map +1 -0
  272. package/esm/constants/change.d.ts +64 -0
  273. package/esm/constants/change.js +66 -0
  274. package/esm/constants/change.js.map +1 -0
  275. package/esm/constants/element.d.ts +7 -0
  276. package/esm/constants/element.js +8 -0
  277. package/esm/constants/element.js.map +1 -0
  278. package/esm/constants/events/animation.d.ts +6 -0
  279. package/esm/constants/events/animation.js +8 -0
  280. package/esm/constants/events/animation.js.map +1 -0
  281. package/esm/constants/events/canvas.d.ts +115 -0
  282. package/esm/constants/events/canvas.js +117 -0
  283. package/esm/constants/events/canvas.js.map +1 -0
  284. package/esm/constants/events/combo.d.ts +109 -0
  285. package/esm/constants/events/combo.js +111 -0
  286. package/esm/constants/events/combo.js.map +1 -0
  287. package/esm/constants/events/common.d.ts +122 -0
  288. package/esm/constants/events/common.js +124 -0
  289. package/esm/constants/events/common.js.map +1 -0
  290. package/esm/constants/events/container.d.ts +14 -0
  291. package/esm/constants/events/container.js +16 -0
  292. package/esm/constants/events/container.js.map +1 -0
  293. package/esm/constants/events/edge.d.ts +91 -0
  294. package/esm/constants/events/edge.js +93 -0
  295. package/esm/constants/events/edge.js.map +1 -0
  296. package/esm/constants/events/graph.d.ts +158 -0
  297. package/esm/constants/events/graph.js +160 -0
  298. package/esm/constants/events/graph.js.map +1 -0
  299. package/esm/constants/events/history.d.ts +38 -0
  300. package/esm/constants/events/history.js +40 -0
  301. package/esm/constants/events/history.js.map +1 -0
  302. package/esm/constants/events/index.d.ts +9 -0
  303. package/esm/constants/events/index.js +10 -0
  304. package/esm/constants/events/index.js.map +1 -0
  305. package/esm/constants/events/node.d.ts +109 -0
  306. package/esm/constants/events/node.js +111 -0
  307. package/esm/constants/events/node.js.map +1 -0
  308. package/esm/constants/graphlib.d.ts +2 -0
  309. package/esm/constants/graphlib.js +3 -0
  310. package/esm/constants/graphlib.js.map +1 -0
  311. package/esm/constants/index.d.ts +5 -0
  312. package/esm/constants/index.js +6 -0
  313. package/esm/constants/index.js.map +1 -0
  314. package/esm/constants/registry.d.ts +62 -0
  315. package/esm/constants/registry.js +64 -0
  316. package/esm/constants/registry.js.map +1 -0
  317. package/esm/elements/base-element.d.ts +35 -0
  318. package/esm/elements/base-element.js +42 -0
  319. package/esm/elements/base-element.js.map +1 -0
  320. package/esm/elements/combos/base-combo.d.ts +91 -0
  321. package/esm/elements/combos/base-combo.js +162 -0
  322. package/esm/elements/combos/base-combo.js.map +1 -0
  323. package/esm/elements/combos/circle.d.ts +25 -0
  324. package/esm/elements/combos/circle.js +45 -0
  325. package/esm/elements/combos/circle.js.map +1 -0
  326. package/esm/elements/combos/index.d.ts +6 -0
  327. package/esm/elements/combos/index.js +4 -0
  328. package/esm/elements/combos/index.js.map +1 -0
  329. package/esm/elements/combos/rect.d.ts +21 -0
  330. package/esm/elements/combos/rect.js +29 -0
  331. package/esm/elements/combos/rect.js.map +1 -0
  332. package/esm/elements/edges/base-edge.d.ts +155 -0
  333. package/esm/elements/edges/base-edge.js +195 -0
  334. package/esm/elements/edges/base-edge.js.map +1 -0
  335. package/esm/elements/edges/cubic-horizontal.d.ts +39 -0
  336. package/esm/elements/edges/cubic-horizontal.js +28 -0
  337. package/esm/elements/edges/cubic-horizontal.js.map +1 -0
  338. package/esm/elements/edges/cubic-vertical.d.ts +39 -0
  339. package/esm/elements/edges/cubic-vertical.js +28 -0
  340. package/esm/elements/edges/cubic-vertical.js.map +1 -0
  341. package/esm/elements/edges/cubic.d.ts +48 -0
  342. package/esm/elements/edges/cubic.js +35 -0
  343. package/esm/elements/edges/cubic.js.map +1 -0
  344. package/esm/elements/edges/index.d.ts +14 -0
  345. package/esm/elements/edges/index.js +8 -0
  346. package/esm/elements/edges/index.js.map +1 -0
  347. package/esm/elements/edges/line.d.ts +25 -0
  348. package/esm/elements/edges/line.js +23 -0
  349. package/esm/elements/edges/line.js.map +1 -0
  350. package/esm/elements/edges/polyline.d.ts +63 -0
  351. package/esm/elements/edges/polyline.js +67 -0
  352. package/esm/elements/edges/polyline.js.map +1 -0
  353. package/esm/elements/edges/quadratic.d.ts +44 -0
  354. package/esm/elements/edges/quadratic.js +24 -0
  355. package/esm/elements/edges/quadratic.js.map +1 -0
  356. package/esm/elements/index.d.ts +3 -0
  357. package/esm/elements/index.js +4 -0
  358. package/esm/elements/index.js.map +1 -0
  359. package/esm/elements/nodes/base-node.d.ts +193 -0
  360. package/esm/elements/nodes/base-node.js +217 -0
  361. package/esm/elements/nodes/base-node.js.map +1 -0
  362. package/esm/elements/nodes/circle.d.ts +26 -0
  363. package/esm/elements/nodes/circle.js +36 -0
  364. package/esm/elements/nodes/circle.js.map +1 -0
  365. package/esm/elements/nodes/diamond.d.ts +21 -0
  366. package/esm/elements/nodes/diamond.js +23 -0
  367. package/esm/elements/nodes/diamond.js.map +1 -0
  368. package/esm/elements/nodes/donut.d.ts +45 -0
  369. package/esm/elements/nodes/donut.js +95 -0
  370. package/esm/elements/nodes/donut.js.map +1 -0
  371. package/esm/elements/nodes/ellipse.d.ts +26 -0
  372. package/esm/elements/nodes/ellipse.js +41 -0
  373. package/esm/elements/nodes/ellipse.js.map +1 -0
  374. package/esm/elements/nodes/hexagon.d.ts +28 -0
  375. package/esm/elements/nodes/hexagon.js +25 -0
  376. package/esm/elements/nodes/hexagon.js.map +1 -0
  377. package/esm/elements/nodes/html.d.ts +41 -0
  378. package/esm/elements/nodes/html.js +222 -0
  379. package/esm/elements/nodes/html.js.map +1 -0
  380. package/esm/elements/nodes/image.d.ts +38 -0
  381. package/esm/elements/nodes/image.js +59 -0
  382. package/esm/elements/nodes/image.js.map +1 -0
  383. package/esm/elements/nodes/index.d.ts +22 -0
  384. package/esm/elements/nodes/index.js +12 -0
  385. package/esm/elements/nodes/index.js.map +1 -0
  386. package/esm/elements/nodes/rect.d.ts +26 -0
  387. package/esm/elements/nodes/rect.js +42 -0
  388. package/esm/elements/nodes/rect.js.map +1 -0
  389. package/esm/elements/nodes/star.d.ts +30 -0
  390. package/esm/elements/nodes/star.js +34 -0
  391. package/esm/elements/nodes/star.js.map +1 -0
  392. package/esm/elements/nodes/triangle.d.ts +31 -0
  393. package/esm/elements/nodes/triangle.js +53 -0
  394. package/esm/elements/nodes/triangle.js.map +1 -0
  395. package/esm/elements/shapes/badge.d.ts +14 -0
  396. package/esm/elements/shapes/badge.js +22 -0
  397. package/esm/elements/shapes/badge.js.map +1 -0
  398. package/esm/elements/shapes/base-shape.d.ts +63 -0
  399. package/esm/elements/shapes/base-shape.js +160 -0
  400. package/esm/elements/shapes/base-shape.js.map +1 -0
  401. package/esm/elements/shapes/contour.d.ts +66 -0
  402. package/esm/elements/shapes/contour.js +36 -0
  403. package/esm/elements/shapes/contour.js.map +1 -0
  404. package/esm/elements/shapes/icon.d.ts +13 -0
  405. package/esm/elements/shapes/icon.js +31 -0
  406. package/esm/elements/shapes/icon.js.map +1 -0
  407. package/esm/elements/shapes/index.d.ts +16 -0
  408. package/esm/elements/shapes/index.js +11 -0
  409. package/esm/elements/shapes/index.js.map +1 -0
  410. package/esm/elements/shapes/label.d.ts +31 -0
  411. package/esm/elements/shapes/label.js +61 -0
  412. package/esm/elements/shapes/label.js.map +1 -0
  413. package/esm/elements/shapes/polygon.d.ts +30 -0
  414. package/esm/elements/shapes/polygon.js +27 -0
  415. package/esm/elements/shapes/polygon.js.map +1 -0
  416. package/esm/exports.d.ts +40 -0
  417. package/esm/exports.js +18 -0
  418. package/esm/exports.js.map +1 -0
  419. package/esm/index.d.ts +3 -249
  420. package/esm/index.js +3 -18
  421. package/esm/index.js.map +1 -1
  422. package/esm/layouts/base-layout.d.ts +10 -0
  423. package/esm/layouts/base-layout.js +9 -0
  424. package/esm/layouts/base-layout.js.map +1 -0
  425. package/esm/layouts/index.d.ts +4 -0
  426. package/esm/layouts/index.js +4 -0
  427. package/esm/layouts/index.js.map +1 -0
  428. package/esm/layouts/types.d.ts +84 -0
  429. package/esm/layouts/types.js.map +1 -0
  430. package/esm/palettes/index.d.ts +10 -0
  431. package/esm/palettes/index.js +64 -0
  432. package/esm/palettes/index.js.map +1 -0
  433. package/esm/palettes/types.d.ts +5 -0
  434. package/esm/palettes/types.js +2 -0
  435. package/esm/palettes/types.js.map +1 -0
  436. package/esm/plugins/background/index.d.ts +38 -0
  437. package/esm/plugins/background/index.js +48 -0
  438. package/esm/plugins/background/index.js.map +1 -0
  439. package/esm/plugins/base-plugin.d.ts +6 -0
  440. package/esm/plugins/base-plugin.js +4 -0
  441. package/esm/plugins/base-plugin.js.map +1 -0
  442. package/esm/plugins/bubble-sets.d.ts +116 -0
  443. package/esm/plugins/bubble-sets.js +279 -0
  444. package/esm/plugins/bubble-sets.js.map +1 -0
  445. package/esm/plugins/camera-setting.d.ts +111 -0
  446. package/esm/plugins/camera-setting.js +72 -0
  447. package/esm/plugins/camera-setting.js.map +1 -0
  448. package/esm/plugins/contextmenu/index.d.ts +115 -0
  449. package/esm/plugins/contextmenu/index.js +132 -0
  450. package/esm/plugins/contextmenu/index.js.map +1 -0
  451. package/esm/plugins/contextmenu/util.d.ts +26 -0
  452. package/esm/plugins/contextmenu/util.js +45 -0
  453. package/esm/plugins/contextmenu/util.js.map +1 -0
  454. package/esm/plugins/grid-line.d.ts +106 -0
  455. package/esm/plugins/grid-line.js +78 -0
  456. package/esm/plugins/grid-line.js.map +1 -0
  457. package/esm/plugins/history/index.d.ts +120 -0
  458. package/esm/plugins/history/index.js +195 -0
  459. package/esm/plugins/history/index.js.map +1 -0
  460. package/esm/plugins/history/util.d.ts +21 -0
  461. package/esm/plugins/history/util.js +83 -0
  462. package/esm/plugins/history/util.js.map +1 -0
  463. package/esm/plugins/hull/index.d.ts +114 -0
  464. package/esm/plugins/hull/index.js +158 -0
  465. package/esm/plugins/hull/index.js.map +1 -0
  466. package/esm/plugins/hull/util.d.ts +12 -0
  467. package/esm/plugins/hull/util.js +203 -0
  468. package/esm/plugins/hull/util.js.map +1 -0
  469. package/esm/plugins/index.d.ts +26 -0
  470. package/esm/plugins/index.js +14 -0
  471. package/esm/plugins/index.js.map +1 -0
  472. package/esm/plugins/legend.d.ts +129 -0
  473. package/esm/plugins/legend.js +318 -0
  474. package/esm/plugins/legend.js.map +1 -0
  475. package/esm/plugins/timebar.d.ts +234 -0
  476. package/esm/plugins/timebar.js +261 -0
  477. package/esm/plugins/timebar.js.map +1 -0
  478. package/esm/plugins/toolbar/index.d.ts +69 -0
  479. package/esm/plugins/toolbar/index.js +71 -0
  480. package/esm/plugins/toolbar/index.js.map +1 -0
  481. package/esm/plugins/toolbar/util.d.ts +33 -0
  482. package/esm/plugins/toolbar/util.js +89 -0
  483. package/esm/plugins/toolbar/util.js.map +1 -0
  484. package/esm/plugins/tooltip.d.ts +116 -0
  485. package/esm/plugins/tooltip.js +294 -0
  486. package/esm/plugins/tooltip.js.map +1 -0
  487. package/esm/plugins/types.d.ts +4 -0
  488. package/esm/plugins/types.js +2 -0
  489. package/esm/plugins/types.js.map +1 -0
  490. package/esm/plugins/watermark/index.d.ts +191 -0
  491. package/esm/plugins/watermark/index.js +67 -0
  492. package/esm/plugins/watermark/index.js.map +1 -0
  493. package/esm/plugins/watermark/util.d.ts +18 -0
  494. package/esm/plugins/watermark/util.js +73 -0
  495. package/esm/plugins/watermark/util.js.map +1 -0
  496. package/esm/preset.d.ts +1 -0
  497. package/esm/preset.js +5 -0
  498. package/esm/preset.js.map +1 -0
  499. package/esm/registry/build-in.d.ts +6 -0
  500. package/esm/registry/build-in.js +114 -0
  501. package/esm/registry/build-in.js.map +1 -0
  502. package/esm/registry/extension/index.d.ts +33 -0
  503. package/esm/registry/extension/index.js +84 -0
  504. package/esm/registry/extension/index.js.map +1 -0
  505. package/esm/registry/extension/types.d.ts +38 -0
  506. package/esm/registry/extension/types.js +2 -0
  507. package/esm/registry/extension/types.js.map +1 -0
  508. package/esm/registry/index.d.ts +59 -0
  509. package/esm/registry/index.js +97 -0
  510. package/esm/registry/index.js.map +1 -0
  511. package/esm/registry/types.d.ts +39 -0
  512. package/esm/registry/types.js +2 -0
  513. package/esm/registry/types.js.map +1 -0
  514. package/esm/runtime/animation.d.ts +54 -0
  515. package/esm/runtime/animation.js +139 -0
  516. package/esm/runtime/animation.js.map +1 -0
  517. package/esm/runtime/batch.d.ts +11 -0
  518. package/esm/runtime/batch.js +31 -0
  519. package/esm/runtime/batch.js.map +1 -0
  520. package/esm/runtime/behavior.d.ts +19 -0
  521. package/esm/runtime/behavior.js +111 -0
  522. package/esm/runtime/behavior.js.map +1 -0
  523. package/esm/runtime/canvas.d.ts +60 -0
  524. package/esm/runtime/canvas.js +257 -0
  525. package/esm/runtime/canvas.js.map +1 -0
  526. package/esm/runtime/data.d.ts +202 -0
  527. package/esm/runtime/data.js +694 -0
  528. package/esm/runtime/data.js.map +1 -0
  529. package/esm/runtime/element.d.ts +102 -0
  530. package/esm/runtime/element.js +553 -0
  531. package/esm/runtime/element.js.map +1 -0
  532. package/esm/runtime/graph.d.ts +828 -458
  533. package/esm/runtime/graph.js +1034 -1465
  534. package/esm/runtime/graph.js.map +1 -1
  535. package/esm/runtime/layout.d.ts +38 -0
  536. package/esm/runtime/layout.js +236 -0
  537. package/esm/runtime/layout.js.map +1 -0
  538. package/esm/runtime/plugin.d.ts +10 -0
  539. package/esm/runtime/plugin.js +15 -0
  540. package/esm/runtime/plugin.js.map +1 -0
  541. package/esm/runtime/transform.d.ts +12 -0
  542. package/esm/runtime/transform.js +27 -0
  543. package/esm/runtime/transform.js.map +1 -0
  544. package/esm/runtime/types.d.ts +90 -0
  545. package/esm/runtime/types.js +2 -0
  546. package/esm/runtime/types.js.map +1 -0
  547. package/esm/runtime/viewport.d.ts +58 -0
  548. package/esm/runtime/viewport.js +241 -0
  549. package/esm/runtime/viewport.js.map +1 -0
  550. package/esm/spec/behavior.d.ts +30 -0
  551. package/esm/spec/behavior.js +2 -0
  552. package/esm/spec/behavior.js.map +1 -0
  553. package/esm/spec/canvas.d.ts +53 -0
  554. package/esm/spec/canvas.js +2 -0
  555. package/esm/spec/canvas.js.map +1 -0
  556. package/esm/spec/data.d.ts +222 -0
  557. package/esm/spec/data.js +2 -0
  558. package/esm/spec/data.js.map +1 -0
  559. package/esm/spec/element/animation.d.ts +6 -0
  560. package/esm/spec/element/animation.js +2 -0
  561. package/esm/spec/element/animation.js.map +1 -0
  562. package/esm/spec/element/combo.d.ts +52 -0
  563. package/esm/spec/element/combo.js +2 -0
  564. package/esm/spec/element/combo.js.map +1 -0
  565. package/esm/spec/element/edge.d.ts +52 -0
  566. package/esm/spec/element/edge.js +2 -0
  567. package/esm/spec/element/edge.js.map +1 -0
  568. package/esm/spec/element/node.d.ts +52 -0
  569. package/esm/spec/element/node.js +2 -0
  570. package/esm/spec/element/node.js.map +1 -0
  571. package/esm/spec/element/palette.d.ts +53 -0
  572. package/esm/spec/element/palette.js +2 -0
  573. package/esm/spec/element/palette.js.map +1 -0
  574. package/esm/spec/graph.d.ts +91 -0
  575. package/esm/spec/graph.js.map +1 -0
  576. package/esm/spec/index.d.ts +12 -0
  577. package/esm/spec/index.js +2 -0
  578. package/esm/spec/index.js.map +1 -0
  579. package/esm/spec/layout.d.ts +4 -0
  580. package/esm/spec/layout.js.map +1 -0
  581. package/esm/spec/plugin.d.ts +32 -0
  582. package/esm/spec/plugin.js +2 -0
  583. package/esm/spec/plugin.js.map +1 -0
  584. package/esm/spec/theme.d.ts +7 -0
  585. package/esm/spec/theme.js +2 -0
  586. package/esm/spec/theme.js.map +1 -0
  587. package/esm/spec/transform.d.ts +12 -0
  588. package/esm/spec/transform.js +2 -0
  589. package/esm/spec/transform.js.map +1 -0
  590. package/esm/spec/viewport.d.ts +82 -0
  591. package/esm/spec/viewport.js +2 -0
  592. package/esm/spec/viewport.js.map +1 -0
  593. package/esm/themes/base.d.ts +28 -0
  594. package/esm/themes/base.js +227 -0
  595. package/esm/themes/base.js.map +1 -0
  596. package/esm/themes/dark.d.ts +2 -0
  597. package/esm/themes/dark.js +16 -0
  598. package/esm/themes/dark.js.map +1 -0
  599. package/esm/themes/index.d.ts +2 -0
  600. package/esm/themes/index.js +3 -0
  601. package/esm/themes/index.js.map +1 -0
  602. package/esm/themes/light.d.ts +2 -0
  603. package/esm/themes/light.js +16 -0
  604. package/esm/themes/light.js.map +1 -0
  605. package/esm/themes/types.d.ts +9 -0
  606. package/esm/themes/types.js +2 -0
  607. package/esm/themes/types.js.map +1 -0
  608. package/esm/transforms/arrange-draw-order.d.ts +10 -0
  609. package/esm/transforms/arrange-draw-order.js +32 -0
  610. package/esm/transforms/arrange-draw-order.js.map +1 -0
  611. package/esm/transforms/base-transform.d.ts +8 -0
  612. package/esm/transforms/base-transform.js +7 -0
  613. package/esm/transforms/base-transform.js.map +1 -0
  614. package/esm/transforms/collapse-expand-combo.d.ts +11 -0
  615. package/esm/transforms/collapse-expand-combo.js +75 -0
  616. package/esm/transforms/collapse-expand-combo.js.map +1 -0
  617. package/esm/transforms/collapse-expand-node.d.ts +12 -0
  618. package/esm/transforms/collapse-expand-node.js +91 -0
  619. package/esm/transforms/collapse-expand-node.js.map +1 -0
  620. package/esm/transforms/get-edge-actual-ends.d.ts +13 -0
  621. package/esm/transforms/get-edge-actual-ends.js +36 -0
  622. package/esm/transforms/get-edge-actual-ends.js.map +1 -0
  623. package/esm/transforms/index.d.ts +8 -0
  624. package/esm/transforms/index.js +8 -0
  625. package/esm/transforms/index.js.map +1 -0
  626. package/esm/transforms/process-parallel-edges.d.ts +85 -0
  627. package/esm/transforms/process-parallel-edges.js +228 -0
  628. package/esm/transforms/process-parallel-edges.js.map +1 -0
  629. package/esm/transforms/types.d.ts +20 -0
  630. package/esm/transforms/types.js +2 -0
  631. package/esm/transforms/types.js.map +1 -0
  632. package/esm/transforms/update-related-edge.d.ts +10 -0
  633. package/esm/transforms/update-related-edge.js +23 -0
  634. package/esm/transforms/update-related-edge.js.map +1 -0
  635. package/esm/transforms/utils.d.ts +13 -0
  636. package/esm/transforms/utils.js +25 -0
  637. package/esm/transforms/utils.js.map +1 -0
  638. package/esm/types/anchor.d.ts +3 -0
  639. package/esm/types/anchor.js +2 -0
  640. package/esm/types/anchor.js.map +1 -0
  641. package/esm/types/animation.d.ts +5 -0
  642. package/esm/types/animation.js +2 -0
  643. package/esm/types/animation.js.map +1 -0
  644. package/esm/types/callable.d.ts +30 -0
  645. package/esm/types/callable.js +2 -0
  646. package/esm/types/callable.js.map +1 -0
  647. package/esm/types/canvas.d.ts +1 -0
  648. package/esm/types/canvas.js +2 -0
  649. package/esm/types/canvas.js.map +1 -0
  650. package/esm/types/change.d.ts +68 -0
  651. package/esm/types/change.js +2 -0
  652. package/esm/types/change.js.map +1 -0
  653. package/esm/types/combo.d.ts +20 -132
  654. package/esm/types/data.d.ts +44 -27
  655. package/esm/types/edge.d.ts +82 -98
  656. package/esm/types/element.d.ts +18 -0
  657. package/esm/types/element.js +2 -0
  658. package/esm/types/element.js.map +1 -0
  659. package/esm/types/enum.d.ts +1 -0
  660. package/esm/types/enum.js +2 -0
  661. package/esm/types/enum.js.map +1 -0
  662. package/esm/types/event.d.ts +54 -38
  663. package/esm/types/event.js +1 -30
  664. package/esm/types/event.js.map +1 -1
  665. package/esm/types/graphlib.d.ts +16 -0
  666. package/esm/types/graphlib.js +2 -0
  667. package/esm/types/graphlib.js.map +1 -0
  668. package/esm/types/history.d.ts +49 -26
  669. package/esm/types/history.js +1 -5
  670. package/esm/types/history.js.map +1 -1
  671. package/esm/types/id.d.ts +1 -0
  672. package/esm/types/id.js +2 -0
  673. package/esm/types/id.js.map +1 -0
  674. package/esm/types/index.d.ts +26 -16
  675. package/esm/types/index.js +1 -1
  676. package/esm/types/index.js.map +1 -1
  677. package/esm/types/layout.d.ts +8 -71
  678. package/esm/types/layout.js +1 -19
  679. package/esm/types/layout.js.map +1 -1
  680. package/esm/types/node.d.ts +132 -203
  681. package/esm/types/padding.d.ts +2 -0
  682. package/esm/types/padding.js +2 -0
  683. package/esm/types/padding.js.map +1 -0
  684. package/esm/types/placement.d.ts +5 -0
  685. package/esm/types/placement.js +2 -0
  686. package/esm/types/placement.js.map +1 -0
  687. package/esm/types/plugin.d.ts +5 -44
  688. package/esm/types/plugin.js +1 -52
  689. package/esm/types/plugin.js.map +1 -1
  690. package/esm/types/point.d.ts +2 -0
  691. package/esm/types/point.js +2 -0
  692. package/esm/types/point.js.map +1 -0
  693. package/esm/types/position.d.ts +2 -0
  694. package/esm/types/position.js +2 -0
  695. package/esm/types/position.js.map +1 -0
  696. package/esm/types/prefix.d.ts +17 -0
  697. package/esm/types/prefix.js +2 -0
  698. package/esm/types/prefix.js.map +1 -0
  699. package/esm/types/size.d.ts +3 -0
  700. package/esm/types/size.js +2 -0
  701. package/esm/types/size.js.map +1 -0
  702. package/esm/types/state.d.ts +1 -0
  703. package/esm/types/state.js +2 -0
  704. package/esm/types/state.js.map +1 -0
  705. package/esm/types/style.d.ts +9 -0
  706. package/esm/types/style.js +2 -0
  707. package/esm/types/style.js.map +1 -0
  708. package/esm/types/tree.d.ts +5 -0
  709. package/esm/types/tree.js +2 -0
  710. package/esm/types/tree.js.map +1 -0
  711. package/esm/types/vector.d.ts +2 -0
  712. package/esm/types/vector.js +2 -0
  713. package/esm/types/vector.js.map +1 -0
  714. package/esm/types/viewport.d.ts +36 -0
  715. package/esm/types/viewport.js +2 -0
  716. package/esm/types/viewport.js.map +1 -0
  717. package/esm/utils/anchor.d.ts +9 -0
  718. package/esm/utils/anchor.js +16 -0
  719. package/esm/utils/anchor.js.map +1 -0
  720. package/esm/utils/animation.d.ts +47 -0
  721. package/esm/utils/animation.js +189 -0
  722. package/esm/utils/animation.js.map +1 -0
  723. package/esm/utils/array.d.ts +9 -0
  724. package/esm/utils/array.js +16 -0
  725. package/esm/utils/array.js.map +1 -0
  726. package/esm/utils/bbox.d.ts +108 -0
  727. package/esm/utils/bbox.js +206 -0
  728. package/esm/utils/bbox.js.map +1 -0
  729. package/esm/utils/cache.d.ts +36 -0
  730. package/esm/utils/cache.js +52 -0
  731. package/esm/utils/cache.js.map +1 -0
  732. package/esm/utils/change.d.ts +17 -0
  733. package/esm/utils/change.js +91 -0
  734. package/esm/utils/change.js.map +1 -0
  735. package/esm/utils/collapsibility.d.ts +9 -0
  736. package/esm/utils/collapsibility.js +11 -0
  737. package/esm/utils/collapsibility.js.map +1 -0
  738. package/esm/utils/data.d.ts +34 -0
  739. package/esm/utils/data.js +59 -0
  740. package/esm/utils/data.js.map +1 -0
  741. package/esm/utils/diff.d.ts +15 -0
  742. package/esm/utils/diff.js +40 -0
  743. package/esm/utils/diff.js.map +1 -0
  744. package/esm/utils/dom.d.ts +29 -0
  745. package/esm/utils/dom.js +92 -0
  746. package/esm/utils/dom.js.map +1 -0
  747. package/esm/utils/edge.d.ts +171 -0
  748. package/esm/utils/edge.js +483 -0
  749. package/esm/utils/edge.js.map +1 -0
  750. package/esm/utils/element.d.ts +231 -0
  751. package/esm/utils/element.js +463 -0
  752. package/esm/utils/element.js.map +1 -0
  753. package/esm/utils/event/events.d.ts +26 -0
  754. package/esm/utils/event/events.js +41 -0
  755. package/esm/utils/event/events.js.map +1 -0
  756. package/esm/utils/event/index.d.ts +29 -0
  757. package/esm/utils/event/index.js +45 -0
  758. package/esm/utils/event/index.js.map +1 -0
  759. package/esm/utils/extension.d.ts +10 -0
  760. package/esm/utils/extension.js +25 -0
  761. package/esm/utils/extension.js.map +1 -0
  762. package/esm/utils/graphlib.d.ts +14 -0
  763. package/esm/utils/graphlib.js +44 -0
  764. package/esm/utils/graphlib.js.map +1 -0
  765. package/esm/utils/id.d.ts +20 -0
  766. package/esm/utils/id.js +41 -0
  767. package/esm/utils/id.js.map +1 -0
  768. package/esm/utils/is.d.ts +34 -0
  769. package/esm/utils/is.js +48 -0
  770. package/esm/utils/is.js.map +1 -0
  771. package/esm/utils/layout.d.ts +70 -0
  772. package/esm/utils/layout.js +204 -0
  773. package/esm/utils/layout.js.map +1 -0
  774. package/esm/utils/line.d.ts +21 -0
  775. package/esm/utils/line.js +41 -0
  776. package/esm/utils/line.js.map +1 -0
  777. package/esm/utils/math.d.ts +10 -0
  778. package/esm/utils/math.js +13 -0
  779. package/esm/utils/math.js.map +1 -0
  780. package/esm/utils/padding.d.ts +9 -0
  781. package/esm/utils/padding.js +15 -0
  782. package/esm/utils/padding.js.map +1 -0
  783. package/esm/utils/palette.d.ts +32 -0
  784. package/esm/utils/palette.js +111 -0
  785. package/esm/utils/palette.js.map +1 -0
  786. package/esm/utils/path.d.ts +35 -0
  787. package/esm/utils/path.js +143 -0
  788. package/esm/utils/path.js.map +1 -0
  789. package/esm/utils/placement.d.ts +9 -0
  790. package/esm/utils/placement.js +18 -0
  791. package/esm/utils/placement.js.map +1 -0
  792. package/esm/utils/point.d.ts +192 -0
  793. package/esm/utils/point.js +342 -0
  794. package/esm/utils/point.js.map +1 -0
  795. package/esm/utils/polygon.d.ts +17 -0
  796. package/esm/utils/polygon.js +59 -0
  797. package/esm/utils/polygon.js.map +1 -0
  798. package/esm/utils/position.d.ts +50 -0
  799. package/esm/utils/position.js +67 -0
  800. package/esm/utils/position.js.map +1 -0
  801. package/esm/utils/prefix.d.ts +66 -0
  802. package/esm/utils/prefix.js +131 -0
  803. package/esm/utils/prefix.js.map +1 -0
  804. package/esm/utils/relation.d.ts +33 -0
  805. package/esm/utils/relation.js +72 -0
  806. package/esm/utils/relation.js.map +1 -0
  807. package/esm/utils/router/orth.d.ts +103 -0
  808. package/esm/utils/router/orth.js +280 -0
  809. package/esm/utils/router/orth.js.map +1 -0
  810. package/esm/utils/shape.d.ts +9 -0
  811. package/esm/utils/shape.js +22 -0
  812. package/esm/utils/shape.js.map +1 -0
  813. package/esm/utils/shortcut.d.ts +31 -0
  814. package/esm/utils/shortcut.js +88 -0
  815. package/esm/utils/shortcut.js.map +1 -0
  816. package/esm/utils/size.d.ts +7 -0
  817. package/esm/utils/size.js +12 -0
  818. package/esm/utils/size.js.map +1 -0
  819. package/esm/utils/style.d.ts +30 -0
  820. package/esm/utils/style.js +46 -0
  821. package/esm/utils/style.js.map +1 -0
  822. package/esm/utils/symbol.d.ts +30 -0
  823. package/esm/utils/symbol.js +73 -0
  824. package/esm/utils/symbol.js.map +1 -0
  825. package/esm/utils/text.d.ts +26 -0
  826. package/esm/utils/text.js +44 -0
  827. package/esm/utils/text.js.map +1 -0
  828. package/esm/utils/theme.d.ts +9 -0
  829. package/esm/utils/theme.js +17 -0
  830. package/esm/utils/theme.js.map +1 -0
  831. package/esm/utils/transform.d.ts +24 -0
  832. package/esm/utils/transform.js +43 -0
  833. package/esm/utils/transform.js.map +1 -0
  834. package/esm/utils/traverse.d.ts +23 -0
  835. package/esm/utils/traverse.js +44 -0
  836. package/esm/utils/traverse.js.map +1 -0
  837. package/esm/utils/tree.d.ts +17 -0
  838. package/esm/utils/tree.js +28 -0
  839. package/esm/utils/tree.js.map +1 -0
  840. package/esm/utils/vector.d.ts +143 -0
  841. package/esm/utils/vector.js +191 -0
  842. package/esm/utils/vector.js.map +1 -0
  843. package/esm/utils/visibility.d.ts +13 -0
  844. package/esm/utils/visibility.js +28 -0
  845. package/esm/utils/visibility.js.map +1 -0
  846. package/lib/animations/executor.d.ts +11 -0
  847. package/lib/animations/executor.js +74 -0
  848. package/lib/animations/executor.js.map +1 -0
  849. package/lib/animations/index.d.ts +32 -0
  850. package/lib/animations/index.js +19 -0
  851. package/lib/animations/index.js.map +1 -0
  852. package/lib/animations/types.d.ts +113 -0
  853. package/lib/animations/types.js.map +1 -0
  854. package/lib/behaviors/base-behavior.d.ts +6 -0
  855. package/lib/behaviors/base-behavior.js +8 -0
  856. package/lib/behaviors/base-behavior.js.map +1 -0
  857. package/lib/behaviors/brush-select.d.ts +189 -0
  858. package/lib/behaviors/brush-select.js +278 -0
  859. package/lib/behaviors/brush-select.js.map +1 -0
  860. package/lib/behaviors/click-select.d.ts +116 -0
  861. package/lib/behaviors/click-select.js +137 -0
  862. package/lib/behaviors/click-select.js.map +1 -0
  863. package/lib/behaviors/collapse-expand.d.ts +64 -0
  864. package/lib/behaviors/collapse-expand.js +80 -0
  865. package/lib/behaviors/collapse-expand.js.map +1 -0
  866. package/lib/behaviors/create-edge.d.ts +75 -0
  867. package/lib/behaviors/create-edge.js +159 -0
  868. package/lib/behaviors/create-edge.js.map +1 -0
  869. package/lib/behaviors/drag-canvas.d.ts +83 -0
  870. package/lib/behaviors/drag-canvas.js +101 -0
  871. package/lib/behaviors/drag-canvas.js.map +1 -0
  872. package/lib/behaviors/drag-element-force.d.ts +53 -0
  873. package/lib/behaviors/drag-element-force.js +98 -0
  874. package/lib/behaviors/drag-element-force.js.map +1 -0
  875. package/lib/behaviors/drag-element.d.ts +182 -0
  876. package/lib/behaviors/drag-element.js +287 -0
  877. package/lib/behaviors/drag-element.js.map +1 -0
  878. package/lib/behaviors/focus-element.d.ts +42 -0
  879. package/lib/behaviors/focus-element.js +62 -0
  880. package/lib/behaviors/focus-element.js.map +1 -0
  881. package/lib/behaviors/hover-activate.d.ts +84 -0
  882. package/lib/behaviors/hover-activate.js +108 -0
  883. package/lib/behaviors/hover-activate.js.map +1 -0
  884. package/lib/behaviors/index.d.ts +26 -0
  885. package/lib/behaviors/index.js +30 -0
  886. package/lib/behaviors/index.js.map +1 -0
  887. package/lib/behaviors/lasso-select.d.ts +41 -0
  888. package/lib/behaviors/lasso-select.js +70 -0
  889. package/lib/behaviors/lasso-select.js.map +1 -0
  890. package/lib/behaviors/scroll-canvas.d.ts +85 -0
  891. package/lib/behaviors/scroll-canvas.js +104 -0
  892. package/lib/behaviors/scroll-canvas.js.map +1 -0
  893. package/lib/behaviors/types.d.ts +6 -0
  894. package/lib/behaviors/types.js.map +1 -0
  895. package/lib/behaviors/zoom-canvas.d.ts +98 -0
  896. package/lib/behaviors/zoom-canvas.js +114 -0
  897. package/lib/behaviors/zoom-canvas.js.map +1 -0
  898. package/lib/constants/animation.d.ts +3 -0
  899. package/lib/constants/animation.js +13 -0
  900. package/lib/constants/animation.js.map +1 -0
  901. package/lib/constants/change.d.ts +64 -0
  902. package/lib/constants/change.js +69 -0
  903. package/lib/constants/change.js.map +1 -0
  904. package/lib/constants/element.d.ts +7 -0
  905. package/lib/constants/element.js +11 -0
  906. package/lib/constants/element.js.map +1 -0
  907. package/lib/constants/events/animation.d.ts +6 -0
  908. package/lib/constants/events/animation.js +11 -0
  909. package/lib/constants/events/animation.js.map +1 -0
  910. package/lib/constants/events/canvas.d.ts +115 -0
  911. package/lib/constants/events/canvas.js +120 -0
  912. package/lib/constants/events/canvas.js.map +1 -0
  913. package/lib/constants/events/combo.d.ts +109 -0
  914. package/lib/constants/events/combo.js +114 -0
  915. package/lib/constants/events/combo.js.map +1 -0
  916. package/lib/constants/events/common.d.ts +122 -0
  917. package/lib/constants/events/common.js +127 -0
  918. package/lib/constants/events/common.js.map +1 -0
  919. package/lib/constants/events/container.d.ts +14 -0
  920. package/lib/constants/events/container.js +19 -0
  921. package/lib/constants/events/container.js.map +1 -0
  922. package/lib/constants/events/edge.d.ts +91 -0
  923. package/lib/constants/events/edge.js +96 -0
  924. package/lib/constants/events/edge.js.map +1 -0
  925. package/lib/constants/events/graph.d.ts +158 -0
  926. package/lib/constants/events/graph.js +163 -0
  927. package/lib/constants/events/graph.js.map +1 -0
  928. package/lib/constants/events/history.d.ts +38 -0
  929. package/lib/constants/events/history.js +43 -0
  930. package/lib/constants/events/history.js.map +1 -0
  931. package/lib/constants/events/index.d.ts +9 -0
  932. package/lib/constants/events/index.js +22 -0
  933. package/lib/constants/events/index.js.map +1 -0
  934. package/lib/constants/events/node.d.ts +109 -0
  935. package/lib/constants/events/node.js +114 -0
  936. package/lib/constants/events/node.js.map +1 -0
  937. package/lib/constants/graphlib.d.ts +2 -0
  938. package/lib/constants/graphlib.js +6 -0
  939. package/lib/constants/graphlib.js.map +1 -0
  940. package/lib/constants/index.d.ts +5 -0
  941. package/lib/constants/index.js +22 -0
  942. package/lib/constants/index.js.map +1 -0
  943. package/lib/constants/registry.d.ts +62 -0
  944. package/lib/constants/registry.js +67 -0
  945. package/lib/constants/registry.js.map +1 -0
  946. package/lib/elements/base-element.d.ts +35 -0
  947. package/lib/elements/base-element.js +46 -0
  948. package/lib/elements/base-element.js.map +1 -0
  949. package/lib/elements/combos/base-combo.d.ts +91 -0
  950. package/lib/elements/combos/base-combo.js +166 -0
  951. package/lib/elements/combos/base-combo.js.map +1 -0
  952. package/lib/elements/combos/circle.d.ts +25 -0
  953. package/lib/elements/combos/circle.js +49 -0
  954. package/lib/elements/combos/circle.js.map +1 -0
  955. package/lib/elements/combos/index.d.ts +6 -0
  956. package/lib/elements/combos/index.js +10 -0
  957. package/lib/elements/combos/index.js.map +1 -0
  958. package/lib/elements/combos/rect.d.ts +21 -0
  959. package/lib/elements/combos/rect.js +33 -0
  960. package/lib/elements/combos/rect.js.map +1 -0
  961. package/lib/elements/edges/base-edge.d.ts +155 -0
  962. package/lib/elements/edges/base-edge.js +222 -0
  963. package/lib/elements/edges/base-edge.js.map +1 -0
  964. package/lib/elements/edges/cubic-horizontal.d.ts +39 -0
  965. package/lib/elements/edges/cubic-horizontal.js +32 -0
  966. package/lib/elements/edges/cubic-horizontal.js.map +1 -0
  967. package/lib/elements/edges/cubic-vertical.d.ts +39 -0
  968. package/lib/elements/edges/cubic-vertical.js +32 -0
  969. package/lib/elements/edges/cubic-vertical.js.map +1 -0
  970. package/lib/elements/edges/cubic.d.ts +48 -0
  971. package/lib/elements/edges/cubic.js +39 -0
  972. package/lib/elements/edges/cubic.js.map +1 -0
  973. package/lib/elements/edges/index.d.ts +14 -0
  974. package/lib/elements/edges/index.js +18 -0
  975. package/lib/elements/edges/index.js.map +1 -0
  976. package/lib/elements/edges/line.d.ts +25 -0
  977. package/lib/elements/edges/line.js +27 -0
  978. package/lib/elements/edges/line.js.map +1 -0
  979. package/lib/elements/edges/polyline.d.ts +63 -0
  980. package/lib/elements/edges/polyline.js +71 -0
  981. package/lib/elements/edges/polyline.js.map +1 -0
  982. package/lib/elements/edges/quadratic.d.ts +44 -0
  983. package/lib/elements/edges/quadratic.js +28 -0
  984. package/lib/elements/edges/quadratic.js.map +1 -0
  985. package/lib/elements/index.d.ts +3 -0
  986. package/lib/elements/index.js +20 -0
  987. package/lib/elements/index.js.map +1 -0
  988. package/lib/elements/nodes/base-node.d.ts +193 -0
  989. package/lib/elements/nodes/base-node.js +221 -0
  990. package/lib/elements/nodes/base-node.js.map +1 -0
  991. package/lib/elements/nodes/circle.d.ts +26 -0
  992. package/lib/elements/nodes/circle.js +40 -0
  993. package/lib/elements/nodes/circle.js.map +1 -0
  994. package/lib/elements/nodes/diamond.d.ts +21 -0
  995. package/lib/elements/nodes/diamond.js +27 -0
  996. package/lib/elements/nodes/diamond.js.map +1 -0
  997. package/lib/elements/nodes/donut.d.ts +45 -0
  998. package/lib/elements/nodes/donut.js +99 -0
  999. package/lib/elements/nodes/donut.js.map +1 -0
  1000. package/lib/elements/nodes/ellipse.d.ts +26 -0
  1001. package/lib/elements/nodes/ellipse.js +45 -0
  1002. package/lib/elements/nodes/ellipse.js.map +1 -0
  1003. package/lib/elements/nodes/hexagon.d.ts +28 -0
  1004. package/lib/elements/nodes/hexagon.js +29 -0
  1005. package/lib/elements/nodes/hexagon.js.map +1 -0
  1006. package/lib/elements/nodes/html.d.ts +41 -0
  1007. package/lib/elements/nodes/html.js +226 -0
  1008. package/lib/elements/nodes/html.js.map +1 -0
  1009. package/lib/elements/nodes/image.d.ts +38 -0
  1010. package/lib/elements/nodes/image.js +63 -0
  1011. package/lib/elements/nodes/image.js.map +1 -0
  1012. package/lib/elements/nodes/index.d.ts +22 -0
  1013. package/lib/elements/nodes/index.js +26 -0
  1014. package/lib/elements/nodes/index.js.map +1 -0
  1015. package/lib/elements/nodes/rect.d.ts +26 -0
  1016. package/lib/elements/nodes/rect.js +46 -0
  1017. package/lib/elements/nodes/rect.js.map +1 -0
  1018. package/lib/elements/nodes/star.d.ts +30 -0
  1019. package/lib/elements/nodes/star.js +38 -0
  1020. package/lib/elements/nodes/star.js.map +1 -0
  1021. package/lib/elements/nodes/triangle.d.ts +31 -0
  1022. package/lib/elements/nodes/triangle.js +57 -0
  1023. package/lib/elements/nodes/triangle.js.map +1 -0
  1024. package/lib/elements/shapes/badge.d.ts +14 -0
  1025. package/lib/elements/shapes/badge.js +26 -0
  1026. package/lib/elements/shapes/badge.js.map +1 -0
  1027. package/lib/elements/shapes/base-shape.d.ts +63 -0
  1028. package/lib/elements/shapes/base-shape.js +164 -0
  1029. package/lib/elements/shapes/base-shape.js.map +1 -0
  1030. package/lib/elements/shapes/contour.d.ts +66 -0
  1031. package/lib/elements/shapes/contour.js +40 -0
  1032. package/lib/elements/shapes/contour.js.map +1 -0
  1033. package/lib/elements/shapes/icon.d.ts +13 -0
  1034. package/lib/elements/shapes/icon.js +35 -0
  1035. package/lib/elements/shapes/icon.js.map +1 -0
  1036. package/lib/elements/shapes/index.d.ts +16 -0
  1037. package/lib/elements/shapes/index.js +19 -0
  1038. package/lib/elements/shapes/index.js.map +1 -0
  1039. package/lib/elements/shapes/label.d.ts +31 -0
  1040. package/lib/elements/shapes/label.js +65 -0
  1041. package/lib/elements/shapes/label.js.map +1 -0
  1042. package/lib/elements/shapes/polygon.d.ts +30 -0
  1043. package/lib/elements/shapes/polygon.js +31 -0
  1044. package/lib/elements/shapes/polygon.js.map +1 -0
  1045. package/lib/exports.d.ts +40 -0
  1046. package/lib/exports.js +108 -0
  1047. package/lib/exports.js.map +1 -0
  1048. package/lib/index.d.ts +3 -249
  1049. package/lib/index.js +4 -27
  1050. package/lib/index.js.map +1 -1
  1051. package/lib/layouts/base-layout.d.ts +10 -0
  1052. package/lib/layouts/base-layout.js +13 -0
  1053. package/lib/layouts/base-layout.js.map +1 -0
  1054. package/lib/layouts/index.d.ts +4 -0
  1055. package/lib/layouts/index.js +25 -0
  1056. package/lib/layouts/index.js.map +1 -0
  1057. package/lib/layouts/types.d.ts +84 -0
  1058. package/lib/layouts/types.js.map +1 -0
  1059. package/lib/palettes/index.d.ts +10 -0
  1060. package/lib/palettes/index.js +67 -0
  1061. package/lib/palettes/index.js.map +1 -0
  1062. package/lib/palettes/types.d.ts +5 -0
  1063. package/lib/palettes/types.js +3 -0
  1064. package/lib/palettes/types.js.map +1 -0
  1065. package/lib/plugins/background/index.d.ts +38 -0
  1066. package/lib/plugins/background/index.js +52 -0
  1067. package/lib/plugins/background/index.js.map +1 -0
  1068. package/lib/plugins/base-plugin.d.ts +6 -0
  1069. package/lib/plugins/base-plugin.js +8 -0
  1070. package/lib/plugins/base-plugin.js.map +1 -0
  1071. package/lib/plugins/bubble-sets.d.ts +116 -0
  1072. package/lib/plugins/bubble-sets.js +283 -0
  1073. package/lib/plugins/bubble-sets.js.map +1 -0
  1074. package/lib/plugins/camera-setting.d.ts +111 -0
  1075. package/lib/plugins/camera-setting.js +76 -0
  1076. package/lib/plugins/camera-setting.js.map +1 -0
  1077. package/lib/plugins/contextmenu/index.d.ts +115 -0
  1078. package/lib/plugins/contextmenu/index.js +136 -0
  1079. package/lib/plugins/contextmenu/index.js.map +1 -0
  1080. package/lib/plugins/contextmenu/util.d.ts +26 -0
  1081. package/lib/plugins/contextmenu/util.js +49 -0
  1082. package/lib/plugins/contextmenu/util.js.map +1 -0
  1083. package/lib/plugins/grid-line.d.ts +106 -0
  1084. package/lib/plugins/grid-line.js +82 -0
  1085. package/lib/plugins/grid-line.js.map +1 -0
  1086. package/lib/plugins/history/index.d.ts +120 -0
  1087. package/lib/plugins/history/index.js +202 -0
  1088. package/lib/plugins/history/index.js.map +1 -0
  1089. package/lib/plugins/history/util.d.ts +21 -0
  1090. package/lib/plugins/history/util.js +88 -0
  1091. package/lib/plugins/history/util.js.map +1 -0
  1092. package/lib/plugins/hull/index.d.ts +114 -0
  1093. package/lib/plugins/hull/index.js +165 -0
  1094. package/lib/plugins/hull/index.js.map +1 -0
  1095. package/lib/plugins/hull/util.d.ts +12 -0
  1096. package/lib/plugins/hull/util.js +207 -0
  1097. package/lib/plugins/hull/util.js.map +1 -0
  1098. package/lib/plugins/index.d.ts +26 -0
  1099. package/lib/plugins/index.js +30 -0
  1100. package/lib/plugins/index.js.map +1 -0
  1101. package/lib/plugins/legend.d.ts +129 -0
  1102. package/lib/plugins/legend.js +322 -0
  1103. package/lib/plugins/legend.js.map +1 -0
  1104. package/lib/plugins/timebar.d.ts +234 -0
  1105. package/lib/plugins/timebar.js +265 -0
  1106. package/lib/plugins/timebar.js.map +1 -0
  1107. package/lib/plugins/toolbar/index.d.ts +69 -0
  1108. package/lib/plugins/toolbar/index.js +75 -0
  1109. package/lib/plugins/toolbar/index.js.map +1 -0
  1110. package/lib/plugins/toolbar/util.d.ts +33 -0
  1111. package/lib/plugins/toolbar/util.js +93 -0
  1112. package/lib/plugins/toolbar/util.js.map +1 -0
  1113. package/lib/plugins/tooltip.d.ts +116 -0
  1114. package/lib/plugins/tooltip.js +298 -0
  1115. package/lib/plugins/tooltip.js.map +1 -0
  1116. package/lib/plugins/types.d.ts +4 -0
  1117. package/lib/plugins/types.js +3 -0
  1118. package/lib/plugins/types.js.map +1 -0
  1119. package/lib/plugins/watermark/index.d.ts +191 -0
  1120. package/lib/plugins/watermark/index.js +71 -0
  1121. package/lib/plugins/watermark/index.js.map +1 -0
  1122. package/lib/plugins/watermark/util.d.ts +18 -0
  1123. package/lib/plugins/watermark/util.js +78 -0
  1124. package/lib/plugins/watermark/util.js.map +1 -0
  1125. package/lib/preset.d.ts +1 -0
  1126. package/lib/preset.js +7 -0
  1127. package/lib/preset.js.map +1 -0
  1128. package/lib/registry/build-in.d.ts +6 -0
  1129. package/lib/registry/build-in.js +117 -0
  1130. package/lib/registry/build-in.js.map +1 -0
  1131. package/lib/registry/extension/index.d.ts +33 -0
  1132. package/lib/registry/extension/index.js +89 -0
  1133. package/lib/registry/extension/index.js.map +1 -0
  1134. package/lib/registry/extension/types.d.ts +38 -0
  1135. package/lib/registry/extension/types.js +3 -0
  1136. package/lib/registry/extension/types.js.map +1 -0
  1137. package/lib/registry/index.d.ts +59 -0
  1138. package/lib/registry/index.js +104 -0
  1139. package/lib/registry/index.js.map +1 -0
  1140. package/lib/registry/types.d.ts +39 -0
  1141. package/lib/registry/types.js +3 -0
  1142. package/lib/registry/types.js.map +1 -0
  1143. package/lib/runtime/animation.d.ts +54 -0
  1144. package/lib/runtime/animation.js +143 -0
  1145. package/lib/runtime/animation.js.map +1 -0
  1146. package/lib/runtime/batch.d.ts +11 -0
  1147. package/lib/runtime/batch.js +35 -0
  1148. package/lib/runtime/batch.js.map +1 -0
  1149. package/lib/runtime/behavior.d.ts +19 -0
  1150. package/lib/runtime/behavior.js +115 -0
  1151. package/lib/runtime/behavior.js.map +1 -0
  1152. package/lib/runtime/canvas.d.ts +60 -0
  1153. package/lib/runtime/canvas.js +261 -0
  1154. package/lib/runtime/canvas.js.map +1 -0
  1155. package/lib/runtime/data.d.ts +202 -0
  1156. package/lib/runtime/data.js +698 -0
  1157. package/lib/runtime/data.js.map +1 -0
  1158. package/lib/runtime/element.d.ts +102 -0
  1159. package/lib/runtime/element.js +557 -0
  1160. package/lib/runtime/element.js.map +1 -0
  1161. package/lib/runtime/graph.d.ts +828 -458
  1162. package/lib/runtime/graph.js +1033 -1463
  1163. package/lib/runtime/graph.js.map +1 -1
  1164. package/lib/runtime/layout.d.ts +38 -0
  1165. package/lib/runtime/layout.js +240 -0
  1166. package/lib/runtime/layout.js.map +1 -0
  1167. package/lib/runtime/plugin.d.ts +10 -0
  1168. package/lib/runtime/plugin.js +19 -0
  1169. package/lib/runtime/plugin.js.map +1 -0
  1170. package/lib/runtime/transform.d.ts +12 -0
  1171. package/lib/runtime/transform.js +31 -0
  1172. package/lib/runtime/transform.js.map +1 -0
  1173. package/lib/runtime/types.d.ts +90 -0
  1174. package/lib/runtime/types.js +3 -0
  1175. package/lib/runtime/types.js.map +1 -0
  1176. package/lib/runtime/viewport.d.ts +58 -0
  1177. package/lib/runtime/viewport.js +245 -0
  1178. package/lib/runtime/viewport.js.map +1 -0
  1179. package/lib/spec/behavior.d.ts +30 -0
  1180. package/lib/spec/behavior.js +3 -0
  1181. package/lib/spec/behavior.js.map +1 -0
  1182. package/lib/spec/canvas.d.ts +53 -0
  1183. package/lib/spec/canvas.js +3 -0
  1184. package/lib/spec/canvas.js.map +1 -0
  1185. package/lib/spec/data.d.ts +222 -0
  1186. package/lib/spec/data.js +3 -0
  1187. package/lib/spec/data.js.map +1 -0
  1188. package/lib/spec/element/animation.d.ts +6 -0
  1189. package/lib/spec/element/animation.js +3 -0
  1190. package/lib/spec/element/animation.js.map +1 -0
  1191. package/lib/spec/element/combo.d.ts +52 -0
  1192. package/lib/spec/element/combo.js +3 -0
  1193. package/lib/spec/element/combo.js.map +1 -0
  1194. package/lib/spec/element/edge.d.ts +52 -0
  1195. package/lib/spec/element/edge.js +3 -0
  1196. package/lib/spec/element/edge.js.map +1 -0
  1197. package/lib/spec/element/node.d.ts +52 -0
  1198. package/lib/spec/element/node.js +3 -0
  1199. package/lib/spec/element/node.js.map +1 -0
  1200. package/lib/spec/element/palette.d.ts +53 -0
  1201. package/lib/spec/element/palette.js +3 -0
  1202. package/lib/spec/element/palette.js.map +1 -0
  1203. package/lib/spec/graph.d.ts +91 -0
  1204. package/lib/spec/graph.js.map +1 -0
  1205. package/lib/spec/index.d.ts +12 -0
  1206. package/lib/spec/index.js +3 -0
  1207. package/lib/spec/index.js.map +1 -0
  1208. package/lib/spec/layout.d.ts +4 -0
  1209. package/lib/spec/layout.js.map +1 -0
  1210. package/lib/spec/plugin.d.ts +32 -0
  1211. package/lib/spec/plugin.js +3 -0
  1212. package/lib/spec/plugin.js.map +1 -0
  1213. package/lib/spec/theme.d.ts +7 -0
  1214. package/lib/spec/theme.js +3 -0
  1215. package/lib/spec/theme.js.map +1 -0
  1216. package/lib/spec/transform.d.ts +12 -0
  1217. package/lib/spec/transform.js +3 -0
  1218. package/lib/spec/transform.js.map +1 -0
  1219. package/lib/spec/viewport.d.ts +82 -0
  1220. package/lib/spec/viewport.js +3 -0
  1221. package/lib/spec/viewport.js.map +1 -0
  1222. package/lib/themes/base.d.ts +28 -0
  1223. package/lib/themes/base.js +231 -0
  1224. package/lib/themes/base.js.map +1 -0
  1225. package/lib/themes/dark.d.ts +2 -0
  1226. package/lib/themes/dark.js +19 -0
  1227. package/lib/themes/dark.js.map +1 -0
  1228. package/lib/themes/index.d.ts +2 -0
  1229. package/lib/themes/index.js +8 -0
  1230. package/lib/themes/index.js.map +1 -0
  1231. package/lib/themes/light.d.ts +2 -0
  1232. package/lib/themes/light.js +19 -0
  1233. package/lib/themes/light.js.map +1 -0
  1234. package/lib/themes/types.d.ts +9 -0
  1235. package/lib/themes/types.js +3 -0
  1236. package/lib/themes/types.js.map +1 -0
  1237. package/lib/transforms/arrange-draw-order.d.ts +10 -0
  1238. package/lib/transforms/arrange-draw-order.js +36 -0
  1239. package/lib/transforms/arrange-draw-order.js.map +1 -0
  1240. package/lib/transforms/base-transform.d.ts +8 -0
  1241. package/lib/transforms/base-transform.js +11 -0
  1242. package/lib/transforms/base-transform.js.map +1 -0
  1243. package/lib/transforms/collapse-expand-combo.d.ts +11 -0
  1244. package/lib/transforms/collapse-expand-combo.js +79 -0
  1245. package/lib/transforms/collapse-expand-combo.js.map +1 -0
  1246. package/lib/transforms/collapse-expand-node.d.ts +12 -0
  1247. package/lib/transforms/collapse-expand-node.js +95 -0
  1248. package/lib/transforms/collapse-expand-node.js.map +1 -0
  1249. package/lib/transforms/get-edge-actual-ends.d.ts +13 -0
  1250. package/lib/transforms/get-edge-actual-ends.js +41 -0
  1251. package/lib/transforms/get-edge-actual-ends.js.map +1 -0
  1252. package/lib/transforms/index.d.ts +8 -0
  1253. package/lib/transforms/index.js +18 -0
  1254. package/lib/transforms/index.js.map +1 -0
  1255. package/lib/transforms/process-parallel-edges.d.ts +85 -0
  1256. package/lib/transforms/process-parallel-edges.js +235 -0
  1257. package/lib/transforms/process-parallel-edges.js.map +1 -0
  1258. package/lib/transforms/types.d.ts +20 -0
  1259. package/lib/transforms/types.js +3 -0
  1260. package/lib/transforms/types.js.map +1 -0
  1261. package/lib/transforms/update-related-edge.d.ts +10 -0
  1262. package/lib/transforms/update-related-edge.js +27 -0
  1263. package/lib/transforms/update-related-edge.js.map +1 -0
  1264. package/lib/transforms/utils.d.ts +13 -0
  1265. package/lib/transforms/utils.js +29 -0
  1266. package/lib/transforms/utils.js.map +1 -0
  1267. package/lib/types/anchor.d.ts +3 -0
  1268. package/lib/types/anchor.js +3 -0
  1269. package/lib/types/anchor.js.map +1 -0
  1270. package/lib/types/animation.d.ts +5 -0
  1271. package/lib/types/animation.js +3 -0
  1272. package/lib/types/animation.js.map +1 -0
  1273. package/lib/types/callable.d.ts +30 -0
  1274. package/lib/types/callable.js +3 -0
  1275. package/lib/types/callable.js.map +1 -0
  1276. package/lib/types/canvas.d.ts +1 -0
  1277. package/lib/types/canvas.js +3 -0
  1278. package/lib/types/canvas.js.map +1 -0
  1279. package/lib/types/change.d.ts +68 -0
  1280. package/lib/types/change.js +3 -0
  1281. package/lib/types/change.js.map +1 -0
  1282. package/lib/types/combo.d.ts +20 -132
  1283. package/lib/types/data.d.ts +44 -27
  1284. package/lib/types/edge.d.ts +82 -98
  1285. package/lib/types/element.d.ts +18 -0
  1286. package/lib/types/element.js +3 -0
  1287. package/lib/types/element.js.map +1 -0
  1288. package/lib/types/enum.d.ts +1 -0
  1289. package/lib/types/enum.js +3 -0
  1290. package/lib/types/enum.js.map +1 -0
  1291. package/lib/types/event.d.ts +54 -38
  1292. package/lib/types/event.js +0 -31
  1293. package/lib/types/event.js.map +1 -1
  1294. package/lib/types/graphlib.d.ts +16 -0
  1295. package/lib/types/graphlib.js +3 -0
  1296. package/lib/types/graphlib.js.map +1 -0
  1297. package/lib/types/history.d.ts +49 -26
  1298. package/lib/types/history.js +0 -6
  1299. package/lib/types/history.js.map +1 -1
  1300. package/lib/types/id.d.ts +1 -0
  1301. package/lib/types/id.js +3 -0
  1302. package/lib/types/id.js.map +1 -0
  1303. package/lib/types/index.d.ts +26 -16
  1304. package/lib/types/index.js +0 -4
  1305. package/lib/types/index.js.map +1 -1
  1306. package/lib/types/layout.d.ts +8 -71
  1307. package/lib/types/layout.js +0 -22
  1308. package/lib/types/layout.js.map +1 -1
  1309. package/lib/types/node.d.ts +132 -203
  1310. package/lib/types/padding.d.ts +2 -0
  1311. package/lib/types/padding.js +3 -0
  1312. package/lib/types/padding.js.map +1 -0
  1313. package/lib/types/placement.d.ts +5 -0
  1314. package/lib/types/placement.js +3 -0
  1315. package/lib/types/placement.js.map +1 -0
  1316. package/lib/types/plugin.d.ts +5 -44
  1317. package/lib/types/plugin.js +0 -54
  1318. package/lib/types/plugin.js.map +1 -1
  1319. package/lib/types/point.d.ts +2 -0
  1320. package/lib/types/point.js +3 -0
  1321. package/lib/types/point.js.map +1 -0
  1322. package/lib/types/position.d.ts +2 -0
  1323. package/lib/types/position.js +3 -0
  1324. package/lib/types/position.js.map +1 -0
  1325. package/lib/types/prefix.d.ts +17 -0
  1326. package/lib/types/prefix.js +3 -0
  1327. package/lib/types/prefix.js.map +1 -0
  1328. package/lib/types/size.d.ts +3 -0
  1329. package/lib/types/size.js +3 -0
  1330. package/lib/types/size.js.map +1 -0
  1331. package/lib/types/state.d.ts +1 -0
  1332. package/lib/types/state.js +3 -0
  1333. package/lib/types/state.js.map +1 -0
  1334. package/lib/types/style.d.ts +9 -0
  1335. package/lib/types/style.js +3 -0
  1336. package/lib/types/style.js.map +1 -0
  1337. package/lib/types/tree.d.ts +5 -0
  1338. package/lib/types/tree.js +3 -0
  1339. package/lib/types/tree.js.map +1 -0
  1340. package/lib/types/vector.d.ts +2 -0
  1341. package/lib/types/vector.js +3 -0
  1342. package/lib/types/vector.js.map +1 -0
  1343. package/lib/types/viewport.d.ts +36 -0
  1344. package/lib/types/viewport.js +3 -0
  1345. package/lib/types/viewport.js.map +1 -0
  1346. package/lib/utils/anchor.d.ts +9 -0
  1347. package/lib/utils/anchor.js +20 -0
  1348. package/lib/utils/anchor.js.map +1 -0
  1349. package/lib/utils/animation.d.ts +47 -0
  1350. package/lib/utils/animation.js +197 -0
  1351. package/lib/utils/animation.js.map +1 -0
  1352. package/lib/utils/array.d.ts +9 -0
  1353. package/lib/utils/array.js +20 -0
  1354. package/lib/utils/array.js.map +1 -0
  1355. package/lib/utils/bbox.d.ts +108 -0
  1356. package/lib/utils/bbox.js +222 -0
  1357. package/lib/utils/bbox.js.map +1 -0
  1358. package/lib/utils/cache.d.ts +36 -0
  1359. package/lib/utils/cache.js +59 -0
  1360. package/lib/utils/cache.js.map +1 -0
  1361. package/lib/utils/change.d.ts +17 -0
  1362. package/lib/utils/change.js +96 -0
  1363. package/lib/utils/change.js.map +1 -0
  1364. package/lib/utils/collapsibility.d.ts +9 -0
  1365. package/lib/utils/collapsibility.js +15 -0
  1366. package/lib/utils/collapsibility.js.map +1 -0
  1367. package/lib/utils/data.d.ts +34 -0
  1368. package/lib/utils/data.js +65 -0
  1369. package/lib/utils/data.js.map +1 -0
  1370. package/lib/utils/diff.d.ts +15 -0
  1371. package/lib/utils/diff.js +44 -0
  1372. package/lib/utils/diff.js.map +1 -0
  1373. package/lib/utils/dom.d.ts +29 -0
  1374. package/lib/utils/dom.js +99 -0
  1375. package/lib/utils/dom.js.map +1 -0
  1376. package/lib/utils/edge.d.ts +171 -0
  1377. package/lib/utils/edge.js +502 -0
  1378. package/lib/utils/edge.js.map +1 -0
  1379. package/lib/utils/element.d.ts +231 -0
  1380. package/lib/utils/element.js +492 -0
  1381. package/lib/utils/element.js.map +1 -0
  1382. package/lib/utils/event/events.d.ts +26 -0
  1383. package/lib/utils/event/events.js +49 -0
  1384. package/lib/utils/event/events.js.map +1 -0
  1385. package/lib/utils/event/index.d.ts +29 -0
  1386. package/lib/utils/event/index.js +64 -0
  1387. package/lib/utils/event/index.js.map +1 -0
  1388. package/lib/utils/extension.d.ts +10 -0
  1389. package/lib/utils/extension.js +29 -0
  1390. package/lib/utils/extension.js.map +1 -0
  1391. package/lib/utils/graphlib.d.ts +14 -0
  1392. package/lib/utils/graphlib.js +50 -0
  1393. package/lib/utils/graphlib.js.map +1 -0
  1394. package/lib/utils/id.d.ts +20 -0
  1395. package/lib/utils/id.js +47 -0
  1396. package/lib/utils/id.js.map +1 -0
  1397. package/lib/utils/is.d.ts +34 -0
  1398. package/lib/utils/is.js +55 -0
  1399. package/lib/utils/is.js.map +1 -0
  1400. package/lib/utils/layout.d.ts +70 -0
  1401. package/lib/utils/layout.js +214 -0
  1402. package/lib/utils/layout.js.map +1 -0
  1403. package/lib/utils/line.d.ts +21 -0
  1404. package/lib/utils/line.js +46 -0
  1405. package/lib/utils/line.js.map +1 -0
  1406. package/lib/utils/math.d.ts +10 -0
  1407. package/lib/utils/math.js +17 -0
  1408. package/lib/utils/math.js.map +1 -0
  1409. package/lib/utils/padding.d.ts +9 -0
  1410. package/lib/utils/padding.js +19 -0
  1411. package/lib/utils/padding.js.map +1 -0
  1412. package/lib/utils/palette.d.ts +32 -0
  1413. package/lib/utils/palette.js +117 -0
  1414. package/lib/utils/palette.js.map +1 -0
  1415. package/lib/utils/path.d.ts +35 -0
  1416. package/lib/utils/path.js +150 -0
  1417. package/lib/utils/path.js.map +1 -0
  1418. package/lib/utils/placement.d.ts +9 -0
  1419. package/lib/utils/placement.js +22 -0
  1420. package/lib/utils/placement.js.map +1 -0
  1421. package/lib/utils/point.d.ts +192 -0
  1422. package/lib/utils/point.js +366 -0
  1423. package/lib/utils/point.js.map +1 -0
  1424. package/lib/utils/polygon.d.ts +17 -0
  1425. package/lib/utils/polygon.js +63 -0
  1426. package/lib/utils/polygon.js.map +1 -0
  1427. package/lib/utils/position.d.ts +50 -0
  1428. package/lib/utils/position.js +75 -0
  1429. package/lib/utils/position.js.map +1 -0
  1430. package/lib/utils/prefix.d.ts +66 -0
  1431. package/lib/utils/prefix.js +141 -0
  1432. package/lib/utils/prefix.js.map +1 -0
  1433. package/lib/utils/relation.d.ts +33 -0
  1434. package/lib/utils/relation.js +77 -0
  1435. package/lib/utils/relation.js.map +1 -0
  1436. package/lib/utils/router/orth.d.ts +103 -0
  1437. package/lib/utils/router/orth.js +292 -0
  1438. package/lib/utils/router/orth.js.map +1 -0
  1439. package/lib/utils/shape.d.ts +9 -0
  1440. package/lib/utils/shape.js +26 -0
  1441. package/lib/utils/shape.js.map +1 -0
  1442. package/lib/utils/shortcut.d.ts +31 -0
  1443. package/lib/utils/shortcut.js +92 -0
  1444. package/lib/utils/shortcut.js.map +1 -0
  1445. package/lib/utils/size.d.ts +7 -0
  1446. package/lib/utils/size.js +16 -0
  1447. package/lib/utils/size.js.map +1 -0
  1448. package/lib/utils/style.d.ts +30 -0
  1449. package/lib/utils/style.js +52 -0
  1450. package/lib/utils/style.js.map +1 -0
  1451. package/lib/utils/symbol.d.ts +30 -0
  1452. package/lib/utils/symbol.js +83 -0
  1453. package/lib/utils/symbol.js.map +1 -0
  1454. package/lib/utils/text.d.ts +26 -0
  1455. package/lib/utils/text.js +50 -0
  1456. package/lib/utils/text.js.map +1 -0
  1457. package/lib/utils/theme.d.ts +9 -0
  1458. package/lib/utils/theme.js +21 -0
  1459. package/lib/utils/theme.js.map +1 -0
  1460. package/lib/utils/transform.d.ts +24 -0
  1461. package/lib/utils/transform.js +48 -0
  1462. package/lib/utils/transform.js.map +1 -0
  1463. package/lib/utils/traverse.d.ts +23 -0
  1464. package/lib/utils/traverse.js +49 -0
  1465. package/lib/utils/traverse.js.map +1 -0
  1466. package/lib/utils/tree.d.ts +17 -0
  1467. package/lib/utils/tree.js +32 -0
  1468. package/lib/utils/tree.js.map +1 -0
  1469. package/lib/utils/vector.d.ts +143 -0
  1470. package/lib/utils/vector.js +210 -0
  1471. package/lib/utils/vector.js.map +1 -0
  1472. package/lib/utils/visibility.d.ts +13 -0
  1473. package/lib/utils/visibility.js +32 -0
  1474. package/lib/utils/visibility.js.map +1 -0
  1475. package/package.json +56 -104
  1476. package/src/animations/executor.ts +94 -0
  1477. package/src/animations/index.ts +23 -0
  1478. package/src/animations/types.ts +122 -0
  1479. package/src/behaviors/base-behavior.ts +6 -0
  1480. package/src/behaviors/brush-select.ts +394 -0
  1481. package/src/behaviors/click-select.ts +245 -0
  1482. package/src/behaviors/collapse-expand.ts +124 -0
  1483. package/src/behaviors/create-edge.ts +224 -0
  1484. package/src/behaviors/drag-canvas.ts +157 -0
  1485. package/src/behaviors/drag-element-force.ts +107 -0
  1486. package/src/behaviors/drag-element.ts +387 -0
  1487. package/src/behaviors/focus-element.ts +88 -0
  1488. package/src/behaviors/hover-activate.ts +185 -0
  1489. package/src/behaviors/index.ts +27 -0
  1490. package/src/behaviors/lasso-select.ts +82 -0
  1491. package/src/behaviors/scroll-canvas.ts +166 -0
  1492. package/src/behaviors/types.ts +7 -0
  1493. package/src/behaviors/zoom-canvas.ts +190 -0
  1494. package/src/constants/animation.ts +12 -0
  1495. package/src/constants/change.ts +65 -0
  1496. package/src/constants/element.ts +8 -0
  1497. package/src/constants/events/animation.ts +6 -0
  1498. package/src/constants/events/canvas.ts +115 -0
  1499. package/src/constants/events/combo.ts +109 -0
  1500. package/src/constants/events/common.ts +122 -0
  1501. package/src/constants/events/container.ts +14 -0
  1502. package/src/constants/events/edge.ts +91 -0
  1503. package/src/constants/events/graph.ts +158 -0
  1504. package/src/constants/events/history.ts +38 -0
  1505. package/src/constants/events/index.ts +9 -0
  1506. package/src/constants/events/node.ts +109 -0
  1507. package/src/constants/graphlib.ts +3 -0
  1508. package/src/constants/index.ts +5 -0
  1509. package/src/constants/registry.ts +62 -0
  1510. package/src/elements/base-element.ts +52 -0
  1511. package/src/elements/combos/base-combo.ts +260 -0
  1512. package/src/elements/combos/circle.ts +61 -0
  1513. package/src/elements/combos/index.ts +7 -0
  1514. package/src/elements/combos/rect.ts +41 -0
  1515. package/src/elements/edges/base-edge.ts +386 -0
  1516. package/src/elements/edges/cubic-horizontal.ts +60 -0
  1517. package/src/elements/edges/cubic-vertical.ts +60 -0
  1518. package/src/elements/edges/cubic.ts +86 -0
  1519. package/src/elements/edges/index.ts +15 -0
  1520. package/src/elements/edges/line.ts +37 -0
  1521. package/src/elements/edges/polyline.ts +143 -0
  1522. package/src/elements/edges/quadratic.ts +61 -0
  1523. package/src/elements/index.ts +3 -0
  1524. package/src/elements/nodes/base-node.ts +425 -0
  1525. package/src/elements/nodes/circle.ts +52 -0
  1526. package/src/elements/nodes/diamond.ts +35 -0
  1527. package/src/elements/nodes/donut.ts +147 -0
  1528. package/src/elements/nodes/ellipse.ts +58 -0
  1529. package/src/elements/nodes/hexagon.ts +45 -0
  1530. package/src/elements/nodes/html.ts +256 -0
  1531. package/src/elements/nodes/image.ts +89 -0
  1532. package/src/elements/nodes/index.ts +23 -0
  1533. package/src/elements/nodes/rect.ts +58 -0
  1534. package/src/elements/nodes/star.ts +56 -0
  1535. package/src/elements/nodes/triangle.ts +78 -0
  1536. package/src/elements/shapes/badge.ts +31 -0
  1537. package/src/elements/shapes/base-shape.ts +199 -0
  1538. package/src/elements/shapes/contour.ts +106 -0
  1539. package/src/elements/shapes/icon.ts +39 -0
  1540. package/src/elements/shapes/index.ts +18 -0
  1541. package/src/elements/shapes/label.ts +95 -0
  1542. package/src/elements/shapes/polygon.ts +51 -0
  1543. package/src/exports.ts +239 -0
  1544. package/src/index.ts +3 -23
  1545. package/src/layouts/base-layout.ts +18 -0
  1546. package/src/layouts/hierarchy.d.ts +10 -0
  1547. package/src/layouts/index.ts +17 -0
  1548. package/src/layouts/types.ts +131 -0
  1549. package/src/palettes/index.ts +67 -0
  1550. package/src/palettes/types.ts +9 -0
  1551. package/src/plugins/background/index.ts +64 -0
  1552. package/src/plugins/base-plugin.ts +6 -0
  1553. package/src/plugins/bubble-sets.ts +333 -0
  1554. package/src/plugins/camera-setting.ts +168 -0
  1555. package/src/plugins/contextmenu/index.ts +225 -0
  1556. package/src/plugins/contextmenu/util.ts +62 -0
  1557. package/src/plugins/grid-line.ts +165 -0
  1558. package/src/plugins/history/index.ts +256 -0
  1559. package/src/plugins/history/util.ts +90 -0
  1560. package/src/plugins/hull/index.ts +211 -0
  1561. package/src/plugins/hull/util.ts +222 -0
  1562. package/src/plugins/index.ts +27 -0
  1563. package/src/plugins/legend.ts +405 -0
  1564. package/src/plugins/timebar.ts +460 -0
  1565. package/src/plugins/toolbar/index.ts +131 -0
  1566. package/src/plugins/toolbar/util.ts +115 -0
  1567. package/src/plugins/tooltip.ts +343 -0
  1568. package/src/plugins/types.ts +5 -0
  1569. package/src/plugins/watermark/index.ts +239 -0
  1570. package/src/plugins/watermark/util.ts +93 -0
  1571. package/src/preset.ts +5 -0
  1572. package/src/registry/build-in.ts +184 -0
  1573. package/src/registry/extension/index.ts +112 -0
  1574. package/src/registry/extension/types.ts +45 -0
  1575. package/src/registry/index.ts +109 -0
  1576. package/src/registry/types.ts +26 -0
  1577. package/src/runtime/animation.ts +186 -0
  1578. package/src/runtime/batch.ts +38 -0
  1579. package/src/runtime/behavior.ts +127 -0
  1580. package/src/runtime/canvas.ts +347 -0
  1581. package/src/runtime/data.ts +789 -0
  1582. package/src/runtime/element.ts +738 -0
  1583. package/src/runtime/graph.ts +1325 -1873
  1584. package/src/runtime/layout.ts +299 -0
  1585. package/src/runtime/plugin.ts +21 -0
  1586. package/src/runtime/transform.ts +35 -0
  1587. package/src/runtime/types.ts +91 -0
  1588. package/src/runtime/viewport.ts +282 -0
  1589. package/src/spec/behavior.ts +33 -0
  1590. package/src/spec/canvas.ts +54 -0
  1591. package/src/spec/data.ts +225 -0
  1592. package/src/spec/element/animation.ts +6 -0
  1593. package/src/spec/element/combo.ts +55 -0
  1594. package/src/spec/element/edge.ts +55 -0
  1595. package/src/spec/element/node.ts +55 -0
  1596. package/src/spec/element/palette.ts +57 -0
  1597. package/src/spec/graph.ts +93 -0
  1598. package/src/spec/index.ts +12 -0
  1599. package/src/spec/layout.ts +7 -0
  1600. package/src/spec/plugin.ts +35 -0
  1601. package/src/spec/theme.ts +7 -0
  1602. package/src/spec/transform.ts +15 -0
  1603. package/src/spec/viewport.ts +76 -0
  1604. package/src/themes/base.ts +267 -0
  1605. package/src/themes/dark.ts +18 -0
  1606. package/src/themes/index.ts +2 -0
  1607. package/src/themes/light.ts +18 -0
  1608. package/src/themes/types.ts +10 -0
  1609. package/src/transforms/arrange-draw-order.ts +42 -0
  1610. package/src/transforms/base-transform.ts +12 -0
  1611. package/src/transforms/collapse-expand-combo.ts +80 -0
  1612. package/src/transforms/collapse-expand-node.ts +107 -0
  1613. package/src/transforms/get-edge-actual-ends.ts +45 -0
  1614. package/src/transforms/index.ts +9 -0
  1615. package/src/transforms/process-parallel-edges.ts +298 -0
  1616. package/src/transforms/types.ts +23 -0
  1617. package/src/transforms/update-related-edge.ts +31 -0
  1618. package/src/transforms/utils.ts +31 -0
  1619. package/src/types/anchor.ts +5 -0
  1620. package/src/types/animation.ts +7 -0
  1621. package/src/types/callable.ts +33 -0
  1622. package/src/types/canvas.ts +1 -0
  1623. package/src/types/change.ts +82 -0
  1624. package/src/types/combo.ts +21 -174
  1625. package/src/types/data.ts +53 -56
  1626. package/src/types/edge.ts +96 -124
  1627. package/src/types/element.ts +25 -0
  1628. package/src/types/enum.ts +1 -0
  1629. package/src/types/event.ts +73 -43
  1630. package/src/types/graphlib.ts +28 -0
  1631. package/src/types/history.ts +50 -27
  1632. package/src/types/id.ts +1 -0
  1633. package/src/types/index.ts +26 -54
  1634. package/src/types/layout.ts +8 -138
  1635. package/src/types/node.ts +140 -225
  1636. package/src/types/padding.ts +3 -0
  1637. package/src/types/placement.ts +17 -0
  1638. package/src/types/plugin.ts +5 -82
  1639. package/src/types/point.ts +2 -0
  1640. package/src/types/position.ts +3 -0
  1641. package/src/types/prefix.ts +19 -0
  1642. package/src/types/size.ts +5 -0
  1643. package/src/types/state.ts +1 -0
  1644. package/src/types/style.ts +10 -0
  1645. package/src/types/tree.ts +5 -0
  1646. package/src/types/vector.ts +3 -0
  1647. package/src/types/viewport.ts +41 -0
  1648. package/src/utils/anchor.ts +19 -0
  1649. package/src/utils/animation.ts +208 -0
  1650. package/src/utils/array.ts +15 -0
  1651. package/src/utils/bbox.ts +228 -0
  1652. package/src/utils/cache.ts +57 -0
  1653. package/src/utils/change.ts +101 -0
  1654. package/src/utils/collapsibility.ts +12 -0
  1655. package/src/utils/data.ts +64 -0
  1656. package/src/utils/diff.ts +43 -0
  1657. package/src/utils/dom.ts +115 -0
  1658. package/src/utils/edge.ts +573 -0
  1659. package/src/utils/element.ts +524 -0
  1660. package/src/utils/event/events.ts +72 -0
  1661. package/src/utils/event/index.ts +50 -0
  1662. package/src/utils/extension.ts +26 -0
  1663. package/src/utils/graphlib.ts +54 -0
  1664. package/src/utils/id.ts +46 -0
  1665. package/src/utils/is.ts +53 -0
  1666. package/src/utils/layout.ts +241 -0
  1667. package/src/utils/line.ts +50 -0
  1668. package/src/utils/math.ts +12 -0
  1669. package/src/utils/padding.ts +16 -0
  1670. package/src/utils/palette.ts +126 -0
  1671. package/src/utils/path.ts +153 -0
  1672. package/src/utils/placement.ts +19 -0
  1673. package/src/utils/point.ts +374 -0
  1674. package/src/utils/polygon.ts +69 -0
  1675. package/src/utils/position.ts +73 -0
  1676. package/src/utils/prefix.ts +141 -0
  1677. package/src/utils/relation.ts +83 -0
  1678. package/src/utils/router/orth.ts +323 -0
  1679. package/src/utils/shape.ts +26 -0
  1680. package/src/utils/shortcut.ts +113 -0
  1681. package/src/utils/size.ts +12 -0
  1682. package/src/utils/style.ts +55 -0
  1683. package/src/utils/symbol.ts +84 -0
  1684. package/src/utils/text.ts +51 -0
  1685. package/src/utils/theme.ts +18 -0
  1686. package/src/utils/transform.ts +50 -0
  1687. package/src/utils/traverse.ts +59 -0
  1688. package/src/utils/tree.ts +47 -0
  1689. package/src/utils/vector.ts +208 -0
  1690. package/src/utils/visibility.ts +31 -0
  1691. package/esm/api-doc/behaviors.d.ts +0 -2
  1692. package/esm/api-doc/behaviors.js +0 -2
  1693. package/esm/api-doc/behaviors.js.map +0 -1
  1694. package/esm/api-doc/graph.d.ts +0 -4
  1695. package/esm/api-doc/graph.js +0 -4
  1696. package/esm/api-doc/graph.js.map +0 -1
  1697. package/esm/api-doc/item.d.ts +0 -11
  1698. package/esm/api-doc/item.js +0 -5
  1699. package/esm/api-doc/item.js.map +0 -1
  1700. package/esm/api-doc/layout.d.ts +0 -1
  1701. package/esm/api-doc/layout.js.map +0 -1
  1702. package/esm/api-doc/plugins.d.ts +0 -1
  1703. package/esm/api-doc/plugins.js +0 -2
  1704. package/esm/api-doc/plugins.js.map +0 -1
  1705. package/esm/api-doc/types.d.ts +0 -0
  1706. package/esm/api-doc/types.js +0 -3
  1707. package/esm/api-doc/types.js.map +0 -1
  1708. package/esm/api-doc/util.d.ts +0 -3
  1709. package/esm/api-doc/util.js +0 -4
  1710. package/esm/api-doc/util.js.map +0 -1
  1711. package/esm/constant/index.d.ts +0 -1
  1712. package/esm/constant/index.js +0 -2
  1713. package/esm/constant/index.js.map +0 -1
  1714. package/esm/constant/shape.d.ts +0 -23
  1715. package/esm/constant/shape.js +0 -27
  1716. package/esm/constant/shape.js.map +0 -1
  1717. package/esm/item/combo.d.ts +0 -81
  1718. package/esm/item/combo.js +0 -188
  1719. package/esm/item/combo.js.map +0 -1
  1720. package/esm/item/edge.d.ts +0 -57
  1721. package/esm/item/edge.js +0 -142
  1722. package/esm/item/edge.js.map +0 -1
  1723. package/esm/item/item.d.ts +0 -191
  1724. package/esm/item/item.js +0 -701
  1725. package/esm/item/item.js.map +0 -1
  1726. package/esm/item/node.d.ts +0 -63
  1727. package/esm/item/node.js +0 -195
  1728. package/esm/item/node.js.map +0 -1
  1729. package/esm/runtime/controller/data.d.ts +0 -89
  1730. package/esm/runtime/controller/data.js +0 -878
  1731. package/esm/runtime/controller/data.js.map +0 -1
  1732. package/esm/runtime/controller/extension.d.ts +0 -9
  1733. package/esm/runtime/controller/extension.js +0 -11
  1734. package/esm/runtime/controller/extension.js.map +0 -1
  1735. package/esm/runtime/controller/index.d.ts +0 -7
  1736. package/esm/runtime/controller/index.js +0 -8
  1737. package/esm/runtime/controller/index.js.map +0 -1
  1738. package/esm/runtime/controller/interaction.d.ts +0 -52
  1739. package/esm/runtime/controller/interaction.js +0 -274
  1740. package/esm/runtime/controller/interaction.js.map +0 -1
  1741. package/esm/runtime/controller/item.d.ts +0 -143
  1742. package/esm/runtime/controller/item.js +0 -1141
  1743. package/esm/runtime/controller/item.js.map +0 -1
  1744. package/esm/runtime/controller/layout.d.ts +0 -33
  1745. package/esm/runtime/controller/layout.js +0 -300
  1746. package/esm/runtime/controller/layout.js.map +0 -1
  1747. package/esm/runtime/controller/plugin.d.ts +0 -45
  1748. package/esm/runtime/controller/plugin.js +0 -173
  1749. package/esm/runtime/controller/plugin.js.map +0 -1
  1750. package/esm/runtime/controller/theme.d.ts +0 -29
  1751. package/esm/runtime/controller/theme.js +0 -58
  1752. package/esm/runtime/controller/theme.js.map +0 -1
  1753. package/esm/runtime/controller/viewport.d.ts +0 -11
  1754. package/esm/runtime/controller/viewport.js +0 -102
  1755. package/esm/runtime/controller/viewport.js.map +0 -1
  1756. package/esm/runtime/hooks.d.ts +0 -33
  1757. package/esm/runtime/hooks.js +0 -74
  1758. package/esm/runtime/hooks.js.map +0 -1
  1759. package/esm/stdlib/behavior/activate-relations.d.ts +0 -61
  1760. package/esm/stdlib/behavior/activate-relations.js +0 -85
  1761. package/esm/stdlib/behavior/activate-relations.js.map +0 -1
  1762. package/esm/stdlib/behavior/brush-select.d.ts +0 -109
  1763. package/esm/stdlib/behavior/brush-select.js +0 -268
  1764. package/esm/stdlib/behavior/brush-select.js.map +0 -1
  1765. package/esm/stdlib/behavior/click-select.d.ts +0 -73
  1766. package/esm/stdlib/behavior/click-select.js +0 -157
  1767. package/esm/stdlib/behavior/click-select.js.map +0 -1
  1768. package/esm/stdlib/behavior/collapse-expand-combo.d.ts +0 -28
  1769. package/esm/stdlib/behavior/collapse-expand-combo.js +0 -35
  1770. package/esm/stdlib/behavior/collapse-expand-combo.js.map +0 -1
  1771. package/esm/stdlib/behavior/collapse-expand-tree.d.ts +0 -44
  1772. package/esm/stdlib/behavior/collapse-expand-tree.js +0 -69
  1773. package/esm/stdlib/behavior/collapse-expand-tree.js.map +0 -1
  1774. package/esm/stdlib/behavior/drag-canvas.d.ts +0 -81
  1775. package/esm/stdlib/behavior/drag-canvas.js +0 -250
  1776. package/esm/stdlib/behavior/drag-canvas.js.map +0 -1
  1777. package/esm/stdlib/behavior/drag-combo.d.ts +0 -111
  1778. package/esm/stdlib/behavior/drag-combo.js +0 -380
  1779. package/esm/stdlib/behavior/drag-combo.js.map +0 -1
  1780. package/esm/stdlib/behavior/drag-node.d.ts +0 -100
  1781. package/esm/stdlib/behavior/drag-node.js +0 -439
  1782. package/esm/stdlib/behavior/drag-node.js.map +0 -1
  1783. package/esm/stdlib/behavior/hover-activate.d.ts +0 -42
  1784. package/esm/stdlib/behavior/hover-activate.js +0 -64
  1785. package/esm/stdlib/behavior/hover-activate.js.map +0 -1
  1786. package/esm/stdlib/behavior/index.d.ts +0 -16
  1787. package/esm/stdlib/behavior/index.js +0 -17
  1788. package/esm/stdlib/behavior/index.js.map +0 -1
  1789. package/esm/stdlib/behavior/lasso-select.d.ts +0 -31
  1790. package/esm/stdlib/behavior/lasso-select.js +0 -79
  1791. package/esm/stdlib/behavior/lasso-select.js.map +0 -1
  1792. package/esm/stdlib/behavior/orbit-canvas-3d.d.ts +0 -36
  1793. package/esm/stdlib/behavior/orbit-canvas-3d.js +0 -62
  1794. package/esm/stdlib/behavior/orbit-canvas-3d.js.map +0 -1
  1795. package/esm/stdlib/behavior/rotate-canvas-3d.d.ts +0 -60
  1796. package/esm/stdlib/behavior/rotate-canvas-3d.js +0 -123
  1797. package/esm/stdlib/behavior/rotate-canvas-3d.js.map +0 -1
  1798. package/esm/stdlib/behavior/shortcuts-call.d.ts +0 -38
  1799. package/esm/stdlib/behavior/shortcuts-call.js +0 -80
  1800. package/esm/stdlib/behavior/shortcuts-call.js.map +0 -1
  1801. package/esm/stdlib/behavior/track-canvas-3d.d.ts +0 -36
  1802. package/esm/stdlib/behavior/track-canvas-3d.js +0 -62
  1803. package/esm/stdlib/behavior/track-canvas-3d.js.map +0 -1
  1804. package/esm/stdlib/behavior/types.d.ts +0 -13
  1805. package/esm/stdlib/behavior/types.js.map +0 -1
  1806. package/esm/stdlib/behavior/zoom-canvas-3d.d.ts +0 -58
  1807. package/esm/stdlib/behavior/zoom-canvas-3d.js +0 -98
  1808. package/esm/stdlib/behavior/zoom-canvas-3d.js.map +0 -1
  1809. package/esm/stdlib/behavior/zoom-canvas.d.ts +0 -68
  1810. package/esm/stdlib/behavior/zoom-canvas.js +0 -169
  1811. package/esm/stdlib/behavior/zoom-canvas.js.map +0 -1
  1812. package/esm/stdlib/data/index.d.ts +0 -3
  1813. package/esm/stdlib/data/index.js +0 -4
  1814. package/esm/stdlib/data/index.js.map +0 -1
  1815. package/esm/stdlib/data/mapNodeSize.d.ts +0 -12
  1816. package/esm/stdlib/data/mapNodeSize.js +0 -43
  1817. package/esm/stdlib/data/mapNodeSize.js.map +0 -1
  1818. package/esm/stdlib/data/transformV4Data.d.ts +0 -9
  1819. package/esm/stdlib/data/transformV4Data.js +0 -142
  1820. package/esm/stdlib/data/transformV4Data.js.map +0 -1
  1821. package/esm/stdlib/data/validateData.d.ts +0 -9
  1822. package/esm/stdlib/data/validateData.js +0 -103
  1823. package/esm/stdlib/data/validateData.js.map +0 -1
  1824. package/esm/stdlib/index.d.ts +0 -150
  1825. package/esm/stdlib/index.js +0 -205
  1826. package/esm/stdlib/index.js.map +0 -1
  1827. package/esm/stdlib/item/combo/circle.d.ts +0 -29
  1828. package/esm/stdlib/item/combo/circle.js +0 -56
  1829. package/esm/stdlib/item/combo/circle.js.map +0 -1
  1830. package/esm/stdlib/item/combo/index.d.ts +0 -2
  1831. package/esm/stdlib/item/combo/index.js +0 -3
  1832. package/esm/stdlib/item/combo/index.js.map +0 -1
  1833. package/esm/stdlib/item/combo/rect.d.ts +0 -31
  1834. package/esm/stdlib/item/combo/rect.js +0 -65
  1835. package/esm/stdlib/item/combo/rect.js.map +0 -1
  1836. package/esm/stdlib/item/edge/base.d.ts +0 -210
  1837. package/esm/stdlib/item/edge/base.js +0 -444
  1838. package/esm/stdlib/item/edge/base.js.map +0 -1
  1839. package/esm/stdlib/item/edge/cubic-horizontal.d.ts +0 -36
  1840. package/esm/stdlib/item/edge/cubic-horizontal.js +0 -56
  1841. package/esm/stdlib/item/edge/cubic-horizontal.js.map +0 -1
  1842. package/esm/stdlib/item/edge/cubic-vertical.d.ts +0 -36
  1843. package/esm/stdlib/item/edge/cubic-vertical.js +0 -56
  1844. package/esm/stdlib/item/edge/cubic-vertical.js.map +0 -1
  1845. package/esm/stdlib/item/edge/cubic.d.ts +0 -59
  1846. package/esm/stdlib/item/edge/cubic.js +0 -116
  1847. package/esm/stdlib/item/edge/cubic.js.map +0 -1
  1848. package/esm/stdlib/item/edge/index.d.ts +0 -7
  1849. package/esm/stdlib/item/edge/index.js +0 -8
  1850. package/esm/stdlib/item/edge/index.js.map +0 -1
  1851. package/esm/stdlib/item/edge/line.d.ts +0 -33
  1852. package/esm/stdlib/item/edge/line.js +0 -63
  1853. package/esm/stdlib/item/edge/line.js.map +0 -1
  1854. package/esm/stdlib/item/edge/loop.d.ts +0 -32
  1855. package/esm/stdlib/item/edge/loop.js +0 -115
  1856. package/esm/stdlib/item/edge/loop.js.map +0 -1
  1857. package/esm/stdlib/item/edge/polyline.d.ts +0 -45
  1858. package/esm/stdlib/item/edge/polyline.js +0 -92
  1859. package/esm/stdlib/item/edge/polyline.js.map +0 -1
  1860. package/esm/stdlib/item/edge/quadratic.d.ts +0 -40
  1861. package/esm/stdlib/item/edge/quadratic.js +0 -78
  1862. package/esm/stdlib/item/edge/quadratic.js.map +0 -1
  1863. package/esm/stdlib/item/node/base.d.ts +0 -256
  1864. package/esm/stdlib/item/node/base.js +0 -596
  1865. package/esm/stdlib/item/node/base.js.map +0 -1
  1866. package/esm/stdlib/item/node/base3d.d.ts +0 -96
  1867. package/esm/stdlib/item/node/base3d.js +0 -129
  1868. package/esm/stdlib/item/node/base3d.js.map +0 -1
  1869. package/esm/stdlib/item/node/circle.d.ts +0 -30
  1870. package/esm/stdlib/item/node/circle.js +0 -56
  1871. package/esm/stdlib/item/node/circle.js.map +0 -1
  1872. package/esm/stdlib/item/node/diamond.d.ts +0 -32
  1873. package/esm/stdlib/item/node/diamond.js +0 -79
  1874. package/esm/stdlib/item/node/diamond.js.map +0 -1
  1875. package/esm/stdlib/item/node/donut.d.ts +0 -70
  1876. package/esm/stdlib/item/node/donut.js +0 -207
  1877. package/esm/stdlib/item/node/donut.js.map +0 -1
  1878. package/esm/stdlib/item/node/ellipse.d.ts +0 -32
  1879. package/esm/stdlib/item/node/ellipse.js +0 -71
  1880. package/esm/stdlib/item/node/ellipse.js.map +0 -1
  1881. package/esm/stdlib/item/node/hexagon.d.ts +0 -33
  1882. package/esm/stdlib/item/node/hexagon.js +0 -109
  1883. package/esm/stdlib/item/node/hexagon.js.map +0 -1
  1884. package/esm/stdlib/item/node/image.d.ts +0 -40
  1885. package/esm/stdlib/item/node/image.js +0 -110
  1886. package/esm/stdlib/item/node/image.js.map +0 -1
  1887. package/esm/stdlib/item/node/index.d.ts +0 -11
  1888. package/esm/stdlib/item/node/index.js +0 -12
  1889. package/esm/stdlib/item/node/index.js.map +0 -1
  1890. package/esm/stdlib/item/node/modelRect.d.ts +0 -61
  1891. package/esm/stdlib/item/node/modelRect.js +0 -186
  1892. package/esm/stdlib/item/node/modelRect.js.map +0 -1
  1893. package/esm/stdlib/item/node/rect.d.ts +0 -32
  1894. package/esm/stdlib/item/node/rect.js +0 -75
  1895. package/esm/stdlib/item/node/rect.js.map +0 -1
  1896. package/esm/stdlib/item/node/sphere.d.ts +0 -33
  1897. package/esm/stdlib/item/node/sphere.js +0 -52
  1898. package/esm/stdlib/item/node/sphere.js.map +0 -1
  1899. package/esm/stdlib/item/node/star.d.ts +0 -34
  1900. package/esm/stdlib/item/node/star.js +0 -115
  1901. package/esm/stdlib/item/node/star.js.map +0 -1
  1902. package/esm/stdlib/item/node/triangle.d.ts +0 -44
  1903. package/esm/stdlib/item/node/triangle.js +0 -177
  1904. package/esm/stdlib/item/node/triangle.js.map +0 -1
  1905. package/esm/stdlib/plugin/fisheye/index.d.ts +0 -130
  1906. package/esm/stdlib/plugin/fisheye/index.js +0 -488
  1907. package/esm/stdlib/plugin/fisheye/index.js.map +0 -1
  1908. package/esm/stdlib/plugin/grid/index.d.ts +0 -36
  1909. package/esm/stdlib/plugin/grid/index.js +0 -81
  1910. package/esm/stdlib/plugin/grid/index.js.map +0 -1
  1911. package/esm/stdlib/plugin/history/combo-command.d.ts +0 -9
  1912. package/esm/stdlib/plugin/history/combo-command.js +0 -21
  1913. package/esm/stdlib/plugin/history/combo-command.js.map +0 -1
  1914. package/esm/stdlib/plugin/history/command.d.ts +0 -18
  1915. package/esm/stdlib/plugin/history/command.js +0 -51
  1916. package/esm/stdlib/plugin/history/command.js.map +0 -1
  1917. package/esm/stdlib/plugin/history/index.d.ts +0 -112
  1918. package/esm/stdlib/plugin/history/index.js +0 -275
  1919. package/esm/stdlib/plugin/history/index.js.map +0 -1
  1920. package/esm/stdlib/plugin/history/item-data-command.d.ts +0 -14
  1921. package/esm/stdlib/plugin/history/item-data-command.js +0 -63
  1922. package/esm/stdlib/plugin/history/item-data-command.js.map +0 -1
  1923. package/esm/stdlib/plugin/history/layer-updated-command.d.ts +0 -9
  1924. package/esm/stdlib/plugin/history/layer-updated-command.js +0 -21
  1925. package/esm/stdlib/plugin/history/layer-updated-command.js.map +0 -1
  1926. package/esm/stdlib/plugin/history/state-updated-command.d.ts +0 -9
  1927. package/esm/stdlib/plugin/history/state-updated-command.js +0 -20
  1928. package/esm/stdlib/plugin/history/state-updated-command.js.map +0 -1
  1929. package/esm/stdlib/plugin/history/visibility-updated-command.d.ts +0 -10
  1930. package/esm/stdlib/plugin/history/visibility-updated-command.js +0 -23
  1931. package/esm/stdlib/plugin/history/visibility-updated-command.js.map +0 -1
  1932. package/esm/stdlib/plugin/hull/bubbleset.d.ts +0 -9
  1933. package/esm/stdlib/plugin/hull/bubbleset.js +0 -592
  1934. package/esm/stdlib/plugin/hull/bubbleset.js.map +0 -1
  1935. package/esm/stdlib/plugin/hull/convexHull.d.ts +0 -14
  1936. package/esm/stdlib/plugin/hull/convexHull.js +0 -56
  1937. package/esm/stdlib/plugin/hull/convexHull.js.map +0 -1
  1938. package/esm/stdlib/plugin/hull/hullComponent.d.ts +0 -87
  1939. package/esm/stdlib/plugin/hull/hullComponent.js +0 -382
  1940. package/esm/stdlib/plugin/hull/hullComponent.js.map +0 -1
  1941. package/esm/stdlib/plugin/hull/index.d.ts +0 -59
  1942. package/esm/stdlib/plugin/hull/index.js +0 -161
  1943. package/esm/stdlib/plugin/hull/index.js.map +0 -1
  1944. package/esm/stdlib/plugin/hull/types.d.ts +0 -15
  1945. package/esm/stdlib/plugin/hull/types.js.map +0 -1
  1946. package/esm/stdlib/plugin/hull/util.d.ts +0 -77
  1947. package/esm/stdlib/plugin/hull/util.js +0 -401
  1948. package/esm/stdlib/plugin/hull/util.js.map +0 -1
  1949. package/esm/stdlib/plugin/index.d.ts +0 -9
  1950. package/esm/stdlib/plugin/index.js +0 -10
  1951. package/esm/stdlib/plugin/index.js.map +0 -1
  1952. package/esm/stdlib/plugin/legend/index.d.ts +0 -163
  1953. package/esm/stdlib/plugin/legend/index.js +0 -594
  1954. package/esm/stdlib/plugin/legend/index.js.map +0 -1
  1955. package/esm/stdlib/plugin/menu/index.d.ts +0 -55
  1956. package/esm/stdlib/plugin/menu/index.js +0 -237
  1957. package/esm/stdlib/plugin/menu/index.js.map +0 -1
  1958. package/esm/stdlib/plugin/minimap/index.d.ts +0 -114
  1959. package/esm/stdlib/plugin/minimap/index.js +0 -576
  1960. package/esm/stdlib/plugin/minimap/index.js.map +0 -1
  1961. package/esm/stdlib/plugin/timebar/index.d.ts +0 -98
  1962. package/esm/stdlib/plugin/timebar/index.js +0 -303
  1963. package/esm/stdlib/plugin/timebar/index.js.map +0 -1
  1964. package/esm/stdlib/plugin/toolbar/index.d.ts +0 -59
  1965. package/esm/stdlib/plugin/toolbar/index.js +0 -215
  1966. package/esm/stdlib/plugin/toolbar/index.js.map +0 -1
  1967. package/esm/stdlib/plugin/tooltip/index.d.ts +0 -96
  1968. package/esm/stdlib/plugin/tooltip/index.js +0 -378
  1969. package/esm/stdlib/plugin/tooltip/index.js.map +0 -1
  1970. package/esm/stdlib/plugin/types.d.ts +0 -9
  1971. package/esm/stdlib/plugin/types.js.map +0 -1
  1972. package/esm/stdlib/selector/lasso.d.ts +0 -15
  1973. package/esm/stdlib/selector/lasso.js +0 -61
  1974. package/esm/stdlib/selector/lasso.js.map +0 -1
  1975. package/esm/stdlib/selector/rect.d.ts +0 -16
  1976. package/esm/stdlib/selector/rect.js +0 -54
  1977. package/esm/stdlib/selector/rect.js.map +0 -1
  1978. package/esm/stdlib/theme/dark.d.ts +0 -2
  1979. package/esm/stdlib/theme/dark.js +0 -332
  1980. package/esm/stdlib/theme/dark.js.map +0 -1
  1981. package/esm/stdlib/theme/index.d.ts +0 -2
  1982. package/esm/stdlib/theme/index.js +0 -3
  1983. package/esm/stdlib/theme/index.js.map +0 -1
  1984. package/esm/stdlib/theme/light.d.ts +0 -2
  1985. package/esm/stdlib/theme/light.js +0 -330
  1986. package/esm/stdlib/theme/light.js.map +0 -1
  1987. package/esm/stdlib/themeSolver/base.d.ts +0 -15
  1988. package/esm/stdlib/themeSolver/base.js +0 -11
  1989. package/esm/stdlib/themeSolver/base.js.map +0 -1
  1990. package/esm/stdlib/themeSolver/index.d.ts +0 -3
  1991. package/esm/stdlib/themeSolver/index.js +0 -4
  1992. package/esm/stdlib/themeSolver/index.js.map +0 -1
  1993. package/esm/stdlib/themeSolver/spec.d.ts +0 -35
  1994. package/esm/stdlib/themeSolver/spec.js +0 -66
  1995. package/esm/stdlib/themeSolver/spec.js.map +0 -1
  1996. package/esm/stdlib/themeSolver/subject.d.ts +0 -41
  1997. package/esm/stdlib/themeSolver/subject.js +0 -396
  1998. package/esm/stdlib/themeSolver/subject.js.map +0 -1
  1999. package/esm/types/animate.d.ts +0 -59
  2000. package/esm/types/animate.js +0 -2
  2001. package/esm/types/animate.js.map +0 -1
  2002. package/esm/types/behavior.d.ts +0 -45
  2003. package/esm/types/behavior.js +0 -14
  2004. package/esm/types/behavior.js.map +0 -1
  2005. package/esm/types/common.d.ts +0 -17
  2006. package/esm/types/common.js +0 -2
  2007. package/esm/types/common.js.map +0 -1
  2008. package/esm/types/graph.d.ts +0 -594
  2009. package/esm/types/graph.js.map +0 -1
  2010. package/esm/types/hook.d.ts +0 -124
  2011. package/esm/types/hook.js +0 -2
  2012. package/esm/types/hook.js.map +0 -1
  2013. package/esm/types/item.d.ts +0 -241
  2014. package/esm/types/item.js +0 -16
  2015. package/esm/types/item.js.map +0 -1
  2016. package/esm/types/loop.d.ts +0 -21
  2017. package/esm/types/loop.js +0 -12
  2018. package/esm/types/loop.js.map +0 -1
  2019. package/esm/types/render.d.ts +0 -1
  2020. package/esm/types/render.js +0 -2
  2021. package/esm/types/render.js.map +0 -1
  2022. package/esm/types/spec.d.ts +0 -82
  2023. package/esm/types/spec.js +0 -2
  2024. package/esm/types/spec.js.map +0 -1
  2025. package/esm/types/stdlib.d.ts +0 -13
  2026. package/esm/types/stdlib.js +0 -2
  2027. package/esm/types/stdlib.js.map +0 -1
  2028. package/esm/types/theme.d.ts +0 -168
  2029. package/esm/types/theme.js +0 -14
  2030. package/esm/types/theme.js.map +0 -1
  2031. package/esm/types/view.d.ts +0 -23
  2032. package/esm/types/view.js +0 -2
  2033. package/esm/types/view.js.map +0 -1
  2034. package/esm/util/animate.d.ts +0 -106
  2035. package/esm/util/animate.js +0 -391
  2036. package/esm/util/animate.js.map +0 -1
  2037. package/esm/util/array.d.ts +0 -28
  2038. package/esm/util/array.js +0 -70
  2039. package/esm/util/array.js.map +0 -1
  2040. package/esm/util/arrow.d.ts +0 -17
  2041. package/esm/util/arrow.js +0 -56
  2042. package/esm/util/arrow.js.map +0 -1
  2043. package/esm/util/bbox.d.ts +0 -106
  2044. package/esm/util/bbox.js +0 -255
  2045. package/esm/util/bbox.js.map +0 -1
  2046. package/esm/util/behavior.d.ts +0 -2
  2047. package/esm/util/behavior.js +0 -12
  2048. package/esm/util/behavior.js.map +0 -1
  2049. package/esm/util/canvas.d.ts +0 -19
  2050. package/esm/util/canvas.js +0 -66
  2051. package/esm/util/canvas.js.map +0 -1
  2052. package/esm/util/data.d.ts +0 -96
  2053. package/esm/util/data.js +0 -262
  2054. package/esm/util/data.js.map +0 -1
  2055. package/esm/util/event.d.ts +0 -40
  2056. package/esm/util/event.js +0 -96
  2057. package/esm/util/event.js.map +0 -1
  2058. package/esm/util/extend.d.ts +0 -27
  2059. package/esm/util/extend.js +0 -22
  2060. package/esm/util/extend.js.map +0 -1
  2061. package/esm/util/extension.d.ts +0 -10
  2062. package/esm/util/extension.js +0 -24
  2063. package/esm/util/extension.js.map +0 -1
  2064. package/esm/util/index.d.ts +0 -52
  2065. package/esm/util/index.js +0 -24
  2066. package/esm/util/index.js.map +0 -1
  2067. package/esm/util/item.d.ts +0 -15
  2068. package/esm/util/item.js +0 -67
  2069. package/esm/util/item.js.map +0 -1
  2070. package/esm/util/layout.d.ts +0 -40
  2071. package/esm/util/layout.js +0 -160
  2072. package/esm/util/layout.js.map +0 -1
  2073. package/esm/util/loop.d.ts +0 -37
  2074. package/esm/util/loop.js +0 -104
  2075. package/esm/util/loop.js.map +0 -1
  2076. package/esm/util/mapper.d.ts +0 -17
  2077. package/esm/util/mapper.js +0 -55
  2078. package/esm/util/mapper.js.map +0 -1
  2079. package/esm/util/math.d.ts +0 -23
  2080. package/esm/util/math.js +0 -23
  2081. package/esm/util/math.js.map +0 -1
  2082. package/esm/util/mock.d.ts +0 -30
  2083. package/esm/util/mock.js +0 -69
  2084. package/esm/util/mock.js.map +0 -1
  2085. package/esm/util/path.d.ts +0 -11
  2086. package/esm/util/path.js +0 -44
  2087. package/esm/util/path.js.map +0 -1
  2088. package/esm/util/point.d.ts +0 -83
  2089. package/esm/util/point.js +0 -185
  2090. package/esm/util/point.js.map +0 -1
  2091. package/esm/util/polyline.d.ts +0 -113
  2092. package/esm/util/polyline.js +0 -505
  2093. package/esm/util/polyline.js.map +0 -1
  2094. package/esm/util/router.d.ts +0 -32
  2095. package/esm/util/router.js +0 -383
  2096. package/esm/util/router.js.map +0 -1
  2097. package/esm/util/shape.d.ts +0 -140
  2098. package/esm/util/shape.js +0 -620
  2099. package/esm/util/shape.js.map +0 -1
  2100. package/esm/util/shape3d.d.ts +0 -23
  2101. package/esm/util/shape3d.js +0 -153
  2102. package/esm/util/shape3d.js.map +0 -1
  2103. package/esm/util/text.d.ts +0 -18
  2104. package/esm/util/text.js +0 -36
  2105. package/esm/util/text.js.map +0 -1
  2106. package/esm/util/type.d.ts +0 -8
  2107. package/esm/util/type.js +0 -8
  2108. package/esm/util/type.js.map +0 -1
  2109. package/esm/util/zoom.d.ts +0 -17
  2110. package/esm/util/zoom.js +0 -40
  2111. package/esm/util/zoom.js.map +0 -1
  2112. package/lib/api-doc/behaviors.d.ts +0 -2
  2113. package/lib/api-doc/behaviors.js +0 -18
  2114. package/lib/api-doc/behaviors.js.map +0 -1
  2115. package/lib/api-doc/graph.d.ts +0 -4
  2116. package/lib/api-doc/graph.js +0 -11
  2117. package/lib/api-doc/graph.js.map +0 -1
  2118. package/lib/api-doc/item.d.ts +0 -11
  2119. package/lib/api-doc/item.js +0 -25
  2120. package/lib/api-doc/item.js.map +0 -1
  2121. package/lib/api-doc/layout.d.ts +0 -1
  2122. package/lib/api-doc/layout.js.map +0 -1
  2123. package/lib/api-doc/plugins.d.ts +0 -1
  2124. package/lib/api-doc/plugins.js +0 -18
  2125. package/lib/api-doc/plugins.js.map +0 -1
  2126. package/lib/api-doc/types.d.ts +0 -0
  2127. package/lib/api-doc/types.js +0 -3
  2128. package/lib/api-doc/types.js.map +0 -1
  2129. package/lib/api-doc/util.d.ts +0 -3
  2130. package/lib/api-doc/util.js +0 -10
  2131. package/lib/api-doc/util.js.map +0 -1
  2132. package/lib/constant/index.d.ts +0 -1
  2133. package/lib/constant/index.js +0 -18
  2134. package/lib/constant/index.js.map +0 -1
  2135. package/lib/constant/shape.d.ts +0 -23
  2136. package/lib/constant/shape.js +0 -30
  2137. package/lib/constant/shape.js.map +0 -1
  2138. package/lib/item/combo.d.ts +0 -81
  2139. package/lib/item/combo.js +0 -194
  2140. package/lib/item/combo.js.map +0 -1
  2141. package/lib/item/edge.d.ts +0 -57
  2142. package/lib/item/edge.js +0 -148
  2143. package/lib/item/edge.js.map +0 -1
  2144. package/lib/item/item.d.ts +0 -191
  2145. package/lib/item/item.js +0 -704
  2146. package/lib/item/item.js.map +0 -1
  2147. package/lib/item/node.d.ts +0 -63
  2148. package/lib/item/node.js +0 -201
  2149. package/lib/item/node.js.map +0 -1
  2150. package/lib/runtime/controller/data.d.ts +0 -89
  2151. package/lib/runtime/controller/data.js +0 -882
  2152. package/lib/runtime/controller/data.js.map +0 -1
  2153. package/lib/runtime/controller/extension.d.ts +0 -9
  2154. package/lib/runtime/controller/extension.js +0 -15
  2155. package/lib/runtime/controller/extension.js.map +0 -1
  2156. package/lib/runtime/controller/index.d.ts +0 -7
  2157. package/lib/runtime/controller/index.js +0 -24
  2158. package/lib/runtime/controller/index.js.map +0 -1
  2159. package/lib/runtime/controller/interaction.d.ts +0 -52
  2160. package/lib/runtime/controller/interaction.js +0 -278
  2161. package/lib/runtime/controller/interaction.js.map +0 -1
  2162. package/lib/runtime/controller/item.d.ts +0 -143
  2163. package/lib/runtime/controller/item.js +0 -1148
  2164. package/lib/runtime/controller/item.js.map +0 -1
  2165. package/lib/runtime/controller/layout.d.ts +0 -33
  2166. package/lib/runtime/controller/layout.js +0 -327
  2167. package/lib/runtime/controller/layout.js.map +0 -1
  2168. package/lib/runtime/controller/plugin.d.ts +0 -45
  2169. package/lib/runtime/controller/plugin.js +0 -180
  2170. package/lib/runtime/controller/plugin.js.map +0 -1
  2171. package/lib/runtime/controller/theme.d.ts +0 -29
  2172. package/lib/runtime/controller/theme.js +0 -65
  2173. package/lib/runtime/controller/theme.js.map +0 -1
  2174. package/lib/runtime/controller/viewport.d.ts +0 -11
  2175. package/lib/runtime/controller/viewport.js +0 -106
  2176. package/lib/runtime/controller/viewport.js.map +0 -1
  2177. package/lib/runtime/hooks.d.ts +0 -33
  2178. package/lib/runtime/hooks.js +0 -77
  2179. package/lib/runtime/hooks.js.map +0 -1
  2180. package/lib/stdlib/behavior/activate-relations.d.ts +0 -61
  2181. package/lib/stdlib/behavior/activate-relations.js +0 -89
  2182. package/lib/stdlib/behavior/activate-relations.js.map +0 -1
  2183. package/lib/stdlib/behavior/brush-select.d.ts +0 -109
  2184. package/lib/stdlib/behavior/brush-select.js +0 -272
  2185. package/lib/stdlib/behavior/brush-select.js.map +0 -1
  2186. package/lib/stdlib/behavior/click-select.d.ts +0 -73
  2187. package/lib/stdlib/behavior/click-select.js +0 -161
  2188. package/lib/stdlib/behavior/click-select.js.map +0 -1
  2189. package/lib/stdlib/behavior/collapse-expand-combo.d.ts +0 -28
  2190. package/lib/stdlib/behavior/collapse-expand-combo.js +0 -39
  2191. package/lib/stdlib/behavior/collapse-expand-combo.js.map +0 -1
  2192. package/lib/stdlib/behavior/collapse-expand-tree.d.ts +0 -44
  2193. package/lib/stdlib/behavior/collapse-expand-tree.js +0 -73
  2194. package/lib/stdlib/behavior/collapse-expand-tree.js.map +0 -1
  2195. package/lib/stdlib/behavior/drag-canvas.d.ts +0 -81
  2196. package/lib/stdlib/behavior/drag-canvas.js +0 -254
  2197. package/lib/stdlib/behavior/drag-canvas.js.map +0 -1
  2198. package/lib/stdlib/behavior/drag-combo.d.ts +0 -111
  2199. package/lib/stdlib/behavior/drag-combo.js +0 -384
  2200. package/lib/stdlib/behavior/drag-combo.js.map +0 -1
  2201. package/lib/stdlib/behavior/drag-node.d.ts +0 -100
  2202. package/lib/stdlib/behavior/drag-node.js +0 -443
  2203. package/lib/stdlib/behavior/drag-node.js.map +0 -1
  2204. package/lib/stdlib/behavior/hover-activate.d.ts +0 -42
  2205. package/lib/stdlib/behavior/hover-activate.js +0 -68
  2206. package/lib/stdlib/behavior/hover-activate.js.map +0 -1
  2207. package/lib/stdlib/behavior/index.d.ts +0 -16
  2208. package/lib/stdlib/behavior/index.js +0 -33
  2209. package/lib/stdlib/behavior/index.js.map +0 -1
  2210. package/lib/stdlib/behavior/lasso-select.d.ts +0 -31
  2211. package/lib/stdlib/behavior/lasso-select.js +0 -83
  2212. package/lib/stdlib/behavior/lasso-select.js.map +0 -1
  2213. package/lib/stdlib/behavior/orbit-canvas-3d.d.ts +0 -36
  2214. package/lib/stdlib/behavior/orbit-canvas-3d.js +0 -66
  2215. package/lib/stdlib/behavior/orbit-canvas-3d.js.map +0 -1
  2216. package/lib/stdlib/behavior/rotate-canvas-3d.d.ts +0 -60
  2217. package/lib/stdlib/behavior/rotate-canvas-3d.js +0 -127
  2218. package/lib/stdlib/behavior/rotate-canvas-3d.js.map +0 -1
  2219. package/lib/stdlib/behavior/shortcuts-call.d.ts +0 -38
  2220. package/lib/stdlib/behavior/shortcuts-call.js +0 -84
  2221. package/lib/stdlib/behavior/shortcuts-call.js.map +0 -1
  2222. package/lib/stdlib/behavior/track-canvas-3d.d.ts +0 -36
  2223. package/lib/stdlib/behavior/track-canvas-3d.js +0 -66
  2224. package/lib/stdlib/behavior/track-canvas-3d.js.map +0 -1
  2225. package/lib/stdlib/behavior/types.d.ts +0 -13
  2226. package/lib/stdlib/behavior/types.js.map +0 -1
  2227. package/lib/stdlib/behavior/zoom-canvas-3d.d.ts +0 -58
  2228. package/lib/stdlib/behavior/zoom-canvas-3d.js +0 -102
  2229. package/lib/stdlib/behavior/zoom-canvas-3d.js.map +0 -1
  2230. package/lib/stdlib/behavior/zoom-canvas.d.ts +0 -68
  2231. package/lib/stdlib/behavior/zoom-canvas.js +0 -173
  2232. package/lib/stdlib/behavior/zoom-canvas.js.map +0 -1
  2233. package/lib/stdlib/data/index.d.ts +0 -3
  2234. package/lib/stdlib/data/index.js +0 -20
  2235. package/lib/stdlib/data/index.js.map +0 -1
  2236. package/lib/stdlib/data/mapNodeSize.d.ts +0 -12
  2237. package/lib/stdlib/data/mapNodeSize.js +0 -47
  2238. package/lib/stdlib/data/mapNodeSize.js.map +0 -1
  2239. package/lib/stdlib/data/transformV4Data.d.ts +0 -9
  2240. package/lib/stdlib/data/transformV4Data.js +0 -146
  2241. package/lib/stdlib/data/transformV4Data.js.map +0 -1
  2242. package/lib/stdlib/data/validateData.d.ts +0 -9
  2243. package/lib/stdlib/data/validateData.js +0 -107
  2244. package/lib/stdlib/data/validateData.js.map +0 -1
  2245. package/lib/stdlib/index.d.ts +0 -150
  2246. package/lib/stdlib/index.js +0 -237
  2247. package/lib/stdlib/index.js.map +0 -1
  2248. package/lib/stdlib/item/combo/circle.d.ts +0 -29
  2249. package/lib/stdlib/item/combo/circle.js +0 -60
  2250. package/lib/stdlib/item/combo/circle.js.map +0 -1
  2251. package/lib/stdlib/item/combo/index.d.ts +0 -2
  2252. package/lib/stdlib/item/combo/index.js +0 -19
  2253. package/lib/stdlib/item/combo/index.js.map +0 -1
  2254. package/lib/stdlib/item/combo/rect.d.ts +0 -31
  2255. package/lib/stdlib/item/combo/rect.js +0 -69
  2256. package/lib/stdlib/item/combo/rect.js.map +0 -1
  2257. package/lib/stdlib/item/edge/base.d.ts +0 -210
  2258. package/lib/stdlib/item/edge/base.js +0 -448
  2259. package/lib/stdlib/item/edge/base.js.map +0 -1
  2260. package/lib/stdlib/item/edge/cubic-horizontal.d.ts +0 -36
  2261. package/lib/stdlib/item/edge/cubic-horizontal.js +0 -60
  2262. package/lib/stdlib/item/edge/cubic-horizontal.js.map +0 -1
  2263. package/lib/stdlib/item/edge/cubic-vertical.d.ts +0 -36
  2264. package/lib/stdlib/item/edge/cubic-vertical.js +0 -60
  2265. package/lib/stdlib/item/edge/cubic-vertical.js.map +0 -1
  2266. package/lib/stdlib/item/edge/cubic.d.ts +0 -59
  2267. package/lib/stdlib/item/edge/cubic.js +0 -120
  2268. package/lib/stdlib/item/edge/cubic.js.map +0 -1
  2269. package/lib/stdlib/item/edge/index.d.ts +0 -7
  2270. package/lib/stdlib/item/edge/index.js +0 -24
  2271. package/lib/stdlib/item/edge/index.js.map +0 -1
  2272. package/lib/stdlib/item/edge/line.d.ts +0 -33
  2273. package/lib/stdlib/item/edge/line.js +0 -67
  2274. package/lib/stdlib/item/edge/line.js.map +0 -1
  2275. package/lib/stdlib/item/edge/loop.d.ts +0 -32
  2276. package/lib/stdlib/item/edge/loop.js +0 -119
  2277. package/lib/stdlib/item/edge/loop.js.map +0 -1
  2278. package/lib/stdlib/item/edge/polyline.d.ts +0 -45
  2279. package/lib/stdlib/item/edge/polyline.js +0 -96
  2280. package/lib/stdlib/item/edge/polyline.js.map +0 -1
  2281. package/lib/stdlib/item/edge/quadratic.d.ts +0 -40
  2282. package/lib/stdlib/item/edge/quadratic.js +0 -82
  2283. package/lib/stdlib/item/edge/quadratic.js.map +0 -1
  2284. package/lib/stdlib/item/node/base.d.ts +0 -256
  2285. package/lib/stdlib/item/node/base.js +0 -600
  2286. package/lib/stdlib/item/node/base.js.map +0 -1
  2287. package/lib/stdlib/item/node/base3d.d.ts +0 -96
  2288. package/lib/stdlib/item/node/base3d.js +0 -133
  2289. package/lib/stdlib/item/node/base3d.js.map +0 -1
  2290. package/lib/stdlib/item/node/circle.d.ts +0 -30
  2291. package/lib/stdlib/item/node/circle.js +0 -60
  2292. package/lib/stdlib/item/node/circle.js.map +0 -1
  2293. package/lib/stdlib/item/node/diamond.d.ts +0 -32
  2294. package/lib/stdlib/item/node/diamond.js +0 -83
  2295. package/lib/stdlib/item/node/diamond.js.map +0 -1
  2296. package/lib/stdlib/item/node/donut.d.ts +0 -70
  2297. package/lib/stdlib/item/node/donut.js +0 -211
  2298. package/lib/stdlib/item/node/donut.js.map +0 -1
  2299. package/lib/stdlib/item/node/ellipse.d.ts +0 -32
  2300. package/lib/stdlib/item/node/ellipse.js +0 -75
  2301. package/lib/stdlib/item/node/ellipse.js.map +0 -1
  2302. package/lib/stdlib/item/node/hexagon.d.ts +0 -33
  2303. package/lib/stdlib/item/node/hexagon.js +0 -113
  2304. package/lib/stdlib/item/node/hexagon.js.map +0 -1
  2305. package/lib/stdlib/item/node/image.d.ts +0 -40
  2306. package/lib/stdlib/item/node/image.js +0 -114
  2307. package/lib/stdlib/item/node/image.js.map +0 -1
  2308. package/lib/stdlib/item/node/index.d.ts +0 -11
  2309. package/lib/stdlib/item/node/index.js +0 -28
  2310. package/lib/stdlib/item/node/index.js.map +0 -1
  2311. package/lib/stdlib/item/node/modelRect.d.ts +0 -61
  2312. package/lib/stdlib/item/node/modelRect.js +0 -190
  2313. package/lib/stdlib/item/node/modelRect.js.map +0 -1
  2314. package/lib/stdlib/item/node/rect.d.ts +0 -32
  2315. package/lib/stdlib/item/node/rect.js +0 -79
  2316. package/lib/stdlib/item/node/rect.js.map +0 -1
  2317. package/lib/stdlib/item/node/sphere.d.ts +0 -33
  2318. package/lib/stdlib/item/node/sphere.js +0 -56
  2319. package/lib/stdlib/item/node/sphere.js.map +0 -1
  2320. package/lib/stdlib/item/node/star.d.ts +0 -34
  2321. package/lib/stdlib/item/node/star.js +0 -119
  2322. package/lib/stdlib/item/node/star.js.map +0 -1
  2323. package/lib/stdlib/item/node/triangle.d.ts +0 -44
  2324. package/lib/stdlib/item/node/triangle.js +0 -181
  2325. package/lib/stdlib/item/node/triangle.js.map +0 -1
  2326. package/lib/stdlib/plugin/fisheye/index.d.ts +0 -130
  2327. package/lib/stdlib/plugin/fisheye/index.js +0 -492
  2328. package/lib/stdlib/plugin/fisheye/index.js.map +0 -1
  2329. package/lib/stdlib/plugin/grid/index.d.ts +0 -36
  2330. package/lib/stdlib/plugin/grid/index.js +0 -85
  2331. package/lib/stdlib/plugin/grid/index.js.map +0 -1
  2332. package/lib/stdlib/plugin/history/combo-command.d.ts +0 -9
  2333. package/lib/stdlib/plugin/history/combo-command.js +0 -25
  2334. package/lib/stdlib/plugin/history/combo-command.js.map +0 -1
  2335. package/lib/stdlib/plugin/history/command.d.ts +0 -18
  2336. package/lib/stdlib/plugin/history/command.js +0 -54
  2337. package/lib/stdlib/plugin/history/command.js.map +0 -1
  2338. package/lib/stdlib/plugin/history/index.d.ts +0 -112
  2339. package/lib/stdlib/plugin/history/index.js +0 -283
  2340. package/lib/stdlib/plugin/history/index.js.map +0 -1
  2341. package/lib/stdlib/plugin/history/item-data-command.d.ts +0 -14
  2342. package/lib/stdlib/plugin/history/item-data-command.js +0 -67
  2343. package/lib/stdlib/plugin/history/item-data-command.js.map +0 -1
  2344. package/lib/stdlib/plugin/history/layer-updated-command.d.ts +0 -9
  2345. package/lib/stdlib/plugin/history/layer-updated-command.js +0 -25
  2346. package/lib/stdlib/plugin/history/layer-updated-command.js.map +0 -1
  2347. package/lib/stdlib/plugin/history/state-updated-command.d.ts +0 -9
  2348. package/lib/stdlib/plugin/history/state-updated-command.js +0 -24
  2349. package/lib/stdlib/plugin/history/state-updated-command.js.map +0 -1
  2350. package/lib/stdlib/plugin/history/visibility-updated-command.d.ts +0 -10
  2351. package/lib/stdlib/plugin/history/visibility-updated-command.js +0 -27
  2352. package/lib/stdlib/plugin/history/visibility-updated-command.js.map +0 -1
  2353. package/lib/stdlib/plugin/hull/bubbleset.d.ts +0 -9
  2354. package/lib/stdlib/plugin/hull/bubbleset.js +0 -596
  2355. package/lib/stdlib/plugin/hull/bubbleset.js.map +0 -1
  2356. package/lib/stdlib/plugin/hull/convexHull.d.ts +0 -14
  2357. package/lib/stdlib/plugin/hull/convexHull.js +0 -61
  2358. package/lib/stdlib/plugin/hull/convexHull.js.map +0 -1
  2359. package/lib/stdlib/plugin/hull/hullComponent.d.ts +0 -87
  2360. package/lib/stdlib/plugin/hull/hullComponent.js +0 -385
  2361. package/lib/stdlib/plugin/hull/hullComponent.js.map +0 -1
  2362. package/lib/stdlib/plugin/hull/index.d.ts +0 -59
  2363. package/lib/stdlib/plugin/hull/index.js +0 -167
  2364. package/lib/stdlib/plugin/hull/index.js.map +0 -1
  2365. package/lib/stdlib/plugin/hull/types.d.ts +0 -15
  2366. package/lib/stdlib/plugin/hull/types.js.map +0 -1
  2367. package/lib/stdlib/plugin/hull/util.d.ts +0 -77
  2368. package/lib/stdlib/plugin/hull/util.js +0 -419
  2369. package/lib/stdlib/plugin/hull/util.js.map +0 -1
  2370. package/lib/stdlib/plugin/index.d.ts +0 -9
  2371. package/lib/stdlib/plugin/index.js +0 -26
  2372. package/lib/stdlib/plugin/index.js.map +0 -1
  2373. package/lib/stdlib/plugin/legend/index.d.ts +0 -163
  2374. package/lib/stdlib/plugin/legend/index.js +0 -598
  2375. package/lib/stdlib/plugin/legend/index.js.map +0 -1
  2376. package/lib/stdlib/plugin/menu/index.d.ts +0 -55
  2377. package/lib/stdlib/plugin/menu/index.js +0 -244
  2378. package/lib/stdlib/plugin/menu/index.js.map +0 -1
  2379. package/lib/stdlib/plugin/minimap/index.d.ts +0 -114
  2380. package/lib/stdlib/plugin/minimap/index.js +0 -580
  2381. package/lib/stdlib/plugin/minimap/index.js.map +0 -1
  2382. package/lib/stdlib/plugin/timebar/index.d.ts +0 -98
  2383. package/lib/stdlib/plugin/timebar/index.js +0 -307
  2384. package/lib/stdlib/plugin/timebar/index.js.map +0 -1
  2385. package/lib/stdlib/plugin/toolbar/index.d.ts +0 -59
  2386. package/lib/stdlib/plugin/toolbar/index.js +0 -222
  2387. package/lib/stdlib/plugin/toolbar/index.js.map +0 -1
  2388. package/lib/stdlib/plugin/tooltip/index.d.ts +0 -96
  2389. package/lib/stdlib/plugin/tooltip/index.js +0 -385
  2390. package/lib/stdlib/plugin/tooltip/index.js.map +0 -1
  2391. package/lib/stdlib/plugin/types.d.ts +0 -9
  2392. package/lib/stdlib/plugin/types.js.map +0 -1
  2393. package/lib/stdlib/selector/lasso.d.ts +0 -15
  2394. package/lib/stdlib/selector/lasso.js +0 -63
  2395. package/lib/stdlib/selector/lasso.js.map +0 -1
  2396. package/lib/stdlib/selector/rect.d.ts +0 -16
  2397. package/lib/stdlib/selector/rect.js +0 -56
  2398. package/lib/stdlib/selector/rect.js.map +0 -1
  2399. package/lib/stdlib/theme/dark.d.ts +0 -2
  2400. package/lib/stdlib/theme/dark.js +0 -335
  2401. package/lib/stdlib/theme/dark.js.map +0 -1
  2402. package/lib/stdlib/theme/index.d.ts +0 -2
  2403. package/lib/stdlib/theme/index.js +0 -19
  2404. package/lib/stdlib/theme/index.js.map +0 -1
  2405. package/lib/stdlib/theme/light.d.ts +0 -2
  2406. package/lib/stdlib/theme/light.js +0 -333
  2407. package/lib/stdlib/theme/light.js.map +0 -1
  2408. package/lib/stdlib/themeSolver/base.d.ts +0 -15
  2409. package/lib/stdlib/themeSolver/base.js +0 -15
  2410. package/lib/stdlib/themeSolver/base.js.map +0 -1
  2411. package/lib/stdlib/themeSolver/index.d.ts +0 -3
  2412. package/lib/stdlib/themeSolver/index.js +0 -20
  2413. package/lib/stdlib/themeSolver/index.js.map +0 -1
  2414. package/lib/stdlib/themeSolver/spec.d.ts +0 -35
  2415. package/lib/stdlib/themeSolver/spec.js +0 -70
  2416. package/lib/stdlib/themeSolver/spec.js.map +0 -1
  2417. package/lib/stdlib/themeSolver/subject.d.ts +0 -41
  2418. package/lib/stdlib/themeSolver/subject.js +0 -404
  2419. package/lib/stdlib/themeSolver/subject.js.map +0 -1
  2420. package/lib/types/animate.d.ts +0 -59
  2421. package/lib/types/animate.js +0 -3
  2422. package/lib/types/animate.js.map +0 -1
  2423. package/lib/types/behavior.d.ts +0 -45
  2424. package/lib/types/behavior.js +0 -18
  2425. package/lib/types/behavior.js.map +0 -1
  2426. package/lib/types/common.d.ts +0 -17
  2427. package/lib/types/common.js +0 -3
  2428. package/lib/types/common.js.map +0 -1
  2429. package/lib/types/graph.d.ts +0 -594
  2430. package/lib/types/graph.js.map +0 -1
  2431. package/lib/types/hook.d.ts +0 -124
  2432. package/lib/types/hook.js +0 -3
  2433. package/lib/types/hook.js.map +0 -1
  2434. package/lib/types/item.d.ts +0 -241
  2435. package/lib/types/item.js +0 -19
  2436. package/lib/types/item.js.map +0 -1
  2437. package/lib/types/loop.d.ts +0 -21
  2438. package/lib/types/loop.js +0 -15
  2439. package/lib/types/loop.js.map +0 -1
  2440. package/lib/types/render.d.ts +0 -1
  2441. package/lib/types/render.js +0 -3
  2442. package/lib/types/render.js.map +0 -1
  2443. package/lib/types/spec.d.ts +0 -82
  2444. package/lib/types/spec.js +0 -3
  2445. package/lib/types/spec.js.map +0 -1
  2446. package/lib/types/stdlib.d.ts +0 -13
  2447. package/lib/types/stdlib.js +0 -3
  2448. package/lib/types/stdlib.js.map +0 -1
  2449. package/lib/types/theme.d.ts +0 -168
  2450. package/lib/types/theme.js +0 -18
  2451. package/lib/types/theme.js.map +0 -1
  2452. package/lib/types/view.d.ts +0 -23
  2453. package/lib/types/view.js +0 -3
  2454. package/lib/types/view.js.map +0 -1
  2455. package/lib/util/animate.d.ts +0 -106
  2456. package/lib/util/animate.js +0 -400
  2457. package/lib/util/animate.js.map +0 -1
  2458. package/lib/util/array.d.ts +0 -28
  2459. package/lib/util/array.js +0 -79
  2460. package/lib/util/array.js.map +0 -1
  2461. package/lib/util/arrow.d.ts +0 -17
  2462. package/lib/util/arrow.js +0 -60
  2463. package/lib/util/arrow.js.map +0 -1
  2464. package/lib/util/bbox.d.ts +0 -106
  2465. package/lib/util/bbox.js +0 -273
  2466. package/lib/util/bbox.js.map +0 -1
  2467. package/lib/util/behavior.d.ts +0 -2
  2468. package/lib/util/behavior.js +0 -16
  2469. package/lib/util/behavior.js.map +0 -1
  2470. package/lib/util/canvas.d.ts +0 -19
  2471. package/lib/util/canvas.js +0 -71
  2472. package/lib/util/canvas.js.map +0 -1
  2473. package/lib/util/data.d.ts +0 -96
  2474. package/lib/util/data.js +0 -276
  2475. package/lib/util/data.js.map +0 -1
  2476. package/lib/util/event.d.ts +0 -40
  2477. package/lib/util/event.js +0 -102
  2478. package/lib/util/event.js.map +0 -1
  2479. package/lib/util/extend.d.ts +0 -27
  2480. package/lib/util/extend.js +0 -29
  2481. package/lib/util/extend.js.map +0 -1
  2482. package/lib/util/extension.d.ts +0 -10
  2483. package/lib/util/extension.js +0 -29
  2484. package/lib/util/extension.js.map +0 -1
  2485. package/lib/util/index.d.ts +0 -52
  2486. package/lib/util/index.js +0 -26
  2487. package/lib/util/index.js.map +0 -1
  2488. package/lib/util/item.d.ts +0 -15
  2489. package/lib/util/item.js +0 -72
  2490. package/lib/util/item.js.map +0 -1
  2491. package/lib/util/layout.d.ts +0 -40
  2492. package/lib/util/layout.js +0 -172
  2493. package/lib/util/layout.js.map +0 -1
  2494. package/lib/util/loop.d.ts +0 -37
  2495. package/lib/util/loop.js +0 -111
  2496. package/lib/util/loop.js.map +0 -1
  2497. package/lib/util/mapper.d.ts +0 -17
  2498. package/lib/util/mapper.js +0 -58
  2499. package/lib/util/mapper.js.map +0 -1
  2500. package/lib/util/math.d.ts +0 -23
  2501. package/lib/util/math.js +0 -29
  2502. package/lib/util/math.js.map +0 -1
  2503. package/lib/util/mock.d.ts +0 -30
  2504. package/lib/util/mock.js +0 -73
  2505. package/lib/util/mock.js.map +0 -1
  2506. package/lib/util/path.d.ts +0 -11
  2507. package/lib/util/path.js +0 -49
  2508. package/lib/util/path.js.map +0 -1
  2509. package/lib/util/point.d.ts +0 -83
  2510. package/lib/util/point.js +0 -197
  2511. package/lib/util/point.js.map +0 -1
  2512. package/lib/util/polyline.d.ts +0 -113
  2513. package/lib/util/polyline.js +0 -524
  2514. package/lib/util/polyline.js.map +0 -1
  2515. package/lib/util/router.d.ts +0 -32
  2516. package/lib/util/router.js +0 -387
  2517. package/lib/util/router.js.map +0 -1
  2518. package/lib/util/shape.d.ts +0 -140
  2519. package/lib/util/shape.js +0 -638
  2520. package/lib/util/shape.js.map +0 -1
  2521. package/lib/util/shape3d.d.ts +0 -23
  2522. package/lib/util/shape3d.js +0 -159
  2523. package/lib/util/shape3d.js.map +0 -1
  2524. package/lib/util/text.d.ts +0 -18
  2525. package/lib/util/text.js +0 -41
  2526. package/lib/util/text.js.map +0 -1
  2527. package/lib/util/type.d.ts +0 -8
  2528. package/lib/util/type.js +0 -13
  2529. package/lib/util/type.js.map +0 -1
  2530. package/lib/util/zoom.d.ts +0 -17
  2531. package/lib/util/zoom.js +0 -45
  2532. package/lib/util/zoom.js.map +0 -1
  2533. package/src/api-doc/behaviors.ts +0 -2
  2534. package/src/api-doc/graph.ts +0 -4
  2535. package/src/api-doc/item.ts +0 -45
  2536. package/src/api-doc/layout.ts +0 -13
  2537. package/src/api-doc/plugins.ts +0 -1
  2538. package/src/api-doc/types.ts +0 -2
  2539. package/src/api-doc/util.ts +0 -3
  2540. package/src/constant/index.ts +0 -1
  2541. package/src/constant/shape.ts +0 -37
  2542. package/src/item/combo.ts +0 -310
  2543. package/src/item/edge.ts +0 -227
  2544. package/src/item/item.ts +0 -906
  2545. package/src/item/node.ts +0 -348
  2546. package/src/runtime/controller/data.ts +0 -1049
  2547. package/src/runtime/controller/extension.ts +0 -14
  2548. package/src/runtime/controller/index.ts +0 -7
  2549. package/src/runtime/controller/interaction.ts +0 -367
  2550. package/src/runtime/controller/item.ts +0 -1611
  2551. package/src/runtime/controller/layout.ts +0 -403
  2552. package/src/runtime/controller/plugin.ts +0 -220
  2553. package/src/runtime/controller/theme.ts +0 -73
  2554. package/src/runtime/controller/viewport.ts +0 -131
  2555. package/src/runtime/hooks.ts +0 -64
  2556. package/src/stdlib/behavior/activate-relations.ts +0 -142
  2557. package/src/stdlib/behavior/brush-select.ts +0 -385
  2558. package/src/stdlib/behavior/click-select.ts +0 -216
  2559. package/src/stdlib/behavior/collapse-expand-combo.ts +0 -57
  2560. package/src/stdlib/behavior/collapse-expand-tree.ts +0 -106
  2561. package/src/stdlib/behavior/drag-canvas.ts +0 -335
  2562. package/src/stdlib/behavior/drag-combo.ts +0 -589
  2563. package/src/stdlib/behavior/drag-node.ts +0 -676
  2564. package/src/stdlib/behavior/hover-activate.ts +0 -102
  2565. package/src/stdlib/behavior/index.ts +0 -16
  2566. package/src/stdlib/behavior/lasso-select.ts +0 -98
  2567. package/src/stdlib/behavior/orbit-canvas-3d.ts +0 -102
  2568. package/src/stdlib/behavior/rotate-canvas-3d.ts +0 -170
  2569. package/src/stdlib/behavior/shortcuts-call.ts +0 -120
  2570. package/src/stdlib/behavior/track-canvas-3d.ts +0 -102
  2571. package/src/stdlib/behavior/types.ts +0 -15
  2572. package/src/stdlib/behavior/zoom-canvas-3d.ts +0 -168
  2573. package/src/stdlib/behavior/zoom-canvas.ts +0 -259
  2574. package/src/stdlib/data/index.ts +0 -3
  2575. package/src/stdlib/data/mapNodeSize.ts +0 -67
  2576. package/src/stdlib/data/transformV4Data.ts +0 -207
  2577. package/src/stdlib/data/validateData.ts +0 -151
  2578. package/src/stdlib/index.ts +0 -286
  2579. package/src/stdlib/item/combo/circle.ts +0 -113
  2580. package/src/stdlib/item/combo/index.ts +0 -2
  2581. package/src/stdlib/item/combo/rect.ts +0 -123
  2582. package/src/stdlib/item/edge/base.ts +0 -731
  2583. package/src/stdlib/item/edge/cubic-horizontal.ts +0 -86
  2584. package/src/stdlib/item/edge/cubic-vertical.ts +0 -85
  2585. package/src/stdlib/item/edge/cubic.ts +0 -198
  2586. package/src/stdlib/item/edge/index.ts +0 -7
  2587. package/src/stdlib/item/edge/line.ts +0 -103
  2588. package/src/stdlib/item/edge/loop.ts +0 -162
  2589. package/src/stdlib/item/edge/polyline.ts +0 -163
  2590. package/src/stdlib/item/edge/quadratic.ts +0 -133
  2591. package/src/stdlib/item/node/base.ts +0 -995
  2592. package/src/stdlib/item/node/base3d.ts +0 -210
  2593. package/src/stdlib/item/node/circle.ts +0 -113
  2594. package/src/stdlib/item/node/diamond.ts +0 -144
  2595. package/src/stdlib/item/node/donut.ts +0 -368
  2596. package/src/stdlib/item/node/ellipse.ts +0 -128
  2597. package/src/stdlib/item/node/hexagon.ts +0 -176
  2598. package/src/stdlib/item/node/image.ts +0 -190
  2599. package/src/stdlib/item/node/index.ts +0 -11
  2600. package/src/stdlib/item/node/modelRect.ts +0 -405
  2601. package/src/stdlib/item/node/rect.ts +0 -141
  2602. package/src/stdlib/item/node/sphere.ts +0 -99
  2603. package/src/stdlib/item/node/star.ts +0 -181
  2604. package/src/stdlib/item/node/triangle.ts +0 -265
  2605. package/src/stdlib/plugin/fisheye/index.ts +0 -607
  2606. package/src/stdlib/plugin/grid/index.ts +0 -125
  2607. package/src/stdlib/plugin/history/combo-command.ts +0 -28
  2608. package/src/stdlib/plugin/history/command.ts +0 -81
  2609. package/src/stdlib/plugin/history/index.ts +0 -347
  2610. package/src/stdlib/plugin/history/item-data-command.ts +0 -96
  2611. package/src/stdlib/plugin/history/layer-updated-command.ts +0 -28
  2612. package/src/stdlib/plugin/history/state-updated-command.ts +0 -36
  2613. package/src/stdlib/plugin/history/visibility-updated-command.ts +0 -41
  2614. package/src/stdlib/plugin/hull/bubbleset.ts +0 -828
  2615. package/src/stdlib/plugin/hull/convexHull.ts +0 -68
  2616. package/src/stdlib/plugin/hull/hullComponent.ts +0 -501
  2617. package/src/stdlib/plugin/hull/index.ts +0 -234
  2618. package/src/stdlib/plugin/hull/types.ts +0 -15
  2619. package/src/stdlib/plugin/hull/util.ts +0 -511
  2620. package/src/stdlib/plugin/index.ts +0 -9
  2621. package/src/stdlib/plugin/legend/index.ts +0 -795
  2622. package/src/stdlib/plugin/menu/index.ts +0 -275
  2623. package/src/stdlib/plugin/minimap/index.ts +0 -698
  2624. package/src/stdlib/plugin/timebar/index.ts +0 -473
  2625. package/src/stdlib/plugin/toolbar/index.ts +0 -257
  2626. package/src/stdlib/plugin/tooltip/index.ts +0 -444
  2627. package/src/stdlib/plugin/types.ts +0 -9
  2628. package/src/stdlib/selector/lasso.ts +0 -75
  2629. package/src/stdlib/selector/rect.ts +0 -78
  2630. package/src/stdlib/theme/dark.ts +0 -418
  2631. package/src/stdlib/theme/index.ts +0 -2
  2632. package/src/stdlib/theme/light.ts +0 -413
  2633. package/src/stdlib/themeSolver/base.ts +0 -22
  2634. package/src/stdlib/themeSolver/index.ts +0 -3
  2635. package/src/stdlib/themeSolver/spec.ts +0 -107
  2636. package/src/stdlib/themeSolver/subject.ts +0 -499
  2637. package/src/types/animate.ts +0 -71
  2638. package/src/types/behavior.ts +0 -48
  2639. package/src/types/common.ts +0 -21
  2640. package/src/types/graph.ts +0 -780
  2641. package/src/types/hook.ts +0 -128
  2642. package/src/types/item.ts +0 -348
  2643. package/src/types/loop.ts +0 -23
  2644. package/src/types/render.ts +0 -1
  2645. package/src/types/spec.ts +0 -133
  2646. package/src/types/stdlib.ts +0 -25
  2647. package/src/types/theme.ts +0 -171
  2648. package/src/types/view.ts +0 -31
  2649. package/src/util/animate.ts +0 -477
  2650. package/src/util/array.ts +0 -68
  2651. package/src/util/arrow.ts +0 -62
  2652. package/src/util/bbox.ts +0 -298
  2653. package/src/util/behavior.ts +0 -14
  2654. package/src/util/canvas.ts +0 -87
  2655. package/src/util/data.ts +0 -307
  2656. package/src/util/event.ts +0 -147
  2657. package/src/util/extend.ts +0 -48
  2658. package/src/util/extension.ts +0 -29
  2659. package/src/util/index.ts +0 -34
  2660. package/src/util/item.ts +0 -136
  2661. package/src/util/layout.ts +0 -165
  2662. package/src/util/loop.ts +0 -145
  2663. package/src/util/mapper.ts +0 -62
  2664. package/src/util/math.ts +0 -33
  2665. package/src/util/mock.ts +0 -72
  2666. package/src/util/path.ts +0 -52
  2667. package/src/util/point.ts +0 -226
  2668. package/src/util/polyline.ts +0 -676
  2669. package/src/util/router.ts +0 -561
  2670. package/src/util/shape.ts +0 -765
  2671. package/src/util/shape3d.ts +0 -203
  2672. package/src/util/text.ts +0 -49
  2673. package/src/util/type.ts +0 -11
  2674. package/src/util/zoom.ts +0 -43
  2675. /package/esm/{stdlib/behavior → animations}/types.js +0 -0
  2676. /package/esm/{stdlib/plugin/hull → behaviors}/types.js +0 -0
  2677. /package/esm/{stdlib/plugin → layouts}/types.js +0 -0
  2678. /package/esm/{types → spec}/graph.js +0 -0
  2679. /package/esm/{api-doc → spec}/layout.js +0 -0
  2680. /package/lib/{stdlib/behavior → animations}/types.js +0 -0
  2681. /package/lib/{stdlib/plugin/hull → behaviors}/types.js +0 -0
  2682. /package/lib/{stdlib/plugin → layouts}/types.js +0 -0
  2683. /package/lib/{types → spec}/graph.js +0 -0
  2684. /package/lib/{api-doc → spec}/layout.js +0 -0
@@ -1,2217 +1,1669 @@
1
1
  import EventEmitter from '@antv/event-emitter';
2
- import { AABB, Canvas, DisplayObject, PointLike } from '@antv/g';
3
- import { GraphChange, ID } from '@antv/graphlib';
4
- import {
5
- clone,
6
- groupBy,
7
- isArray,
8
- isEmpty,
9
- isEqual,
10
- isNil,
11
- isNumber,
12
- isObject,
13
- isString,
14
- map,
15
- } from '@antv/util';
16
- import { History } from '../stdlib/plugin/history';
17
- import { Command } from '../stdlib/plugin/history/command';
2
+ import type { AABB, BaseStyleProps } from '@antv/g';
3
+ import { debounce, isEqual, isFunction, isNumber, isObject, isString, omit } from '@antv/util';
4
+ import { COMBO_KEY, GraphEvent } from '../constants';
5
+ import type { Plugin } from '../plugins/types';
6
+ import { getExtension } from '../registry';
18
7
  import type {
19
- ComboUserModel,
20
- EdgeUserModel,
8
+ BehaviorOptions,
9
+ ComboData,
10
+ ComboOptions,
11
+ EdgeData,
12
+ EdgeOptions,
21
13
  GraphData,
22
- IGraph,
23
- NodeUserModel,
24
- Specification,
25
- } from '../types';
26
- import type { CameraAnimationOptions } from '../types/animate';
27
- import type { BehaviorOptionsOf, BehaviorRegistry } from '../types/behavior';
28
- import type { ComboDisplayModel, ComboModel } from '../types/combo';
29
- import type { Padding, Point } from '../types/common';
30
- import type { DataChangeType, DataConfig, GraphCore } from '../types/data';
31
- import type { EdgeDisplayModel, EdgeModel, EdgeModelData } from '../types/edge';
32
- import type { StackType } from '../types/history';
33
- import type { Hooks, ViewportChangeHookParams } from '../types/hook';
34
- import type { ITEM_TYPE, SHAPE_TYPE, ShapeStyle } from '../types/item';
35
- import type {
36
- ImmediatelyInvokedLayoutOptions,
14
+ GraphOptions,
37
15
  LayoutOptions,
38
- StandardLayoutOptions,
39
- } from '../types/layout';
40
- import type { NodeDisplayModel, NodeModel, NodeModelData } from '../types/node';
41
- import type { RendererName } from '../types/render';
16
+ NodeData,
17
+ NodeOptions,
18
+ PluginOptions,
19
+ ThemeOptions,
20
+ TransformOptions,
21
+ } from '../spec';
22
+ import type { UpdateBehaviorOption } from '../spec/behavior';
23
+ import type { UpdatePluginOption } from '../spec/plugin';
24
+ import type { UpdateTransformOption } from '../spec/transform';
42
25
  import type {
43
- ThemeOptionsOf,
44
- ThemeRegistry,
45
- ThemeSpecification,
46
- } from '../types/theme';
47
- import { FitViewRules, GraphTransformOptions } from '../types/view';
48
- import { changeRenderer, createCanvas } from '../util/canvas';
49
- import { formatPadding } from '../util/shape';
50
- import { Plugin as PluginBase } from '../types/plugin';
51
- import {
52
- DataController,
53
- ExtensionController,
54
- InteractionController,
55
- ItemController,
56
- LayoutController,
57
- ThemeController,
58
- ViewportController,
59
- } from './controller';
60
- import { PluginController } from './controller/plugin';
61
- import Hook from './hooks';
62
-
63
- export default class Graph<B extends BehaviorRegistry, T extends ThemeRegistry>
64
- extends EventEmitter
65
- implements IGraph<B, T>
66
- {
67
- public hooks: Hooks;
68
- // for nodes and edges, which will be separate into groups
69
- public canvas: Canvas;
70
- // the container dom for the graph canvas
71
- public container: HTMLElement;
72
- // the tag to indicate whether the graph instance is destroyed
73
- public destroyed: boolean;
74
- // the renderer type of current graph
75
- public rendererType: RendererName;
76
- // for transient shapes for interactions, e.g. transient node and related edges while draging, delegates
77
- public transientCanvas: Canvas;
78
- // for background shapes, e.g. grid, pipe indices
79
- public backgroundCanvas: Canvas;
80
- // the tag indicates all the three canvases are all ready
81
- private canvasReady: boolean;
82
- private specification: Specification<B, T>;
83
-
84
- private dataController: DataController;
85
- private interactionController: InteractionController;
86
- private layoutController: LayoutController;
87
- private viewportController: ViewportController;
88
- private itemController: ItemController;
89
- private extensionController: ExtensionController;
90
- private themeController: ThemeController;
91
- private pluginController: PluginController;
92
-
93
- private defaultSpecification = {
94
- theme: {
95
- type: 'spec',
96
- base: 'light',
97
- },
98
- enableStack: true,
26
+ CallableValue,
27
+ DataID,
28
+ EdgeDirection,
29
+ ElementDatum,
30
+ ElementType,
31
+ FitViewOptions,
32
+ ID,
33
+ IEvent,
34
+ NodeLikeData,
35
+ PartialEdgeData,
36
+ PartialGraphData,
37
+ PartialNodeLikeData,
38
+ Point,
39
+ Position,
40
+ State,
41
+ Vector2,
42
+ ViewportAnimationEffectTiming,
43
+ } from '../types';
44
+ import { isCollapsed } from '../utils/collapsibility';
45
+ import { sizeOf } from '../utils/dom';
46
+ import { GraphLifeCycleEvent, emit } from '../utils/event';
47
+ import { idOf } from '../utils/id';
48
+ import { parsePoint, toPointObject } from '../utils/point';
49
+ import { zIndexOf } from '../utils/style';
50
+ import { subtract } from '../utils/vector';
51
+ import { Animation } from './animation';
52
+ import { BatchController } from './batch';
53
+ import { BehaviorController } from './behavior';
54
+ import type { DataURLOptions } from './canvas';
55
+ import { Canvas } from './canvas';
56
+ import type { HierarchyKey } from './data';
57
+ import { DataController } from './data';
58
+ import { ElementController } from './element';
59
+ import { LayoutController } from './layout';
60
+ import { PluginController } from './plugin';
61
+ import { TransformController } from './transform';
62
+ import { RuntimeContext } from './types';
63
+ import { ViewportController } from './viewport';
64
+
65
+ export class Graph extends EventEmitter {
66
+ private options: GraphOptions;
67
+
68
+ /**
69
+ * @internal
70
+ */
71
+ static defaultOptions: GraphOptions = {
72
+ autoResize: false,
73
+ theme: 'light',
74
+ rotation: 0,
75
+ zoom: 1,
76
+ zoomRange: [0.01, 10],
99
77
  };
100
78
 
101
- constructor(spec: Specification<B, T>) {
102
- super();
79
+ /**
80
+ * <zh/> 当前图实例是否已经被销毁
81
+ *
82
+ * <en/> Whether the current graph instance has been destroyed
83
+ */
84
+ public destroyed = false;
103
85
 
104
- this.specification = Object.assign({}, this.defaultSpecification, spec);
105
- this.initHooks();
106
- this.initCanvas();
107
- this.initControllers();
108
- this.initHistory();
109
-
110
- this.hooks.init.emit({
111
- canvases: {
112
- background: this.backgroundCanvas,
113
- main: this.canvas,
114
- transient: this.transientCanvas,
115
- },
116
- });
86
+ // @ts-expect-error will be initialized in createRuntime
87
+ private context: RuntimeContext = {
88
+ model: new DataController(),
89
+ };
117
90
 
118
- const { data } = spec;
119
- if (data) {
120
- // TODO: handle multiple type data configs
121
- this.read(data as GraphData);
122
- }
91
+ constructor(options: GraphOptions) {
92
+ super();
93
+ this.options = Object.assign({}, Graph.defaultOptions, options);
94
+ this.setOptions(this.options);
95
+ this.context.graph = this;
96
+
97
+ // Listening window.resize to autoResize.
98
+ this.options.autoResize && window.addEventListener('resize', this.onResize);
123
99
  }
124
100
 
125
101
  /**
126
- * Initialize the controllers for different plugins.
127
- */
128
- private initControllers() {
129
- this.dataController = new DataController(this);
130
- this.interactionController = new InteractionController(this);
131
- this.layoutController = new LayoutController(this);
132
- this.themeController = new ThemeController(this);
133
- this.itemController = new ItemController(this);
134
- this.viewportController = new ViewportController(this);
135
- this.extensionController = new ExtensionController(this);
136
- this.pluginController = new PluginController(this);
137
- }
138
-
139
- private initCanvas() {
140
- const {
141
- renderer,
142
- container,
143
- canvas,
144
- backgroundCanvas,
145
- transientCanvas,
146
- width,
147
- height,
148
- } = this.specification;
149
-
150
- let pixelRatio: number;
151
- if (renderer && !isString(renderer)) {
152
- // @ts-ignore
153
- this.rendererType = renderer.type || 'canvas';
154
- // @ts-ignore
155
- pixelRatio = renderer.pixelRatio;
156
- } else {
157
- // @ts-ignore
158
- this.rendererType = renderer || 'canvas';
159
- }
102
+ * <zh/> 获取配置项
103
+ *
104
+ * <en/> Get options
105
+ * @returns <zh/> 配置项 | <en/> options
106
+ * @apiCategory option
107
+ */
108
+ public getOptions(): GraphOptions {
109
+ return this.options;
110
+ }
160
111
 
161
- /**
162
- * These 3 canvases can be passed in by users, e.g. when doing serverside rendering we can't use DOM API.
163
- */
164
- if (canvas) {
165
- this.canvas = canvas;
166
- this.backgroundCanvas = backgroundCanvas;
167
- this.transientCanvas = transientCanvas;
168
- this.container = container as HTMLDivElement;
169
- } else {
170
- const containerDOM = isString(container)
171
- ? document.getElementById(container as string)
172
- : (container as HTMLElement);
112
+ /**
113
+ * <zh/> 设置配置项
114
+ *
115
+ * <en/> Set options
116
+ * @param options - <zh/> 配置项 | <en/> options
117
+ * @remarks
118
+ * <zh/> 要更新 devicePixelRatio、container 属性请销毁后重新创建实例
119
+ *
120
+ * <en/> To update devicePixelRatio and container properties, please destroy and recreate the instance
121
+ * @apiCategory option
122
+ */
123
+ public setOptions(options: GraphOptions): void {
124
+ const { background, behaviors, combo, data, edge, height, layout, node, plugins, theme, transforms, width } =
125
+ options;
173
126
 
174
- if (!containerDOM) {
175
- console.error(
176
- `Create graph failed. The container for graph ${containerDOM} is not exist.`,
177
- );
178
- this.destroy();
179
- return;
180
- }
181
-
182
- this.container = containerDOM;
183
- const size = [width, height];
184
- if (size[0] === undefined) {
185
- size[0] = containerDOM.scrollWidth;
186
- }
187
- if (size[1] === undefined) {
188
- size[1] = containerDOM.scrollHeight;
189
- }
190
- this.backgroundCanvas = createCanvas(
191
- this.rendererType,
192
- containerDOM,
193
- size[0],
194
- size[1],
195
- pixelRatio,
196
- );
197
- this.canvas = createCanvas(
198
- this.rendererType,
199
- containerDOM,
200
- size[0],
201
- size[1],
202
- pixelRatio,
203
- );
204
- this.transientCanvas = createCanvas(
205
- this.rendererType,
206
- containerDOM,
207
- size[0],
208
- size[1],
209
- pixelRatio,
210
- );
211
- }
127
+ Object.assign(this.options, options);
212
128
 
213
- Promise.all(
214
- [this.backgroundCanvas, this.canvas, this.transientCanvas].map(
215
- (canvas) => canvas.ready,
216
- ),
217
- ).then(() => {
218
- [this.backgroundCanvas, this.canvas, this.transientCanvas].forEach(
219
- (canvas, i) => {
220
- const $domElement = canvas
221
- .getContextService()
222
- .getDomElement() as unknown as HTMLElement;
223
- if ($domElement && $domElement.style) {
224
- $domElement.style.position = 'fixed';
225
- $domElement.style.outline = 'none';
226
- $domElement.tabIndex = 1; // Enable keyboard events
227
- // Transient canvas should let interactive events go through.
228
- if (i === 2) {
229
- $domElement.style.pointerEvents = 'none';
230
- }
231
- }
232
- },
233
- );
234
-
235
- this.canvasReady = true;
236
- });
129
+ if (background) this.setBackground(background);
130
+ if (behaviors) this.setBehaviors(behaviors);
131
+ if (combo) this.setCombo(combo);
132
+ if (data) this.setData(data);
133
+ if (edge) this.setEdge(edge);
134
+ if (layout) this.setLayout(layout);
135
+ if (node) this.setNode(node);
136
+ if (theme) this.setTheme(theme);
137
+ if (plugins) this.setPlugins(plugins);
138
+ if (transforms) this.setTransforms(transforms);
139
+ if (isNumber(width) || isNumber(height))
140
+ this.setSize(width ?? this.options.width ?? 0, height ?? this.options.height ?? 0);
237
141
  }
238
142
 
239
- private initHistory() {
240
- const { enableStack, stackCfg } = this.specification;
241
- if (enableStack) {
242
- const history = {
243
- type: 'history',
244
- key: 'history',
245
- enableStack,
246
- stackCfg,
247
- };
248
- if (!this.specification.plugins) {
249
- this.specification.plugins = [];
250
- }
251
- this.specification.plugins.push(history);
252
- }
143
+ /**
144
+ * <zh/> 设置画布背景色
145
+ *
146
+ * <en/> Set canvas background color
147
+ * @param background - <zh/> 背景色 | <en/> background color
148
+ * @apiCategory canvas
149
+ */
150
+ public setBackground(background: GraphOptions['background']): void {
151
+ this.options.background = background;
152
+ this.context.canvas?.setBackground(background);
253
153
  }
254
154
 
255
155
  /**
256
- * Change the renderer at runtime.
257
- * @param type renderer name
258
- * @returns
156
+ * <zh/> 获取画布背景色
157
+ *
158
+ * <en/> Get canvas background color
159
+ * @returns <zh/> 背景色 | <en/> background color
160
+ * @apiCategory canvas
259
161
  */
260
- public changeRenderer(type) {
261
- this.rendererType = type || 'canvas';
262
- changeRenderer(this.rendererType, this.canvas);
162
+ public getBackground(): GraphOptions['background'] {
163
+ return this.options.background;
263
164
  }
264
165
 
265
166
  /**
266
- * Initialize the hooks for graph's lifecycles.
167
+ * <zh/> 获取当前图容器的大小
168
+ *
169
+ * <en/> Get the size of the current canvas container
170
+ * @returns <zh/> 画布尺寸 | <en/> canvas size
171
+ * @apiCategory canvas
267
172
  */
268
- private initHooks() {
269
- this.hooks = {
270
- init: new Hook<{
271
- canvases: {
272
- background: Canvas;
273
- main: Canvas;
274
- transient: Canvas;
275
- };
276
- }>({ name: 'init' }),
277
- datachange: new Hook<{ data: GraphData; type: DataChangeType }>({
278
- name: 'datachange',
279
- }),
280
- itemchange: new Hook<{
281
- type: ITEM_TYPE;
282
- changes: GraphChange<NodeModelData, EdgeModelData>[];
283
- graphCore: GraphCore;
284
- theme: ThemeSpecification;
285
- animate?: boolean;
286
- upsertAncestors?: boolean;
287
- }>({ name: 'itemchange' }),
288
- render: new Hook<{
289
- graphCore: GraphCore;
290
- theme: ThemeSpecification;
291
- transientCanvas: Canvas;
292
- }>({
293
- name: 'render',
294
- }),
295
- layout: new Hook<{
296
- graphCore: GraphCore;
297
- options?: LayoutOptions;
298
- animate?: boolean;
299
- }>({ name: 'layout' }),
300
- viewportchange: new Hook<ViewportChangeHookParams>({ name: 'viewport' }),
301
- modechange: new Hook<{ mode: string }>({ name: 'modechange' }),
302
- behaviorchange: new Hook<{
303
- action: 'update' | 'add' | 'remove';
304
- modes: string[];
305
- behaviors: (string | BehaviorOptionsOf<{}>)[];
306
- }>({ name: 'behaviorchange' }),
307
- itemstatechange: new Hook<{
308
- ids: ID[];
309
- states?: string[];
310
- value?: boolean;
311
- }>({
312
- name: 'itemstatechange',
313
- }),
314
- itemvisibilitychange: new Hook<{ ids: ID[]; value: boolean }>({
315
- name: 'itemvisibilitychange',
316
- }),
317
- itemzindexchange: new Hook<{
318
- ids: ID[];
319
- action: 'front' | 'back';
320
- graphCore: GraphCore;
321
- }>({
322
- name: 'itemzindexchange',
323
- }),
324
- transientupdate: new Hook<{
325
- type: ITEM_TYPE | SHAPE_TYPE;
326
- id: ID;
327
- config: {
328
- style: ShapeStyle;
329
- action: 'remove' | 'add' | 'update' | undefined;
330
- };
331
- canvas: Canvas;
332
- graphCore: GraphCore;
333
- }>({ name: 'transientupdate' }),
334
- pluginchange: new Hook<{
335
- action: 'update' | 'add' | 'remove';
336
- plugins: (
337
- | string
338
- | { key: string; type: string; [cfgName: string]: unknown }
339
- )[];
340
- }>({ name: 'pluginchange' }),
341
- themechange: new Hook<{
342
- theme: ThemeSpecification;
343
- canvases: {
344
- background: Canvas;
345
- main: Canvas;
346
- transient: Canvas;
347
- };
348
- }>({ name: 'init' }),
349
- treecollapseexpand: new Hook<{
350
- ids: ID[];
351
- animate: boolean;
352
- action: 'collapse' | 'expand';
353
- graphCore: GraphCore;
354
- }>({ name: 'treecollapseexpand' }),
355
- destroy: new Hook<{}>({ name: 'destroy' }),
356
- };
173
+ public getSize(): [number, number] {
174
+ if (this.context.canvas) return this.context.canvas.getSize();
175
+ return [this.options.width || 0, this.options.height || 0];
357
176
  }
358
177
 
359
178
  /**
360
- * Update the specs(configurations).
179
+ * <zh/> 获取当前图容器的大小
180
+ *
181
+ * <en/> Get the size of the current canvas container
182
+ * @param width - <zh/> 画布宽度 | <en/> canvas width
183
+ * @param height - <zh/> 画布高度 | <en/> canvas height
184
+ * @apiCategory canvas
361
185
  */
362
- public updateSpecification(spec: Specification<B, T>): Specification<B, T> {
363
- return Object.assign(this.specification, spec);
186
+ public setSize(width: number, height: number): void {
187
+ Object.assign(this.options, { width, height });
188
+ this.context.canvas?.resize(width, height);
364
189
  }
190
+
365
191
  /**
366
- * Update the theme specs (configurations).
192
+ * <zh/> 获取当前图的缩放区间
193
+ *
194
+ * <en/> Get the zoom range of the current graph
195
+ * @param zoomRange - <zh/> 缩放区间 | <en/> zoom range
196
+ * @apiCategory viewport
367
197
  */
368
- public updateTheme(theme: ThemeOptionsOf<T>) {
369
- this.specification.theme = theme;
370
- // const { specification } = this.themeController;
371
- // notifiying the themeController
372
- this.hooks.themechange.emit({
373
- canvases: {
374
- background: this.backgroundCanvas,
375
- main: this.canvas,
376
- transient: this.transientCanvas,
377
- },
378
- });
379
- // theme is formatted by themeController, notify the item controller to update the items
380
- this.hooks.themechange.emit({
381
- theme: this.themeController.specification,
382
- });
198
+ public setZoomRange(zoomRange: GraphOptions['zoomRange']): void {
199
+ this.options.zoomRange = zoomRange;
383
200
  }
384
201
 
385
202
  /**
386
- * Get the copy of specs(configurations).
387
- * @returns graph specs
203
+ * <zh/> 获取当前图的缩放区间
204
+ *
205
+ * <en/> Get the zoom range of the current graph
206
+ * @returns <zh/> 缩放区间 | <en/> zoom range
207
+ * @apiCategory viewport
388
208
  */
389
- public getSpecification(): Specification<B, T> {
390
- return this.specification;
209
+ public getZoomRange(): GraphOptions['zoomRange'] {
210
+ return this.options.zoomRange;
391
211
  }
392
212
 
393
213
  /**
394
- * Input data and render the graph.
395
- * If there is old data, diffs and changes it.
396
- * @param data
397
- * @returns
398
- * @group Data
214
+ * <zh/> 设置节点样式映射
215
+ *
216
+ * <en/> Set node mapper
217
+ * @param node - <zh/> 节点配置 | <en/> node configuration
218
+ * @apiCategory element
399
219
  */
400
- public async read(data: DataConfig) {
401
- this.hooks.datachange.emit({ data, type: 'replace' });
402
- const emitRender = async () => {
403
- this.hooks.render.emit({
404
- graphCore: this.dataController.graphCore,
405
- theme: this.themeController.specification,
406
- transientCanvas: this.transientCanvas,
407
- });
408
- this.emit('afterrender');
409
-
410
- this.once('afterlayout', async () => {
411
- const { autoFit } = this.specification;
412
- if (autoFit) {
413
- if (autoFit === 'view') {
414
- await this.fitView();
415
- } else if (autoFit === 'center') {
416
- await this.fitCenter();
417
- } else {
418
- const { type, effectTiming, ...others } = autoFit;
419
- if (type === 'view') {
420
- await this.fitView(others as any, effectTiming);
421
- } else if (type === 'center') {
422
- await this.fitCenter(effectTiming);
423
- } else if (type === 'position') {
424
- // TODO: align
425
- await this.translateTo((others as any).position, effectTiming);
426
- }
427
- }
428
- }
429
- });
430
- await this.layout();
431
- };
432
- if (this.canvasReady) {
433
- await emitRender();
434
- } else {
435
- await Promise.all(
436
- [this.backgroundCanvas, this.canvas, this.transientCanvas].map(
437
- (canvas) => canvas.ready,
438
- ),
439
- );
440
- await emitRender();
441
- }
220
+ public setNode(node: NodeOptions): void {
221
+ this.options.node = node;
222
+ this.context.model.refreshData();
442
223
  }
443
224
 
444
225
  /**
445
- * Change graph data.
446
- * @param data new data
447
- * @param type the way to change data, 'replace' means discard the old data and use the new one; 'mergeReplace' means merge the common part, remove (old - new), add (new - old)
448
- * @returns
449
- * @group Data
226
+ * <zh/> 设置边样式映射
227
+ *
228
+ * <en/> Set edge mapper
229
+ * @param edge - <zh/> 边配置 | <en/> edge configuration
230
+ * @apiCategory element
450
231
  */
451
- public async changeData(
452
- data: DataConfig,
453
- type: 'replace' | 'mergeReplace' = 'mergeReplace',
454
- ) {
455
- this.hooks.datachange.emit({ data, type });
456
- this.hooks.render.emit({
457
- graphCore: this.dataController.graphCore,
458
- theme: this.themeController.specification,
459
- transientCanvas: this.transientCanvas,
460
- });
461
- this.emit('afterrender');
462
-
463
- await this.layout();
232
+ public setEdge(edge: EdgeOptions): void {
233
+ this.options.edge = edge;
234
+ this.context.model.refreshData();
464
235
  }
465
236
 
466
237
  /**
467
- * Clear the graph, means remove all the items on the graph.
468
- * @returns
238
+ * <zh/> 设置组合样式映射
239
+ *
240
+ * <en/> Set combo mapper
241
+ * @param combo - <zh/> 组合配置 | <en/> combo configuration
242
+ * @apiCategory element
469
243
  */
470
- public clear() {
471
- this.startBatch();
472
- this.removeData(
473
- 'edge',
474
- this.getAllEdgesData().map((edge) => edge.id),
475
- );
476
- this.removeData(
477
- 'node',
478
- this.getAllNodesData().map((node) => node.id),
479
- );
480
- this.removeData(
481
- 'combo',
482
- this.getAllCombosData().map((combo) => combo.id),
483
- );
484
- this.stopBatch();
244
+ public setCombo(combo: ComboOptions): void {
245
+ this.options.combo = combo;
246
+ this.context.model.refreshData();
485
247
  }
486
248
 
487
- public getViewportCenter(): PointLike {
488
- const { width, height } = this.canvas.getConfig();
489
- return { x: width! / 2, y: height! / 2 };
490
- }
491
- public async transform(
492
- options: GraphTransformOptions,
493
- effectTiming?: CameraAnimationOptions,
494
- ): Promise<void> {
495
- await this.hooks.viewportchange.emitLinearAsync({
496
- transform: options,
497
- effectTiming,
498
- });
499
- this.emit('viewportchange', options);
249
+ /**
250
+ * <zh/> 获取主题
251
+ *
252
+ * <en/> Get theme
253
+ * @returns <zh/> 主题配置 | <en/> theme configuration
254
+ * @apiCategory theme
255
+ */
256
+ public getTheme(): ThemeOptions {
257
+ return this.options.theme!;
500
258
  }
501
259
 
502
260
  /**
503
- * Stop the current transition of transform immediately.
261
+ * <zh/> 设置主题
262
+ *
263
+ * <en/> Set theme
264
+ * @param theme - <zh/> 主题配置 | <en/> theme configuration
265
+ * @apiCategory theme
504
266
  */
505
- public stopTransformTransition() {
506
- this.canvas.getCamera().cancelLandmarkAnimation();
267
+ public setTheme(theme: CallableValue<ThemeOptions>): void {
268
+ this.options.theme = isFunction(theme) ? theme(this.getTheme()) : theme;
269
+
270
+ const { background } = getExtension('theme', this.options.theme) || {};
271
+ if (background && !this.options.background) {
272
+ this.setBackground(background);
273
+ }
507
274
  }
508
275
 
509
276
  /**
510
- * Move the graph with a relative distance under viewport coordinates.
511
- * @param dx x of the relative distance
512
- * @param dy y of the relative distance
513
- * @param effectTiming animation configurations
277
+ * <zh/> 设置布局
278
+ *
279
+ * <en/> Set layout
280
+ * @param layout - <zh/> 布局配置 | <en/> layout configuration
281
+ * @apiCategory layout
514
282
  */
515
- public async translate(
516
- distance: Partial<{
517
- dx: number;
518
- dy: number;
519
- dz: number;
520
- }>,
521
- effectTiming?: CameraAnimationOptions,
522
- ) {
523
- await this.transform(
524
- {
525
- translate: distance,
526
- },
527
- effectTiming,
528
- );
283
+ public setLayout(layout: CallableValue<LayoutOptions>): void {
284
+ this.options.layout = isFunction(layout) ? layout(this.getLayout()) : layout;
529
285
  }
530
286
 
531
287
  /**
532
- * Move the graph to destination under viewport coordinates.
533
- * @param destination destination under viewport coordinates.
534
- * @param effectTiming animation configurations
288
+ * <zh/> 获取布局
289
+ *
290
+ * <en/> Get layout
291
+ * @returns <zh/> 布局配置 | <en/> layout configuration
292
+ * @apiCategory layout
535
293
  */
536
- public async translateTo(
537
- { x, y }: Point,
538
- effectTiming?: CameraAnimationOptions,
539
- ) {
540
- const { x: cx, y: cy } = this.getViewportCenter();
541
- await this.translate({ dx: cx - x, dy: cy - y }, effectTiming);
294
+ public getLayout(): LayoutOptions {
295
+ return this.options.layout!;
542
296
  }
543
297
 
544
298
  /**
545
- * Zoom the graph with a relative ratio.
546
- * @param ratio relative ratio to zoom
547
- * @param origin origin under viewport coordinates.
548
- * @param effectTiming animation configurations
299
+ * <zh/> 设置交互
300
+ *
301
+ * <en/> Set behaviors
302
+ * @param behaviors - <zh/> 交互配置 | <en/> behavior configuration
303
+ * @apiCategory behavior
549
304
  */
550
- public async zoom(
551
- ratio: number,
552
- origin?: Point,
553
- effectTiming?: CameraAnimationOptions,
554
- ) {
555
- await this.transform(
556
- {
557
- zoom: {
558
- ratio,
559
- },
560
- origin,
561
- },
562
- effectTiming,
563
- );
305
+ public setBehaviors(behaviors: CallableValue<BehaviorOptions>): void {
306
+ this.options.behaviors = isFunction(behaviors) ? behaviors(this.getBehaviors()) : behaviors;
307
+ this.context.behavior?.setBehaviors(this.options.behaviors);
564
308
  }
565
309
 
566
310
  /**
567
- * Zoom the graph to a specified ratio.
568
- * @param zoom specified ratio
569
- * @param origin zoom center
570
- * @param effectTiming animation configurations
571
- */
572
- public async zoomTo(
573
- zoom: number,
574
- origin?: PointLike,
575
- effectTiming?: CameraAnimationOptions,
576
- ) {
577
- await this.zoom(
578
- zoom / this.canvas.getCamera().getZoom(),
579
- origin,
580
- effectTiming,
311
+ * <zh/> 更新交互
312
+ *
313
+ * <en/> Update behavior
314
+ * @param behavior - <zh/> 交互配置 | <en/> behavior configuration
315
+ * @apiCategory behavior
316
+ */
317
+ public updateBehavior(behavior: UpdateBehaviorOption): void {
318
+ this.setBehaviors((behaviors) =>
319
+ behaviors.map((_behavior) => {
320
+ if (isObject(_behavior) && _behavior.key === behavior.key) {
321
+ return { ..._behavior, ...behavior };
322
+ }
323
+ return _behavior;
324
+ }),
581
325
  );
582
326
  }
583
327
 
584
328
  /**
585
- * Return the current zoom level of camera.
586
- * @returns current zoom
329
+ * <zh/> 获取交互
330
+ *
331
+ * <en/> Get behaviors
332
+ * @returns <zh/> 交互配置 | <en/> behavior configuration
333
+ * @apiCategory behavior
587
334
  */
588
- public getZoom() {
589
- return this.canvas.getCamera().getZoom();
335
+ public getBehaviors(): BehaviorOptions {
336
+ return this.options.behaviors || [];
590
337
  }
591
338
 
592
339
  /**
593
- * Rotate the graph with a relative angle.
594
- * @param angle
595
- * @param origin
596
- * @param effectTiming
340
+ * <zh/> 设置插件
341
+ *
342
+ * <en/> Set plugins
343
+ * @param plugins - <zh/> 插件配置 | <en/> plugin configuration
344
+ * @apiCategory plugin
597
345
  */
598
- public async rotate(
599
- angle: number,
600
- origin?: PointLike,
601
- effectTiming?: CameraAnimationOptions,
602
- ) {
603
- await this.transform(
604
- {
605
- rotate: {
606
- angle,
607
- },
608
- origin,
609
- },
610
- effectTiming,
611
- );
346
+ public setPlugins(plugins: CallableValue<PluginOptions>): void {
347
+ this.options.plugins = isFunction(plugins) ? plugins(this.getPlugins()) : plugins;
348
+ this.context.plugin?.setPlugins(this.options.plugins);
612
349
  }
613
350
 
614
351
  /**
615
- * Rotate the graph to an absolute angle.
616
- * @param angle
617
- * @param origin
618
- * @param effectTiming
619
- */
620
- public async rotateTo(
621
- angle: number,
622
- origin?: PointLike,
623
- effectTiming?: CameraAnimationOptions,
624
- ) {
625
- await this.rotate(
626
- angle - this.canvas.getCamera().getRoll(),
627
- origin,
628
- effectTiming,
352
+ * <zh/> 更新插件
353
+ *
354
+ * <en/> Update plugin
355
+ * @param plugin - <zh/> 插件配置 | <en/> plugin configuration
356
+ * @apiCategory plugin
357
+ */
358
+ public updatePlugin(plugin: UpdatePluginOption): void {
359
+ this.setPlugins((plugins) =>
360
+ plugins.map((_plugin) => {
361
+ if (isObject(_plugin) && _plugin.key === plugin.key) {
362
+ return { ..._plugin, ...plugin };
363
+ }
364
+ return _plugin;
365
+ }),
629
366
  );
630
367
  }
631
368
 
632
369
  /**
633
- * Fit the graph content to the view.
634
- * @param options.padding padding while fitting
635
- * @param options.rules rules for fitting
636
- * @param effectTiming animation configurations
637
- */
638
- public async fitView(
639
- options?: {
640
- padding: Padding;
641
- rules: FitViewRules;
642
- },
643
- effectTiming?: CameraAnimationOptions,
644
- ) {
645
- const { padding, rules } = options || {};
646
- const [top, right, bottom, left] = padding
647
- ? formatPadding(padding)
648
- : [0, 0, 0, 0];
649
- const { direction = 'both', ratioRule = 'min' } = rules || {};
650
-
651
- // Get the bounds of the whole graph.
652
- const {
653
- center: [graphCenterX, graphCenterY],
654
- halfExtents,
655
- } = this.canvas.document.documentElement.getBounds();
656
- const origin = this.canvas.canvas2Viewport({
657
- x: graphCenterX,
658
- y: graphCenterY,
659
- });
660
- const { width: viewportWidth, height: viewportHeight } =
661
- this.canvas.getConfig();
662
-
663
- const graphWidth = halfExtents[0] * 2;
664
- const graphHeight = halfExtents[1] * 2;
665
- const tlInCanvas = this.canvas.viewport2Canvas({ x: left, y: top });
666
- const brInCanvas = this.canvas.viewport2Canvas({
667
- x: viewportWidth! - right,
668
- y: viewportHeight! - bottom,
669
- });
670
-
671
- const targetViewWidth = brInCanvas.x - tlInCanvas.x;
672
- const targetViewHeight = brInCanvas.y - tlInCanvas.y;
673
-
674
- const wRatio = targetViewWidth / graphWidth;
675
- const hRatio = targetViewHeight / graphHeight;
676
-
677
- let ratio: number;
678
- if (direction === 'x') {
679
- ratio = wRatio;
680
- } else if (direction === 'y') {
681
- ratio = hRatio;
682
- } else {
683
- ratio =
684
- ratioRule === 'max'
685
- ? Math.max(wRatio, hRatio)
686
- : Math.min(wRatio, hRatio);
687
- }
370
+ * <zh/> 获取插件
371
+ *
372
+ * <en/> Get plugins
373
+ * @returns <zh/> 插件配置 | <en/> plugin configuration
374
+ * @apiCategory plugin
375
+ */
376
+ public getPlugins(): PluginOptions {
377
+ return this.options.plugins || [];
378
+ }
688
379
 
689
- await this.transform(
690
- {
691
- translate: {
692
- dx: viewportWidth! / 2 - origin.x,
693
- dy: viewportHeight! / 2 - origin.y,
694
- },
695
- zoom: {
696
- ratio,
697
- },
698
- },
699
- effectTiming,
700
- );
380
+ /**
381
+ * <zh/> 获取插件实例
382
+ *
383
+ * <en/> Get plugin instance
384
+ * @param key - <zh/> 插件 key | <en/> plugin key
385
+ * @returns <zh/> 插件实例 | <en/> plugin instance
386
+ * @apiCategory plugin
387
+ */
388
+ public getPluginInstance<T extends Plugin>(key: string) {
389
+ return this.context.plugin!.getPluginInstance(key) as unknown as T;
701
390
  }
391
+
702
392
  /**
703
- * Fit the graph center to the view center.
704
- * @param effectTiming animation configurations
393
+ * <zh/> 设置数据转换器
394
+ *
395
+ * <en/> Set data transforms
396
+ * @param transforms - <zh/> 数据转换配置 | <en/> data transform configuration
397
+ * @apiCategory transform
705
398
  */
706
- public async fitCenter(effectTiming?: CameraAnimationOptions) {
707
- // Get the bounds of the whole graph.
708
- const {
709
- center: [graphCenterX, graphCenterY],
710
- } = this.canvas.document.documentElement.getBounds();
711
- await this.translateTo(
712
- this.canvas.canvas2Viewport({ x: graphCenterX, y: graphCenterY }),
713
- effectTiming,
714
- );
399
+ public setTransforms(transforms: CallableValue<TransformOptions>): void {
400
+ this.options.transforms = isFunction(transforms) ? transforms(this.getTransforms()) : transforms;
401
+ this.context.transform?.setTransforms(this.options.transforms);
715
402
  }
403
+
716
404
  /**
717
- * Move the graph to make the item align the view center.
718
- * @param item node/edge/combo item or its id
719
- * @param effectTiming animation configurations
720
- */
721
- public async focusItem(id: ID | ID[], effectTiming?: CameraAnimationOptions) {
722
- let bounds: AABB | null = null;
723
- for (const itemId of !isArray(id) ? [id] : id) {
724
- const item = this.getItemById(itemId);
725
- if (item) {
726
- const itemBounds = item.group.getBounds();
727
- if (!bounds) {
728
- bounds = itemBounds;
729
- } else {
730
- bounds.add(itemBounds);
405
+ * <zh/> 更新数据转换器
406
+ *
407
+ * <en/> Update data transform
408
+ * @param transform - <zh/> 数据转换配置 | <en/> data transform configuration
409
+ * @apiCategory transform
410
+ */
411
+ public updateTransform(transform: UpdateTransformOption): void {
412
+ this.setTransforms((transforms) =>
413
+ transforms.map((_transform) => {
414
+ if (isObject(_transform) && _transform.key === transform.key) {
415
+ return { ..._transform, ...transform };
731
416
  }
732
- }
733
- }
734
-
735
- if (bounds) {
736
- const {
737
- center: [itemCenterX, itemCenterY],
738
- } = bounds;
739
- await this.translateTo(
740
- this.canvas.canvas2Viewport({ x: itemCenterX, y: itemCenterY }),
741
- effectTiming,
742
- );
743
- }
417
+ return _transform;
418
+ }),
419
+ );
420
+ this.context.model.refreshData();
744
421
  }
745
422
 
746
423
  /**
747
- * Get item by id. We don't want to
748
- * @param id
749
- * @returns Node | Edge | Combo
424
+ * <zh/> 获取数据转换器
425
+ *
426
+ * <en/> Get data transforms
427
+ * @returns <zh/> 数据转换器实例 | <en/> data transform instance
428
+ * @apiCategory transform
750
429
  */
751
- private getItemById(id: ID) {
752
- return this.itemController.getItemById(id);
430
+ public getTransforms(): TransformOptions {
431
+ return this.options.transforms || [];
753
432
  }
754
433
 
755
434
  /**
756
- * Get the size of the graph canvas.
757
- * @returns [width, height]
758
- * @group View
435
+ * <zh/> 获取数据
436
+ *
437
+ * <en/> Get data
438
+ * @returns <zh/> 数据 | <en/> data
439
+ * @apiCategory data
759
440
  */
760
- public getSize(): number[] {
761
- const { width = 500, height = 500 } = this.specification;
762
- return [width, height];
441
+ public getData(): GraphData {
442
+ return this.context.model.getData();
763
443
  }
764
444
 
765
445
  /**
766
- * Set the size for the graph canvas.
767
- * @param number[] [width, height]
768
- * @group View
446
+ * <zh/> 获取单个元素数据
447
+ *
448
+ * <en/> Get element data by ID
449
+ * @param id - <zh/> 元素 ID | <en/> element ID
450
+ * @returns <zh/> 元素数据 | <en/> element data
451
+ * @apiCategory data
769
452
  */
770
- public setSize(size: number[]) {
771
- if (!isArray(size) || size.length < 2) {
772
- console.warn(
773
- `Failed to setSize. The parameter size: ${size} is invalid. It must be an array with 2 number elements.`,
774
- );
775
- return;
776
- }
777
- this.specification.width = size[0];
778
- this.specification.height = size[1];
779
- this.canvas.resize(size[0], size[1]);
453
+ public getElementData(id: ID): ElementDatum;
454
+ /**
455
+ * <zh/> 批量获取多个元素数据
456
+ *
457
+ * <en/> Get multiple element data in batch
458
+ * @param ids - <zh/> 元素 ID 数组 | <en/> element ID array
459
+ * @apiCategory data
460
+ */
461
+ public getElementData(ids: ID[]): ElementDatum[];
462
+ public getElementData(ids: ID | ID[]): ElementDatum | ElementDatum[] {
463
+ if (Array.isArray(ids)) return ids.map((id) => this.context.model.getElementDataById(id));
464
+ return this.context.model.getElementDataById(ids);
780
465
  }
781
466
 
782
467
  /**
783
- * Get the rendering coordinate according to the canvas dom (viewport) coordinate.
784
- * @param Point rendering coordinate
785
- * @returns canvas dom (viewport) coordinate
786
- * @group View
468
+ * <zh/> 获取所有节点数据
469
+ *
470
+ * <en/> Get all node data
471
+ * @returns <zh/> 节点数据 | <en/> node data
472
+ * @apiCategory data
473
+ */
474
+ public getNodeData(): NodeData[];
475
+ /**
476
+ * <zh/> 获取单个节点数据
477
+ *
478
+ * <en/> Get single node data
479
+ * @param id - <zh/> 节点 ID | <en/> node ID
480
+ * @returns <zh/> 节点数据 | <en/> node data
481
+ * @apiCategory data
482
+ */
483
+ public getNodeData(id: ID): NodeData;
484
+ /**
485
+ * <zh/> 批量获取多个节点数据
486
+ *
487
+ * <en/> Get multiple node data in batch
488
+ * @param ids - <zh/> 节点 ID 数组 | <en/> node ID array
489
+ * @returns <zh/> 节点数据 | <en/> node data
490
+ * @apiCategory data
787
491
  */
788
- public getCanvasByViewport(viewportPoint: Point): Point {
789
- return this.canvas.viewport2Canvas(viewportPoint);
492
+ public getNodeData(ids: ID[]): NodeData[];
493
+ public getNodeData(id?: ID | ID[]): NodeData | NodeData[] {
494
+ if (id === undefined) return this.context.model.getNodeData();
495
+ if (Array.isArray(id)) return this.context.model.getNodeData(id);
496
+ return this.context.model.getNodeData([id])?.[0];
790
497
  }
791
498
 
792
499
  /**
793
- * Get the canvas dom (viewport) coordinate according to the rendering coordinate.
794
- * @param Point canvas dom (viewport) coordinate
795
- * @returns rendering coordinate
796
- * @group View
500
+ * <zh/> 获取所有边数据
501
+ *
502
+ * <en/> Get all edge data
503
+ * @returns <zh/> 边数据 | <en/> edge data
504
+ * @apiCategory data
505
+ */
506
+ public getEdgeData(): EdgeData[];
507
+ /**
508
+ * <zh/> 获取单条边数据
509
+ *
510
+ * <en/> Get single edge data
511
+ * @param id - <zh/> 边 ID | <en/> edge ID
512
+ * @returns <zh/> 边数据 | <en/> edge data
513
+ * @apiCategory data
797
514
  */
798
- public getViewportByCanvas(canvasPoint: Point): Point {
799
- return this.canvas.canvas2Viewport(canvasPoint);
515
+ public getEdgeData(id: ID): EdgeData;
516
+ /**
517
+ * <zh/> 批量获取多条边数据
518
+ *
519
+ * <en/> Get multiple edge data in batch
520
+ * @param ids - <zh/> 边 ID 数组 | <en/> edge ID array
521
+ * @returns <zh/> 边数据 | <en/> edge data
522
+ * @apiCategory data
523
+ */
524
+ public getEdgeData(ids: ID[]): EdgeData[];
525
+ public getEdgeData(id?: ID | ID[]): EdgeData | EdgeData[] {
526
+ if (id === undefined) return this.context.model.getEdgeData();
527
+ if (Array.isArray(id)) return this.context.model.getEdgeData(id);
528
+ return this.context.model.getEdgeData([id])?.[0];
800
529
  }
801
530
 
802
531
  /**
803
- * Get the browser coordinate according to the rendering coordinate.
804
- * @param Point rendering coordinate
805
- * @returns browser coordinate
806
- * @group View
532
+ * <zh/> 获取所有组合数据
533
+ *
534
+ * <en/> Get all combo data
535
+ * @returns <zh/> 组合数据 | <en/> combo data
536
+ * @apiCategory data
537
+ */
538
+ public getComboData(): ComboData[];
539
+ /**
540
+ * <zh/> 获取单个组合数据
541
+ *
542
+ * <en/> Get single combo data
543
+ * @param id - <zh/> 组合ID | <en/> combo ID
544
+ * @returns <zh/> 组合数据 | <en/> combo data
545
+ * @apiCategory data
546
+ */
547
+ public getComboData(id: ID): ComboData;
548
+ /**
549
+ * <zh/> 批量获取多个组合数据
550
+ *
551
+ * <en/> Get multiple combo data in batch
552
+ * @param ids - <zh/> 组合ID 数组 | <en/> combo ID array
553
+ * @returns <zh/> 组合数据 | <en/> combo data
554
+ * @apiCategory data
807
555
  */
808
- public getClientByCanvas(canvasPoint: Point): Point {
809
- const viewportPoint = this.canvas.canvas2Viewport(canvasPoint);
810
- return this.canvas.viewport2Client(viewportPoint as any);
556
+ public getComboData(ids: ID[]): ComboData[];
557
+ public getComboData(id?: ID | ID[]): ComboData | ComboData[] {
558
+ if (id === undefined) return this.context.model.getComboData();
559
+ if (Array.isArray(id)) return this.context.model.getComboData(id);
560
+ return this.context.model.getComboData([id])?.[0];
811
561
  }
812
562
 
813
563
  /**
814
- * Get the rendering coordinate according to the browser coordinate.
815
- * @param Point browser coordinate
816
- * @returns rendering coordinate
817
- * @group View
564
+ * <zh/> 设置全量数据
565
+ *
566
+ * <en/> Set full data
567
+ * @param data - <zh/> 数据 | <en/> data
568
+ * @apiCategory data
818
569
  */
819
- public getCanvasByClient(clientPoint: Point): Point {
820
- const viewportPoint = this.canvas.client2Viewport(clientPoint);
821
- return this.canvas.viewport2Canvas(viewportPoint as any);
570
+ public setData(data: CallableValue<GraphData>): void {
571
+ this.context.model.setData(isFunction(data) ? data(this.getData()) : data);
822
572
  }
823
573
 
824
- // ===== item operations =====
825
574
  /**
826
- * Find a node's inner data according to id or function.
827
- * @param { ID | Function } condition id or condition function
828
- * @returns result node's inner data
829
- * @group Data
575
+ * <zh/> 新增元素数据
576
+ *
577
+ * <en/> Add element data
578
+ * @param data - <zh/> 元素数据 | <en/> element data
579
+ * @apiCategory data
830
580
  */
831
- public getNodeData(condition: ID | Function): NodeModel | undefined {
832
- const conds =
833
- isString(condition) || isNumber(condition) ? [condition] : condition;
834
- return this.dataController.findData('node', conds)?.[0] as NodeModel;
581
+ public addData(data: CallableValue<GraphData>): void {
582
+ this.context.model.addData(isFunction(data) ? data(this.getData()) : data);
835
583
  }
584
+
836
585
  /**
837
- * Find an edge's inner data according to id or function.
838
- * @param { ID | Function } condition id or condition function
839
- * @returns result edge's inner data
840
- * @group Data
586
+ * <zh/> 新增节点数据
587
+ *
588
+ * <en/> Add node data
589
+ * @param data - <zh/> 节点数据 | <en/> node data
590
+ * @apiCategory data
841
591
  */
842
- public getEdgeData(condition: ID | Function): EdgeModel | undefined {
843
- const conds =
844
- isString(condition) || isNumber(condition) || isNumber(condition)
845
- ? [condition]
846
- : condition;
847
- return this.dataController.findData('edge', conds)?.[0] as EdgeModel;
592
+ public addNodeData(data: CallableValue<NodeData[]>): void {
593
+ this.context.model.addNodeData(isFunction(data) ? data(this.getNodeData()) : data);
848
594
  }
595
+
849
596
  /**
850
- * Find an combo's inner data according to id or function.
851
- * @param { ID | Function } condition id or condition function
852
- * @returns result combo's inner data
853
- * @group Data
597
+ * <zh/> 新增边数据
598
+ *
599
+ * <en/> Add edge data
600
+ * @param data - <zh/> 边数据 | <en/> edge data
601
+ * @apiCategory data
854
602
  */
855
- public getComboData(condition: ID | Function): ComboModel | undefined {
856
- const conds =
857
- isString(condition) || isNumber(condition) ? [condition] : condition;
858
- return this.dataController.findData('combo', conds)?.[0] as ComboModel;
603
+ public addEdgeData(data: CallableValue<EdgeData[]>): void {
604
+ this.context.model.addEdgeData(isFunction(data) ? data(this.getEdgeData()) : data);
859
605
  }
606
+
860
607
  /**
861
- * Get all the nodes' inner data
862
- * @returns all nodes' inner data on the graph
863
- * @group Data
608
+ * <zh/> 新增组合数据
609
+ *
610
+ * <en/> Add combo data
611
+ * @param data - <zh/> 组合数据 | <en/> combo data
612
+ * @apiCategory data
864
613
  */
865
- public getAllNodesData(): NodeModel[] {
866
- return this.dataController.findAllData('node') as NodeModel[];
614
+ public addComboData(data: CallableValue<ComboData[]>): void {
615
+ this.context.model.addComboData(isFunction(data) ? data(this.getComboData()) : data);
867
616
  }
617
+
868
618
  /**
869
- * Get all the edges' inner data
870
- * @returns all edges' inner data on the graph
871
- * @group Data
619
+ * <zh/> 更新元素数据
620
+ *
621
+ * <en/> Update element data
622
+ * @param data - <zh/> 元素数据 | <en/> element data
623
+ * @apiCategory data
872
624
  */
873
- public getAllEdgesData(): EdgeModel[] {
874
- return this.dataController.findAllData('edge') as EdgeModel[];
625
+ public updateData(data: CallableValue<PartialGraphData>): void {
626
+ this.context.model.updateData(isFunction(data) ? data(this.getData()) : data);
875
627
  }
628
+
876
629
  /**
877
- * Get all the combos' inner data
878
- * @returns all combos' inner data on the graph
879
- * @group Data
630
+ * <zh/> 更新节点数据
631
+ *
632
+ * <en/> Update node data
633
+ * @param data - <zh/> 节点数据 | <en/> node data
634
+ * @apiCategory data
880
635
  */
881
- public getAllCombosData(): ComboModel[] {
882
- return this.dataController.findAllData('combo') as ComboModel[];
636
+ public updateNodeData(data: CallableValue<PartialNodeLikeData<NodeData>[]>): void {
637
+ this.context.model.updateNodeData(isFunction(data) ? data(this.getNodeData()) : data);
883
638
  }
639
+
884
640
  /**
885
- * Get one-hop edge ids from a start node.
886
- * @param nodeId id of the start node
887
- * @returns one-hop edges' data array
888
- * @group Data
641
+ * <zh/> 更新边数据
642
+ *
643
+ * <en/> Update edge data
644
+ * @param data - <zh/> 边数据 | <en/> edge data
645
+ * @apiCategory data
889
646
  */
890
- public getRelatedEdgesData(
891
- nodeId: ID,
892
- direction: 'in' | 'out' | 'both' = 'both',
893
- ): EdgeModel[] {
894
- return this.dataController.findRelatedEdges(nodeId, direction);
647
+ public updateEdgeData(data: CallableValue<PartialEdgeData<EdgeData>[]>): void {
648
+ this.context.model.updateEdgeData(isFunction(data) ? data(this.getEdgeData()) : data);
895
649
  }
650
+
896
651
  /**
897
- * Get one-hop node ids from a start node.
898
- * @param nodeId id of the start node
899
- * @returns one-hop nodes' data array
900
- * @group Data
652
+ * <zh/> 更新组合数据
653
+ *
654
+ * <en/> Update combo data
655
+ * @param data - <zh/> 组合数据 | <en/> combo data
656
+ * @apiCategory data
901
657
  */
902
- public getNeighborNodesData(
903
- nodeId: ID,
904
- direction: 'in' | 'out' | 'both' = 'both',
905
- ): NodeModel[] {
906
- return this.dataController.findNeighborNodes(nodeId, direction);
658
+ public updateComboData(data: CallableValue<PartialNodeLikeData<ComboData>[]>): void {
659
+ this.context.model.updateComboData(isFunction(data) ? data(this.getComboData()) : data);
907
660
  }
661
+
908
662
  /**
909
- * Get the children's data of a combo.
910
- * @param comboId combo id
911
- * @returns children's data array
912
- * @group Data
663
+ * <zh/> 删除多条元素数据
664
+ *
665
+ * <en/> Remove multiple element data
666
+ * @param ids - <zh/> 元素 ID 数组 | <en/> element ID array
667
+ * @apiCategory data
913
668
  */
914
- public getComboChildrenData(comboId: ID): (ComboModel | NodeModel)[] {
915
- return this.dataController.findChildren(comboId, 'combo');
669
+ public removeData(ids: DataID | ((data: GraphData) => DataID)): void {
670
+ this.context.model.removeData(isFunction(ids) ? ids(this.getData()) : ids);
916
671
  }
917
672
 
918
- /*
919
- * Get the display model of a node / edge / combo.
920
- * @param id item id
921
- * @returns display model
922
- * @group Data
673
+ /**
674
+ * <zh/> 删除多条节点数据
675
+ *
676
+ * <en/> Remove multiple node data
677
+ * @param ids - <zh/> 节点 ID 数组 | <en/> node ID array
678
+ * @apiCategory data
923
679
  */
924
- protected getDisplayModel(
925
- id: ID,
926
- ): NodeDisplayModel | EdgeDisplayModel | ComboDisplayModel {
927
- return this.itemController.findDisplayModel(id);
680
+ public removeNodeData(ids: ID[] | ((data: NodeData[]) => ID[])): void {
681
+ this.context.model.removeNodeData(isFunction(ids) ? ids(this.getNodeData()) : ids);
928
682
  }
929
683
 
930
684
  /**
931
- * Retrieve the nearby edges for a given node using quadtree collision detection.
932
- * @param nodeId node id
933
- * @group Data
685
+ * <zh/> 删除多条边数据
686
+ *
687
+ * <en/> Remove multiple edge data
688
+ * @param ids - <zh/> 边 ID 数组 | <en/> edge ID array
689
+ * @apiCategory data
934
690
  */
935
- public getNearEdgesForNode(nodeId: ID): EdgeModel[] {
936
- const { graphCore } = this.dataController;
937
- return this.itemController.findNearEdgesByNode(nodeId, graphCore);
691
+ public removeEdgeData(ids: ID[] | ((data: EdgeData[]) => ID[])): void {
692
+ this.context.model.removeEdgeData(isFunction(ids) ? ids(this.getEdgeData()) : ids);
938
693
  }
939
694
 
940
695
  /**
941
- * Find items which has the state.
942
- * @param itemType item type
943
- * @param state state name
944
- * @param additionalFilter additional filter function
945
- * @returns items that is the type and has the state
946
- * @group Item
696
+ * <zh/> 删除多条组合数据
697
+ *
698
+ * <en/> Remove multiple combo data
699
+ * @param ids - <zh/> 组合 ID 数组 | <en/> 组合 ID array
700
+ * @apiCategory data
947
701
  */
948
- public findIdByState(
949
- itemType: ITEM_TYPE,
950
- state: string,
951
- value: string | boolean = true,
952
- additionalFilter?: (item: NodeModel | EdgeModel | ComboModel) => boolean,
953
- ): ID[] {
954
- let ids = this.itemController.findIdByState(itemType, state, value);
955
- if (additionalFilter) {
956
- let getDataFunc: any = this.getEdgeData;
957
- if (itemType === 'node') getDataFunc = this.getNodeData;
958
- else if (itemType === 'combo') getDataFunc = this.getComboData;
959
- ids = ids.filter((id) => additionalFilter(getDataFunc(id)));
960
- }
961
- return ids;
962
- }
963
- /**
964
- * Add one or more node/edge/combo data to the graph.
965
- * @param itemType item type
966
- * @param model user data
967
- * @returns whether success
968
- * @group Data
969
- */
970
- public addData(
971
- itemType: ITEM_TYPE,
972
- models:
973
- | NodeUserModel
974
- | EdgeUserModel
975
- | ComboUserModel
976
- | NodeUserModel[]
977
- | EdgeUserModel[]
978
- | ComboUserModel[],
979
- ):
980
- | NodeModel
981
- | EdgeModel
982
- | ComboModel
983
- | NodeModel[]
984
- | EdgeModel[]
985
- | ComboModel[] {
986
- // data controller and item controller subscribe additem in order
987
-
988
- const { graphCore } = this.dataController;
989
- const { specification } = this.themeController;
990
- graphCore.once('changed', (event) => {
991
- if (!event.changes.length) return;
992
- const changes = event.changes;
993
- this.hooks.itemchange.emit({
994
- type: itemType,
995
- changes: graphCore.reduceChanges(event.changes),
996
- graphCore,
997
- theme: specification,
998
- });
999
- this.emit('afteritemchange', {
1000
- type: itemType,
1001
- action: 'add',
1002
- models,
1003
- apiName: 'addData',
1004
- changes,
1005
- });
1006
- });
1007
-
1008
- const modelArr = isArray(models) ? models : [models];
1009
- const data = { nodes: [], edges: [], combos: [] };
1010
- data[`${itemType}s`] = modelArr;
1011
- this.hooks.datachange.emit({
1012
- data,
1013
- type: 'union',
1014
- });
1015
- const dataList = this.dataController.findData(
1016
- itemType,
1017
- modelArr.map((model) => model.id),
1018
- );
1019
- return isArray(models) ? dataList : dataList[0];
1020
- }
1021
- /**
1022
- * Remove one or more node/edge/combo data from the graph.
1023
- * @param item the item to be removed
1024
- * @returns whether success
1025
- * @group Data
1026
- */
1027
- public removeData(itemType: ITEM_TYPE, ids: ID | ID[]) {
1028
- const idArr = isArray(ids) ? ids : [ids];
1029
- const data = { nodes: [], edges: [], combos: [] };
1030
- const { userGraphCore, graphCore } = this.dataController;
1031
- const { specification } = this.themeController;
1032
- const getItem =
1033
- itemType === 'edge' ? userGraphCore.getEdge : userGraphCore.getNode;
1034
- data[`${itemType}s`] = idArr.map((id) => getItem.bind(userGraphCore)(id));
1035
- graphCore.once('changed', (event) => {
1036
- if (!event.changes.length) return;
1037
- const changes = event.changes;
1038
- this.hooks.itemchange.emit({
1039
- type: itemType,
1040
- changes: event.changes,
1041
- graphCore,
1042
- theme: specification,
1043
- });
1044
- this.emit('afteritemchange', {
1045
- type: itemType,
1046
- action: 'remove',
1047
- ids: idArr,
1048
- apiName: 'removeData',
1049
- changes,
1050
- });
1051
- });
1052
- this.hooks.datachange.emit({
1053
- data,
1054
- type: 'remove',
1055
- });
702
+ public removeComboData(ids: ID[] | ((data: ComboData[]) => ID[])): void {
703
+ this.context.model.removeComboData(isFunction(ids) ? ids(this.getComboData()) : ids);
1056
704
  }
705
+
1057
706
  /**
1058
- * Extends the fields of oldValue and newValue
1059
- * to make sure they both contain the union set of their original fields.
1060
- * The missing fields' values are filled using data from displayModel data.
1061
- * @param changes
1062
- * @returns
1063
- */
1064
- private extendChanges(changes) {
1065
- return changes
1066
- .map((change) => {
1067
- const { id, propertyName, oldValue, newValue } = change;
1068
- if (!oldValue || !newValue) return change;
1069
- if (propertyName) {
1070
- if (oldValue !== newValue) return change;
1071
- return false;
1072
- }
707
+ * <zh/> 获取元素类型
708
+ *
709
+ * <en/> Get element type
710
+ * @param id - <zh/> 元素 ID | <en/> element ID
711
+ * @returns <zh/> 元素类型 | <en/> element type
712
+ * @apiCategory element
713
+ */
714
+ public getElementType(id: ID): ElementType {
715
+ return this.context.model.getElementType(id);
716
+ }
1073
717
 
1074
- const displayData = this.getItemById(id).displayModel.data;
1075
- const oldFields = Object.keys(oldValue);
1076
- const newFields = Object.keys(newValue);
1077
- const commonFields = [...new Set([...oldFields, ...newFields])];
1078
-
1079
- commonFields.forEach((field) => {
1080
- if (!Object.prototype.hasOwnProperty.call(oldValue, field)) {
1081
- oldValue[field] = displayData[field];
1082
- }
1083
- if (!Object.prototype.hasOwnProperty.call(newValue, field)) {
1084
- newValue[field] = displayData[field];
1085
- }
1086
- });
718
+ /**
719
+ * <zh/> 获取节点或组合关联边的数据
720
+ *
721
+ * <en/> Get edge data related to the node or combo
722
+ * @param id - <zh/> 节点或组合ID | <en/> node or combo ID
723
+ * @param direction - <zh/> 边的方向 | <en/> edge direction
724
+ * @returns <zh/> 边数据 | <en/> edge data
725
+ * @apiCategory data
726
+ */
727
+ public getRelatedEdgesData(id: ID, direction: EdgeDirection = 'both'): EdgeData[] {
728
+ return this.context.model.getRelatedEdgesData(id, direction);
729
+ }
1087
730
 
1088
- if (
1089
- (oldValue.x === undefined || Number.isNaN(oldValue.x)) &&
1090
- !oldValue._isCombo
1091
- )
1092
- oldValue.x = 0;
1093
- if (
1094
- (oldValue.y === undefined || Number.isNaN(oldValue.x)) &&
1095
- !oldValue._isCombo
1096
- )
1097
- oldValue.y = 0;
1098
- if (Number.isNaN(newValue.x)) delete newValue.x;
1099
- if (Number.isNaN(newValue.y)) delete newValue.y;
1100
-
1101
- if (isEqual(newValue, oldValue)) return false;
1102
-
1103
- return {
1104
- ...change,
1105
- newValue,
1106
- oldValue,
1107
- };
1108
- })
1109
- .filter(Boolean);
1110
- }
1111
- /**
1112
- * Update one or more node/edge/combo data on the graph.
1113
- * @param {ITEM_TYPE} itemType 'node' | 'edge' | 'combo'
1114
- * @param models new configurations for every node/edge/combo, which has id field to indicate the specific item
1115
- * @group Data
1116
- */
1117
- public updateData(
1118
- itemType: ITEM_TYPE,
1119
- models:
1120
- | Partial<NodeUserModel>
1121
- | Partial<EdgeUserModel>
1122
- | Partial<
1123
- | ComboUserModel
1124
- | Partial<NodeUserModel>[]
1125
- | Partial<EdgeUserModel>[]
1126
- | Partial<ComboUserModel>[]
1127
- >,
1128
- ):
1129
- | NodeModel
1130
- | EdgeModel
1131
- | ComboModel
1132
- | NodeModel[]
1133
- | EdgeModel[]
1134
- | ComboModel[] {
1135
- const modelArr = isArray(models) ? models : [models];
1136
- const data = { nodes: [], edges: [], combos: [] };
1137
- data[`${itemType}s`] = modelArr;
1138
-
1139
- const { graphCore } = this.dataController;
1140
- const { specification } = this.themeController;
1141
- graphCore.once('changed', (event) => {
1142
- const changes = this.extendChanges(clone(event.changes));
1143
- this.hooks.itemchange.emit({
1144
- type: itemType,
1145
- changes: event.changes,
1146
- graphCore,
1147
- theme: specification,
1148
- });
1149
- this.emit('afteritemchange', {
1150
- type: itemType,
1151
- action: 'update',
1152
- models,
1153
- apiName: 'updateData',
1154
- changes,
1155
- });
1156
- });
731
+ /**
732
+ * <zh/> 获取节点或组合的一跳邻居节点数据
733
+ *
734
+ * <en/> Get the one-hop neighbor node data of the node or combo
735
+ * @param id - <zh/> 节点或组合ID | <en/> node or combo ID
736
+ * @returns <zh/> 邻居节点数据 | <en/> neighbor node data
737
+ * @apiCategory data
738
+ */
739
+ public getNeighborNodesData(id: ID): NodeData[] {
740
+ return this.context.model.getNeighborNodesData(id);
741
+ }
1157
742
 
1158
- this.hooks.datachange.emit({
1159
- data,
1160
- type: 'update',
1161
- });
1162
- const dataList = this.dataController.findData(
1163
- itemType,
1164
- modelArr.map((model) => model.id),
1165
- );
1166
- return isArray(models) ? dataList : dataList[0];
1167
- }
1168
-
1169
- /**
1170
- * Update one or more nodes' positions,
1171
- * do not update other styles which leads to better performance than updating positions by updateData.
1172
- * @param models new configurations with x and y for every node, which has id field to indicate the specific item
1173
- * @group Data
1174
- */
1175
- public updateNodePosition(
1176
- models:
1177
- | Partial<NodeUserModel>
1178
- | Partial<
1179
- ComboUserModel | Partial<NodeUserModel>[] | Partial<ComboUserModel>[]
1180
- >,
1181
- upsertAncestors?: boolean,
1182
- disableAnimate = false,
1183
- callback?: (
1184
- model: NodeModel | EdgeModel | ComboModel,
1185
- canceled?: boolean,
1186
- ) => void,
1187
- stack?: boolean,
1188
- ) {
1189
- return this.updatePosition(
1190
- 'node',
1191
- models,
1192
- upsertAncestors,
1193
- disableAnimate,
1194
- callback,
1195
- stack,
1196
- );
743
+ /**
744
+ * <zh/> 获取节点或组合的祖先元素数据
745
+ *
746
+ * <en/> Get the ancestor element data of the node or combo
747
+ * @param id - <zh/> 节点或组合ID | <en/> node or combo ID
748
+ * @param hierarchy - <zh/> 指定树图层级关系还是组合层级关系 | <en/> specify tree or combo hierarchy relationship
749
+ * @returns <zh/> 祖先元素数据 | <en/> ancestor element data
750
+ * @remarks
751
+ * <zh/> 数组中的顺序是从父节点到祖先节点
752
+ *
753
+ * <en/> The order in the array is from the parent node to the ancestor node
754
+ * @apiCategory data
755
+ */
756
+ public getAncestorsData(id: ID, hierarchy: HierarchyKey): NodeLikeData[] {
757
+ return this.context.model.getAncestorsData(id, hierarchy);
1197
758
  }
1198
759
 
1199
760
  /**
1200
- * Update one or more combos' positions,
1201
- * do not update other styles which leads to better performance than updating positions by updateData.
1202
- * In fact, it changes the succeed nodes positions to affect the combo's position, but not modify the combo's position directly.
1203
- * @param models new configurations with x and y for every combo, which has id field to indicate the specific item
1204
- * @group Data
1205
- */
1206
- public updateComboPosition(
1207
- models:
1208
- | Partial<NodeUserModel>
1209
- | Partial<
1210
- ComboUserModel | Partial<NodeUserModel>[] | Partial<ComboUserModel>[]
1211
- >,
1212
- upsertAncestors?: boolean,
1213
- disableAnimate = false,
1214
- callback?: (model: NodeModel | EdgeModel | ComboModel) => void,
1215
- stack?: boolean,
1216
- ) {
1217
- return this.updatePosition(
1218
- 'combo',
1219
- models,
1220
- upsertAncestors,
1221
- disableAnimate,
1222
- callback,
1223
- stack,
1224
- );
761
+ * <zh/> 获取节点或组合的父元素数据
762
+ *
763
+ * <en/> Get the parent element data of the node or combo
764
+ * @param id - <zh/> 节点或组合ID | <en/> node or combo ID
765
+ * @param hierarchy - <zh/> 指定树图层级关系还是组合层级关系 | <en/> specify tree or combo hierarchy relationship
766
+ * @returns <zh/> 父元素数据 | <en/> parent element data
767
+ * @apiCategory data
768
+ */
769
+ public getParentData(id: ID, hierarchy: HierarchyKey): NodeLikeData | undefined {
770
+ return this.context.model.getParentData(id, hierarchy);
1225
771
  }
1226
772
 
1227
773
  /**
1228
- * Get history plugin instance
774
+ * <zh/> 获取节点或组合的子元素数据
775
+ *
776
+ * <en/> Get the child element data of the node or combo
777
+ * @param id - <zh/> 节点或组合ID | <en/> node or combo ID
778
+ * @returns <zh/> 子元素数据 | <en/> child element data
779
+ * @apiCategory data
1229
780
  */
1230
- private getHistoryPlugin(): History {
1231
- if (
1232
- !this.specification.enableStack ||
1233
- !this.pluginController.hasPlugin('history')
1234
- ) {
1235
- console.error('The history plugin is not loaded or initialized.');
1236
- return;
1237
- }
1238
- return this.pluginController.getPlugin('history') as History;
1239
- }
1240
-
1241
- private updatePosition(
1242
- type: 'node' | 'combo',
1243
- models:
1244
- | Partial<NodeUserModel>
1245
- | Partial<
1246
- ComboUserModel | Partial<NodeUserModel>[] | Partial<ComboUserModel>[]
1247
- >,
1248
- upsertAncestors?: boolean,
1249
- disableAnimate = false,
1250
- callback?: (
1251
- model: NodeModel | EdgeModel | ComboModel,
1252
- canceled?: boolean,
1253
- ) => void,
1254
- stack?: boolean,
1255
- ) {
1256
- const modelArr = isArray(models) ? models : [models];
1257
- const { graphCore } = this.dataController;
1258
- const { specification } = this.themeController;
1259
- graphCore.once('changed', (event) => {
1260
- if (!event.changes.length) return;
1261
- const changes = event.changes.filter(
1262
- (change) => !isEqual(change.newValue, change.oldValue),
1263
- );
1264
- this.hooks.itemchange.emit({
1265
- type,
1266
- changes: event.changes,
1267
- graphCore,
1268
- theme: specification,
1269
- upsertAncestors,
1270
- action: 'updatePosition',
1271
- animate: !disableAnimate,
1272
- callback,
1273
- });
1274
- this.emit('afteritemchange', {
1275
- type,
1276
- action: 'updatePosition',
1277
- upsertAncestors,
1278
- models,
1279
- apiName: 'updatePosition',
1280
- changes,
1281
- });
1282
- });
781
+ public getChildrenData(id: ID): NodeLikeData[] {
782
+ return this.context.model.getChildrenData(id);
783
+ }
1283
784
 
1284
- this.hooks.datachange.emit({
1285
- data: {
1286
- nodes: type === 'node' ? (modelArr as NodeUserModel[]) : [],
1287
- edges: [],
1288
- combos: type === 'combo' ? (modelArr as ComboUserModel[]) : [],
1289
- },
1290
- type: 'update',
1291
- });
1292
- const dataList = this.dataController.findData(
1293
- type,
1294
- modelArr.map((model) => model.id),
1295
- );
1296
- return isArray(models) ? dataList : dataList[0];
785
+ /**
786
+ * <zh/> 获取指定状态下的节点数据
787
+ *
788
+ * <en/> Get node data in a specific state
789
+ * @param state - <zh/> 状态 | <en/> state
790
+ * @returns <zh/> 节点数据 | <en/> node data
791
+ * @apiCategory data
792
+ */
793
+ public getElementDataByState(elementType: 'node', state: State): NodeData[];
794
+ /**
795
+ * <zh/> 获取指定状态下的边数据
796
+ *
797
+ * <en/> Get edge data in a specific state
798
+ * @param state - <zh/> 状态 | <en/> state
799
+ * @returns <zh/> 边数据 | <en/> edge data
800
+ * @apiCategory data
801
+ */
802
+ public getElementDataByState(elementType: 'edge', state: State): EdgeData[];
803
+ /**
804
+ * <zh/> 获取指定状态下的组合数据
805
+ *
806
+ * <en/> Get combo data in a specific state
807
+ * @param state - <zh/> 状态 | <en/> state
808
+ * @returns <zh/> 组合数据 | <en/> combo data
809
+ * @apiCategory data
810
+ */
811
+ public getElementDataByState(elementType: 'combo', state: State): ComboData[];
812
+ public getElementDataByState(elementType: ElementType, state: State): ElementDatum[] {
813
+ return this.context.model.getElementDataByState(elementType, state);
1297
814
  }
1298
815
 
1299
- private getItemPreviousVisibility(ids: ID[]) {
1300
- const objs = ids.map((id) => ({ id, visible: this.getItemVisible(id) }));
1301
- const groupedByVisible = groupBy(objs, 'visible');
816
+ private async initCanvas() {
817
+ if (this.context.canvas) return await this.context.canvas.init();
818
+
819
+ const { container = 'container', width, height, renderer, background } = this.options;
820
+
821
+ if (container instanceof Canvas) {
822
+ this.context.canvas = container;
823
+ container.setBackground(background);
824
+ await container.init();
825
+ } else {
826
+ const $container = isString(container) ? document.getElementById(container!) : container;
827
+ const containerSize = sizeOf($container!);
1302
828
 
1303
- const values = [];
1304
- for (const visible in groupedByVisible) {
1305
- values.push({
1306
- ids: map(groupedByVisible[visible], (item) => item.id),
1307
- visible: visible === 'true',
829
+ this.emit(GraphEvent.BEFORE_CANVAS_INIT, { container: $container, width, height });
830
+
831
+ const canvas = new Canvas({
832
+ container: $container!,
833
+ width: width || containerSize[0],
834
+ height: height || containerSize[1],
835
+ background,
836
+ renderer,
1308
837
  });
838
+
839
+ this.context.canvas = canvas;
840
+ await canvas.init();
841
+ this.emit(GraphEvent.AFTER_CANVAS_INIT, { canvas });
1309
842
  }
1310
- return values;
843
+ }
844
+
845
+ private initRuntime() {
846
+ this.context.options = this.options;
847
+ if (!this.context.batch) this.context.batch = new BatchController(this.context);
848
+ if (!this.context.plugin) this.context.plugin = new PluginController(this.context);
849
+ if (!this.context.viewport) this.context.viewport = new ViewportController(this.context);
850
+ if (!this.context.transform) this.context.transform = new TransformController(this.context);
851
+ if (!this.context.element) this.context.element = new ElementController(this.context);
852
+ if (!this.context.animation) this.context.animation = new Animation(this.context);
853
+ if (!this.context.layout) this.context.layout = new LayoutController(this.context);
854
+ if (!this.context.behavior) this.context.behavior = new BehaviorController(this.context);
855
+ }
856
+
857
+ private async prepare(): Promise<void> {
858
+ // 等待同步任务执行完成,避免 render 后立即调用 destroy 导致的问题
859
+ // Wait for synchronous tasks to complete, to avoid problems caused by calling destroy immediately after render
860
+ await Promise.resolve();
861
+
862
+ if (this.destroyed) throw new Error('Graph has been destroyed');
863
+
864
+ await this.initCanvas();
865
+ this.initRuntime();
1311
866
  }
1312
867
 
1313
868
  /**
1314
- * Show the item(s).
1315
- * @param item the item to be shown
1316
- * @returns
1317
- * @group Item
869
+ * <zh/> 执行渲染
870
+ *
871
+ * <en/> Render
872
+ * @remarks
873
+ * <zh/> 此过程会执行数据更新、绘制元素、执行布局
874
+ *
875
+ * <en/> This process will execute data update, element rendering, and layout execution
876
+ * @apiCategory render
1318
877
  */
1319
- public showItem(ids: ID | ID[], disableAnimate = false) {
1320
- const idArr = isArray(ids) ? ids : [ids];
1321
- if (isEmpty(idArr)) return;
1322
- const changes = {
1323
- newValue: [{ ids: idArr, visible: true }],
1324
- oldValue: this.getItemPreviousVisibility(idArr),
1325
- };
1326
- this.hooks.itemvisibilitychange.emit({
1327
- ids: idArr as ID[],
1328
- value: true,
1329
- graphCore: this.dataController.graphCore,
1330
- animate: !disableAnimate,
1331
- });
1332
- this.emit('afteritemvisibilitychange', {
1333
- ids,
1334
- value: true,
1335
- animate: !disableAnimate,
1336
- action: 'updateVisibility',
1337
- apiName: 'showItem',
1338
- changes,
1339
- });
878
+ public async render(): Promise<void> {
879
+ await this.prepare();
880
+ emit(this, new GraphLifeCycleEvent(GraphEvent.BEFORE_RENDER));
881
+ const animation = this.context.element!.draw();
882
+ await Promise.all([animation?.finished, this.context.layout!.layout()]);
883
+ await this.autoFit();
884
+ emit(this, new GraphLifeCycleEvent(GraphEvent.AFTER_RENDER));
1340
885
  }
886
+
1341
887
  /**
1342
- * Hide the item(s).
1343
- * @param item the item to be hidden
1344
- * @returns
1345
- * @group Item
888
+ * <zh/> 绘制元素
889
+ *
890
+ * <en/> Draw elements
891
+ * @returns <zh/> 渲染结果 | <en/> draw result
892
+ * @apiCategory element
1346
893
  */
1347
- public hideItem(ids: ID | ID[], disableAnimate = false) {
1348
- const idArr = isArray(ids) ? ids : [ids];
1349
- if (isEmpty(idArr)) return;
1350
- const changes = {
1351
- newValue: [{ ids: idArr, visible: false }],
1352
- oldValue: this.getItemPreviousVisibility(idArr),
1353
- };
1354
- this.hooks.itemvisibilitychange.emit({
1355
- ids: idArr as ID[],
1356
- value: false,
1357
- graphCore: this.dataController.graphCore,
1358
- animate: !disableAnimate,
1359
- });
1360
- this.emit('afteritemvisibilitychange', {
1361
- ids,
1362
- value: false,
1363
- animate: !disableAnimate,
1364
- action: 'updateVisibility',
1365
- apiName: 'hideItem',
1366
- changes,
1367
- });
894
+ public async draw(): Promise<void> {
895
+ await this.prepare();
896
+ await this.context.element!.draw()?.finished;
897
+ await this.autoFit();
1368
898
  }
1369
899
 
1370
900
  /**
1371
- * Make the item(s) to the front.
1372
- * @param ids
1373
- * @returns
1374
- * @group Item
901
+ * <zh/> 执行布局
902
+ *
903
+ * <en/> Execute layout
904
+ * @apiCategory layout
1375
905
  */
1376
- public frontItem(ids: ID | ID[]) {
1377
- const idArr = isArray(ids) ? ids : [ids];
1378
- this.hooks.itemzindexchange.emit({
1379
- ids: idArr as ID[],
1380
- action: 'front',
1381
- graphCore: this.dataController.graphCore,
1382
- });
1383
- this.emit('afteritemzindexchange', {
1384
- ids: idArr,
1385
- action: 'front',
1386
- apiName: 'frontItem',
1387
- });
906
+ public async layout() {
907
+ await this.context.layout!.layout();
1388
908
  }
909
+
1389
910
  /**
1390
- * Make the item(s) to the back.
1391
- * @param ids
1392
- * @returns
1393
- * @group Item
911
+ * <zh/> 停止布局
912
+ *
913
+ * <en/> Stop layout
914
+ * @remarks
915
+ * <zh/> 适用于带有迭代动画的布局,目前有 `force` 属于此类布局,即停止力导布局的迭代,一般用于布局迭代时间过长情况下的手动停止迭代动画,例如在点击画布/节点的监听中调用
916
+ *
917
+ * <en/> Suitable for layouts with iterative animations. Currently, `force` belongs to this type of layout, that is, stop the iteration of the force-directed layout. It is generally used to manually stop the iteration animation when the layout iteration time is too long, such as calling in the click canvas/node listener
918
+ * @apiCategory layout
1394
919
  */
1395
- public backItem(ids: ID | ID[]) {
1396
- const idArr = isArray(ids) ? ids : [ids];
1397
- this.hooks.itemzindexchange.emit({
1398
- ids: idArr as ID[],
1399
- action: 'back',
1400
- graphCore: this.dataController.graphCore,
1401
- });
1402
- this.emit('afteritemzindexchange', {
1403
- ids: idArr,
1404
- action: 'back',
1405
- apiName: 'backItem',
1406
- });
920
+ public stopLayout() {
921
+ this.context.layout!.stopLayout();
1407
922
  }
1408
923
 
1409
- private getItemPreviousStates(stateOption: {
1410
- ids: ID | ID[];
1411
- states: string | string[];
1412
- value: boolean;
1413
- }) {
1414
- const { ids, states } = stateOption;
1415
- const idArr = Array.isArray(ids) ? ids : [ids];
1416
- const stateArr = Array.isArray(states) ? states : [states];
1417
- if (isEmpty(idArr)) return;
1418
- return idArr.flatMap((id) => {
1419
- return stateArr.map((state) => ({
1420
- ids: id,
1421
- states: state,
1422
- value: this.getItemState(id, state),
1423
- }));
1424
- });
1425
- }
1426
924
  /**
1427
- * Set state for the item.
1428
- * @param item the item to be set
1429
- * @param state the state name
1430
- * @param value state value
1431
- * @returns
1432
- * @group Item
1433
- */
1434
- public setItemState(
1435
- ids: ID | ID[],
1436
- states: string | string[],
1437
- value: boolean,
1438
- ) {
1439
- const idArr = isArray(ids) ? ids : [ids];
1440
- const stateArr = isArray(states) ? states : [states];
1441
- const stateOption = { ids: idArr, states: stateArr, value };
1442
- const changes = {
1443
- newValue: [stateOption],
1444
- oldValue: this.getItemPreviousStates(stateOption),
1445
- };
1446
- this.hooks.itemstatechange.emit({
1447
- ids: idArr as ID[],
1448
- states: stateArr as string[],
1449
- value,
1450
- });
1451
- this.emit('afteritemstatechange', {
1452
- ids,
1453
- states,
1454
- value,
1455
- action: 'updateState',
1456
- apiName: 'setItemState',
1457
- changes,
1458
- });
925
+ * <zh/> 清空画布元素
926
+ *
927
+ * <en/> Clear canvas elements
928
+ * @apiCategory canvas
929
+ */
930
+ public async clear(): Promise<void> {
931
+ this.context.model.setData({});
932
+ await this.draw();
1459
933
  }
934
+
1460
935
  /**
1461
- * Get the state value for an item.
1462
- * @param id the id for the item
1463
- * @param states the state name
1464
- * @returns {boolean} the state value
1465
- * @group Item
1466
- */
1467
- public getItemState(id: ID, state: string) {
1468
- return this.itemController.getItemState(id, state);
936
+ * <zh/> 销毁当前图实例
937
+ *
938
+ * <en/> Destroy the current graph instance
939
+ * @apiCategory instance
940
+ */
941
+ public destroy(): void {
942
+ emit(this, new GraphLifeCycleEvent(GraphEvent.BEFORE_DESTROY));
943
+
944
+ const { layout, animation, element, model, canvas, behavior, plugin } = this.context;
945
+ plugin?.destroy();
946
+ behavior?.destroy();
947
+ layout?.destroy();
948
+ animation?.destroy();
949
+ element?.destroy();
950
+ model.destroy();
951
+ canvas?.destroy();
952
+ this.options = {};
953
+ // @ts-expect-error force delete
954
+ this.context = {};
955
+
956
+ this.off();
957
+ window.removeEventListener('resize', this.onResize);
958
+
959
+ this.destroyed = true;
960
+
961
+ emit(this, new GraphLifeCycleEvent(GraphEvent.AFTER_DESTROY));
1469
962
  }
1470
963
 
1471
964
  /**
1472
- * Get all the state names with value true for an item.
1473
- * @param id the id for the item
1474
- * @returns {string[]} the state names with value true
1475
- * @group Item
965
+ * <zh/> 获取画布实例
966
+ *
967
+ * <en/> Get canvas instance
968
+ * @returns - <zh/> 画布实例 | <en/> canvas instance
969
+ * @apiCategory canvas
1476
970
  */
1477
- public getItemAllStates(id: ID): string[] {
1478
- return this.itemController.getItemAllStates(id);
971
+ public getCanvas(): Canvas {
972
+ return this.context.canvas;
1479
973
  }
1480
974
 
1481
975
  /**
1482
- * Clear all the states for item(s).
1483
- * @param ids the id(s) for the item(s) to be clear
1484
- * @param states the states' names, all the states wil be cleared if states is not assigned
1485
- * @returns
1486
- * @group Item
976
+ * <zh/> 调整画布大小为图容器大小
977
+ *
978
+ * <en/> Resize the canvas to the size of the graph container
979
+ * @apiCategory viewport
1487
980
  */
1488
- public clearItemState(ids: ID | ID[], states?: string[]) {
1489
- const idArr = isArray(ids) ? ids : [ids];
1490
- const stateOptions = { ids: idArr, states, value: false };
1491
- const changes = {
1492
- newValue: [stateOptions],
1493
- oldValue: this.getItemPreviousStates(stateOptions),
1494
- };
1495
- this.hooks.itemstatechange.emit({
1496
- ids: idArr as ID[],
1497
- states,
1498
- value: false,
1499
- });
1500
- this.emit('afteritemstatechange', {
1501
- ids,
1502
- states,
1503
- value: false,
1504
- action: 'updateState',
1505
- apiName: 'clearItemState',
1506
- changes,
1507
- });
981
+ public resize(): void;
982
+ /**
983
+ * <zh/> 调整画布大小为指定宽高
984
+ *
985
+ * <en/> Resize the canvas to the specified width and height
986
+ * @param width - <zh/> 宽度 | <en/> width
987
+ * @param height - <zh/> 高度 | <en/> height
988
+ * @apiCategory viewport
989
+ */
990
+ public resize(width: number, height: number): void;
991
+ public resize(width?: number, height?: number): void {
992
+ const size: Vector2 = !width || !height ? sizeOf(this.context.canvas!.getContainer()!) : [width, height];
993
+ if (isEqual(size, this.getSize())) return;
994
+ emit(this, new GraphLifeCycleEvent(GraphEvent.BEFORE_SIZE_CHANGE, { size }));
995
+ this.context.canvas.resize(...size);
996
+ emit(this, new GraphLifeCycleEvent(GraphEvent.AFTER_SIZE_CHANGE, { size }));
1508
997
  }
1509
998
 
1510
999
  /**
1511
- * Get the rendering bbox for a node / edge / combo, or the graph (when the id is not assigned).
1512
- * @param id the id for the node / edge / combo, undefined for the whole graph
1513
- * @returns rendering bounding box. returns false if the item is not exist
1514
- * @group Item
1000
+ * <zh/> 将图缩放至合适大小并平移至视口中心
1001
+ *
1002
+ * <en/> Zoom the graph to fit the viewport and move it to the center of the viewport
1003
+ * @param options - <zh/> 适配配置 | <en/> fit options
1004
+ * @param animation - <zh/> 动画配置 | <en/> animation configuration
1005
+ * @apiCategory viewport
1515
1006
  */
1516
- public getRenderBBox(
1517
- id: ID | undefined,
1518
- onlyKeyShape = false,
1519
- isTransient = false,
1520
- ): AABB | false {
1521
- if (!id) return this.canvas.getRoot().getRenderBounds();
1522
- return this.itemController.getItemBBox(id, onlyKeyShape, isTransient);
1007
+ public async fitView(options?: FitViewOptions, animation?: ViewportAnimationEffectTiming): Promise<void> {
1008
+ await this.context.viewport?.fitView(options, animation);
1523
1009
  }
1524
1010
 
1525
1011
  /**
1526
- * Get the visibility for a node / edge / combo.
1527
- * @param id the id for the node / edge / combo
1528
- * @returns visibility for the item, false for invisible or unexistence for the item
1529
- * @group Item
1012
+ * <zh/> 将图平移至视口中心
1013
+ *
1014
+ * <en/> Move the graph to the center of the viewport
1015
+ * @param animation - <zh/> 动画配置 | <en/> animation configuration
1016
+ * @apiCategory viewport
1530
1017
  */
1531
- public getItemVisible(id: ID) {
1532
- return this.itemController.getItemVisible(id);
1018
+ public async fitCenter(animation?: ViewportAnimationEffectTiming): Promise<void> {
1019
+ await this.context.viewport?.fitCenter(animation);
1533
1020
  }
1534
1021
 
1535
- // ===== combo operations =====
1022
+ private async autoFit(): Promise<void> {
1023
+ const { autoFit } = this.context.options;
1024
+ if (!autoFit) return;
1025
+
1026
+ if (isString(autoFit)) {
1027
+ if (autoFit === 'view') await this.fitView();
1028
+ else if (autoFit === 'center') await this.fitCenter();
1029
+ } else {
1030
+ const { type, animation } = autoFit;
1031
+ if (type === 'view') await this.fitView(autoFit.options, animation);
1032
+ else if (type === 'center') await this.fitCenter(animation);
1033
+ }
1034
+ }
1536
1035
 
1537
1036
  /**
1538
- * Add a new combo to the graph, and update the structure of the existed child in childrenIds to be the children of the new combo.
1539
- * Different from addData with combo type, this API update the succeeds' combo tree strucutres in the same time.
1540
- * @param model combo user data
1541
- * @returns whether success
1542
- * @group Combo
1037
+ * <zh/> 移动图,使得元素对齐到视口中心
1038
+ *
1039
+ * <en/> Move the graph so that the element is aligned to the center of the viewport
1040
+ * @param id - <zh/> 元素 ID | <en/> element ID
1041
+ * @param animation - <zh/> 动画配置 | <en/> animation configuration
1042
+ * @apiCategory viewport
1543
1043
  */
1544
- public addCombo(model: ComboUserModel, childrenIds: ID[]): ComboModel {
1545
- const { graphCore } = this.dataController;
1546
- const { specification } = this.themeController;
1547
- graphCore.once('changed', (event) => {
1548
- if (!event.changes.length) return;
1549
- const changes = event.changes;
1550
- this.hooks.itemchange.emit({
1551
- type: 'combo',
1552
- changes: graphCore.reduceChanges(event.changes),
1553
- graphCore,
1554
- theme: specification,
1555
- });
1556
- this.emit('afteritemchange', {
1557
- type: 'combo',
1558
- action: 'add',
1559
- models: [model],
1560
- apiName: 'addCombo',
1561
- changes,
1562
- });
1563
- });
1564
-
1565
- const data = {
1566
- nodes: [],
1567
- edges: [],
1568
- combos: [
1569
- {
1570
- ...model,
1571
- data: {
1572
- ...model.data,
1573
- _children: childrenIds,
1574
- },
1575
- },
1576
- ],
1577
- };
1578
- this.hooks.datachange.emit({
1579
- data,
1580
- type: 'addCombo',
1581
- });
1582
- return this.dataController.findData('combo', [model.id])[0] as ComboModel;
1044
+ public async focusElement(id: ID | ID[], animation?: ViewportAnimationEffectTiming): Promise<void> {
1045
+ await this.context.viewport?.focusElements(Array.isArray(id) ? id : [id], animation);
1583
1046
  }
1047
+
1584
1048
  /**
1585
- * Collapse a combo.
1586
- * @param comboId combo ids
1587
- * @group Combo
1049
+ * <zh/> 基于当前缩放比例进行缩放
1050
+ *
1051
+ * <en/> Zoom based on the current zoom ratio
1052
+ * @param ratio - <zh/> 缩放比例 | <en/> zoom ratio
1053
+ * @param animation - <zh/> 动画配置 | <en/> animation configuration
1054
+ * @param origin - <zh/> 缩放中心(视口坐标) | <en/> zoom center(viewport coordinates)
1055
+ * @remarks
1056
+ * <zh/>
1057
+ * - ratio > 1 放大
1058
+ * - ratio < 1 缩小
1059
+ *
1060
+ * <en/>
1061
+ * - ratio > 1 zoom in
1062
+ * - ratio < 1 zoom out
1063
+ * @apiCategory viewport
1588
1064
  */
1589
- public collapseCombo(comboIds: ID | ID[]) {
1590
- const ids = isArray(comboIds) ? comboIds : [comboIds];
1591
- this.executeWithoutStacking(() => {
1592
- this.updateData(
1593
- 'combo',
1594
- ids.map((id) => ({ id, data: { collapsed: true } })),
1595
- );
1596
- });
1597
- this.emit('aftercollapsecombo', {
1598
- type: 'combo',
1599
- action: 'collapseCombo',
1600
- ids: comboIds,
1601
- apiName: 'collapseCombo',
1602
- });
1065
+ public async zoomBy(ratio: number, animation?: ViewportAnimationEffectTiming, origin?: Point): Promise<void> {
1066
+ await this.context.viewport!.transform({ mode: 'relative', scale: ratio, origin }, animation);
1603
1067
  }
1068
+
1604
1069
  /**
1605
- * Expand a combo.
1606
- * @param combo combo ids
1607
- * @group Combo
1070
+ * <zh/> 缩放画布至指定比例
1071
+ *
1072
+ * <en/> Zoom the canvas to the specified ratio
1073
+ * @param zoom - <zh/> 指定缩放比例 | <en/> specified zoom ratio
1074
+ * @param animation - <zh/> 动画配置 | <en/> animation configuration
1075
+ * @param origin - <zh/> 缩放中心(视口坐标) | <en/> zoom center(viewport coordinates)
1076
+ * @remarks
1077
+ * <zh/>
1078
+ * - zoom = 1 默认大小
1079
+ * - zoom > 1 放大
1080
+ * - zoom < 1 缩小
1081
+ *
1082
+ * <en/>
1083
+ * - zoom = 1 default size
1084
+ * - zoom > 1 zoom in
1085
+ * - zoom < 1 zoom out
1086
+ * @apiCategory viewport
1608
1087
  */
1609
- public expandCombo(comboIds: ID | ID[]) {
1610
- const ids = isArray(comboIds) ? comboIds : [comboIds];
1611
- this.executeWithoutStacking(() => {
1612
- this.updateData(
1613
- 'combo',
1614
- ids.map((id) => ({ id, data: { collapsed: false } })),
1615
- );
1616
- });
1617
- this.emit('afterexpandcombo', {
1618
- type: 'combo',
1619
- action: 'expandCombo',
1620
- ids: comboIds,
1621
- apiName: 'expandCombo',
1622
- });
1088
+ public async zoomTo(zoom: number, animation?: ViewportAnimationEffectTiming, origin?: Point): Promise<void> {
1089
+ this.context.viewport!.transform({ mode: 'absolute', scale: zoom, origin }, animation);
1623
1090
  }
1624
1091
 
1625
1092
  /**
1626
- * Move one or more combos a distance (dx, dy) relatively,
1627
- * do not update other styles which leads to better performance than updating positions by updateData.
1628
- * In fact, it changes the succeed nodes positions to affect the combo's position, but not modify the combo's position directly.
1629
- * @param models new configurations with x and y for every combo, which has id field to indicate the specific item
1630
- * @group Combo
1631
- */
1632
- public moveCombo(
1633
- ids: ID | ID[],
1634
- dx: number,
1635
- dy: number,
1636
- upsertAncestors?: boolean,
1637
- callback?: (
1638
- model: NodeModel | EdgeModel | ComboModel,
1639
- canceled?: boolean,
1640
- ) => void,
1641
- ): ComboModel[] {
1642
- const idArr = isArray(ids) ? ids : [ids];
1643
- const { graphCore } = this.dataController;
1644
- const { specification } = this.themeController;
1645
- graphCore.once('changed', (event) => {
1646
- if (!event.changes.length) return;
1647
- const changes = this.extendChanges(clone(event.changes));
1648
- this.hooks.itemchange.emit({
1649
- type: 'combo',
1650
- changes: event.changes,
1651
- graphCore,
1652
- theme: specification,
1653
- upsertAncestors,
1654
- action: 'updatePosition',
1655
- callback,
1656
- });
1657
- this.emit('afteritemchange', {
1658
- type: 'combo',
1659
- ids: idArr,
1660
- dx,
1661
- dy,
1662
- action: 'updatePosition',
1663
- upsertAncestors,
1664
- apiName: 'moveCombo',
1665
- changes,
1666
- });
1667
- });
1668
-
1669
- this.hooks.datachange.emit({
1670
- data: {
1671
- nodes: [],
1672
- edges: [],
1673
- combos: idArr.map((id) => ({ id, data: { dx, dy } })),
1674
- },
1675
- type: 'moveCombo',
1676
- });
1677
- return this.dataController.findData('combo', idArr) as ComboModel[];
1678
- }
1679
-
1680
- // ===== layout =====
1681
- /**
1682
- * Layout the graph (with current configurations if cfg is not assigned).
1683
- */
1684
- public async layout(options?: LayoutOptions, disableAnimate = false) {
1685
- this.emit('beforelayout');
1686
- const { graphCore } = this.dataController;
1687
- const formattedOptions = {
1688
- ...this.getSpecification().layout,
1689
- ...options,
1690
- } as LayoutOptions;
1691
-
1692
- this.updateSpecification({ layout: formattedOptions });
1693
-
1694
- const layoutUnset =
1695
- (!options && !this.getSpecification().layout) ||
1696
- !Object.keys(formattedOptions).length;
1697
- if (layoutUnset) {
1698
- const nodes = graphCore.getAllNodes();
1699
- if (nodes.every((node) => isNil(node.data.x) && isNil(node.data.y))) {
1700
- // Use `grid` layout as default when x/y of each node is unset.
1701
- (formattedOptions as StandardLayoutOptions).type = 'grid';
1702
- } else {
1703
- // Use user-defined position(x/y default to 0).
1704
- (formattedOptions as ImmediatelyInvokedLayoutOptions).execute = async (
1705
- graph,
1706
- ) => {
1707
- const nodes = graph.getAllNodes();
1708
- return {
1709
- nodes: nodes.map((node) => ({
1710
- id: node.id,
1711
- data: {
1712
- x: Number(node.data.x) || 0,
1713
- y: Number(node.data.y) || 0,
1714
- },
1715
- })),
1716
- edges: [],
1717
- };
1718
- };
1719
- }
1720
- }
1721
-
1722
- await this.hooks.layout.emitLinearAsync({
1723
- graphCore,
1724
- options: formattedOptions,
1725
- animate: !disableAnimate,
1726
- });
1727
-
1728
- this.emit('afterlayout');
1093
+ * <zh/> 获取当前缩放比例
1094
+ *
1095
+ * <en/> Get the current zoom ratio
1096
+ * @returns <zh/> 缩放比例 | <en/> zoom ratio
1097
+ * @apiCategory viewport
1098
+ */
1099
+ public getZoom(): number {
1100
+ return this.context.viewport!.getZoom();
1729
1101
  }
1730
1102
 
1731
1103
  /**
1732
- * Some layout algorithms has many iterations which can be stopped at any time.
1104
+ * <zh/> 基于当前旋转角度进行旋转
1105
+ *
1106
+ * <en/> Rotate based on the current rotation angle
1107
+ * @param angle - <zh/> 旋转角度 | <en/> rotation angle
1108
+ * @param animation - <zh/> 动画配置 | <en/> animation configuration
1109
+ * @param origin - <zh/> 旋转中心(视口坐标) | <en/> rotation center(viewport coordinates)
1110
+ * @apiCategory viewport
1733
1111
  */
1734
- public stopLayout() {
1735
- this.layoutController.stopLayout();
1112
+ public async rotateBy(angle: number, animation?: ViewportAnimationEffectTiming, origin?: Point): Promise<void> {
1113
+ await this.context.viewport!.transform({ mode: 'relative', rotate: angle, origin }, animation);
1736
1114
  }
1737
1115
 
1738
1116
  /**
1117
+ * <zh/> 旋转画布至指定角度
1739
1118
  *
1740
- * @returns
1119
+ * <en/> Rotate the canvas to the specified angle
1120
+ * @param angle - <zh/> 目标角度 | <en/> target angle
1121
+ * @param animation - <zh/> 动画配置 | <en/> animation configuration
1122
+ * @param origin - <zh/> 旋转中心(视口坐标) | <en/> rotation center(viewport coordinates)
1123
+ * @apiCategory viewport
1741
1124
  */
1742
- public getLayoutCurrentAnimation() {
1743
- return this.layoutController.getCurrentAnimation();
1125
+ public async rotateTo(angle: number, animation?: ViewportAnimationEffectTiming, origin?: Point): Promise<void> {
1126
+ await this.context.viewport!.transform({ mode: 'absolute', rotate: angle, origin }, animation);
1744
1127
  }
1745
1128
 
1746
1129
  /**
1747
- * Switch mode.
1748
- * @param mode mode name
1749
- * @returns
1750
- * @group Interaction
1130
+ * <zh/> 获取当前旋转角度
1131
+ *
1132
+ * <en/> Get the current rotation angle
1133
+ * @returns <zh/> 旋转角度 | <en/> rotation angle
1134
+ * @apiCategory viewport
1751
1135
  */
1752
- public setMode(mode: string) {
1753
- this.hooks.modechange.emit({ mode });
1136
+ public getRotation(): number {
1137
+ return this.context.viewport!.getRotation();
1754
1138
  }
1755
1139
 
1756
1140
  /**
1757
- * Get current mode.
1758
- * @returns mode name
1759
- * @group Interaction
1141
+ * <zh/> 将图平移指定距离
1142
+ *
1143
+ * <en/> Translate the graph by the specified distance
1144
+ * @param offset - <zh/> 偏移量 | <en/> offset
1145
+ * @param animation - <zh/> 动画配置 | <en/> animation configuration
1146
+ * @apiCategory viewport
1760
1147
  */
1761
- public getMode(): string {
1762
- return this.interactionController.getMode();
1148
+ public async translateBy(offset: Point, animation?: ViewportAnimationEffectTiming): Promise<void> {
1149
+ await this.context.viewport!.transform({ mode: 'relative', translate: offset }, animation);
1763
1150
  }
1764
1151
 
1765
1152
  /**
1766
- * Add behavior(s) to mode(s).
1767
- * @param behaviors behavior names or configs
1768
- * @param modes mode names
1769
- * @returns
1770
- * @group Interaction
1153
+ * <zh/> 将图平移至指定位置
1154
+ *
1155
+ * <en/> Translate the graph to the specified position
1156
+ * @param position - <zh/> 指定位置 | <en/> specified position
1157
+ * @param animation - <zh/> 动画配置 | <en/> animation configuration
1158
+ * @apiCategory viewport
1771
1159
  */
1772
- public addBehaviors(
1773
- behaviors: BehaviorOptionsOf<B> | BehaviorOptionsOf<B>[],
1774
- modes: string | string[],
1775
- ) {
1776
- const modesArr = isArray(modes) ? modes : [modes];
1777
- const behaviorsArr = isArray(behaviors) ? behaviors : [behaviors];
1778
- this.hooks.behaviorchange.emit({
1779
- action: 'add',
1780
- modes: modesArr,
1781
- // TODO: update type define.
1782
- // @ts-ignore
1783
- behaviors: behaviorsArr,
1784
- });
1785
- // update the graph specification
1786
- modesArr.forEach((mode) => {
1787
- this.specification.modes[mode] =
1788
- this.specification.modes[mode].concat(behaviorsArr);
1789
- });
1160
+ public async translateTo(position: Point, animation?: ViewportAnimationEffectTiming): Promise<void> {
1161
+ await this.context.viewport!.transform({ mode: 'absolute', translate: position }, animation);
1790
1162
  }
1163
+
1791
1164
  /**
1792
- * Remove behavior(s) from mode(s).
1793
- * @param behaviors behavior configs with unique key
1794
- * @param modes mode names
1795
- * @returns
1796
- * @group Interaction
1165
+ * <zh/> 获取图的位置
1166
+ *
1167
+ * <en/> Get the position of the graph
1168
+ * @returns <zh/> 图的位置 | <en/> position of the graph
1169
+ * @remarks
1170
+ * <zh/> 默认状态下,图的位置为 [0, 0]
1171
+ *
1172
+ * <en/> By default, the position of the graph is [0, 0]
1173
+ * @apiCategory viewport
1797
1174
  */
1798
- public removeBehaviors(behaviorKeys: string[], modes: string | string[]) {
1799
- const modesArr = isArray(modes) ? modes : [modes];
1800
- this.hooks.behaviorchange.emit({
1801
- action: 'remove',
1802
- modes: modesArr,
1803
- behaviors: behaviorKeys,
1804
- });
1805
- // update the graph specification
1806
- modesArr.forEach((mode) => {
1807
- behaviorKeys.forEach((key) => {
1808
- const oldBehavior = this.specification.modes[mode].find(
1809
- (behavior) => isObject(behavior) && behavior.key === key,
1810
- );
1811
- const indexOfOldBehavior =
1812
- this.specification.modes[mode].indexOf(oldBehavior);
1813
- this.specification.modes[mode].splice(indexOfOldBehavior, 1);
1814
- });
1815
- });
1175
+ public getPosition(): Point {
1176
+ return subtract([0, 0], this.getCanvasByViewport([0, 0]));
1816
1177
  }
1817
1178
 
1818
1179
  /**
1819
- * Update a behavior on a mode.
1820
- * @param behavior behavior configs, whose name indicates the behavior to be updated
1821
- * @param mode mode name
1822
- * @returns
1823
- * @group Interaction
1180
+ * <zh/> 将元素平移指定距离
1181
+ *
1182
+ * <en/> Translate the element by the specified distance
1183
+ * @param id - <zh/> 元素 ID | <en/> element ID
1184
+ * @param offset - <zh/> 偏移量 | <en/> offset
1185
+ * @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
1186
+ * @apiCategory element
1824
1187
  */
1825
- public updateBehavior(behavior: BehaviorOptionsOf<B>, mode?: string) {
1826
- this.hooks.behaviorchange.emit({
1827
- action: 'update',
1828
- modes: [mode],
1829
- // TODO: update type define.
1830
- // @ts-ignore
1831
- behaviors: [behavior],
1832
- });
1833
- // no need to update specification since the corresponding part is the same object as the behavior's option
1834
- // this.specification.modes[mode].forEach((b, i) => {
1835
- // if (isObject(b) && b.key === behavior.key) {
1836
- // this.specification.modes[mode][i] = behavior;
1837
- // }
1838
- // });
1839
- }
1840
-
1841
- /**
1842
- * Add plugin(s) to graph.
1843
- * @param pluginCfgs
1844
- * @returns
1845
- * @group Plugin
1846
- */
1847
- public addPlugins(
1848
- pluginCfgs: (
1849
- | {
1850
- key: string;
1851
- type: string;
1852
- [cfgName: string]: unknown; // TODO: configs from plugins
1853
- }
1854
- | string
1855
- )[],
1856
- ) {
1857
- const pluginsArr = isArray(pluginCfgs) ? pluginCfgs : [pluginCfgs];
1858
-
1859
- // update the graph specification
1860
- if (!this.specification.plugins) this.specification.plugins = [];
1861
- const oldPlugins = this.specification.plugins;
1862
- const validPlugins: (
1863
- | {
1864
- key: string;
1865
- type: string;
1866
- [cfgName: string]: unknown; // TODO: configs from plugins
1867
- }
1868
- | string
1869
- )[] = [];
1870
- pluginsArr.forEach((config) => {
1871
- const oldPlugin = oldPlugins.find((oldPlugin) => {
1872
- if (typeof oldPlugin === 'string' || typeof config === 'string')
1873
- return false;
1874
- return oldPlugin.key === config.key;
1875
- });
1876
- if (oldPlugin) {
1877
- console.warn(
1878
- `Add plugin with key ${
1879
- (config as any).key
1880
- } failed, the key is duplicated to the existing plugins on the graph.`,
1881
- );
1882
- return;
1883
- }
1884
- validPlugins.push(config);
1885
- });
1886
- this.specification.plugins = oldPlugins.concat(validPlugins);
1188
+ public async translateElementBy(id: ID, offset: Position, animation?: boolean): Promise<void>;
1189
+ /**
1190
+ * <zh/> 批量将元素平移指定距离
1191
+ *
1192
+ * <en/> Batch translate elements by the specified distance
1193
+ * @param offsets - <zh/> 偏移量配置 | <en/> offset configuration
1194
+ * @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
1195
+ * @apiCategory element
1196
+ */
1197
+ public async translateElementBy(offsets: Record<ID, Position>, animation?: boolean): Promise<void>;
1198
+ public async translateElementBy(
1199
+ args1: ID | Record<ID, Position>,
1200
+ args2?: Position | boolean,
1201
+ args3: boolean = true,
1202
+ ): Promise<void> {
1203
+ const [config, animation] = isObject(args1)
1204
+ ? [args1, (args2 as boolean) ?? true]
1205
+ : [{ [args1 as ID]: args2 as Position }, args3];
1887
1206
 
1888
- this.hooks.pluginchange.emit({
1889
- action: 'add',
1890
- plugins: validPlugins,
1891
- });
1207
+ Object.entries(config).forEach(([id, offset]) => this.context.model.translateNodeBy(id, offset));
1208
+ await this.context.element!.draw({ animation })?.finished;
1892
1209
  }
1893
1210
 
1894
1211
  /**
1895
- * Remove plugin(s) from graph.
1896
- * @param pluginKeys
1897
- * @returns
1898
- * @group Plugin
1212
+ * <zh/> 将元素平移至指定位置
1213
+ *
1214
+ * <en/> Translate the element to the specified position
1215
+ * @param id - <zh/> 元素 ID | <en/> element ID
1216
+ * @param position - <zh/> 指定位置 | <en/> specified position
1217
+ * @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
1218
+ * @apiCategory element
1899
1219
  */
1900
- public removePlugins(pluginKeys: (PluginBase | string)[]) {
1901
- const pluginArr = isArray(pluginKeys) ? pluginKeys : [pluginKeys];
1902
- this.hooks.pluginchange.emit({
1903
- action: 'remove',
1904
- plugins: pluginArr,
1905
- });
1906
- // update the graph specification
1907
- const { plugins } = this.specification;
1908
- this.specification.plugins = plugins?.filter((plugin) => {
1909
- if (isObject(plugin))
1910
- return !(
1911
- pluginArr.includes(plugin.key) ||
1912
- pluginArr.includes(plugin as PluginBase)
1913
- );
1914
- return !pluginArr.includes(plugin);
1915
- });
1220
+ public async translateElementTo(id: ID, position: Position, animation?: boolean): Promise<void>;
1221
+ /**
1222
+ * <zh/> 批量将元素平移至指定位置
1223
+ *
1224
+ * <en/> Batch translate elements to the specified position
1225
+ * @param positions - <zh/> 位置配置 | <en/> position configuration
1226
+ * @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
1227
+ * @apiCategory element
1228
+ */
1229
+ public async translateElementTo(positions: Record<ID, Position>, animation?: boolean): Promise<void>;
1230
+ public async translateElementTo(
1231
+ args1: ID | Record<ID, Position>,
1232
+ args2?: boolean | Position,
1233
+ args3: boolean = true,
1234
+ ): Promise<void> {
1235
+ const [config, animation] = isObject(args1)
1236
+ ? [args1, (args2 as boolean) ?? true]
1237
+ : [{ [args1 as ID]: args2 as Position }, args3];
1238
+
1239
+ Object.entries(config).forEach(([id, position]) => this.context.model.translateNodeTo(id, position));
1240
+ await this.context.element!.draw({ animation })?.finished;
1916
1241
  }
1917
1242
 
1918
1243
  /**
1919
- * Update a plugin of the graph.
1920
- * @param plugin plugin configs, whose key indicates the behavior to be updated
1921
- * @returns
1922
- * @group Interaction
1244
+ * <zh/> 获取元素位置
1245
+ *
1246
+ * <en/> Get element position
1247
+ * @param id - <zh/> 元素 ID | <en/> element ID
1248
+ * @returns <zh/> 元素位置 | <en/> element position
1249
+ * @apiCategory element
1923
1250
  */
1924
- public updatePlugin(
1925
- plugin:
1926
- | {
1927
- key: string;
1928
- type: string;
1929
- [cfg: string]: unknown;
1930
- }
1931
- | PluginBase,
1932
- ) {
1933
- const { plugins } = this.specification;
1934
- const { key } = plugin;
1935
- if (!key) {
1936
- console.warn(
1937
- 'Update plugin failed, the key for the plugin to be updated should be assign.',
1938
- );
1939
- return;
1940
- }
1941
- if (!plugins) {
1942
- console.warn(
1943
- 'Update plugin failed, the plugin to be updated does not exist.',
1944
- );
1945
- return;
1946
- }
1947
- const oldPlugin = plugins?.find((p) => {
1948
- if (typeof p === 'string') return p === key;
1949
- return p.key === key;
1950
- });
1951
- if (!oldPlugin) {
1952
- console.warn(
1953
- 'Update plugin failed, the key for the plugin to be updated should be assign.',
1954
- );
1955
- return;
1956
- }
1957
- const idx = plugins.indexOf(oldPlugin);
1958
- plugins[idx] = {
1959
- // TODO: update type define.
1960
- // @ts-ignore
1961
- ...oldPlugin,
1962
- ...plugin,
1963
- };
1251
+ public getElementPosition(id: ID): Position {
1252
+ return this.context.model.getElementPosition(id);
1253
+ }
1964
1254
 
1965
- this.hooks.pluginchange.emit({
1966
- action: 'update',
1967
- plugins: [plugin],
1968
- });
1255
+ /**
1256
+ * <zh/> 获取元素渲染样式
1257
+ *
1258
+ * <en/> Get element rendering style
1259
+ * @param id - <zh/> 元素 ID | <en/> element ID
1260
+ * @returns <zh/> 元素渲染样式 | <en/> element rendering style
1261
+ * @apiCategory element
1262
+ */
1263
+ public getElementRenderStyle(id: ID) {
1264
+ return omit(this.context.element!.getElement(id)!.attributes, ['context']);
1969
1265
  }
1970
1266
 
1971
1267
  /**
1972
- * Draw or update a G shape or group to the transient canvas.
1973
- * @param type shape type or item type
1974
- * @param id new shape id or updated shape id for a interation shape, node/edge/combo id for item interaction group drawing
1975
- * @returns upserted shape or group
1976
- * @group Interaction
1268
+ * <zh/> 设置元素可见性
1269
+ *
1270
+ * <en/> Set element visibility
1271
+ * @param id - <zh/> 元素 ID | <en/> element ID
1272
+ * @param visibility - <zh/> 可见性 | <en/> visibility
1273
+ * @param animation - <zh/> 动画配置 | <en/> animation configuration
1274
+ * @apiCategory element
1977
1275
  */
1978
- public drawTransient(
1979
- type: ITEM_TYPE | SHAPE_TYPE,
1276
+ public async setElementVisibility(
1980
1277
  id: ID,
1981
- config: {
1982
- action: 'remove' | 'add' | 'update' | undefined;
1983
- style: ShapeStyle;
1984
- onlyDrawKeyShape?: boolean;
1985
- upsertAncestors?: boolean;
1986
- },
1987
- canvas?: Canvas,
1988
- ): DisplayObject {
1989
- this.hooks.transientupdate.emit({
1990
- type,
1991
- id,
1992
- config,
1993
- canvas: canvas || this.transientCanvas,
1994
- graphCore: this.dataController.graphCore,
1278
+ visibility: BaseStyleProps['visibility'],
1279
+ animation?: boolean,
1280
+ ): Promise<void>;
1281
+ /**
1282
+ * <zh/> 批量设置元素可见性
1283
+ *
1284
+ * <en/> Batch set element visibility
1285
+ * @param visibility - <zh/> 可见性配置 | <en/> visibility configuration
1286
+ * @param animation - <zh/> 动画配置 | <en/> animation configuration
1287
+ * @apiCategory element
1288
+ */
1289
+ public async setElementVisibility(
1290
+ visibility: Record<ID, BaseStyleProps['visibility']>,
1291
+ animation?: boolean,
1292
+ ): Promise<void>;
1293
+ public async setElementVisibility(
1294
+ args1: ID | Record<ID, BaseStyleProps['visibility']>,
1295
+ args2?: boolean | BaseStyleProps['visibility'],
1296
+ args3: boolean = true,
1297
+ ): Promise<void> {
1298
+ const [config, animation] = isObject(args1)
1299
+ ? [args1, (args2 as boolean) ?? true]
1300
+ : [{ [args1]: args2 as BaseStyleProps['visibility'] }, args3];
1301
+
1302
+ const dataToUpdate: Required<PartialGraphData> = { nodes: [], edges: [], combos: [] };
1303
+ Object.entries(config).forEach(([id, value]) => {
1304
+ const elementType = this.getElementType(id);
1305
+ dataToUpdate[`${elementType}s`].push({ id, style: { visibility: value } });
1995
1306
  });
1996
- return this.itemController.getTransient(String(id));
1997
- }
1998
1307
 
1999
- // ===== history operations =====
1308
+ const { model, element } = this.context;
1309
+ model.preventUpdateNodeLikeHierarchy(() => {
1310
+ model.updateData(dataToUpdate);
1311
+ });
1312
+ await element!.draw({ animation, stage: 'visibility' })?.finished;
1313
+ }
2000
1314
 
2001
1315
  /**
2002
- * Determine if history (redo/undo) is enabled.
2003
- */
2004
- public isHistoryEnabled() {
2005
- const history = this.getHistoryPlugin();
2006
- return history?.isEnable();
1316
+ * <zh/> 显示元素
1317
+ *
1318
+ * <en/> Show element
1319
+ * @param id - <zh/> 元素 ID | <en/> element ID
1320
+ * @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
1321
+ * @apiCategory element
1322
+ */
1323
+ public async showElement(id: ID | ID[], animation?: boolean): Promise<void> {
1324
+ const ids = Array.isArray(id) ? id : [id];
1325
+ await this.setElementVisibility(
1326
+ Object.fromEntries(ids.map((_id) => [_id, 'visible'] as [ID, BaseStyleProps['visibility']])),
1327
+ animation,
1328
+ );
2007
1329
  }
2008
1330
 
2009
1331
  /**
2010
- * Push the operation(s) onto the specified stack
2011
- * @param cmd commands to be pushed
2012
- * @param stackType undo/redo stack
2013
- * @param isNew
2014
- */
2015
- public pushStack(cmd: Command[], stackType: StackType, isNew?: boolean) {
2016
- const history = this.getHistoryPlugin();
2017
- return history?.push(cmd, stackType, isNew);
1332
+ * <zh/> 隐藏元素
1333
+ *
1334
+ * <en/> Hide element
1335
+ * @param id - <zh/> 元素 ID | <en/> element ID
1336
+ * @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
1337
+ * @apiCategory element
1338
+ */
1339
+ public async hideElement(id: ID | ID[], animation?: boolean): Promise<void> {
1340
+ const ids = Array.isArray(id) ? id : [id];
1341
+ await this.setElementVisibility(
1342
+ Object.fromEntries(ids.map((_id) => [_id, 'hidden'] as [ID, BaseStyleProps['visibility']])),
1343
+ animation,
1344
+ );
2018
1345
  }
2019
1346
 
2020
1347
  /**
2021
- * Pause stacking operation.
1348
+ * <zh/> 获取元素可见性
1349
+ *
1350
+ * <en/> Get element visibility
1351
+ * @param id - <zh/> 元素 ID | <en/> element ID
1352
+ * @returns <zh/> 元素可见性 | <en/> element visibility
1353
+ * @apiCategory element
2022
1354
  */
2023
- public pauseStacking(): void {
2024
- const history = this.getHistoryPlugin();
2025
- return history?.pauseStacking();
1355
+ public getElementVisibility(id: ID): BaseStyleProps['visibility'] {
1356
+ const element = this.context.element!.getElement(id)!;
1357
+ return element?.style?.visibility ?? 'visible';
2026
1358
  }
2027
1359
 
2028
1360
  /**
2029
- * Resume stacking operation.
1361
+ * <zh/> 设置元素层级
1362
+ *
1363
+ * <en/> Set element z-index
1364
+ * @param id - <zh/> 元素 ID | <en/> element ID
1365
+ * @param zIndex - <zh/> 层级 | <en/> z-index
1366
+ * @apiCategory element
2030
1367
  */
2031
- public resumeStacking(): void {
2032
- const history = this.getHistoryPlugin();
2033
- return history?.resumeStacking();
1368
+ public async setElementZIndex(id: ID, zIndex: number): Promise<void>;
1369
+ /**
1370
+ * <zh/> 批量设置元素层级
1371
+ *
1372
+ * <en/> Batch set element z-index
1373
+ * @param zIndex - <zh/> 层级配置 | <en/> z-index configuration
1374
+ * @apiCategory element
1375
+ */
1376
+ public async setElementZIndex(zIndex: Record<ID, number>): Promise<void>;
1377
+ public async setElementZIndex(args1: ID | Record<ID, number>, args2?: number): Promise<void> {
1378
+ const dataToUpdate: Required<PartialGraphData> = { nodes: [], edges: [], combos: [] };
1379
+ const config = isObject(args1) ? args1 : { [args1 as ID]: args2 as number };
1380
+
1381
+ Object.entries(config).forEach(([id, value]) => {
1382
+ const elementType = this.getElementType(id);
1383
+ dataToUpdate[`${elementType}s`].push({ id, style: { zIndex: value } });
1384
+ });
1385
+
1386
+ const { model, element } = this.context;
1387
+ model.preventUpdateNodeLikeHierarchy(() => model.updateData(dataToUpdate));
1388
+ await element!.draw({ animation: false })?.finished;
2034
1389
  }
2035
1390
 
2036
1391
  /**
2037
- * Execute a callback without allowing any stacking operations.
2038
- * @param callback
2039
- */
2040
- public executeWithoutStacking = (callback: () => void): void => {
2041
- const history = this.getHistoryPlugin();
2042
- history?.pauseStacking();
2043
- try {
2044
- callback();
2045
- } finally {
2046
- history?.resumeStacking();
2047
- }
2048
- };
1392
+ * <zh/> 将元素置于最顶层
1393
+ *
1394
+ * <en/> Bring the element to the front
1395
+ * @param id - <zh/> 元素 ID | <en/> element ID
1396
+ * @apiCategory element
1397
+ */
1398
+ public async frontElement(id: ID | ID[]): Promise<void> {
1399
+ const ids = Array.isArray(id) ? id : [id];
1400
+ const { model } = this.context;
1401
+ const config: Record<ID, number> = {};
1402
+
1403
+ ids.map((_id) => {
1404
+ const zIndex = model.getFrontZIndex(_id);
1405
+ const elementType = model.getElementType(_id);
1406
+ if (elementType === 'combo') {
1407
+ const ancestor = model.getAncestorsData(_id, COMBO_KEY).at(-1) || this.getComboData(_id);
1408
+ const combos = [ancestor, ...model.getDescendantsData(idOf(ancestor))].filter((datum) =>
1409
+ model.isCombo(idOf(datum)),
1410
+ );
1411
+ const delta = zIndex - zIndexOf(ancestor);
1412
+ combos.forEach((combo) => {
1413
+ config[idOf(combo)] = zIndexOf(combo) + delta;
1414
+ });
1415
+ } else config[_id] = zIndex;
1416
+ });
2049
1417
 
2050
- /**
2051
- * Retrieve the current redo stack which consists of operations that could be undone
2052
- */
2053
- public getUndoStack() {
2054
- const history = this.getHistoryPlugin();
2055
- return history?.getUndoStack();
1418
+ await this.setElementZIndex(config);
2056
1419
  }
2057
1420
 
2058
1421
  /**
2059
- * Retrieve the current undo stack which consists of operations that were undone
1422
+ * <zh/> 获取元素层级
1423
+ *
1424
+ * <en/> Get element z-index
1425
+ * @param id - <zh/> 元素 ID | <en/> element ID
1426
+ * @returns <zh/> 元素层级 | <en/> element z-index
1427
+ * @apiCategory element
2060
1428
  */
2061
- public getRedoStack() {
2062
- const history = this.getHistoryPlugin();
2063
- return history?.getRedoStack();
1429
+ public getElementZIndex(id: ID): number {
1430
+ return zIndexOf(this.context.model.getElementDataById(id));
2064
1431
  }
2065
1432
 
2066
1433
  /**
2067
- * Retrieve the complete history stack
2068
- * @returns
1434
+ * <zh/> 设置元素状态
1435
+ *
1436
+ * <en/> Set element state
1437
+ * @param id - <zh/> 元素 ID | <en/> element ID
1438
+ * @param state - <zh/> 状态 | <en/> state
1439
+ * @param animation - <zh/> 动画配置 | <en/> animation configuration
1440
+ * @apiCategory element
2069
1441
  */
2070
- public getStack() {
2071
- const history = this.getHistoryPlugin();
2072
- return history?.getStack();
1442
+ public async setElementState(id: ID, state: State | State[], animation?: boolean): Promise<void>;
1443
+ /**
1444
+ * <zh/> 批量设置元素状态
1445
+ *
1446
+ * <en/> Batch set element state
1447
+ * @param state - <zh/> 状态配置 | <en/> state configuration
1448
+ * @param animation - <zh/> 动画配置 | <en/> animation configuration
1449
+ * @apiCategory element
1450
+ */
1451
+ public async setElementState(state: Record<ID, State | State[]>, animation?: boolean): Promise<void>;
1452
+ public async setElementState(
1453
+ args1: ID | Record<ID, State | State[]>,
1454
+ args2?: boolean | State | State[],
1455
+ args3: boolean = true,
1456
+ ): Promise<void> {
1457
+ const [config, animation] = isObject(args1)
1458
+ ? [args1, (args2 as boolean) ?? true]
1459
+ : [{ [args1]: args2 as State | State[] }, args3];
1460
+
1461
+ const parseState = (state: State | State[]) => {
1462
+ if (!state) return [];
1463
+ return Array.isArray(state) ? state : [state];
1464
+ };
1465
+
1466
+ const dataToUpdate: Required<PartialGraphData> = { nodes: [], edges: [], combos: [] };
1467
+ Object.entries(config).forEach(([id, value]) => {
1468
+ const elementType = this.getElementType(id);
1469
+ dataToUpdate[`${elementType}s`].push({ id, states: parseState(value) });
1470
+ });
1471
+ this.updateData(dataToUpdate);
1472
+
1473
+ await this.context.element!.draw({ animation })?.finished;
2073
1474
  }
2074
1475
 
2075
1476
  /**
2076
- * Restore n operations that were last n reverted on the graph.
2077
- * @param steps The number of operations to undo. Default to 1.
2078
- * @returns
1477
+ * <zh/> 获取元素状态
1478
+ *
1479
+ * <en/> Get element state
1480
+ * @param id - <zh/> 元素 ID | <en/> element ID
1481
+ * @returns <zh/> 元素状态 | <en/> element state
1482
+ * @apiCategory element
2079
1483
  */
2080
- public undo() {
2081
- const history = this.getHistoryPlugin();
2082
- history?.undo();
1484
+ public getElementState(id: ID): State[] {
1485
+ return this.context.model.getElementState(id);
2083
1486
  }
2084
1487
 
2085
1488
  /**
2086
- * Revert recent n operation(s) performed on the graph.
2087
- * @param steps The number of operations to redo. Default to 1.
2088
- * @returns
1489
+ * <zh/> 获取元素自身以及子节点在世界坐标系下的渲染包围盒
1490
+ *
1491
+ * <en/> Get the rendering bounding box of the element itself and its child nodes in the world coordinate system
1492
+ * @param id - <zh/> 元素 ID | <en/> element ID
1493
+ * @returns <zh/> 渲染包围盒 | <en/> render bounding box
1494
+ * @apiCategory element
2089
1495
  */
2090
- public redo() {
2091
- const history = this.getHistoryPlugin();
2092
- history?.redo();
1496
+ public getElementRenderBounds(id: ID): AABB {
1497
+ return this.context.element!.getElement(id)!.getRenderBounds();
2093
1498
  }
2094
1499
 
1500
+ private isCollapsingExpanding = false;
1501
+
2095
1502
  /**
2096
- * Indicate whether there are any actions available in the undo stack.
1503
+ * <zh/> 收起 Combo
1504
+ *
1505
+ * <en/> Collapse Combo
1506
+ * @param id - <zh/> 元素 ID | <en/> element ID
1507
+ * @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
1508
+ * @apiCategory element
2097
1509
  */
2098
- public canUndo() {
2099
- const history = this.getHistoryPlugin();
2100
- return history?.canUndo();
1510
+ public async collapseElement(id: ID, animation: boolean = true): Promise<void> {
1511
+ const { model, element } = this.context;
1512
+ if (isCollapsed(model.getNodeLikeData([id])[0])) return;
1513
+
1514
+ if (this.isCollapsingExpanding) return;
1515
+
1516
+ const elementType = model.getElementType(id);
1517
+
1518
+ this.isCollapsingExpanding = true;
1519
+ this.setElementCollapsibility(id, true);
1520
+ if (elementType === 'node') await element!.collapseNode(id, animation);
1521
+ else if (elementType === 'combo') await element!.collapseCombo(id, animation);
1522
+
1523
+ this.isCollapsingExpanding = false;
2101
1524
  }
2102
1525
 
2103
1526
  /**
2104
- * Indicate whether there are any actions available in the redo stack.
1527
+ * <zh/> 展开 Combo
1528
+ *
1529
+ * <en/> Expand Combo
1530
+ * @param id - <zh/> 元素 ID | <en/> element ID
1531
+ * @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
1532
+ * @apiCategory element
2105
1533
  */
2106
- public canRedo() {
2107
- const history = this.getHistoryPlugin();
2108
- return history?.canRedo();
1534
+ public async expandElement(id: ID, animation: boolean = true): Promise<void> {
1535
+ const { model, element } = this.context;
1536
+ if (!isCollapsed(model.getNodeLikeData([id])[0])) return;
1537
+
1538
+ if (this.isCollapsingExpanding) return;
1539
+
1540
+ const elementType = model.getElementType(id);
1541
+
1542
+ this.isCollapsingExpanding = true;
1543
+ this.setElementCollapsibility(id, false);
1544
+ if (elementType === 'node') await element!.expandNode(id, animation);
1545
+ else if (elementType === 'combo') await element!.expandCombo(id, animation);
1546
+
1547
+ this.isCollapsingExpanding = false;
1548
+ }
1549
+
1550
+ private setElementCollapsibility(id: ID, collapsed: boolean) {
1551
+ const elementType = this.getElementType(id);
1552
+ if (elementType === 'node') this.updateNodeData([{ id, style: { collapsed } }]);
1553
+ else if (elementType === 'combo') this.updateComboData([{ id, style: { collapsed } }]);
2109
1554
  }
2110
1555
 
2111
1556
  /**
2112
- * Begin a batch operation.
2113
- * Any operations performed between `startBatch` and `stopBatch` are grouped together.
2114
- * treated as a single operation when undoing or redoing.
1557
+ * <zh/> 导出画布内容为 DataURL
1558
+ *
1559
+ * <en/> Export canvas content as DataURL
1560
+ * @param options - <zh/> 导出配置 | <en/> export configuration
1561
+ * @returns <zh/> DataURL | <en/> DataURL
1562
+ * @apiCategory exportImage
2115
1563
  */
2116
- public startBatch() {
2117
- const history = this.getHistoryPlugin();
2118
- history?.startBatch();
1564
+ public async toDataURL(options: Partial<DataURLOptions> = {}): Promise<string> {
1565
+ return this.context.canvas!.toDataURL(options);
2119
1566
  }
2120
1567
 
2121
1568
  /**
2122
- * End a batch operation.
2123
- * Any operations performed between `startBatch` and `stopBatch` are grouped together.
2124
- * treated as a single operation when undoing or redoing.
1569
+ * <zh/> 给定的视窗 DOM 坐标,转换为画布上的绘制坐标
1570
+ *
1571
+ * <en/> Convert the given viewport DOM coordinates to the drawing coordinates on the canvas
1572
+ * @param point - <zh/> 视窗坐标 | <en/> viewport coordinates
1573
+ * @returns <zh/> 画布上的绘制坐标 | <en/> drawing coordinates on the canvas
1574
+ * @apiCategory viewport
2125
1575
  */
2126
- public stopBatch() {
2127
- const history = this.getHistoryPlugin();
2128
- history?.stopBatch();
1576
+ public getCanvasByViewport(point: Point): Point {
1577
+ return parsePoint(this.context.canvas!.viewport2Canvas(toPointObject(point)));
2129
1578
  }
2130
1579
 
2131
1580
  /**
2132
- * Execute a provided function within a batched context
2133
- * All operations performed inside callback will be treated as a composite operation
2134
- * more convenient way without manually invoking `startBatch` and `stopBatch`.
2135
- * @param callback The func containing operations to be batched together.
1581
+ * <zh/> 给定画布上的绘制坐标,转换为视窗 DOM 的坐标
1582
+ *
1583
+ * <en/> Convert the given drawing coordinates on the canvas to the coordinates of the viewport DOM
1584
+ * @param point - <zh/> 画布坐标 | <en/> canvas coordinates
1585
+ * @returns <zh/> 视窗 DOM 的坐标 | <en/> coordinates of the viewport DOM
1586
+ * @apiCategory viewport
2136
1587
  */
2137
- public batch(callback: () => void) {
2138
- const history = this.getHistoryPlugin();
2139
- history?.batch(callback);
1588
+ public getViewportByCanvas(point: Point): Point {
1589
+ return parsePoint(this.context.canvas.canvas2Viewport(toPointObject(point)));
2140
1590
  }
2141
1591
 
2142
1592
  /**
2143
- * Clear history stack
2144
- * @param {StackType} stackType undo/redo stack
1593
+ * <zh/> 给定画布上的绘制坐标,转换为浏览器坐标
1594
+ *
1595
+ * <en/> Convert the given drawing coordinates on the canvas to browser coordinates
1596
+ * @param point - <zh/> 画布坐标 | <en/> canvas coordinates
1597
+ * @returns <zh/> 浏览器坐标 | <en/> browser coordinates
1598
+ * @apiCategory viewport
2145
1599
  */
2146
- public clearStack(stackType?: StackType) {
2147
- const history = this.getHistoryPlugin();
2148
- if (!stackType) return history?.clear();
2149
- return stackType === 'undo'
2150
- ? history?.clearUndoStack()
2151
- : history?.clearRedoStack();
1600
+ public getClientByCanvas(point: Point): Point {
1601
+ const viewportPoint = this.context.canvas.canvas2Viewport(toPointObject(point));
1602
+ return parsePoint(this.context.canvas.viewport2Canvas(viewportPoint));
2152
1603
  }
2153
1604
 
2154
1605
  /**
2155
- * Collapse sub tree(s).
2156
- * @param ids Root id(s) of the sub trees.
2157
- * @param disableAnimate Whether disable the animations for this operation.
2158
- * @param stack Whether push this operation to stack.
2159
- * @returns
2160
- * @group Tree
1606
+ * <zh/> 给定的浏览器坐标,转换为画布上的绘制坐标
1607
+ *
1608
+ * <en/> Convert the given browser coordinates to drawing coordinates on the canvas
1609
+ * @param point - <zh/> 浏览器坐标 | <en/> browser coordinates
1610
+ * @returns <zh/> 画布上的绘制坐标 | <en/> drawing coordinates on the canvas
1611
+ * @apiCategory viewport
2161
1612
  */
2162
- public collapse(ids: ID | ID[], disableAnimate = false, stack?: boolean) {
2163
- this.hooks.treecollapseexpand.emit({
2164
- ids: isArray(ids) ? ids : [ids],
2165
- action: 'collapse',
2166
- animate: !disableAnimate,
2167
- graphCore: this.dataController.graphCore,
2168
- });
1613
+ public getCanvasByClient(point: Point): Point {
1614
+ const viewportPoint = this.context.canvas.client2Viewport(toPointObject(point));
1615
+ return parsePoint(this.context.canvas.viewport2Canvas(viewportPoint));
2169
1616
  }
1617
+
2170
1618
  /**
2171
- * Expand sub tree(s).
2172
- * @param ids Root id(s) of the sub trees.
2173
- * @param disableAnimate Whether disable the animations for this operation.
2174
- * @param stack Whether push this operation to stack.
2175
- * @returns
2176
- * @group Tree
1619
+ * <zh/> 获取视口中心的画布坐标
1620
+ *
1621
+ * <en/> Get the canvas coordinates of the viewport center
1622
+ * @returns <zh/> 视口中心的画布坐标 | <en/> Canvas coordinates of the viewport center
1623
+ * @apiCategory viewport
2177
1624
  */
2178
- public expand(ids: ID | ID[], disableAnimate = false, stack?: boolean) {
2179
- this.hooks.treecollapseexpand.emit({
2180
- ids: isArray(ids) ? ids : [ids],
2181
- action: 'expand',
2182
- animate: !disableAnimate,
2183
- graphCore: this.dataController.graphCore,
2184
- });
1625
+ public getViewportCenter(): Point {
1626
+ return this.context.viewport!.getViewportCenter();
2185
1627
  }
2186
1628
 
2187
1629
  /**
2188
- * Destroy the graph instance and remove the related canvases.
2189
- * @returns
2190
- * @group Graph Instance
1630
+ * <zh/> 获取画布中心的画布坐标
1631
+ *
1632
+ * <en/> Get the canvas coordinates of the canvas center
1633
+ * @returns <zh/> 画布中心的画布坐标 | <en/> Canvas coordinates of the canvas center
1634
+ * @apiCategory viewport
2191
1635
  */
2192
- public destroy(callback?: Function) {
2193
- // TODO: call the destroy functions after items' buildOut animations finished
2194
- // setTimeout(() => {
2195
- this.canvas.destroy();
2196
- this.backgroundCanvas.destroy();
2197
- this.transientCanvas.destroy();
2198
-
2199
- // clear history stack
2200
- this.clearStack();
2201
-
2202
- callback?.();
2203
- // }, 500);
1636
+ public getCanvasCenter(): Point {
1637
+ return this.context.viewport!.getCanvasCenter();
1638
+ }
2204
1639
 
2205
- this.hooks.destroy.emit({});
1640
+ private onResize = debounce(() => {
1641
+ this.resize();
1642
+ }, 300);
2206
1643
 
2207
- // TODO: destroy controllers and off the listeners
2208
- // this.dataController.destroy();
2209
- // this.interactionController.destroy();
2210
- // this.layoutController.destroy();
2211
- // this.themeController.destroy();
2212
- // this.itemController.destroy();
2213
- // this.extensionController.destroy();
1644
+ /**
1645
+ * <zh/> 监听事件
1646
+ *
1647
+ * <en/> Listen to events
1648
+ * @param eventName - <zh/> 事件名称 | <en/> event name
1649
+ * @param callback - <zh/> 回调函数 | <en/> callback function
1650
+ * @returns <zh/> Graph 实例 | <en/> Graph instance
1651
+ * @apiCategory event
1652
+ */
1653
+ public on<T extends IEvent = IEvent>(eventName: string, callback: (event: T) => void) {
1654
+ return super.on(eventName, callback);
1655
+ }
2214
1656
 
2215
- this.destroyed = true;
1657
+ /**
1658
+ * <zh/> 一次性监听事件
1659
+ *
1660
+ * <en/> Listen to events once
1661
+ * @param eventName - <zh/> 事件名称 | <en/> event name
1662
+ * @param callback - <zh/> 回调函数 | <en/> callback function
1663
+ * @returns <zh/> Graph 实例 | <en/> Graph instance
1664
+ * @apiCategory event
1665
+ */
1666
+ public once<T extends IEvent = IEvent>(eventName: string, callback: (event: T) => void) {
1667
+ return super.once(eventName, callback);
2216
1668
  }
2217
1669
  }