@antv/g6 5.0.0-beta.30 → 5.0.0-beta.31

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 (598) hide show
  1. package/dist/g6.min.js +2 -2
  2. package/dist/lib/behaviors/focus-element.d.ts +29 -0
  3. package/dist/lib/behaviors/hover-element.d.ts +61 -0
  4. package/dist/lib/{src/behaviors → behaviors}/index.d.ts +4 -0
  5. package/dist/lib/{src/constants → constants}/element.d.ts +1 -0
  6. package/dist/lib/{src/constants → constants}/events/animation.d.ts +1 -1
  7. package/dist/lib/{src/constants → constants}/events/canvas.d.ts +1 -1
  8. package/dist/lib/{src/constants → constants}/events/common.d.ts +1 -1
  9. package/dist/lib/{src/constants → constants}/events/container.d.ts +1 -1
  10. package/dist/lib/{src/constants → constants}/events/edge.d.ts +1 -1
  11. package/dist/lib/{src/constants → constants}/events/graph.d.ts +1 -1
  12. package/dist/lib/{src/constants → constants}/events/node.d.ts +1 -1
  13. package/dist/lib/{src/elements → elements}/nodes/base-node.d.ts +1 -1
  14. package/dist/lib/elements/nodes/hexagon.d.ts +21 -0
  15. package/dist/lib/{src/elements → elements}/nodes/index.d.ts +2 -0
  16. package/dist/lib/{src/elements → elements}/shapes/badge.d.ts +1 -1
  17. package/dist/lib/{src/elements → elements}/shapes/base-shape.d.ts +2 -1
  18. package/dist/lib/{src/exports.d.ts → exports.d.ts} +10 -2
  19. package/dist/lib/{src/layouts → layouts}/index.d.ts +1 -1
  20. package/dist/lib/{src/plugins → plugins}/index.d.ts +2 -0
  21. package/dist/lib/plugins/toolbar/index.d.ts +62 -0
  22. package/dist/lib/plugins/toolbar/util.d.ts +34 -0
  23. package/dist/lib/{src/plugins → plugins}/tooltip.d.ts +1 -1
  24. package/dist/lib/{src/runtime → runtime}/behavior.d.ts +1 -0
  25. package/dist/lib/{src/runtime → runtime}/element.d.ts +2 -2
  26. package/dist/lib/{src/utils → utils}/dom.d.ts +10 -0
  27. package/dist/lib/{src/utils → utils}/element.d.ts +6 -0
  28. package/dist/lib/{src/utils → utils}/id.d.ts +9 -1
  29. package/dist/lib/utils/relation.d.ts +34 -0
  30. package/dist/lib/{src/utils → utils}/traverse.d.ts +9 -0
  31. package/esm/behaviors/focus-element.d.ts +29 -0
  32. package/esm/behaviors/focus-element.js +57 -0
  33. package/esm/behaviors/focus-element.js.map +1 -0
  34. package/esm/behaviors/hover-element.d.ts +61 -0
  35. package/esm/behaviors/hover-element.js +85 -0
  36. package/esm/behaviors/hover-element.js.map +1 -0
  37. package/esm/behaviors/index.d.ts +4 -0
  38. package/esm/behaviors/index.js +2 -0
  39. package/esm/behaviors/index.js.map +1 -1
  40. package/esm/constants/element.d.ts +1 -0
  41. package/esm/constants/element.js +1 -0
  42. package/esm/constants/element.js.map +1 -1
  43. package/esm/constants/events/animation.d.ts +1 -1
  44. package/esm/constants/events/animation.js.map +1 -1
  45. package/esm/constants/events/canvas.d.ts +1 -1
  46. package/esm/constants/events/canvas.js.map +1 -1
  47. package/esm/constants/events/common.d.ts +1 -1
  48. package/esm/constants/events/common.js.map +1 -1
  49. package/esm/constants/events/container.d.ts +1 -1
  50. package/esm/constants/events/container.js.map +1 -1
  51. package/esm/constants/events/edge.d.ts +1 -1
  52. package/esm/constants/events/edge.js.map +1 -1
  53. package/esm/constants/events/graph.d.ts +1 -1
  54. package/esm/constants/events/graph.js.map +1 -1
  55. package/esm/constants/events/node.d.ts +1 -1
  56. package/esm/constants/events/node.js.map +1 -1
  57. package/esm/elements/nodes/base-node.d.ts +1 -1
  58. package/esm/elements/nodes/hexagon.d.ts +21 -0
  59. package/esm/elements/nodes/hexagon.js +20 -0
  60. package/esm/elements/nodes/hexagon.js.map +1 -0
  61. package/esm/elements/nodes/index.d.ts +2 -0
  62. package/esm/elements/nodes/index.js +1 -0
  63. package/esm/elements/nodes/index.js.map +1 -1
  64. package/esm/elements/shapes/badge.d.ts +1 -1
  65. package/esm/elements/shapes/base-shape.d.ts +2 -1
  66. package/esm/elements/shapes/base-shape.js +6 -1
  67. package/esm/elements/shapes/base-shape.js.map +1 -1
  68. package/esm/exports.d.ts +10 -2
  69. package/esm/exports.js +5 -0
  70. package/esm/exports.js.map +1 -1
  71. package/esm/plugins/contextmenu.js +2 -3
  72. package/esm/plugins/contextmenu.js.map +1 -1
  73. package/esm/plugins/index.d.ts +2 -0
  74. package/esm/plugins/index.js +1 -0
  75. package/esm/plugins/index.js.map +1 -1
  76. package/esm/plugins/toolbar/index.d.ts +62 -0
  77. package/esm/plugins/toolbar/index.js +68 -0
  78. package/esm/plugins/toolbar/index.js.map +1 -0
  79. package/esm/plugins/toolbar/util.d.ts +34 -0
  80. package/esm/plugins/toolbar/util.js +88 -0
  81. package/esm/plugins/toolbar/util.js.map +1 -0
  82. package/esm/plugins/tooltip.d.ts +1 -1
  83. package/esm/plugins/tooltip.js +3 -3
  84. package/esm/registry/build-in.js +7 -3
  85. package/esm/registry/build-in.js.map +1 -1
  86. package/esm/registry/extension/index.js +5 -7
  87. package/esm/registry/extension/index.js.map +1 -1
  88. package/esm/runtime/behavior.d.ts +1 -0
  89. package/esm/runtime/behavior.js +12 -2
  90. package/esm/runtime/behavior.js.map +1 -1
  91. package/esm/runtime/canvas.js +6 -1
  92. package/esm/runtime/canvas.js.map +1 -1
  93. package/esm/runtime/data.js +1 -1
  94. package/esm/runtime/data.js.map +1 -1
  95. package/esm/runtime/element.d.ts +2 -2
  96. package/esm/runtime/element.js +8 -3
  97. package/esm/runtime/element.js.map +1 -1
  98. package/esm/runtime/graph.js +4 -3
  99. package/esm/runtime/graph.js.map +1 -1
  100. package/esm/runtime/layout.js +5 -1
  101. package/esm/runtime/layout.js.map +1 -1
  102. package/esm/themes/base.js +7 -0
  103. package/esm/themes/base.js.map +1 -1
  104. package/esm/utils/dom.d.ts +10 -0
  105. package/esm/utils/dom.js +22 -0
  106. package/esm/utils/dom.js.map +1 -1
  107. package/esm/utils/element.d.ts +6 -0
  108. package/esm/utils/element.js +15 -0
  109. package/esm/utils/element.js.map +1 -1
  110. package/esm/utils/id.d.ts +9 -1
  111. package/esm/utils/id.js +10 -0
  112. package/esm/utils/id.js.map +1 -1
  113. package/esm/utils/relation.d.ts +34 -0
  114. package/esm/utils/relation.js +72 -0
  115. package/esm/utils/relation.js.map +1 -0
  116. package/esm/utils/traverse.d.ts +9 -0
  117. package/esm/utils/traverse.js +21 -0
  118. package/esm/utils/traverse.js.map +1 -1
  119. package/lib/behaviors/focus-element.d.ts +29 -0
  120. package/lib/behaviors/focus-element.js +61 -0
  121. package/lib/behaviors/focus-element.js.map +1 -0
  122. package/lib/behaviors/hover-element.d.ts +61 -0
  123. package/lib/behaviors/hover-element.js +89 -0
  124. package/lib/behaviors/hover-element.js.map +1 -0
  125. package/lib/behaviors/index.d.ts +4 -0
  126. package/lib/behaviors/index.js +5 -1
  127. package/lib/behaviors/index.js.map +1 -1
  128. package/lib/constants/element.d.ts +1 -0
  129. package/lib/constants/element.js +2 -1
  130. package/lib/constants/element.js.map +1 -1
  131. package/lib/constants/events/animation.d.ts +1 -1
  132. package/lib/constants/events/animation.js.map +1 -1
  133. package/lib/constants/events/canvas.d.ts +1 -1
  134. package/lib/constants/events/canvas.js.map +1 -1
  135. package/lib/constants/events/common.d.ts +1 -1
  136. package/lib/constants/events/common.js.map +1 -1
  137. package/lib/constants/events/container.d.ts +1 -1
  138. package/lib/constants/events/container.js.map +1 -1
  139. package/lib/constants/events/edge.d.ts +1 -1
  140. package/lib/constants/events/edge.js.map +1 -1
  141. package/lib/constants/events/graph.d.ts +1 -1
  142. package/lib/constants/events/graph.js.map +1 -1
  143. package/lib/constants/events/node.d.ts +1 -1
  144. package/lib/constants/events/node.js.map +1 -1
  145. package/lib/elements/nodes/base-node.d.ts +1 -1
  146. package/lib/elements/nodes/hexagon.d.ts +21 -0
  147. package/lib/elements/nodes/hexagon.js +24 -0
  148. package/lib/elements/nodes/hexagon.js.map +1 -0
  149. package/lib/elements/nodes/index.d.ts +2 -0
  150. package/lib/elements/nodes/index.js +3 -1
  151. package/lib/elements/nodes/index.js.map +1 -1
  152. package/lib/elements/shapes/badge.d.ts +1 -1
  153. package/lib/elements/shapes/base-shape.d.ts +2 -1
  154. package/lib/elements/shapes/base-shape.js +6 -1
  155. package/lib/elements/shapes/base-shape.js.map +1 -1
  156. package/lib/exports.d.ts +10 -2
  157. package/lib/exports.js +8 -1
  158. package/lib/exports.js.map +1 -1
  159. package/lib/plugins/contextmenu.js +1 -2
  160. package/lib/plugins/contextmenu.js.map +1 -1
  161. package/lib/plugins/index.d.ts +2 -0
  162. package/lib/plugins/index.js +3 -1
  163. package/lib/plugins/index.js.map +1 -1
  164. package/lib/plugins/toolbar/index.d.ts +62 -0
  165. package/lib/plugins/toolbar/index.js +72 -0
  166. package/lib/plugins/toolbar/index.js.map +1 -0
  167. package/lib/plugins/toolbar/util.d.ts +34 -0
  168. package/lib/plugins/toolbar/util.js +92 -0
  169. package/lib/plugins/toolbar/util.js.map +1 -0
  170. package/lib/plugins/tooltip.d.ts +1 -1
  171. package/lib/plugins/tooltip.js +3 -3
  172. package/lib/registry/build-in.js +4 -0
  173. package/lib/registry/build-in.js.map +1 -1
  174. package/lib/registry/extension/index.js +5 -7
  175. package/lib/registry/extension/index.js.map +1 -1
  176. package/lib/runtime/behavior.d.ts +1 -0
  177. package/lib/runtime/behavior.js +12 -2
  178. package/lib/runtime/behavior.js.map +1 -1
  179. package/lib/runtime/canvas.js +6 -1
  180. package/lib/runtime/canvas.js.map +1 -1
  181. package/lib/runtime/data.js +1 -1
  182. package/lib/runtime/data.js.map +1 -1
  183. package/lib/runtime/element.d.ts +2 -2
  184. package/lib/runtime/element.js +12 -7
  185. package/lib/runtime/element.js.map +1 -1
  186. package/lib/runtime/graph.js +4 -3
  187. package/lib/runtime/graph.js.map +1 -1
  188. package/lib/runtime/layout.js +5 -1
  189. package/lib/runtime/layout.js.map +1 -1
  190. package/lib/themes/base.js +7 -0
  191. package/lib/themes/base.js.map +1 -1
  192. package/lib/utils/dom.d.ts +10 -0
  193. package/lib/utils/dom.js +24 -1
  194. package/lib/utils/dom.js.map +1 -1
  195. package/lib/utils/element.d.ts +6 -0
  196. package/lib/utils/element.js +17 -1
  197. package/lib/utils/element.js.map +1 -1
  198. package/lib/utils/id.d.ts +9 -1
  199. package/lib/utils/id.js +12 -1
  200. package/lib/utils/id.js.map +1 -1
  201. package/lib/utils/relation.d.ts +34 -0
  202. package/lib/utils/relation.js +77 -0
  203. package/lib/utils/relation.js.map +1 -0
  204. package/lib/utils/traverse.d.ts +9 -0
  205. package/lib/utils/traverse.js +23 -1
  206. package/lib/utils/traverse.js.map +1 -1
  207. package/package.json +13 -13
  208. package/src/behaviors/focus-element.ts +89 -0
  209. package/src/behaviors/hover-element.ts +147 -0
  210. package/src/behaviors/index.ts +4 -0
  211. package/src/constants/element.ts +2 -0
  212. package/src/constants/events/animation.ts +1 -1
  213. package/src/constants/events/canvas.ts +1 -1
  214. package/src/constants/events/common.ts +1 -1
  215. package/src/constants/events/container.ts +1 -1
  216. package/src/constants/events/edge.ts +1 -1
  217. package/src/constants/events/graph.ts +1 -1
  218. package/src/constants/events/node.ts +1 -1
  219. package/src/elements/nodes/hexagon.ts +37 -0
  220. package/src/elements/nodes/index.ts +2 -0
  221. package/src/elements/shapes/base-shape.ts +8 -2
  222. package/src/exports.ts +8 -0
  223. package/src/plugins/contextmenu.ts +2 -3
  224. package/src/plugins/index.ts +2 -0
  225. package/src/plugins/toolbar/index.ts +125 -0
  226. package/src/plugins/toolbar/util.ts +117 -0
  227. package/src/plugins/tooltip.ts +3 -3
  228. package/src/registry/build-in.ts +7 -2
  229. package/src/registry/extension/index.ts +5 -7
  230. package/src/runtime/behavior.ts +13 -2
  231. package/src/runtime/canvas.ts +6 -1
  232. package/src/runtime/data.ts +1 -1
  233. package/src/runtime/element.ts +8 -3
  234. package/src/runtime/graph.ts +4 -3
  235. package/src/runtime/layout.ts +5 -1
  236. package/src/themes/base.ts +7 -0
  237. package/src/utils/dom.ts +32 -0
  238. package/src/utils/element.ts +16 -0
  239. package/src/utils/id.ts +12 -1
  240. package/src/utils/relation.ts +84 -0
  241. package/src/utils/traverse.ts +26 -0
  242. package/dist/lib/__tests__/demo/animation/animation-breathe.d.ts +0 -2
  243. package/dist/lib/__tests__/demo/animation/animation-fade-in.d.ts +0 -2
  244. package/dist/lib/__tests__/demo/animation/animation-translate.d.ts +0 -2
  245. package/dist/lib/__tests__/demo/animation/animation-wave.d.ts +0 -2
  246. package/dist/lib/__tests__/demo/animation/animation-zoom-in.d.ts +0 -2
  247. package/dist/lib/__tests__/demo/animation/controller-element-position.d.ts +0 -2
  248. package/dist/lib/__tests__/demo/animation/controller-element-state.d.ts +0 -2
  249. package/dist/lib/__tests__/demo/animation/controller-element.d.ts +0 -2
  250. package/dist/lib/__tests__/demo/animation/edge-cubic.d.ts +0 -2
  251. package/dist/lib/__tests__/demo/animation/edge-line.d.ts +0 -2
  252. package/dist/lib/__tests__/demo/animation/edge-quadratic.d.ts +0 -2
  253. package/dist/lib/__tests__/demo/animation/index.d.ts +0 -12
  254. package/dist/lib/__tests__/demo/animation/shape-label.d.ts +0 -2
  255. package/dist/lib/__tests__/demo/case/behavior-drag-canvas.d.ts +0 -2
  256. package/dist/lib/__tests__/demo/case/behavior-drag-element.d.ts +0 -2
  257. package/dist/lib/__tests__/demo/case/behavior-zoom-canvas.d.ts +0 -2
  258. package/dist/lib/__tests__/demo/case/combo-expand-collapse.d.ts +0 -2
  259. package/dist/lib/__tests__/demo/case/combo.d.ts +0 -2
  260. package/dist/lib/__tests__/demo/case/common-graph.d.ts +0 -2
  261. package/dist/lib/__tests__/demo/case/edge-polyline.d.ts +0 -2
  262. package/dist/lib/__tests__/demo/case/element-change-type.d.ts +0 -2
  263. package/dist/lib/__tests__/demo/case/element-port.d.ts +0 -2
  264. package/dist/lib/__tests__/demo/case/element-position-combo.d.ts +0 -2
  265. package/dist/lib/__tests__/demo/case/element-position.d.ts +0 -2
  266. package/dist/lib/__tests__/demo/case/element-state.d.ts +0 -2
  267. package/dist/lib/__tests__/demo/case/element-visibility.d.ts +0 -2
  268. package/dist/lib/__tests__/demo/case/element-z-index.d.ts +0 -2
  269. package/dist/lib/__tests__/demo/case/graph-event.d.ts +0 -2
  270. package/dist/lib/__tests__/demo/case/index.d.ts +0 -52
  271. package/dist/lib/__tests__/demo/case/layout-antv-dagre-flow-combo.d.ts +0 -2
  272. package/dist/lib/__tests__/demo/case/layout-antv-dagre-flow.d.ts +0 -2
  273. package/dist/lib/__tests__/demo/case/layout-circular-basic.d.ts +0 -2
  274. package/dist/lib/__tests__/demo/case/layout-circular-configuration-translate.d.ts +0 -2
  275. package/dist/lib/__tests__/demo/case/layout-circular-degree.d.ts +0 -2
  276. package/dist/lib/__tests__/demo/case/layout-circular-division.d.ts +0 -2
  277. package/dist/lib/__tests__/demo/case/layout-circular-spiral.d.ts +0 -2
  278. package/dist/lib/__tests__/demo/case/layout-combo-combined.d.ts +0 -2
  279. package/dist/lib/__tests__/demo/case/layout-compact-box-basic.d.ts +0 -2
  280. package/dist/lib/__tests__/demo/case/layout-compact-box-left-align.d.ts +0 -2
  281. package/dist/lib/__tests__/demo/case/layout-compact-box-top-to-bottom.d.ts +0 -2
  282. package/dist/lib/__tests__/demo/case/layout-concentric.d.ts +0 -2
  283. package/dist/lib/__tests__/demo/case/layout-dagre.d.ts +0 -2
  284. package/dist/lib/__tests__/demo/case/layout-dendrogram-basic.d.ts +0 -2
  285. package/dist/lib/__tests__/demo/case/layout-dendrogram-tb.d.ts +0 -2
  286. package/dist/lib/__tests__/demo/case/layout-force.d.ts +0 -2
  287. package/dist/lib/__tests__/demo/case/layout-fruchterman-basic.d.ts +0 -2
  288. package/dist/lib/__tests__/demo/case/layout-fruchterman-cluster.d.ts +0 -2
  289. package/dist/lib/__tests__/demo/case/layout-fruchterman-fix.d.ts +0 -2
  290. package/dist/lib/__tests__/demo/case/layout-grid.d.ts +0 -2
  291. package/dist/lib/__tests__/demo/case/layout-mds.d.ts +0 -2
  292. package/dist/lib/__tests__/demo/case/layout-mindmap-h-custom-side.d.ts +0 -2
  293. package/dist/lib/__tests__/demo/case/layout-mindmap-h-left.d.ts +0 -2
  294. package/dist/lib/__tests__/demo/case/layout-mindmap-h-right.d.ts +0 -2
  295. package/dist/lib/__tests__/demo/case/layout-mindmap-h.d.ts +0 -2
  296. package/dist/lib/__tests__/demo/case/layout-radial-basic.d.ts +0 -2
  297. package/dist/lib/__tests__/demo/case/layout-radial-configuration-translate.d.ts +0 -2
  298. package/dist/lib/__tests__/demo/case/layout-radial-prevent-overlap-unstrict.d.ts +0 -2
  299. package/dist/lib/__tests__/demo/case/layout-radial-prevent-overlap.d.ts +0 -2
  300. package/dist/lib/__tests__/demo/case/layout-radial-sort.d.ts +0 -2
  301. package/dist/lib/__tests__/demo/case/plugin-contextmenu.d.ts +0 -2
  302. package/dist/lib/__tests__/demo/case/plugin-grid-line.d.ts +0 -2
  303. package/dist/lib/__tests__/demo/case/plugin-tooltip.d.ts +0 -2
  304. package/dist/lib/__tests__/demo/case/plugin-watermark-image.d.ts +0 -2
  305. package/dist/lib/__tests__/demo/case/plugin-watermark.d.ts +0 -2
  306. package/dist/lib/__tests__/demo/case/theme.d.ts +0 -2
  307. package/dist/lib/__tests__/demo/case/viewport-fit.d.ts +0 -2
  308. package/dist/lib/__tests__/demo/index.d.ts +0 -3
  309. package/dist/lib/__tests__/demo/static/common.d.ts +0 -45
  310. package/dist/lib/__tests__/demo/static/controller-element-position.d.ts +0 -2
  311. package/dist/lib/__tests__/demo/static/controller-element-visibility.d.ts +0 -2
  312. package/dist/lib/__tests__/demo/static/controller-element-z-index.d.ts +0 -2
  313. package/dist/lib/__tests__/demo/static/controller-element.d.ts +0 -2
  314. package/dist/lib/__tests__/demo/static/controller-layout-antv-dagre.d.ts +0 -2
  315. package/dist/lib/__tests__/demo/static/controller-layout-circular.d.ts +0 -2
  316. package/dist/lib/__tests__/demo/static/controller-layout-compact-box.d.ts +0 -2
  317. package/dist/lib/__tests__/demo/static/controller-layout-d3-force.d.ts +0 -2
  318. package/dist/lib/__tests__/demo/static/controller-layout-dendrogram.d.ts +0 -2
  319. package/dist/lib/__tests__/demo/static/controller-layout-force.d.ts +0 -2
  320. package/dist/lib/__tests__/demo/static/controller-layout-forceatlas2-wasm.d.ts +0 -2
  321. package/dist/lib/__tests__/demo/static/controller-layout-fruchterman-gpu.d.ts +0 -2
  322. package/dist/lib/__tests__/demo/static/controller-layout-fruchterman-wasm.d.ts +0 -2
  323. package/dist/lib/__tests__/demo/static/controller-layout-grid.d.ts +0 -2
  324. package/dist/lib/__tests__/demo/static/controller-layout-indented.d.ts +0 -2
  325. package/dist/lib/__tests__/demo/static/controller-layout-mindmap.d.ts +0 -2
  326. package/dist/lib/__tests__/demo/static/controller-layout-radial.d.ts +0 -2
  327. package/dist/lib/__tests__/demo/static/controller-viewport.d.ts +0 -2
  328. package/dist/lib/__tests__/demo/static/edge-arrow.d.ts +0 -2
  329. package/dist/lib/__tests__/demo/static/edge-cubic-horizontal.d.ts +0 -2
  330. package/dist/lib/__tests__/demo/static/edge-cubic-vertical.d.ts +0 -2
  331. package/dist/lib/__tests__/demo/static/edge-cubic.d.ts +0 -2
  332. package/dist/lib/__tests__/demo/static/edge-custom-arrow.d.ts +0 -2
  333. package/dist/lib/__tests__/demo/static/edge-line.d.ts +0 -2
  334. package/dist/lib/__tests__/demo/static/edge-loop-curve.d.ts +0 -2
  335. package/dist/lib/__tests__/demo/static/edge-loop-polyline.d.ts +0 -2
  336. package/dist/lib/__tests__/demo/static/edge-polyline.d.ts +0 -2
  337. package/dist/lib/__tests__/demo/static/edge-port.d.ts +0 -2
  338. package/dist/lib/__tests__/demo/static/edge-quadratic.d.ts +0 -2
  339. package/dist/lib/__tests__/demo/static/element-label-background.d.ts +0 -2
  340. package/dist/lib/__tests__/demo/static/element-label-oversized.d.ts +0 -2
  341. package/dist/lib/__tests__/demo/static/graph-element.d.ts +0 -2
  342. package/dist/lib/__tests__/demo/static/index.d.ts +0 -9
  343. package/dist/lib/__tests__/demo/static/layered-canvas.d.ts +0 -2
  344. package/dist/lib/__tests__/demo/static/node-circle.d.ts +0 -2
  345. package/dist/lib/__tests__/demo/static/node-diamond.d.ts +0 -2
  346. package/dist/lib/__tests__/demo/static/node-ellipse.d.ts +0 -2
  347. package/dist/lib/__tests__/demo/static/node-image.d.ts +0 -2
  348. package/dist/lib/__tests__/demo/static/node-rect.d.ts +0 -2
  349. package/dist/lib/__tests__/demo/static/node-star.d.ts +0 -2
  350. package/dist/lib/__tests__/demo/static/node-triangle.d.ts +0 -2
  351. package/dist/lib/__tests__/demo/static/shape-badge.d.ts +0 -2
  352. package/dist/lib/__tests__/demo/static/shape-icon.d.ts +0 -2
  353. package/dist/lib/__tests__/demo/static/shape-label.d.ts +0 -2
  354. package/dist/lib/__tests__/demo/types.d.ts +0 -33
  355. package/dist/lib/__tests__/integration/animation.spec.d.ts +0 -1
  356. package/dist/lib/__tests__/integration/static.spec.d.ts +0 -1
  357. package/dist/lib/__tests__/main.d.ts +0 -1
  358. package/dist/lib/__tests__/setup.d.ts +0 -4
  359. package/dist/lib/__tests__/unit/behaviors/behavior-collapse-expand.spec.d.ts +0 -1
  360. package/dist/lib/__tests__/unit/behaviors/behavior-drag-canvas.spec.d.ts +0 -1
  361. package/dist/lib/__tests__/unit/behaviors/behavior-drag-element-combo.spec.d.ts +0 -1
  362. package/dist/lib/__tests__/unit/behaviors/behavior-drag-element.spec.d.ts +0 -1
  363. package/dist/lib/__tests__/unit/behaviors/behavior-zoom-canvas.spec.d.ts +0 -1
  364. package/dist/lib/__tests__/unit/behaviors/drag-element-bug.spec.d.ts +0 -1
  365. package/dist/lib/__tests__/unit/elements/change-type.spec.d.ts +0 -1
  366. package/dist/lib/__tests__/unit/elements/combo.spec.d.ts +0 -1
  367. package/dist/lib/__tests__/unit/elements/edge-polyline.spec.d.ts +0 -1
  368. package/dist/lib/__tests__/unit/elements/port.spec.d.ts +0 -1
  369. package/dist/lib/__tests__/unit/elements/position-combo.spec.d.ts +0 -1
  370. package/dist/lib/__tests__/unit/elements/position.spec.d.ts +0 -1
  371. package/dist/lib/__tests__/unit/elements/state.spec.d.ts +0 -1
  372. package/dist/lib/__tests__/unit/elements/visibility.spec.d.ts +0 -1
  373. package/dist/lib/__tests__/unit/elements/z-index.spec.d.ts +0 -1
  374. package/dist/lib/__tests__/unit/layouts/circular.spec.d.ts +0 -1
  375. package/dist/lib/__tests__/unit/layouts/combo-layout.spec.d.ts +0 -1
  376. package/dist/lib/__tests__/unit/layouts/compact-box.spec.d.ts +0 -1
  377. package/dist/lib/__tests__/unit/layouts/dagre.spec.d.ts +0 -1
  378. package/dist/lib/__tests__/unit/layouts/dendrogram.spec.d.ts +0 -1
  379. package/dist/lib/__tests__/unit/layouts/fruchterman.spec.d.ts +0 -1
  380. package/dist/lib/__tests__/unit/layouts/grid.spec.d.ts +0 -1
  381. package/dist/lib/__tests__/unit/layouts/layout-concentric.spec.d.ts +0 -1
  382. package/dist/lib/__tests__/unit/layouts/mds.spec.d.ts +0 -1
  383. package/dist/lib/__tests__/unit/layouts/mindmap.spec.d.ts +0 -1
  384. package/dist/lib/__tests__/unit/layouts/radial-layout.spec.d.ts +0 -1
  385. package/dist/lib/__tests__/unit/plugins/plugin-contextmenu.spec.d.ts +0 -1
  386. package/dist/lib/__tests__/unit/plugins/plugin-grid-line.spec.d.ts +0 -1
  387. package/dist/lib/__tests__/unit/plugins/plugin-watermark.spec.d.ts +0 -1
  388. package/dist/lib/__tests__/unit/plugins/tooltip.spec.d.ts +0 -1
  389. package/dist/lib/__tests__/unit/registry.spec.d.ts +0 -1
  390. package/dist/lib/__tests__/unit/runtime/canvas.spec.d.ts +0 -1
  391. package/dist/lib/__tests__/unit/runtime/data.spec.d.ts +0 -1
  392. package/dist/lib/__tests__/unit/runtime/element/visibility.spec.d.ts +0 -1
  393. package/dist/lib/__tests__/unit/runtime/element/z-index.spec.d.ts +0 -1
  394. package/dist/lib/__tests__/unit/runtime/element.spec.d.ts +0 -1
  395. package/dist/lib/__tests__/unit/runtime/graph/auto-resize.spec.d.ts +0 -1
  396. package/dist/lib/__tests__/unit/runtime/graph/graph.spec.d.ts +0 -1
  397. package/dist/lib/__tests__/unit/runtime/viewport.spec.d.ts +0 -1
  398. package/dist/lib/__tests__/unit/spec/behavior.spec.d.ts +0 -1
  399. package/dist/lib/__tests__/unit/spec/canvas.spec.d.ts +0 -1
  400. package/dist/lib/__tests__/unit/spec/data.spec.d.ts +0 -1
  401. package/dist/lib/__tests__/unit/spec/element/combo.spec.d.ts +0 -1
  402. package/dist/lib/__tests__/unit/spec/element/edge.spec.d.ts +0 -1
  403. package/dist/lib/__tests__/unit/spec/element/node.spec.d.ts +0 -1
  404. package/dist/lib/__tests__/unit/spec/index.spec.d.ts +0 -1
  405. package/dist/lib/__tests__/unit/spec/layout.spec.d.ts +0 -1
  406. package/dist/lib/__tests__/unit/spec/plugin.spec.d.ts +0 -1
  407. package/dist/lib/__tests__/unit/spec/theme.spec.d.ts +0 -1
  408. package/dist/lib/__tests__/unit/spec/viewport.spec.d.ts +0 -1
  409. package/dist/lib/__tests__/unit/utils/anchor.spec.d.ts +0 -1
  410. package/dist/lib/__tests__/unit/utils/animation.spec.d.ts +0 -1
  411. package/dist/lib/__tests__/unit/utils/array.spec.d.ts +0 -1
  412. package/dist/lib/__tests__/unit/utils/bbox.spec.d.ts +0 -1
  413. package/dist/lib/__tests__/unit/utils/cache.spec.d.ts +0 -1
  414. package/dist/lib/__tests__/unit/utils/change.spec.d.ts +0 -1
  415. package/dist/lib/__tests__/unit/utils/combo.spec.d.ts +0 -1
  416. package/dist/lib/__tests__/unit/utils/data.spec.d.ts +0 -1
  417. package/dist/lib/__tests__/unit/utils/diff.spec.d.ts +0 -1
  418. package/dist/lib/__tests__/unit/utils/dom.spec.d.ts +0 -1
  419. package/dist/lib/__tests__/unit/utils/edge.spec.d.ts +0 -1
  420. package/dist/lib/__tests__/unit/utils/element.spec.d.ts +0 -1
  421. package/dist/lib/__tests__/unit/utils/event.spec.d.ts +0 -1
  422. package/dist/lib/__tests__/unit/utils/extension.spec.d.ts +0 -1
  423. package/dist/lib/__tests__/unit/utils/graphlib.spec.d.ts +0 -1
  424. package/dist/lib/__tests__/unit/utils/id.spec.d.ts +0 -1
  425. package/dist/lib/__tests__/unit/utils/is.spec.d.ts +0 -1
  426. package/dist/lib/__tests__/unit/utils/layout.spec.d.ts +0 -1
  427. package/dist/lib/__tests__/unit/utils/math.spec.d.ts +0 -1
  428. package/dist/lib/__tests__/unit/utils/padding.spec.d.ts +0 -1
  429. package/dist/lib/__tests__/unit/utils/palette.spec.d.ts +0 -1
  430. package/dist/lib/__tests__/unit/utils/placement.spec.d.ts +0 -1
  431. package/dist/lib/__tests__/unit/utils/point.spec.d.ts +0 -1
  432. package/dist/lib/__tests__/unit/utils/position.spec.d.ts +0 -1
  433. package/dist/lib/__tests__/unit/utils/prefix.spec.d.ts +0 -1
  434. package/dist/lib/__tests__/unit/utils/random.spec.d.ts +0 -1
  435. package/dist/lib/__tests__/unit/utils/router.spec.d.ts +0 -1
  436. package/dist/lib/__tests__/unit/utils/shape.spec.d.ts +0 -1
  437. package/dist/lib/__tests__/unit/utils/shortcut.spec.d.ts +0 -1
  438. package/dist/lib/__tests__/unit/utils/size.spec.d.ts +0 -1
  439. package/dist/lib/__tests__/unit/utils/style.spec.d.ts +0 -1
  440. package/dist/lib/__tests__/unit/utils/symbol.spec.d.ts +0 -1
  441. package/dist/lib/__tests__/unit/utils/text.spec.d.ts +0 -1
  442. package/dist/lib/__tests__/unit/utils/traverse.spec.d.ts +0 -1
  443. package/dist/lib/__tests__/unit/utils/tree.spec.d.ts +0 -1
  444. package/dist/lib/__tests__/unit/utils/vector.spec.d.ts +0 -1
  445. package/dist/lib/__tests__/unit/utils/visibility.spec.d.ts +0 -1
  446. package/dist/lib/__tests__/utils/create.d.ts +0 -15
  447. package/dist/lib/__tests__/utils/dir.d.ts +0 -9
  448. package/dist/lib/__tests__/utils/get-cases.d.ts +0 -2
  449. package/dist/lib/__tests__/utils/index.d.ts +0 -4
  450. package/dist/lib/__tests__/utils/offscreen-canvas-context.d.ts +0 -21
  451. package/dist/lib/__tests__/utils/random.d.ts +0 -5
  452. package/dist/lib/__tests__/utils/sleep.d.ts +0 -1
  453. package/dist/lib/__tests__/utils/to-be-close-to.d.ts +0 -10
  454. package/dist/lib/__tests__/utils/to-match-svg-snapshot.d.ts +0 -14
  455. package/dist/lib/__tests__/utils/use-snapshot-matchers.d.ts +0 -9
  456. /package/dist/lib/{src/animations → animations}/executor.d.ts +0 -0
  457. /package/dist/lib/{src/animations → animations}/index.d.ts +0 -0
  458. /package/dist/lib/{src/animations → animations}/types.d.ts +0 -0
  459. /package/dist/lib/{src/behaviors → behaviors}/base-behavior.d.ts +0 -0
  460. /package/dist/lib/{src/behaviors → behaviors}/collapse-expand.d.ts +0 -0
  461. /package/dist/lib/{src/behaviors → behaviors}/drag-canvas.d.ts +0 -0
  462. /package/dist/lib/{src/behaviors → behaviors}/drag-element.d.ts +0 -0
  463. /package/dist/lib/{src/behaviors → behaviors}/types.d.ts +0 -0
  464. /package/dist/lib/{src/behaviors → behaviors}/zoom-canvas.d.ts +0 -0
  465. /package/dist/lib/{src/constants → constants}/animation.d.ts +0 -0
  466. /package/dist/lib/{src/constants → constants}/change.d.ts +0 -0
  467. /package/dist/lib/{src/constants → constants}/events/combo.d.ts +0 -0
  468. /package/dist/lib/{src/constants → constants}/events/index.d.ts +0 -0
  469. /package/dist/lib/{src/constants → constants}/graphlib.d.ts +0 -0
  470. /package/dist/lib/{src/constants → constants}/index.d.ts +0 -0
  471. /package/dist/lib/{src/elements → elements}/combos/base-combo.d.ts +0 -0
  472. /package/dist/lib/{src/elements → elements}/combos/circle.d.ts +0 -0
  473. /package/dist/lib/{src/elements → elements}/combos/index.d.ts +0 -0
  474. /package/dist/lib/{src/elements → elements}/combos/rect.d.ts +0 -0
  475. /package/dist/lib/{src/elements → elements}/edges/base-edge.d.ts +0 -0
  476. /package/dist/lib/{src/elements → elements}/edges/cubic-horizontal.d.ts +0 -0
  477. /package/dist/lib/{src/elements → elements}/edges/cubic-vertical.d.ts +0 -0
  478. /package/dist/lib/{src/elements → elements}/edges/cubic.d.ts +0 -0
  479. /package/dist/lib/{src/elements → elements}/edges/index.d.ts +0 -0
  480. /package/dist/lib/{src/elements → elements}/edges/line.d.ts +0 -0
  481. /package/dist/lib/{src/elements → elements}/edges/polyline.d.ts +0 -0
  482. /package/dist/lib/{src/elements → elements}/edges/quadratic.d.ts +0 -0
  483. /package/dist/lib/{src/elements → elements}/index.d.ts +0 -0
  484. /package/dist/lib/{src/elements → elements}/nodes/circle.d.ts +0 -0
  485. /package/dist/lib/{src/elements → elements}/nodes/diamond.d.ts +0 -0
  486. /package/dist/lib/{src/elements → elements}/nodes/ellipse.d.ts +0 -0
  487. /package/dist/lib/{src/elements → elements}/nodes/image.d.ts +0 -0
  488. /package/dist/lib/{src/elements → elements}/nodes/polygon.d.ts +0 -0
  489. /package/dist/lib/{src/elements → elements}/nodes/rect.d.ts +0 -0
  490. /package/dist/lib/{src/elements → elements}/nodes/star.d.ts +0 -0
  491. /package/dist/lib/{src/elements → elements}/nodes/triangle.d.ts +0 -0
  492. /package/dist/lib/{src/elements → elements}/shapes/icon.d.ts +0 -0
  493. /package/dist/lib/{src/elements → elements}/shapes/index.d.ts +0 -0
  494. /package/dist/lib/{src/elements → elements}/shapes/label.d.ts +0 -0
  495. /package/dist/lib/{src/index.d.ts → index.d.ts} +0 -0
  496. /package/dist/lib/{src/layouts → layouts}/types.d.ts +0 -0
  497. /package/dist/lib/{src/palettes → palettes}/index.d.ts +0 -0
  498. /package/dist/lib/{src/palettes → palettes}/types.d.ts +0 -0
  499. /package/dist/lib/{src/plugins → plugins}/base-plugin.d.ts +0 -0
  500. /package/dist/lib/{src/plugins → plugins}/contextmenu.d.ts +0 -0
  501. /package/dist/lib/{src/plugins → plugins}/grid-line.d.ts +0 -0
  502. /package/dist/lib/{src/plugins → plugins}/types.d.ts +0 -0
  503. /package/dist/lib/{src/plugins → plugins}/watermark.d.ts +0 -0
  504. /package/dist/lib/{src/preset.d.ts → preset.d.ts} +0 -0
  505. /package/dist/lib/{src/registry → registry}/build-in.d.ts +0 -0
  506. /package/dist/lib/{src/registry → registry}/extension/index.d.ts +0 -0
  507. /package/dist/lib/{src/registry → registry}/extension/types.d.ts +0 -0
  508. /package/dist/lib/{src/registry → registry}/index.d.ts +0 -0
  509. /package/dist/lib/{src/registry → registry}/types.d.ts +0 -0
  510. /package/dist/lib/{src/runtime → runtime}/canvas.d.ts +0 -0
  511. /package/dist/lib/{src/runtime → runtime}/data.d.ts +0 -0
  512. /package/dist/lib/{src/runtime → runtime}/graph.d.ts +0 -0
  513. /package/dist/lib/{src/runtime → runtime}/index.d.ts +0 -0
  514. /package/dist/lib/{src/runtime → runtime}/layout.d.ts +0 -0
  515. /package/dist/lib/{src/runtime → runtime}/plugin.d.ts +0 -0
  516. /package/dist/lib/{src/runtime → runtime}/types.d.ts +0 -0
  517. /package/dist/lib/{src/runtime → runtime}/viewport.d.ts +0 -0
  518. /package/dist/lib/{src/spec → spec}/behavior.d.ts +0 -0
  519. /package/dist/lib/{src/spec → spec}/canvas.d.ts +0 -0
  520. /package/dist/lib/{src/spec → spec}/data.d.ts +0 -0
  521. /package/dist/lib/{src/spec → spec}/element/animation.d.ts +0 -0
  522. /package/dist/lib/{src/spec → spec}/element/base.d.ts +0 -0
  523. /package/dist/lib/{src/spec → spec}/element/combo.d.ts +0 -0
  524. /package/dist/lib/{src/spec → spec}/element/edge.d.ts +0 -0
  525. /package/dist/lib/{src/spec → spec}/element/node.d.ts +0 -0
  526. /package/dist/lib/{src/spec → spec}/element/palette.d.ts +0 -0
  527. /package/dist/lib/{src/spec → spec}/index.d.ts +0 -0
  528. /package/dist/lib/{src/spec → spec}/layout.d.ts +0 -0
  529. /package/dist/lib/{src/spec → spec}/plugin.d.ts +0 -0
  530. /package/dist/lib/{src/spec → spec}/spec.d.ts +0 -0
  531. /package/dist/lib/{src/spec → spec}/theme.d.ts +0 -0
  532. /package/dist/lib/{src/spec → spec}/viewport.d.ts +0 -0
  533. /package/dist/lib/{src/themes → themes}/base.d.ts +0 -0
  534. /package/dist/lib/{src/themes → themes}/dark.d.ts +0 -0
  535. /package/dist/lib/{src/themes → themes}/index.d.ts +0 -0
  536. /package/dist/lib/{src/themes → themes}/light.d.ts +0 -0
  537. /package/dist/lib/{src/themes → themes}/types.d.ts +0 -0
  538. /package/dist/lib/{src/types → types}/anchor.d.ts +0 -0
  539. /package/dist/lib/{src/types → types}/animation.d.ts +0 -0
  540. /package/dist/lib/{src/types → types}/behavior.d.ts +0 -0
  541. /package/dist/lib/{src/types → types}/callable.d.ts +0 -0
  542. /package/dist/lib/{src/types → types}/canvas.d.ts +0 -0
  543. /package/dist/lib/{src/types → types}/change.d.ts +0 -0
  544. /package/dist/lib/{src/types → types}/data.d.ts +0 -0
  545. /package/dist/lib/{src/types → types}/edge.d.ts +0 -0
  546. /package/dist/lib/{src/types → types}/element.d.ts +0 -0
  547. /package/dist/lib/{src/types → types}/enum.d.ts +0 -0
  548. /package/dist/lib/{src/types → types}/event.d.ts +0 -0
  549. /package/dist/lib/{src/types → types}/graphlib.d.ts +0 -0
  550. /package/dist/lib/{src/types → types}/index.d.ts +0 -0
  551. /package/dist/lib/{src/types → types}/node.d.ts +0 -0
  552. /package/dist/lib/{src/types → types}/padding.d.ts +0 -0
  553. /package/dist/lib/{src/types → types}/placement.d.ts +0 -0
  554. /package/dist/lib/{src/types → types}/plugin.d.ts +0 -0
  555. /package/dist/lib/{src/types → types}/point.d.ts +0 -0
  556. /package/dist/lib/{src/types → types}/position.d.ts +0 -0
  557. /package/dist/lib/{src/types → types}/prefix.d.ts +0 -0
  558. /package/dist/lib/{src/types → types}/size.d.ts +0 -0
  559. /package/dist/lib/{src/types → types}/state.d.ts +0 -0
  560. /package/dist/lib/{src/types → types}/style.d.ts +0 -0
  561. /package/dist/lib/{src/types → types}/tree.d.ts +0 -0
  562. /package/dist/lib/{src/types → types}/vector.d.ts +0 -0
  563. /package/dist/lib/{src/types → types}/viewport.d.ts +0 -0
  564. /package/dist/lib/{src/utils → utils}/anchor.d.ts +0 -0
  565. /package/dist/lib/{src/utils → utils}/animation.d.ts +0 -0
  566. /package/dist/lib/{src/utils → utils}/array.d.ts +0 -0
  567. /package/dist/lib/{src/utils → utils}/bbox.d.ts +0 -0
  568. /package/dist/lib/{src/utils → utils}/cache.d.ts +0 -0
  569. /package/dist/lib/{src/utils → utils}/change.d.ts +0 -0
  570. /package/dist/lib/{src/utils → utils}/combo.d.ts +0 -0
  571. /package/dist/lib/{src/utils → utils}/contextmenu.d.ts +0 -0
  572. /package/dist/lib/{src/utils → utils}/data.d.ts +0 -0
  573. /package/dist/lib/{src/utils → utils}/diff.d.ts +0 -0
  574. /package/dist/lib/{src/utils → utils}/edge.d.ts +0 -0
  575. /package/dist/lib/{src/utils → utils}/event/events.d.ts +0 -0
  576. /package/dist/lib/{src/utils → utils}/event/index.d.ts +0 -0
  577. /package/dist/lib/{src/utils → utils}/extension.d.ts +0 -0
  578. /package/dist/lib/{src/utils → utils}/graphlib.d.ts +0 -0
  579. /package/dist/lib/{src/utils → utils}/is.d.ts +0 -0
  580. /package/dist/lib/{src/utils → utils}/layout.d.ts +0 -0
  581. /package/dist/lib/{src/utils → utils}/math.d.ts +0 -0
  582. /package/dist/lib/{src/utils → utils}/padding.d.ts +0 -0
  583. /package/dist/lib/{src/utils → utils}/palette.d.ts +0 -0
  584. /package/dist/lib/{src/utils → utils}/placement.d.ts +0 -0
  585. /package/dist/lib/{src/utils → utils}/point.d.ts +0 -0
  586. /package/dist/lib/{src/utils → utils}/position.d.ts +0 -0
  587. /package/dist/lib/{src/utils → utils}/prefix.d.ts +0 -0
  588. /package/dist/lib/{src/utils → utils}/router/orth.d.ts +0 -0
  589. /package/dist/lib/{src/utils → utils}/shape.d.ts +0 -0
  590. /package/dist/lib/{src/utils → utils}/shortcut.d.ts +0 -0
  591. /package/dist/lib/{src/utils → utils}/size.d.ts +0 -0
  592. /package/dist/lib/{src/utils → utils}/style.d.ts +0 -0
  593. /package/dist/lib/{src/utils → utils}/symbol.d.ts +0 -0
  594. /package/dist/lib/{src/utils → utils}/text.d.ts +0 -0
  595. /package/dist/lib/{src/utils → utils}/tree.d.ts +0 -0
  596. /package/dist/lib/{src/utils → utils}/vector.d.ts +0 -0
  597. /package/dist/lib/{src/utils → utils}/visibility.d.ts +0 -0
  598. /package/dist/lib/{src/utils → utils}/watermark.d.ts +0 -0
