graph.d.ts 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. import { Basecoat, NumberExt, Dom, KeyValue } from '@antv/x6-common';
  2. import { Point, Rectangle } from '@antv/x6-geometry';
  3. import { Model, Collection, Cell, Node, Edge } from '../model';
  4. import { CellView } from '../view';
  5. import * as Registry from '../registry';
  6. import { GraphView } from './view';
  7. import { EventArgs } from './events';
  8. import { CSSManager as Css } from './css';
  9. import { Options as GraphOptions } from './options';
  10. import { GridManager as Grid } from './grid';
  11. import { TransformManager as Transform } from './transform';
  12. import { BackgroundManager as Background } from './background';
  13. import { PanningManager as Panning } from './panning';
  14. import { MouseWheel as Wheel } from './mousewheel';
  15. import { VirtualRenderManager as VirtualRender } from './virtual-render';
  16. import { Renderer as ViewRenderer } from '../renderer';
  17. import { DefsManager as Defs } from './defs';
  18. import { CoordManager as Coord } from './coord';
  19. import { HighlightManager as Highlight } from './highlight';
  20. import { SizeManager as Size } from './size';
  21. export declare class Graph extends Basecoat<EventArgs> {
  22. private installedPlugins;
  23. model: Model;
  24. readonly options: GraphOptions.Definition;
  25. readonly css: Css;
  26. readonly view: GraphView;
  27. readonly grid: Grid;
  28. readonly defs: Defs;
  29. readonly coord: Coord;
  30. readonly renderer: ViewRenderer;
  31. readonly highlight: Highlight;
  32. readonly transform: Transform;
  33. readonly background: Background;
  34. readonly panning: Panning;
  35. readonly mousewheel: Wheel;
  36. readonly virtualRender: VirtualRender;
  37. readonly size: Size;
  38. get container(): HTMLElement;
  39. protected get [Symbol.toStringTag](): string;
  40. constructor(options: Partial<GraphOptions.Manual>);
  41. isNode(cell: Cell): cell is Node;
  42. isEdge(cell: Cell): cell is Edge;
  43. resetCells(cells: Cell[], options?: Collection.SetOptions): this;
  44. clearCells(options?: Cell.SetOptions): this;
  45. toJSON(options?: Model.ToJSONOptions): {
  46. cells: Cell.Properties[];
  47. };
  48. parseJSON(data: Model.FromJSONData): (Edge<Edge.Properties> | Node<Node.Properties>)[];
  49. fromJSON(data: Model.FromJSONData, options?: Model.FromJSONOptions): this;
  50. getCellById(id: string): Cell<Cell.Properties>;
  51. addNode(metadata: Node.Metadata, options?: Model.AddOptions): Node;
  52. addNode(node: Node, options?: Model.AddOptions): Node;
  53. addNodes(nodes: (Node | Node.Metadata)[], options?: Model.AddOptions): this;
  54. createNode(metadata: Node.Metadata): Node<Node.Properties>;
  55. removeNode(nodeId: string, options?: Collection.RemoveOptions): Node | null;
  56. removeNode(node: Node, options?: Collection.RemoveOptions): Node | null;
  57. addEdge(metadata: Edge.Metadata, options?: Model.AddOptions): Edge;
  58. addEdge(edge: Edge, options?: Model.AddOptions): Edge;
  59. addEdges(edges: (Edge | Edge.Metadata)[], options?: Model.AddOptions): this;
  60. removeEdge(edgeId: string, options?: Collection.RemoveOptions): Edge | null;
  61. removeEdge(edge: Edge, options?: Collection.RemoveOptions): Edge | null;
  62. createEdge(metadata: Edge.Metadata): Edge<Edge.Properties>;
  63. addCell(cell: Cell | Cell[], options?: Model.AddOptions): this;
  64. removeCell(cellId: string, options?: Collection.RemoveOptions): Cell | null;
  65. removeCell(cell: Cell, options?: Collection.RemoveOptions): Cell | null;
  66. removeCells(cells: (Cell | string)[], options?: Cell.RemoveOptions): (Cell<Cell.Properties> | null)[];
  67. removeConnectedEdges(cell: Cell | string, options?: Cell.RemoveOptions): Edge<Edge.Properties>[];
  68. disconnectConnectedEdges(cell: Cell | string, options?: Edge.SetOptions): this;
  69. hasCell(cellId: string): boolean;
  70. hasCell(cell: Cell): boolean;
  71. getCells(): Cell<Cell.Properties>[];
  72. getCellCount(): number;
  73. /**
  74. * Returns all the nodes in the graph.
  75. */
  76. getNodes(): Node<Node.Properties>[];
  77. /**
  78. * Returns all the edges in the graph.
  79. */
  80. getEdges(): Edge<Edge.Properties>[];
  81. /**
  82. * Returns all outgoing edges for the node.
  83. */
  84. getOutgoingEdges(cell: Cell | string): Edge<Edge.Properties>[] | null;
  85. /**
  86. * Returns all incoming edges for the node.
  87. */
  88. getIncomingEdges(cell: Cell | string): Edge<Edge.Properties>[] | null;
  89. /**
  90. * Returns edges connected with cell.
  91. */
  92. getConnectedEdges(cell: Cell | string, options?: Model.GetConnectedEdgesOptions): Edge<Edge.Properties>[];
  93. /**
  94. * Returns an array of all the roots of the graph.
  95. */
  96. getRootNodes(): Node<Node.Properties>[];
  97. /**
  98. * Returns an array of all the leafs of the graph.
  99. */
  100. getLeafNodes(): Node<Node.Properties>[];
  101. /**
  102. * Returns `true` if the node is a root node, i.e.
  103. * there is no edges coming to the node.
  104. */
  105. isRootNode(cell: Cell | string): boolean;
  106. /**
  107. * Returns `true` if the node is a leaf node, i.e.
  108. * there is no edges going out from the node.
  109. */
  110. isLeafNode(cell: Cell | string): boolean;
  111. /**
  112. * Returns all the neighbors of node in the graph. Neighbors are all
  113. * the nodes connected to node via either incoming or outgoing edge.
  114. */
  115. getNeighbors(cell: Cell, options?: Model.GetNeighborsOptions): Cell<Cell.Properties>[];
  116. /**
  117. * Returns `true` if `cell2` is a neighbor of `cell1`.
  118. */
  119. isNeighbor(cell1: Cell, cell2: Cell, options?: Model.GetNeighborsOptions): boolean;
  120. getSuccessors(cell: Cell, options?: Model.GetPredecessorsOptions): Cell<Cell.Properties>[];
  121. /**
  122. * Returns `true` if `cell2` is a successor of `cell1`.
  123. */
  124. isSuccessor(cell1: Cell, cell2: Cell, options?: Model.GetPredecessorsOptions): boolean;
  125. getPredecessors(cell: Cell, options?: Model.GetPredecessorsOptions): Cell<Cell.Properties>[];
  126. /**
  127. * Returns `true` if `cell2` is a predecessor of `cell1`.
  128. */
  129. isPredecessor(cell1: Cell, cell2: Cell, options?: Model.GetPredecessorsOptions): boolean;
  130. getCommonAncestor(...cells: (Cell | null | undefined)[]): Cell<Cell.Properties> | null;
  131. /**
  132. * Returns an array of cells that result from finding nodes/edges that
  133. * are connected to any of the cells in the cells array. This function
  134. * loops over cells and if the current cell is a edge, it collects its
  135. * source/target nodes; if it is an node, it collects its incoming and
  136. * outgoing edges if both the edge terminal (source/target) are in the
  137. * cells array.
  138. */
  139. getSubGraph(cells: Cell[], options?: Model.GetSubgraphOptions): Cell<Cell.Properties>[];
  140. /**
  141. * Clones the whole subgraph (including all the connected links whose
  142. * source/target is in the subgraph). If `options.deep` is `true`, also
  143. * take into account all the embedded cells of all the subgraph cells.
  144. *
  145. * Returns a map of the form: { [original cell ID]: [clone] }.
  146. */
  147. cloneSubGraph(cells: Cell[], options?: Model.GetSubgraphOptions): KeyValue<Cell<Cell.Properties>>;
  148. cloneCells(cells: Cell[]): KeyValue<Cell<Cell.Properties>>;
  149. /**
  150. * Returns an array of nodes whose bounding box contains point.
  151. * Note that there can be more then one node as nodes might overlap.
  152. */
  153. getNodesFromPoint(x: number, y: number): Node[];
  154. getNodesFromPoint(p: Point.PointLike): Node[];
  155. /**
  156. * Returns an array of nodes whose bounding box top/left coordinate
  157. * falls into the rectangle.
  158. */
  159. getNodesInArea(x: number, y: number, w: number, h: number, options?: Model.GetCellsInAreaOptions): Node[];
  160. getNodesInArea(rect: Rectangle.RectangleLike, options?: Model.GetCellsInAreaOptions): Node[];
  161. getNodesUnderNode(node: Node, options?: {
  162. by?: 'bbox' | Rectangle.KeyPoint;
  163. }): Node<Node.Properties>[];
  164. searchCell(cell: Cell, iterator: Model.SearchIterator, options?: Model.SearchOptions): this;
  165. /** *
  166. * Returns an array of IDs of nodes on the shortest
  167. * path between source and target.
  168. */
  169. getShortestPath(source: Cell | string, target: Cell | string, options?: Model.GetShortestPathOptions): string[];
  170. /**
  171. * Returns the bounding box that surrounds all cells in the graph.
  172. */
  173. getAllCellsBBox(): Rectangle | null;
  174. /**
  175. * Returns the bounding box that surrounds all the given cells.
  176. */
  177. getCellsBBox(cells: Cell[], options?: Cell.GetCellsBBoxOptions): Rectangle | null;
  178. startBatch(name: string | Model.BatchName, data?: KeyValue): void;
  179. stopBatch(name: string | Model.BatchName, data?: KeyValue): void;
  180. batchUpdate<T>(execute: () => T, data?: KeyValue): T;
  181. batchUpdate<T>(name: string | Model.BatchName, execute: () => T, data?: KeyValue): T;
  182. updateCellId(cell: Cell, newId: string): Cell<Cell.Properties> | undefined;
  183. findView(ref: Cell | Element): CellView<Cell<Cell.Properties>, CellView.Options> | null;
  184. findViews(ref: Point.PointLike | Rectangle.RectangleLike): CellView<Cell<Cell.Properties>, CellView.Options>[];
  185. findViewByCell(cellId: string | number): CellView | null;
  186. findViewByCell(cell: Cell | null): CellView | null;
  187. findViewByElem(elem: string | Element | undefined | null): CellView<Cell<Cell.Properties>, CellView.Options> | null;
  188. findViewsFromPoint(x: number, y: number): CellView[];
  189. findViewsFromPoint(p: Point.PointLike): CellView[];
  190. findViewsInArea(x: number, y: number, width: number, height: number, options?: ViewRenderer.FindViewsInAreaOptions): CellView[];
  191. findViewsInArea(rect: Rectangle.RectangleLike, options?: ViewRenderer.FindViewsInAreaOptions): CellView[];
  192. /**
  193. * Returns the current transformation matrix of the graph.
  194. */
  195. matrix(): DOMMatrix;
  196. /**
  197. * Sets new transformation with the given `matrix`
  198. */
  199. matrix(mat: DOMMatrix | Dom.MatrixLike | null): this;
  200. resize(width?: number, height?: number): this;
  201. scale(): Dom.Scale;
  202. scale(sx: number, sy?: number, cx?: number, cy?: number): this;
  203. zoom(): number;
  204. zoom(factor: number, options?: Transform.ZoomOptions): this;
  205. zoomTo(factor: number, options?: Omit<Transform.ZoomOptions, 'absolute'>): this;
  206. zoomToRect(rect: Rectangle.RectangleLike, options?: Transform.ScaleContentToFitOptions & Transform.ScaleContentToFitOptions): this;
  207. zoomToFit(options?: Transform.GetContentAreaOptions & Transform.ScaleContentToFitOptions): this;
  208. rotate(): Dom.Rotation;
  209. rotate(angle: number, cx?: number, cy?: number): this;
  210. translate(): Dom.Translation;
  211. translate(tx: number, ty: number): this;
  212. translateBy(dx: number, dy: number): this;
  213. getGraphArea(): Rectangle;
  214. getContentArea(options?: Transform.GetContentAreaOptions): Rectangle;
  215. getContentBBox(options?: Transform.GetContentAreaOptions): Rectangle;
  216. fitToContent(gridWidth?: number, gridHeight?: number, padding?: NumberExt.SideOptions, options?: Transform.FitToContentOptions): Rectangle;
  217. fitToContent(options?: Transform.FitToContentFullOptions): Rectangle;
  218. scaleContentToFit(options?: Transform.ScaleContentToFitOptions): this;
  219. /**
  220. * Position the center of graph to the center of the viewport.
  221. */
  222. center(options?: Transform.CenterOptions): this;
  223. /**
  224. * Position the point (x,y) on the graph (in local coordinates) to the
  225. * center of the viewport. If only one of the coordinates is specified,
  226. * only center along the specified dimension and keep the other coordinate
  227. * unchanged.
  228. */
  229. centerPoint(x: number, y: null | number, options?: Transform.CenterOptions): this;
  230. centerPoint(x: null | number, y: number, options?: Transform.CenterOptions): this;
  231. centerPoint(optons?: Transform.CenterOptions): this;
  232. centerContent(options?: Transform.PositionContentOptions): this;
  233. centerCell(cell: Cell, options?: Transform.PositionContentOptions): this;
  234. positionPoint(point: Point.PointLike, x: number | string, y: number | string, options?: Transform.CenterOptions): this;
  235. positionRect(rect: Rectangle.RectangleLike, direction: Transform.Direction, options?: Transform.CenterOptions): this;
  236. positionCell(cell: Cell, direction: Transform.Direction, options?: Transform.CenterOptions): this;
  237. positionContent(pos: Transform.Direction, options?: Transform.PositionContentOptions): this;
  238. snapToGrid(p: Point.PointLike): Point;
  239. snapToGrid(x: number, y: number): Point;
  240. pageToLocal(rect: Rectangle.RectangleLike): Rectangle;
  241. pageToLocal(x: number, y: number, width: number, height: number): Rectangle;
  242. pageToLocal(p: Point.PointLike): Point;
  243. pageToLocal(x: number, y: number): Point;
  244. localToPage(rect: Rectangle.RectangleLike): Rectangle;
  245. localToPage(x: number, y: number, width: number, height: number): Rectangle;
  246. localToPage(p: Point.PointLike): Point;
  247. localToPage(x: number, y: number): Point;
  248. clientToLocal(rect: Rectangle.RectangleLike): Rectangle;
  249. clientToLocal(x: number, y: number, width: number, height: number): Rectangle;
  250. clientToLocal(p: Point.PointLike): Point;
  251. clientToLocal(x: number, y: number): Point;
  252. localToClient(rect: Rectangle.RectangleLike): Rectangle;
  253. localToClient(x: number, y: number, width: number, height: number): Rectangle;
  254. localToClient(p: Point.PointLike): Point;
  255. localToClient(x: number, y: number): Point;
  256. /**
  257. * Transform the rectangle `rect` defined in the local coordinate system to
  258. * the graph coordinate system.
  259. */
  260. localToGraph(rect: Rectangle.RectangleLike): Rectangle;
  261. /**
  262. * Transform the rectangle `x`, `y`, `width`, `height` defined in the local
  263. * coordinate system to the graph coordinate system.
  264. */
  265. localToGraph(x: number, y: number, width: number, height: number): Rectangle;
  266. /**
  267. * Transform the point `p` defined in the local coordinate system to
  268. * the graph coordinate system.
  269. */
  270. localToGraph(p: Point.PointLike): Point;
  271. /**
  272. * Transform the point `x`, `y` defined in the local coordinate system to
  273. * the graph coordinate system.
  274. */
  275. localToGraph(x: number, y: number): Point;
  276. graphToLocal(rect: Rectangle.RectangleLike): Rectangle;
  277. graphToLocal(x: number, y: number, width: number, height: number): Rectangle;
  278. graphToLocal(p: Point.PointLike): Point;
  279. graphToLocal(x: number, y: number): Point;
  280. clientToGraph(rect: Rectangle.RectangleLike): Rectangle;
  281. clientToGraph(x: number, y: number, width: number, height: number): Rectangle;
  282. clientToGraph(p: Point.PointLike): Point;
  283. clientToGraph(x: number, y: number): Point;
  284. defineFilter(options: Defs.FilterOptions): string;
  285. defineGradient(options: Defs.GradientOptions): string;
  286. defineMarker(options: Defs.MarkerOptions): string;
  287. getGridSize(): number;
  288. setGridSize(gridSize: number): this;
  289. showGrid(): this;
  290. hideGrid(): this;
  291. clearGrid(): this;
  292. drawGrid(options?: Grid.DrawGridOptions): this;
  293. updateBackground(): this;
  294. drawBackground(options?: Background.Options, onGraph?: boolean): this;
  295. clearBackground(onGraph?: boolean): this;
  296. enableVirtualRender(): this;
  297. disableVirtualRender(): this;
  298. isMouseWheelEnabled(): boolean;
  299. enableMouseWheel(): this;
  300. disableMouseWheel(): this;
  301. toggleMouseWheel(enabled?: boolean): this;
  302. isPannable(): any;
  303. enablePanning(): this;
  304. disablePanning(): this;
  305. togglePanning(pannable?: boolean): this;
  306. use(plugin: Graph.Plugin, ...options: any[]): this;
  307. getPlugin<T extends Graph.Plugin>(pluginName: string): T | undefined;
  308. getPlugins<T extends Graph.Plugin[]>(pluginName: string[]): T | undefined;
  309. enablePlugins(plugins: string[] | string): this;
  310. disablePlugins(plugins: string[] | string): this;
  311. isPluginEnabled(pluginName: string): boolean | undefined;
  312. disposePlugins(plugins: string[] | string): this;
  313. dispose(clean?: boolean): void;
  314. }
  315. export declare namespace Graph {
  316. export import View = GraphView;
  317. export import Renderer = ViewRenderer;
  318. export import MouseWheel = Wheel;
  319. export import DefsManager = Defs;
  320. export import GridManager = Grid;
  321. export import CoordManager = Coord;
  322. export import TransformManager = Transform;
  323. export import HighlightManager = Highlight;
  324. export import BackgroundManager = Background;
  325. export import PanningManager = Panning;
  326. }
  327. export declare namespace Graph {
  328. interface Options extends GraphOptions.Manual {
  329. }
  330. }
  331. export declare namespace Graph {
  332. const toStringTag: string;
  333. function isGraph(instance: any): instance is Graph;
  334. }
  335. export declare namespace Graph {
  336. function render(options: Partial<Options>, data?: Model.FromJSONData): Graph;
  337. function render(container: HTMLElement, data?: Model.FromJSONData): Graph;
  338. }
  339. export declare namespace Graph {
  340. const registerNode: {
  341. (entities: {
  342. [name: string]: Node.Definition | (Node.Config & {
  343. inherit?: string | Node.Definition | undefined;
  344. });
  345. }, force?: boolean | undefined): void;
  346. <K extends string | number | symbol>(name: K, entity: never[K], force?: boolean | undefined): Node.Definition;
  347. (name: string, entity: Node.Definition | (Node.Config & {
  348. inherit?: string | Node.Definition | undefined;
  349. }), force?: boolean | undefined): Node.Definition;
  350. };
  351. const registerEdge: {
  352. (entities: {
  353. [name: string]: Edge.Definition | (Edge.Config & {
  354. inherit?: string | Edge.Definition | undefined;
  355. });
  356. }, force?: boolean | undefined): void;
  357. <K extends string | number | symbol>(name: K, entity: never[K], force?: boolean | undefined): Edge.Definition;
  358. (name: string, entity: Edge.Definition | (Edge.Config & {
  359. inherit?: string | Edge.Definition | undefined;
  360. }), force?: boolean | undefined): Edge.Definition;
  361. };
  362. const registerView: {
  363. (entities: {
  364. [name: string]: CellView.Definition;
  365. }, force?: boolean | undefined): void;
  366. <K extends string | number>(name: K, entity: KeyValue<CellView.Definition>[K], force?: boolean | undefined): CellView.Definition;
  367. (name: string, entity: CellView.Definition, force?: boolean | undefined): CellView.Definition;
  368. };
  369. const registerAttr: {
  370. (entities: {
  371. [name: string]: Registry.Attr.Definition;
  372. }, force?: boolean | undefined): void;
  373. <K extends string | number>(name: K, entity: Registry.Attr.Definitions[K], force?: boolean | undefined): Registry.Attr.Definition;
  374. (name: string, entity: Registry.Attr.Definition, force?: boolean | undefined): Registry.Attr.Definition;
  375. };
  376. const registerGrid: {
  377. (entities: {
  378. [name: string]: Registry.Grid.CommonDefinition;
  379. }, force?: boolean | undefined): void;
  380. <K extends "dot" | "fixedDot" | "mesh" | "doubleMesh">(name: K, entity: typeof import("../registry/grid/main")[K], force?: boolean | undefined): Registry.Grid.CommonDefinition;
  381. (name: string, entity: Registry.Grid.CommonDefinition, force?: boolean | undefined): Registry.Grid.CommonDefinition;
  382. };
  383. const registerFilter: {
  384. (entities: {
  385. [name: string]: Registry.Filter.CommonDefinition;
  386. }, force?: boolean | undefined): void;
  387. <K extends "outline" | "highlight" | "blur" | "dropShadow" | "grayScale" | "sepia" | "saturate" | "hueRotate" | "invert" | "brightness" | "contrast">(name: K, entity: typeof import("../registry/filter/main")[K], force?: boolean | undefined): Registry.Filter.CommonDefinition;
  388. (name: string, entity: Registry.Filter.CommonDefinition, force?: boolean | undefined): Registry.Filter.CommonDefinition;
  389. };
  390. const registerNodeTool: {
  391. (entities: {
  392. [name: string]: import("../view").ToolsView.ToolItem.Definition | (import("../view").ToolsView.ToolItem.Options & {
  393. inherit?: string | undefined;
  394. } & KeyValue<any>);
  395. }, force?: boolean | undefined): void;
  396. <K extends "button" | "boundary" | "button-remove" | "node-editor">(name: K, entity: {
  397. boundary: typeof import("../registry/tool/boundary").Boundary;
  398. button: typeof import("../registry/tool/button").Button;
  399. 'button-remove': typeof import("../view").ToolsView.ToolItem;
  400. 'node-editor': typeof import("../view").ToolsView.ToolItem;
  401. }[K], force?: boolean | undefined): import("../view").ToolsView.ToolItem.Definition;
  402. (name: string, entity: import("../view").ToolsView.ToolItem.Definition | (import("../view").ToolsView.ToolItem.Options & {
  403. inherit?: string | undefined;
  404. } & KeyValue<any>), force?: boolean | undefined): import("../view").ToolsView.ToolItem.Definition;
  405. };
  406. const registerEdgeTool: {
  407. (entities: {
  408. [name: string]: import("../view").ToolsView.ToolItem.Definition | (import("../view").ToolsView.ToolItem.Options & {
  409. inherit?: string | undefined;
  410. } & KeyValue<any>);
  411. }, force?: boolean | undefined): void;
  412. <K extends "button" | "vertices" | "boundary" | "button-remove" | "source-anchor" | "target-anchor" | "source-arrowhead" | "target-arrowhead" | "segments" | "edge-editor">(name: K, entity: {
  413. boundary: typeof import("../registry/tool/boundary").Boundary;
  414. vertices: typeof import("../registry/tool/vertices").Vertices;
  415. segments: typeof import("../registry/tool/segments").Segments;
  416. button: typeof import("../registry/tool/button").Button;
  417. 'button-remove': typeof import("../view").ToolsView.ToolItem;
  418. 'source-anchor': typeof import("../view").ToolsView.ToolItem;
  419. 'target-anchor': typeof import("../view").ToolsView.ToolItem;
  420. 'source-arrowhead': typeof import("../view").ToolsView.ToolItem;
  421. 'target-arrowhead': typeof import("../view").ToolsView.ToolItem;
  422. 'edge-editor': typeof import("../view").ToolsView.ToolItem;
  423. }[K], force?: boolean | undefined): import("../view").ToolsView.ToolItem.Definition;
  424. (name: string, entity: import("../view").ToolsView.ToolItem.Definition | (import("../view").ToolsView.ToolItem.Options & {
  425. inherit?: string | undefined;
  426. } & KeyValue<any>), force?: boolean | undefined): import("../view").ToolsView.ToolItem.Definition;
  427. };
  428. const registerBackground: {
  429. (entities: {
  430. [name: string]: Registry.Background.Definition<Registry.Background.CommonOptions>;
  431. }, force?: boolean | undefined): void;
  432. <K extends string | number>(name: K, entity: {
  433. [name: string]: Registry.Background.Definition<Registry.Background.CommonOptions>;
  434. }[K], force?: boolean | undefined): Registry.Background.Definition<Registry.Background.CommonOptions>;
  435. (name: string, entity: Registry.Background.Definition<Registry.Background.CommonOptions>, force?: boolean | undefined): Registry.Background.Definition<Registry.Background.CommonOptions>;
  436. };
  437. const registerHighlighter: {
  438. (entities: {
  439. [name: string]: Registry.Highlighter.CommonDefinition;
  440. }, force?: boolean | undefined): void;
  441. <K extends "stroke" | "opacity" | "className">(name: K, entity: typeof import("../registry/highlighter/main")[K], force?: boolean | undefined): Registry.Highlighter.CommonDefinition;
  442. (name: string, entity: Registry.Highlighter.CommonDefinition, force?: boolean | undefined): Registry.Highlighter.CommonDefinition;
  443. };
  444. const registerPortLayout: {
  445. (entities: {
  446. [name: string]: Registry.PortLayout.CommonDefinition;
  447. }, force?: boolean | undefined): void;
  448. <K extends "bottom" | "left" | "right" | "top" | "line" | "ellipse" | "absolute" | "ellipseSpread">(name: K, entity: typeof import("../registry/port-layout/main")[K], force?: boolean | undefined): Registry.PortLayout.CommonDefinition;
  449. (name: string, entity: Registry.PortLayout.CommonDefinition, force?: boolean | undefined): Registry.PortLayout.CommonDefinition;
  450. };
  451. const registerPortLabelLayout: {
  452. (entities: {
  453. [name: string]: Registry.PortLabelLayout.CommonDefinition;
  454. }, force?: boolean | undefined): void;
  455. <K extends "bottom" | "left" | "right" | "top" | "manual" | "outside" | "outsideOriented" | "inside" | "insideOriented" | "radial" | "radialOriented">(name: K, entity: typeof import("../registry/port-label-layout/main")[K], force?: boolean | undefined): Registry.PortLabelLayout.CommonDefinition;
  456. (name: string, entity: Registry.PortLabelLayout.CommonDefinition, force?: boolean | undefined): Registry.PortLabelLayout.CommonDefinition;
  457. };
  458. const registerMarker: {
  459. (entities: {
  460. [name: string]: Registry.Marker.Factory<KeyValue<any>>;
  461. }, force?: boolean | undefined): void;
  462. <K extends "path" | "circle" | "ellipse" | "async" | "block" | "classic" | "diamond" | "cross" | "circlePlus">(name: K, entity: typeof import("../registry/marker/main")[K], force?: boolean | undefined): Registry.Marker.Factory<KeyValue<any>>;
  463. (name: string, entity: Registry.Marker.Factory<KeyValue<any>>, force?: boolean | undefined): Registry.Marker.Factory<KeyValue<any>>;
  464. };
  465. const registerRouter: {
  466. (entities: {
  467. [name: string]: Registry.Router.CommonDefinition;
  468. }, force?: boolean | undefined): void;
  469. <K extends "normal" | "oneSide" | "orth" | "metro" | "manhattan" | "er" | "loop">(name: K, entity: typeof import("../registry/router/main")[K], force?: boolean | undefined): Registry.Router.CommonDefinition;
  470. (name: string, entity: Registry.Router.CommonDefinition, force?: boolean | undefined): Registry.Router.CommonDefinition;
  471. };
  472. const registerConnector: {
  473. (entities: {
  474. [name: string]: Registry.Connector.Definition<Registry.Connector.BaseOptions>;
  475. }, force?: boolean | undefined): void;
  476. <K extends "normal" | "loop" | "rounded" | "smooth" | "jumpover">(name: K, entity: typeof import("../registry/connector/main")[K], force?: boolean | undefined): Registry.Connector.Definition<Registry.Connector.BaseOptions>;
  477. (name: string, entity: Registry.Connector.Definition<Registry.Connector.BaseOptions>, force?: boolean | undefined): Registry.Connector.Definition<Registry.Connector.BaseOptions>;
  478. };
  479. const registerAnchor: {
  480. (entities: {
  481. [name: string]: Registry.NodeAnchor.CommonDefinition;
  482. }, force?: boolean | undefined): void;
  483. <K extends "bottom" | "center" | "left" | "right" | "top" | "orth" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "nodeCenter" | "midSide">(name: K, entity: typeof import("../registry/node-anchor/main")[K], force?: boolean | undefined): Registry.NodeAnchor.CommonDefinition;
  484. (name: string, entity: Registry.NodeAnchor.CommonDefinition, force?: boolean | undefined): Registry.NodeAnchor.CommonDefinition;
  485. };
  486. const registerEdgeAnchor: {
  487. (entities: {
  488. [name: string]: Registry.EdgeAnchor.CommonDefinition;
  489. }, force?: boolean | undefined): void;
  490. <K extends "length" | "orth" | "ratio" | "closest">(name: K, entity: typeof import("../registry/edge-anchor/main")[K], force?: boolean | undefined): Registry.EdgeAnchor.CommonDefinition;
  491. (name: string, entity: Registry.EdgeAnchor.CommonDefinition, force?: boolean | undefined): Registry.EdgeAnchor.CommonDefinition;
  492. };
  493. const registerConnectionPoint: {
  494. (entities: {
  495. [name: string]: Registry.ConnectionPoint.CommonDefinition;
  496. }, force?: boolean | undefined): void;
  497. <K extends "rect" | "anchor" | "bbox" | "boundary">(name: K, entity: typeof import("../registry/connection-point/main")[K], force?: boolean | undefined): Registry.ConnectionPoint.CommonDefinition;
  498. (name: string, entity: Registry.ConnectionPoint.CommonDefinition, force?: boolean | undefined): Registry.ConnectionPoint.CommonDefinition;
  499. };
  500. }
  501. export declare namespace Graph {
  502. const unregisterNode: {
  503. <K extends string | number | symbol>(name: K): Node.Definition | null;
  504. (name: string): Node.Definition | null;
  505. };
  506. const unregisterEdge: {
  507. <K extends string | number | symbol>(name: K): Edge.Definition | null;
  508. (name: string): Edge.Definition | null;
  509. };
  510. const unregisterView: {
  511. <K extends string | number>(name: K): CellView.Definition | null;
  512. (name: string): CellView.Definition | null;
  513. };
  514. const unregisterAttr: {
  515. <K extends string | number>(name: K): Registry.Attr.Definition | null;
  516. (name: string): Registry.Attr.Definition | null;
  517. };
  518. const unregisterGrid: {
  519. <K extends "dot" | "fixedDot" | "mesh" | "doubleMesh">(name: K): Registry.Grid.CommonDefinition | null;
  520. (name: string): Registry.Grid.CommonDefinition | null;
  521. };
  522. const unregisterFilter: {
  523. <K extends "outline" | "highlight" | "blur" | "dropShadow" | "grayScale" | "sepia" | "saturate" | "hueRotate" | "invert" | "brightness" | "contrast">(name: K): Registry.Filter.CommonDefinition | null;
  524. (name: string): Registry.Filter.CommonDefinition | null;
  525. };
  526. const unregisterNodeTool: {
  527. <K extends "button" | "boundary" | "button-remove" | "node-editor">(name: K): import("../view").ToolsView.ToolItem.Definition | null;
  528. (name: string): import("../view").ToolsView.ToolItem.Definition | null;
  529. };
  530. const unregisterEdgeTool: {
  531. <K extends "button" | "vertices" | "boundary" | "button-remove" | "source-anchor" | "target-anchor" | "source-arrowhead" | "target-arrowhead" | "segments" | "edge-editor">(name: K): import("../view").ToolsView.ToolItem.Definition | null;
  532. (name: string): import("../view").ToolsView.ToolItem.Definition | null;
  533. };
  534. const unregisterBackground: {
  535. <K extends string | number>(name: K): Registry.Background.Definition<Registry.Background.CommonOptions> | null;
  536. (name: string): Registry.Background.Definition<Registry.Background.CommonOptions> | null;
  537. };
  538. const unregisterHighlighter: {
  539. <K extends "stroke" | "opacity" | "className">(name: K): Registry.Highlighter.CommonDefinition | null;
  540. (name: string): Registry.Highlighter.CommonDefinition | null;
  541. };
  542. const unregisterPortLayout: {
  543. <K extends "bottom" | "left" | "right" | "top" | "line" | "ellipse" | "absolute" | "ellipseSpread">(name: K): Registry.PortLayout.CommonDefinition | null;
  544. (name: string): Registry.PortLayout.CommonDefinition | null;
  545. };
  546. const unregisterPortLabelLayout: {
  547. <K extends "bottom" | "left" | "right" | "top" | "manual" | "outside" | "outsideOriented" | "inside" | "insideOriented" | "radial" | "radialOriented">(name: K): Registry.PortLabelLayout.CommonDefinition | null;
  548. (name: string): Registry.PortLabelLayout.CommonDefinition | null;
  549. };
  550. const unregisterMarker: {
  551. <K extends "path" | "circle" | "ellipse" | "async" | "block" | "classic" | "diamond" | "cross" | "circlePlus">(name: K): Registry.Marker.Factory<KeyValue<any>> | null;
  552. (name: string): Registry.Marker.Factory<KeyValue<any>> | null;
  553. };
  554. const unregisterRouter: {
  555. <K extends "normal" | "oneSide" | "orth" | "metro" | "manhattan" | "er" | "loop">(name: K): Registry.Router.CommonDefinition | null;
  556. (name: string): Registry.Router.CommonDefinition | null;
  557. };
  558. const unregisterConnector: {
  559. <K extends "normal" | "loop" | "rounded" | "smooth" | "jumpover">(name: K): Registry.Connector.Definition<Registry.Connector.BaseOptions> | null;
  560. (name: string): Registry.Connector.Definition<Registry.Connector.BaseOptions> | null;
  561. };
  562. const unregisterAnchor: {
  563. <K extends "bottom" | "center" | "left" | "right" | "top" | "orth" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "nodeCenter" | "midSide">(name: K): Registry.NodeAnchor.CommonDefinition | null;
  564. (name: string): Registry.NodeAnchor.CommonDefinition | null;
  565. };
  566. const unregisterEdgeAnchor: {
  567. <K extends "length" | "orth" | "ratio" | "closest">(name: K): Registry.EdgeAnchor.CommonDefinition | null;
  568. (name: string): Registry.EdgeAnchor.CommonDefinition | null;
  569. };
  570. const unregisterConnectionPoint: {
  571. <K extends "rect" | "anchor" | "bbox" | "boundary">(name: K): Registry.ConnectionPoint.CommonDefinition | null;
  572. (name: string): Registry.ConnectionPoint.CommonDefinition | null;
  573. };
  574. }
  575. export declare namespace Graph {
  576. type Plugin = {
  577. name: string;
  578. init: (graph: Graph, ...options: any[]) => any;
  579. dispose: () => void;
  580. enable?: () => void;
  581. disable?: () => void;
  582. isEnabled?: () => boolean;
  583. };
  584. }