@antv/layout 1.0.0-alpha.16 → 1.0.0-alpha.18

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 (46) hide show
  1. package/dist/5eff5240d48719e2c5a3.worker.js +2 -0
  2. package/dist/5eff5240d48719e2c5a3.worker.js.map +1 -0
  3. package/dist/index.min.js +1 -1
  4. package/dist/index.min.js.map +1 -1
  5. package/esm/5eff5240d48719e2c5a3.worker.js +2 -0
  6. package/esm/5eff5240d48719e2c5a3.worker.js.map +1 -0
  7. package/esm/index.esm.js +1 -1
  8. package/esm/index.esm.js.map +1 -1
  9. package/lib/d3Force/index.d.ts +0 -1
  10. package/lib/dagre/acyclic.d.ts +4 -0
  11. package/lib/dagre/add-border-segments.d.ts +2 -0
  12. package/lib/dagre/coordinate-system.d.ts +4 -0
  13. package/lib/dagre/data/list.d.ts +12 -0
  14. package/lib/dagre/greedy-fas.d.ts +3 -0
  15. package/lib/dagre/layout.d.ts +18 -0
  16. package/lib/dagre/nesting-graph.d.ts +8 -0
  17. package/lib/dagre/normalize.d.ts +5 -0
  18. package/lib/dagre/order/add-subgraph-constraints.d.ts +3 -0
  19. package/lib/dagre/order/barycenter.d.ts +14 -0
  20. package/lib/dagre/order/build-layer-graph.d.ts +3 -0
  21. package/lib/dagre/order/cross-count.d.ts +3 -0
  22. package/lib/dagre/order/index.d.ts +2 -0
  23. package/lib/dagre/order/init-data-order.d.ts +6 -0
  24. package/lib/dagre/order/init-order.d.ts +3 -0
  25. package/lib/dagre/order/resolve-conflicts.d.ts +20 -0
  26. package/lib/dagre/order/sort-subgraph.d.ts +7 -0
  27. package/lib/dagre/order/sort.d.ts +7 -0
  28. package/lib/dagre/parent-dummy-chains.d.ts +3 -0
  29. package/lib/dagre/position/bk.d.ts +25 -0
  30. package/lib/dagre/position/index.d.ts +7 -0
  31. package/lib/dagre/rank/feasible-tree.d.ts +5 -0
  32. package/lib/dagre/rank/index.d.ts +2 -0
  33. package/lib/dagre/rank/network-simplex.d.ts +16 -0
  34. package/lib/dagre/rank/util.d.ts +6 -0
  35. package/lib/dagre/util.d.ts +35 -0
  36. package/lib/dagre.d.ts +31 -0
  37. package/lib/fruchterman.d.ts +0 -1
  38. package/lib/index.d.ts +1 -0
  39. package/lib/types.d.ts +35 -18
  40. package/lib/util/common.d.ts +11 -1
  41. package/lib/util/function.d.ts +7 -0
  42. package/package.json +1 -1
  43. package/dist/0ee54f2e2414f719b33e.worker.js +0 -2
  44. package/dist/0ee54f2e2414f719b33e.worker.js.map +0 -1
  45. package/esm/0ee54f2e2414f719b33e.worker.js +0 -2
  46. package/esm/0ee54f2e2414f719b33e.worker.js.map +0 -1
@@ -38,7 +38,6 @@ export declare class D3ForceLayout implements LayoutWithIterations<D3ForceLayout
38
38
  stop(): void;
39
39
  /**
40
40
  * Manually steps the simulation by the specified number of iterations.
41
- * When finished it will trigger `onLayoutEnd` callback.
42
41
  * @see https://github.com/d3/d3-force#simulation_tick
43
42
  */
