@antv/g6 5.0.0-beta.27 → 5.0.0-beta.29

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