package/src/utils/id.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { ID } from '@antv/graphlib';
2
2
  import { isNumber, isString } from '@antv/util';
3
- import type { ComboData, EdgeData, NodeData } from '../spec';
3
+ import type { ComboData, EdgeData, GraphData, NodeData } from '../spec';
4
4
  import { isEdgeData } from './is';
5
5
 
6
6
  /**
@@ -27,3 +27,14 @@ export function idOf(data: Partial<NodeData | EdgeData | ComboData>): ID {
27
27
  export function parentIdOf(data: Partial<NodeData | ComboData>) {
28
28
  return data.style?.parentId;
29
29
  }
30
+
31
+ /**
32
+ * <zh/> 获取图数据中所有节点/边/Combo 的 ID
33
+ *
34
+ * <en/> Get the IDs of all nodes/edges/combos in the graph data
35
+ * @param data - <zh/> 图数据 | <en/> graph data
36
+ * @returns - <zh/> 返回元素 ID 数组 | <en/> Returns an array of element IDs
37
+ */
38
+ export function getIds(data: GraphData): ID[] {
39
+ return Object.values(data).flatMap((elements: NodeData[] | EdgeData[] | ComboData[]) => elements.map(idOf));
40
+ }
@@ -0,0 +1,84 @@
1
+ import type { ID } from '@antv/graphlib';
2
+ import type { Graph } from '../runtime/graph';
3
+ import type { ElementType } from '../types';
4
+ import { idOf } from './id';
5
+ import { bfs } from './traverse';
6
+
7
+ /**
8
+ * <zh/> 获取指定元素在 n 度关系内的所有元素的 ID
9
+ *
10
+ * <en/> Get the IDs of all elements within an n-degree relationship from the specified element
11
+ * @description
12
+ * <zh/> 对于节点,0 度关系是节点本身,1 度关系包括节点的直接相邻节点和边,以此类推。
13
+ * 对于边,0 度关系是边本身,1 度关系包括边本身及其两个端点,以此类推。
14
+ *
15
+ * <en/> For a node, 0-degree relationship includes the node itself; 1-degree relationship includes the node's direct neighbors and their connecting edges, etc.
16
+ * For an edge, 0-degree relationship includes the edge itself; 1-degree relationship includes the edge and its two endpoints, etc
17
+ * @param graph - <zh/> 图实例 | <en/> graph instance
18
+ * @param elementType - <zh/> 元素类型 | <en/> element type
19
+ * @param elementId - <zh/> 起始元素的 ID | <en/> start element ID
20
+ * @param degree - <zh/> 指定的度数 | <en/> the specified degree
21
+ * @returns - <zh/> 返回节点和边的 ID 数组 | <en/> Returns an array of node and edge IDs
22
+ */
23
+ export function getElementNthDegreeIds(graph: Graph, elementType: ElementType, elementId: ID, degree: number): ID[] {
24
+ if (elementType === 'combo' || elementType === 'node') {
25
+ return getNodeNthDegreeIds(graph, elementId, degree);
26
+ }
27
+
28
+ const edgeData = graph.getEdgeData(elementId);
29
+ if (!edgeData) return [];
30
+
31
+ const sourceRelations = getNodeNthDegreeIds(graph, edgeData.source, degree - 1);
32
+ const targetRelations = getNodeNthDegreeIds(graph, edgeData.target, degree - 1);
33
+
34
+ return Array.from(new Set<ID>([...sourceRelations, ...targetRelations, elementId]));
35
+ }
36
+
37
+ /**
38
+ * <zh/> 获取指定节点在 n 度关系内的所有元素的 ID
39
+ *
40
+ * <en/> Get all elements IDs within n-degree relationship of the specified node
41
+ * @description
42
+ * <zh/> 节点的 0 度关系是节点本身,1 度关系是节点的直接相邻节点和边,以此类推
43
+ *
44
+ * <en/> 0-degree relationship of a node is the node itself; 1-degree relationship is the node's neighboring nodes and related edges, etc
45
+ * @param graph - <zh/> 图实例 | <en/> graph instance
46
+ * @param startNodeId - <zh/> 起始节点的 ID | <en/> The ID of the starting node
47
+ * @param degree - <zh/> 指定的度数 | <en/> The specified degree
48
+ * @returns - <zh/> 返回节点和边的 ID 数组 | <en/> Returns an array of node and edge IDs
49
+ */
50
+ export function getNodeNthDegreeIds(graph: Graph, startNodeId: ID, degree: number): ID[] {
51
+ const visitedNodes = new Set<ID>();
52
+ const visitedEdges = new Set<ID>();
53
+ const relations = new Set<ID>();
54
+
55
+ bfs(
56
+ startNodeId,
57
+ (nodeId: ID, depth: number) => {
58
+ if (depth > degree) return;
59
+ relations.add(nodeId);
60
+
61
+ graph.getRelatedEdgesData(nodeId).forEach((edge) => {
62
+ const edgeId = idOf(edge);
63
+ if (!visitedEdges.has(edgeId) && depth < degree) {
64
+ relations.add(edgeId);
65
+ visitedEdges.add(edgeId);
66
+ }
67
+ });
68
+ },
69
+ (nodeId: ID) => {
70
+ return graph
71
+ .getRelatedEdgesData(nodeId)
72
+ .map((edge) => (edge.source === nodeId ? edge.target : edge.source))
73
+ .filter((neighborNodeId) => {
74
+ if (!visitedNodes.has(neighborNodeId)) {
75
+ visitedNodes.add(neighborNodeId);
76
+ return true;
77
+ }
78
+ return false;
79
+ });
80
+ },
81
+ );
82
+
83
+ return Array.from(relations);
84
+ }
@@ -31,3 +31,29 @@ export function dfs<N>(
31
31
 
32
32
  if (mode === 'BT') visitor(node, depth);
33
33
  }