44
43
  tick(iterations?: number): {
@@ -0,0 +1,4 @@
1
+ import { Graph } from "../types";
2
+ declare const run: (g: Graph, acyclicer: string) => void;
3
+ declare const undo: (g: Graph) => void;
4
+ export { run, undo };
@@ -0,0 +1,2 @@
1
+ import { Graph } from "../types";
2
+ export declare const addBorderSegments: (g: Graph) => void;
@@ -0,0 +1,4 @@
1
+ import { DagreRankdir, Graph } from "../types";
2
+ declare const adjust: (g: Graph, rankdir: DagreRankdir) => void;
3
+ declare const undo: (g: Graph, rankdir: DagreRankdir) => void;
4
+ export { adjust, undo };
@@ -0,0 +1,12 @@
1
+ type LinkedNode<T> = {
2
+ prev?: LinkedNode<T>;
3
+ next?: LinkedNode<T>;
4
+ } & T;
5
+ export default class List<T> {
6
+ shortcut: LinkedNode<T>;
7
+ constructor();
8
+ dequeue(): LinkedNode<T> | undefined;
9
+ enqueue(entry: LinkedNode<T>): void;
10
+ toString(): string;
11
+ }
12
+ export {};
@@ -0,0 +1,3 @@
1
+ import { Edge } from "@antv/graphlib";
2
+ import { EdgeData, Graph as IGraph } from "../types";
3
+ export declare const greedyFAS: (g: IGraph, weightFn?: ((e: Edge<EdgeData>) => number) | undefined) => Edge<EdgeData>[];
@@ -0,0 +1,18 @@
1
+ import { ID } from "@antv/graphlib";
2
+ import { DagreRankdir, Graph as IGraph } from "../types";
3
+ export declare const layout: (g: IGraph, options: {
4
+ keepNodeOrder: boolean;
5
+ prevGraph: IGraph | null;
6
+ edgeLabelSpace?: boolean | undefined;
7
+ align?: string | undefined;
8
+ nodesep?: number | undefined;
9
+ edgesep?: number | undefined;
10
+ ranksep?: number | undefined;
11
+ acyclicer: string;
12
+ nodeOrder: ID[];
13
+ ranker: "network-simplex" | "tight-tree" | "longest-path";
14
+ rankdir: DagreRankdir;
15
+ }) => {
16
+ width: number;
17
+ height: number;
18
+ } | undefined;
@@ -0,0 +1,8 @@
1
+ import { ID } from "@antv/graphlib";
2
+ import { Graph as IGraph } from "../types";
3
+ declare const run: (g: IGraph) => {
4
+ nestingRoot: ID;
5
+ nodeRankFactor: number;
6
+ };
7
+ declare const cleanup: (g: IGraph, nestingRoot?: ID) => void;
8
+ export { run, cleanup };
@@ -0,0 +1,5 @@
1
+ import { ID } from "@antv/graphlib";
2
+ import { Graph as IGraph } from "../types";
3
+ declare const run: (g: IGraph, dummyChains: ID[]) => void;
4
+ declare const undo: (g: IGraph, dummyChains: ID[]) => void;
5
+ export { run, undo };
@@ -0,0 +1,3 @@
1
+ import { ID } from "@antv/graphlib";
2
+ import { Graph } from "../../types";
3
+ export declare const addSubgraphConstraints: (g: Graph, cg: Graph, vs: ID[]) => void;
@@ -0,0 +1,14 @@
1
+ import { ID } from "@antv/graphlib";
2
+ import { Graph } from "../../types";
3
+ /**
4
+ * TODO: The median method consistently performs better than the barycenter method and has a slight theoretical advantage
5
+ */
6
+ export declare const barycenter: (g: Graph, movable: ID[]) => ({
7
+ v: ID;
8
+ barycenter?: undefined;
9
+ weight?: undefined;
10
+ } | {
11
+ v: ID;
12
+ barycenter: number;
13
+ weight: number;
14
+ })[];
@@ -0,0 +1,3 @@
1
+ import { Graph } from "@antv/graphlib";
2
+ import { Graph as IGraph } from "../../types";
3
+ export declare const buildLayerGraph: (g: IGraph, rank: number, direction: "in" | "out") => Graph<{}, import("@antv/graphlib").PlainObject>;
@@ -0,0 +1,3 @@
1
+ import { ID } from "@antv/graphlib";
2
+ import { Graph } from "../../types";
3
+ export declare const crossCount: (g: Graph, layering: ID[][]) => number;
@@ -0,0 +1,2 @@
1
+ import { Graph as IGraph } from "../../types";
2
+ export declare const order: (g: IGraph, keepNodeOrder?: boolean) => void;
@@ -0,0 +1,6 @@
1
+ import { ID } from "@antv/graphlib";
2
+ import { Graph } from "../../types";
3
+ /**
4
+ * 按照数据中的结果设置fixorder
5
+ */
6
+ export declare const initDataOrder: (g: Graph, nodeOrder?: ID[]) => void;
@@ -0,0 +1,3 @@
1
+ import { ID } from "@antv/graphlib";
2
+ import { Graph } from "../../types";
3
+ export declare const initOrder: (g: Graph) => ID[][];
@@ -0,0 +1,20 @@
1
+ import { ID } from "@antv/graphlib";
2
+ import { Graph } from "../../types";
3
+ export type ConflictEntry = {
4
+ i: number;
5
+ indegree?: number;
6
+ in?: ConflictEntry[];
7
+ out?: ConflictEntry[];
8
+ vs: ID[];
9
+ barycenter?: number;
10
+ weight?: number;
11
+ merged?: boolean;
12
+ fixorder?: number;
13
+ order?: number;
14
+ };
15
+ declare const resolveConflicts: (entries: {
16
+ v: ID;
17
+ barycenter?: number;
18
+ weight?: number;
19
+ }[], cg: Graph) => ConflictEntry[];
20
+ export default resolveConflicts;
@@ -0,0 +1,7 @@
1
+ import { ID } from "@antv/graphlib";
2
+ import { Graph } from "../../types";
3
+ export declare const sortSubgraph: (g: Graph, v: ID, cg: Graph, biasRight?: boolean, usePrev?: boolean, keepNodeOrder?: boolean) => {
4
+ vs: ID[];
5
+ barycenter?: number | undefined;
6
+ weight?: number | undefined;
7
+ };
@@ -0,0 +1,7 @@
1
+ import { ID } from "@antv/graphlib";
2
+ import { ConflictEntry } from "./resolve-conflicts";
3
+ export declare const sort: (entries: ConflictEntry[], biasRight?: boolean, usePrev?: boolean, keepNodeOrder?: boolean) => {
4
+ vs: ID[];
5
+ barycenter?: number | undefined;
6
+ weight?: number | undefined;
7
+ };
@@ -0,0 +1,3 @@
1
+ import { ID } from "@antv/graphlib";
2
+ import { Graph as IGraph } from "../types";
3
+ export declare const parentDummyChains: (g: IGraph, dummyChains: ID[]) => void;
@@ -0,0 +1,25 @@
1
+ import { ID, Node } from "@antv/graphlib";
2
+ import { Graph as IGraph, NodeData } from "../../types";
3
+ type Conflicts = Record<ID, Record<ID, boolean>>;
4
+ export declare const findType1Conflicts: (g: IGraph, layering?: ID[][]) => {};
5
+ export declare const findType2Conflicts: (g: IGraph, layering?: ID[][]) => {};
6
+ export declare const findOtherInnerSegmentNode: (g: IGraph, v: ID) => Node<NodeData> | undefined;
7
+ export declare const addConflict: (conflicts: Conflicts, v: ID, w: ID) => void;
8
+ export declare const hasConflict: (conflicts: Conflicts, v: ID, w: ID) => boolean;
9
+ export declare const verticalAlignment: (g: IGraph, layering: ID[][], conflicts: Conflicts, neighborFn: (v: ID) => Node<NodeData>[]) => {
10
+ root: Record<ID, ID>;
11
+ align: Record<ID, ID>;
12
+ };
13
+ export declare const horizontalCompaction: (g: IGraph, layering: ID[][], root: Record<ID, ID>, align: Record<ID, ID>, nodesep: number, edgesep: number, reverseSep?: boolean) => Record<ID, number>;
14
+ export declare const buildBlockGraph: (g: IGraph, layering: ID[][], root: Record<ID, ID>, nodesep: number, edgesep: number, reverseSep?: boolean) => IGraph;
15
+ export declare const findSmallestWidthAlignment: (g: IGraph, xss: Record<string, Record<string, number>>) => Record<string, number>;
16
+ export declare function alignCoordinates(xss: Record<string, Record<string, number>>, alignTo: Record<string, number>): void;
17
+ export declare const balance: (xss: Record<string, Record<string, number>>, align?: string) => Record<string, number>;
18
+ export declare const positionX: (g: IGraph, options?: Partial<{
19
+ align: string;
20
+ nodesep: number;
21
+ edgesep: number;
22
+ }> | undefined) => Record<string, number>;
23
+ export declare const sep: (nodeSep: number, edgeSep: number, reverseSep: boolean) => (g: IGraph, v: ID, w: ID) => number;
24
+ export declare const width: (g: IGraph, v: ID) => number;
25
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Graph as IGraph } from "../../types";
2
+ export declare const position: (g: IGraph, options?: Partial<{
3
+ align: string;
4
+ nodesep: number;
5
+ edgesep: number;
6
+ ranksep: number;
7
+ }>) => void;
@@ -0,0 +1,5 @@
1
+ import { Graph } from "@antv/graphlib";
2
+ import { Graph as IGraph } from "../../types";
3
+ declare const feasibleTree: (g: IGraph) => Graph<import("@antv/graphlib").PlainObject, import("@antv/graphlib").PlainObject>;
4
+ declare const feasibleTreeWithLayer: (g: IGraph) => Graph<import("@antv/graphlib").PlainObject, import("@antv/graphlib").PlainObject>;
5
+ export { feasibleTree, feasibleTreeWithLayer };
@@ -0,0 +1,2 @@
1
+ import { Graph as IGraph } from "../../types";
2
+ export declare const rank: (g: IGraph, ranker: "network-simplex" | "tight-tree" | "longest-path") => void;
@@ -0,0 +1,16 @@
1
+ import { Edge, ID } from "@antv/graphlib";
2
+ import { EdgeData, Graph as IGraph } from "../../types";
3
+ export declare const networkSimplex: (og: IGraph) => void;
4
+ export declare const initCutValues: (t: IGraph, g: IGraph) => void;
5
+ export declare const calcCutValue: (t: IGraph, g: IGraph, child: ID) => number;
6
+ export declare const initLowLimValues: (tree: IGraph, root?: ID) => void;
7
+ export declare const leaveEdge: (tree: IGraph) => Edge<EdgeData> | undefined;
8
+ export declare const enterEdge: (t: IGraph, g: IGraph, edge: Edge<EdgeData>) => Edge<EdgeData>;
9
+ /**
10
+ *
11
+ * @param t
12
+ * @param g
13
+ * @param e edge to remove
14
+ * @param f edge to add
15
+ */
16
+ export declare const exchangeEdges: (t: IGraph, g: IGraph, e: Edge<EdgeData>, f: Edge<EdgeData>) => void;
@@ -0,0 +1,6 @@
1
+ import { Edge } from "@antv/graphlib";
2
+ import { EdgeData, Graph } from "../../types";
3
+ declare const longestPath: (g: Graph) => void;
4
+ declare const longestPathWithLayer: (g: Graph) => void;
5
+ declare const slack: (g: Graph, e: Edge<EdgeData>) => number;
6
+ export { longestPath, longestPathWithLayer, slack };
@@ -0,0 +1,35 @@
1
+ import { ID, Graph, Node } from "@antv/graphlib";
2
+ import { Graph as IGraph, NodeData } from "../types";
3
+ export declare const addDummyNode: (g: IGraph, type: string, data: NodeData, name: string) => ID;
4
+ export declare const simplify: (g: IGraph) => Graph<import("@antv/graphlib").PlainObject, import("@antv/graphlib").PlainObject>;
5
+ export declare const asNonCompoundGraph: (g: IGraph) => IGraph;
6
+ export declare const zipObject: <T = any>(keys: ID[], values: T[]) => Record<ID, T>;
7
+ export declare const successorWeights: (g: IGraph) => Record<ID, Record<string, number>>;
8
+ export declare const predecessorWeights: (g: IGraph) => Record<ID, Record<ID, number>>;
9
+ export declare const intersectRect: (rect: {
10
+ x?: number | undefined;
11
+ y?: number | undefined;
12
+ width?: number | undefined;
13
+ height?: number | undefined;
14
+ }, point: {
15
+ x?: number | undefined;
16
+ y?: number | undefined;
17
+ }) => {
18
+ x: number;
19
+ y: number;
20
+ };
21
+ export declare const buildLayerMatrix: (g: IGraph) => ID[][];
22
+ export declare const normalizeRanks: (g: IGraph) => void;
23
+ export declare const removeEmptyRanks: (g: IGraph, nodeRankFactor?: number) => void;
24
+ export declare const addBorderNode: (g: IGraph, prefix: string, rank?: number, order?: number) => ID;
25
+ export declare const maxRank: (g: IGraph) => number;
26
+ export declare const partition: <T = any>(collection: T[], fn: (val: T) => boolean) => {
27
+ lhs: T[];
28
+ rhs: T[];
29
+ };
30
+ export declare const minBy: <T = any>(array: T[], func: (param: T) => number) => T;
31
+ /**
32
+ * @description DFS traversal.
33
+ * @description.zh-CN DFS 遍历。
34
+ */
35
+ export declare const dfs: (graph: IGraph, node: Node<NodeData> | Node<NodeData>[], order: "pre" | "post", isDirected: boolean) => ID[];
package/lib/dagre.d.ts ADDED
@@ -0,0 +1,31 @@
1
+ import type { Graph as IGraph, Layout, LayoutMapping, Node, DagreLayoutOptions } from "./types";
2
+ /**
3
+ * Layout arranging the nodes in a circle.
4
+ *
5
+ * @example
6
+ * // Assign layout options when initialization.
7
+ * const layout = new CircularLayout({ radius: 10 });
8
+ * const positions = await layout.execute(graph); // { nodes: [], edges: [] }
9
+ *
10
+ * // Or use different options later.
11
+ * const layout = new CircularLayout({ radius: 10 });
12
+ * const positions = await layout.execute(graph, { radius: 20 }); // { nodes: [], edges: [] }
13
+ *
14
+ * // If you want to assign the positions directly to the nodes, use assign method.
15
+ * await layout.assign(graph, { radius: 20 });
16
+ */
17
+ export declare class DagreLayout implements Layout<DagreLayoutOptions> {
18
+ options: DagreLayoutOptions;
19
+ id: string;
20
+ constructor(options?: DagreLayoutOptions);
21
+ /**
22
+ * Return the positions of nodes and edges(if needed).
23
+ */
24
+ execute(graph: IGraph, options?: DagreLayoutOptions): Promise<LayoutMapping>;
25
+ /**
26
+ * To directly assign the positions to the nodes.
27
+ */
28
+ assign(graph: IGraph, options?: DagreLayoutOptions): Promise<void>;
29
+ private genericDagreLayout;
30
+ layoutNode: (node: Node) => boolean;
31
+ }
@@ -41,7 +41,6 @@ export declare class FruchtermanLayout implements LayoutWithIterations<Fruchterm
41
41
  stop(): void;
42
42
  /**
43
43
  * Manually steps the simulation by the specified number of iterations.
44
- * When finished it will trigger `onLayoutEnd` callback.
45
44
  * @see https://github.com/d3/d3-force#simulation_tick
46
45
  */
47
46
  tick(iterations?: number): LayoutMapping;
package/lib/index.d.ts CHANGED
@@ -10,5 +10,6 @@ export * from "./fruchterman";
10
10
  export * from "./d3Force";
11
11
  export * from "./force";
12
12
  export * from "./forceAtlas2";
13
+ export * from "./dagre";
13
14
  export * from "./types";
14
15
  export * from "./util";
package/lib/types.d.ts CHANGED
@@ -1,7 +1,20 @@
1
- import { Graph as IGraph, Node as INode, Edge as IEdge, PlainObject, GraphView as IGraphView } from "@antv/graphlib";
1
+ import { Graph as IGraph, Node as INode, Edge as IEdge, PlainObject, GraphView as IGraphView, ID } from "@antv/graphlib";
2
2
  export interface NodeData extends PlainObject {
3
3
  size?: number | number[];
4
4
  bboxSize?: number[];
5
+ borderLeft?: ID | ID[];
6
+ borderRight?: ID | ID[];
7
+ x?: number;
8
+ y?: number;
9
+ height?: number;
10
+ width?: number;
11
+ e?: IEdge<EdgeData>;
12
+ selfEdges?: IEdge<EdgeData>[];
13
+ rank?: number;
14
+ order?: number;
15
+ minRank?: number;
16
+ maxRank?: number;
17
+ layout?: boolean;
5
18
  }