34
+
35
+ /**
36
+ * <zh/> 执行广度优先遍历
37
+ *
38
+ * <en/> perform breadth first traversal
39
+ * @param node - <zh/> 起始节点 | <en/> start node
40
+ * @param visitor - <zh/> 访问节点函数 | <en/> visitor function
41
+ * @param navigator - <zh/> 获取子节点函数 | <en/> get children function
42
+ */
43
+ export function bfs<N>(node: N, visitor: (node: N, depth: number) => void, navigator: (node: N) => N[] | undefined) {
44
+ const queue: [N, number][] = [[node, 0]];
45
+
46
+ while (queue.length) {
47
+ const [current, depth] = queue.shift()!;
48
+
49
+ visitor(current, depth);
50
+
51
+ const children = navigator(current);
52
+
53
+ if (children) {
54
+ for (const child of children) {
55
+ queue.push([child, depth + 1]);
56
+ }
57
+ }
58
+ }
59
+ }
@@ -1,2 +0,0 @@
1
- import type { AnimationTestCase } from '../types';
2
- export declare const animationBreathe: AnimationTestCase;
@@ -1,2 +0,0 @@
1
- import type { AnimationTestCase } from '../types';
2
- export declare const animationFadeIn: AnimationTestCase;
@@ -1,2 +0,0 @@
1
- import type { AnimationTestCase } from '../types';
2
- export declare const animationTranslate: AnimationTestCase;
@@ -1,2 +0,0 @@
1
- import type { AnimationTestCase } from '../types';
2
- export declare const animationWave: AnimationTestCase;
@@ -1,2 +0,0 @@
1
- import type { AnimationTestCase } from '../types';
2
- export declare const animationZoomIn: AnimationTestCase;
@@ -1,2 +0,0 @@
1
- import type { AnimationTestCase } from '../types';
2
- export declare const controllerElementPosition: AnimationTestCase;
@@ -1,2 +0,0 @@
1
- import type { AnimationTestCase } from '../types';
2
- export declare const controllerElementState: AnimationTestCase;
@@ -1,2 +0,0 @@
1
- import type { AnimationTestCase } from '../types';
2
- export declare const controllerElement: AnimationTestCase;
@@ -1,2 +0,0 @@
1
- import type { AnimationTestCase } from '../types';
2
- export declare const edgeCubic: AnimationTestCase;
@@ -1,2 +0,0 @@
1
- import type { AnimationTestCase } from '../types';
2
- export declare const edgeLine: AnimationTestCase;
@@ -1,2 +0,0 @@
1
- import type { AnimationTestCase } from '../types';
2
- export declare const edgeQuadratic: AnimationTestCase;
@@ -1,12 +0,0 @@
1
- export * from './animation-breathe';
2
- export * from './animation-fade-in';
3
- export * from './animation-translate';
4
- export * from './animation-wave';
5
- export * from './animation-zoom-in';
6
- export * from './controller-element';
7
- export * from './controller-element-position';
8
- export * from './controller-element-state';
9
- export * from './edge-cubic';
10
- export * from './edge-line';
11
- export * from './edge-quadratic';
12
- export * from './shape-label';
@@ -1,2 +0,0 @@
1
- import type { AnimationTestCase } from '../types';
2
- export declare const shapeLabel: AnimationTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const behaviorDragCanvas: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const behaviorDragNode: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const behaviorZoomCanvas: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const comboExpandCollapse: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const combo: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const commonGraph: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const edgePolyline: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const elementChangeType: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const elementPort: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const elementPositionCombo: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const elementPosition: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const elementState: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const elementVisibility: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const elementZIndex: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const graphEvent: STDTestCase;
@@ -1,52 +0,0 @@
1
- export * from './behavior-drag-canvas';
2
- export * from './behavior-drag-element';
3
- export * from './behavior-zoom-canvas';
4
- export * from './combo';
5
- export * from './combo-expand-collapse';
6
- export * from './common-graph';
7
- export * from './edge-polyline';
8
- export * from './element-change-type';
9
- export * from './element-port';
10
- export * from './element-position';
11
- export * from './element-position-combo';
12
- export * from './element-state';
13
- export * from './element-visibility';
14
- export * from './element-z-index';
15
- export * from './graph-event';
16
- export * from './layout-antv-dagre-flow';
17
- export * from './layout-antv-dagre-flow-combo';
18
- export * from './layout-circular-basic';
19
- export * from './layout-circular-configuration-translate';
20
- export * from './layout-circular-degree';
21
- export * from './layout-circular-division';
22
- export * from './layout-circular-spiral';
23
- export * from './layout-combo-combined';
24
- export * from './layout-compact-box-basic';
25
- export * from './layout-compact-box-left-align';
26
- export * from './layout-compact-box-top-to-bottom';
27
- export * from './layout-concentric';
28
- export * from './layout-dagre';
29
- export * from './layout-dendrogram-basic';
30
- export * from './layout-dendrogram-tb';
31
- export * from './layout-force';
32
- export * from './layout-fruchterman-basic';
33
- export * from './layout-fruchterman-cluster';
34
- export * from './layout-fruchterman-fix';
35
- export * from './layout-grid';
36
- export * from './layout-mds';
37
- export * from './layout-mindmap-h';
38
- export * from './layout-mindmap-h-custom-side';
39
- export * from './layout-mindmap-h-left';
40
- export * from './layout-mindmap-h-right';
41
- export * from './layout-radial-basic';
42
- export * from './layout-radial-configuration-translate';
43
- export * from './layout-radial-prevent-overlap';
44
- export * from './layout-radial-prevent-overlap-unstrict';
45
- export * from './layout-radial-sort';
46
- export * from './plugin-contextmenu';
47
- export * from './plugin-grid-line';
48
- export * from './plugin-tooltip';
49
- export * from './plugin-watermark';
50
- export * from './plugin-watermark-image';
51
- export * from './theme';
52
- export * from './viewport-fit';
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutAntVDagreFlowCombo: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutAntVDagreFlow: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutCircularBasic: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutCircularConfigurationTranslate: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutCircularDegree: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutCircularDivision: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutCircularSpiral: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutComboCombined: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutCompactBoxBasic: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutCompactBoxTopToBottom: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutCompactBoxLeftAlign: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutConcentric: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutDagre: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutDendrogramBasic: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutDendrogramTb: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutForce: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutFruchtermanBasic: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutFruchtermanCluster: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutFruchtermanFix: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutGrid: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutMDS: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutMindmapHCustomSide: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutMindmapHLeft: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutMindmapHRight: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutMindmapH: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutRadialBasic: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutRadialConfigurationTranslate: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutRadialPreventOverlapUnstrict: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutRadialPreventOverlap: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const layoutRadialSort: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const pluginContextmenu: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const pluginGridLine: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const pluginTooltip: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const pluginWatermarkImage: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const pluginWatermark: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const theme: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const viewportFit: STDTestCase;
@@ -1,3 +0,0 @@
1
- export * as animations from './animation';
2
- export * as cases from './case';
3
- export * as statics from './static';
@@ -1,45 +0,0 @@
1
- /**
2
- * <zh/> 包含可在浏览器和 node 环境下运行的测试用例,依赖了 @antv/layout-wasm 的测试用例将被排除
3
- *
4
- * <en/> Contains test cases that can run in both browser and node environments, and test cases that depend on @antv/layout-wasm will be excluded
5
- */
6
- export * from './controller-element';
7
- export * from './controller-element-position';
8
- export * from './controller-element-visibility';
9
- export * from './controller-element-z-index';
10
- export * from './controller-layout-antv-dagre';
11
- export * from './controller-layout-circular';
12
- export * from './controller-layout-compact-box';
13
- export * from './controller-layout-d3-force';
14
- export * from './controller-layout-dendrogram';
15
- export * from './controller-layout-force';
16
- export * from './controller-layout-grid';
17
- export * from './controller-layout-indented';
18
- export * from './controller-layout-mindmap';
19
- export * from './controller-layout-radial';
20
- export * from './controller-viewport';
21
- export * from './edge-arrow';
22
- export * from './edge-cubic';
23
- export * from './edge-cubic-horizontal';
24
- export * from './edge-cubic-vertical';
25
- export * from './edge-custom-arrow';
26
- export * from './edge-line';
27
- export * from './edge-loop-curve';
28
- export * from './edge-loop-polyline';
29
- export * from './edge-polyline';
30
- export * from './edge-port';
31
- export * from './edge-quadratic';
32
- export * from './element-label-background';
33
- export * from './element-label-oversized';
34
- export * from './graph-element';
35
- export * from './layered-canvas';
36
- export * from './node-circle';
37
- export * from './node-diamond';
38
- export * from './node-ellipse';
39
- export * from './node-image';
40
- export * from './node-rect';
41
- export * from './node-star';
42
- export * from './node-triangle';
43
- export * from './shape-badge';
44
- export * from './shape-icon';
45
- export * from './shape-label';
@@ -1,2 +0,0 @@
1
- import type { StaticTestCase } from '../types';
2
- export declare const controllerElementPosition: StaticTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const controllerElementVisibility: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const controllerElementZIndex: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const controllerElement: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const controllerLayoutAntVDagre: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const controllerLayoutCircular: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const controllerLayoutCompactBox: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const controllerLayoutD3Force: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const controllerLayoutDendrogram: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const controllerLayoutForce: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const controllerLayoutForceatlas2WASM: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const controllerLayoutFruchtermanGPU: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const controllerLayoutFruchtermanWASM: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const controllerLayoutGrid: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const controllerLayoutIndented: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const controllerLayoutMindmap: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const controllerLayoutRadial: STDTestCase;
@@ -1,2 +0,0 @@
1
- import type { STDTestCase } from '../types';
2
- export declare const controllerViewport: STDTestCase;