6
19
  export interface OutNodeData extends NodeData {
7
20
  x: number;
@@ -9,6 +22,13 @@ export interface OutNodeData extends NodeData {
9
22
  }
10
23
  export interface EdgeData extends PlainObject {
11
24
  virtual?: boolean;
25
+ weight?: number;
26
+ x?: number;
27
+ y?: number;
28
+ height?: number;
29
+ width?: number;
30
+ points?: Point[];
31
+ controlPoints?: Point[];
12
32
  }
13
33
  /** input node */
14
34
  export type Node = INode<NodeData>;
@@ -77,10 +97,7 @@ export interface LayoutSupervisor {
77
97
  kill(): void;
78
98
  isRunning(): boolean;
79
99
  }
80
- interface CommonOptions {
81
- onLayoutEnd?: (data: LayoutMapping) => void;
82
- }
83
- export interface CircularLayoutOptions extends CommonOptions {
100
+ export interface CircularLayoutOptions {
84
101
  center?: PointTuple;
85
102
  width?: number;
86
103
  height?: number;
@@ -96,7 +113,7 @@ export interface CircularLayoutOptions extends CommonOptions {
96
113
  nodeSpacing?: ((node?: Node) => number) | number;
97
114
  nodeSize?: number | number[];
98
115
  }
99
- export interface GridLayoutOptions extends CommonOptions {
116
+ export interface GridLayoutOptions {
100
117
  width?: number;
101
118
  height?: number;
102
119
  begin?: PointTuple;
@@ -113,16 +130,16 @@ export interface GridLayoutOptions extends CommonOptions {
113
130
  };
114
131
  nodeSpacing?: ((node?: Node) => number) | number;
115
132
  }
116
- export interface RandomLayoutOptions extends CommonOptions {
133
+ export interface RandomLayoutOptions {
117
134
  center?: PointTuple;
118
135
  width?: number;
119
136
  height?: number;
120
137
  }
121
- export interface MDSLayoutOptions extends CommonOptions {
138
+ export interface MDSLayoutOptions {
122
139
  center?: PointTuple;
123
140
  linkDistance?: number;
124
141
  }
125
- export interface ConcentricLayoutOptions extends CommonOptions {
142
+ export interface ConcentricLayoutOptions {
126
143
  center?: PointTuple;
127
144
  preventOverlap?: boolean;
128
145
  nodeSize?: number | PointTuple;
@@ -136,7 +153,7 @@ export interface ConcentricLayoutOptions extends CommonOptions {
136
153
  height?: number;
137
154
  nodeSpacing?: number | number[] | ((node?: Node) => number);
138
155
  }
139
- export interface RadialLayoutOptions extends CommonOptions {
156
+ export interface RadialLayoutOptions {
140
157
  center?: PointTuple;
141
158
  width?: number;
142
159
  height?: number;
@@ -152,8 +169,9 @@ export interface RadialLayoutOptions extends CommonOptions {
152
169
  sortBy?: string;
153
170
  sortStrength?: number;
154
171
  }
155
- export interface DagreLayoutOptions extends CommonOptions {
156
- rankdir?: "TB" | "BT" | "LR" | "RL";
172
+ export type DagreRankdir = "TB" | "BT" | "LR" | "RL" | "tb" | "lr" | "rl" | "bt";
173
+ export interface DagreLayoutOptions {
174
+ rankdir?: DagreRankdir;
157
175
  align?: "UL" | "UR" | "DL" | "DR";
158
176
  begin?: PointTuple;
159
177
  nodeSize?: number | number[];
@@ -164,7 +182,7 @@ export interface DagreLayoutOptions extends CommonOptions {
164
182
  edgeLabelSpace?: boolean;
165
183
  nodeOrder?: string[];
166
184
  radial?: boolean;
167
- focusNode: string | Node | null;
185
+ focusNode?: string | Node | null;
168
186
  preset?: {
169
187
  nodes: OutNode[];
170
188
  edges: Edge[];
@@ -172,7 +190,7 @@ export interface DagreLayoutOptions extends CommonOptions {
172
190
  nodesepFunc?: (d?: Node) => number;
173
191
  ranksepFunc?: (d?: Node) => number;
174
192
  }
175
- export interface D3ForceLayoutOptions extends CommonOptions {
193
+ export interface D3ForceLayoutOptions {
176
194
  center?: PointTuple;
177
195
  linkDistance?: number | ((edge?: Edge) => number);
178
196
  edgeStrength?: number | ((edge?: Edge) => number);
@@ -207,7 +225,7 @@ export interface CentripetalOptions {
207
225
  centerStrength?: number;
208
226
  };
209
227
  }
210
- export interface ForceLayoutOptions extends CommonOptions {
228
+ export interface ForceLayoutOptions {
211
229
  center?: PointTuple;
212
230
  width?: number;
213
231
  height?: number;
@@ -242,7 +260,7 @@ export interface ForceLayoutOptions extends CommonOptions {
242
260
  iterations: number;
243
261
  }) => void;
244
262
  }
245
- export interface ForceAtlas2LayoutOptions extends CommonOptions {
263
+ export interface ForceAtlas2LayoutOptions {
246
264
  center?: PointTuple;
247
265
  width?: number;
248
266
  height?: number;
@@ -260,7 +278,7 @@ export interface ForceAtlas2LayoutOptions extends CommonOptions {
260
278
  nodeSize?: number | number[] | ((node?: Node) => number);
261
279
  onTick?: (data: LayoutMapping) => void;
262
280
  }
263
- export interface FruchtermanLayoutOptions extends CommonOptions {
281
+ export interface FruchtermanLayoutOptions {
264
282
  center?: PointTuple;
265
283
  maxIteration?: number;
266
284
  width?: number;
@@ -272,4 +290,3 @@ export interface FruchtermanLayoutOptions extends CommonOptions {
272
290
  nodeClusterBy?: string;
273
291
  onTick?: (data: LayoutMapping) => void;
274
292
  }
275
- export {};
@@ -4,7 +4,6 @@ import { PointTuple, Graph } from "../types";
4
4
  * @param graph original graph
5
5
  * @param assign whether assign result to original graph
6
6
  * @param center the layout center
7
- * @param onLayoutEnd callback for layout end
8
7
  * @returns
9
8
  */
10
9
  export declare const handleSingleNodeGraph: (graph: Graph, assign: boolean, center: PointTuple) => {
@@ -14,6 +13,17 @@ export declare const handleSingleNodeGraph: (graph: Graph, assign: boolean, cent
14
13
  y: number;
15
14
  size?: number | number[] | undefined;
16
15
  bboxSize?: number[] | undefined;
16
+ borderLeft?: import("@antv/graphlib").ID | import("@antv/graphlib").ID[] | undefined;
17
+ borderRight?: import("@antv/graphlib").ID | import("@antv/graphlib").ID[] | undefined;
18
+ height?: number | undefined;
19
+ width?: number | undefined;
20
+ e?: import("@antv/graphlib").Edge<import("../types").EdgeData> | undefined;
21
+ selfEdges?: import("@antv/graphlib").Edge<import("../types").EdgeData>[] | undefined;
22
+ rank?: number | undefined;
23
+ order?: number | undefined;
24
+ minRank?: number | undefined;
25
+ maxRank?: number | undefined;
26
+ layout?: boolean | undefined;
17
27
  };
18
28
  id: import("@antv/graphlib").ID;
19
29
  }[];
@@ -17,3 +17,10 @@ export declare function formatSizeFn<T extends Node>(defaultValue: number, value
17
17
  width: number;
18
18
  height: number;
19
19
  } | ((d?: T) => number) | undefined, resultIsNumber?: boolean): (d: T) => number | number[];
20
+ /**
21
+ * format the props nodeSize and nodeSpacing to a function
22
+ * @param nodeSize
23
+ * @param nodeSpacing
24
+ * @returns
25
+ */
26
+ export declare const formatNodeSize: (nodeSize: number | number[] | undefined, nodeSpacing: number | Function | undefined) => (nodeData: Node) => number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/layout",
3
- "version": "1.0.0-alpha.16",
3
+ "version": "1.0.0-alpha.18",
4
4
  "description": "graph layout algorithm",
5
5
  "main": "dist/index.min.js",
6
6
  "module": "esm/index.esm.js",