@flowgram.ai/free-auto-layout-plugin 0.1.0
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.
- package/dist/esm/index.js +2543 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/index.d.mts +243 -0
- package/dist/index.d.ts +243 -0
- package/dist/index.js +2568 -0
- package/dist/index.js.map +1 -0
- package/package.json +56 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { Graph } from '@dagrejs/graphlib';
|
|
2
|
+
export { Graph as DagreGraph } from '@dagrejs/graphlib';
|
|
3
|
+
import * as _flowgram_ai_core from '@flowgram.ai/core';
|
|
4
|
+
import { WorkflowNodeEntity, WorkflowLineEntity } from '@flowgram.ai/free-layout-core';
|
|
5
|
+
|
|
6
|
+
declare function layout(g: any, opts: any): void;
|
|
7
|
+
declare function buildLayoutGraph(inputGraph: any): Graph;
|
|
8
|
+
declare function updateInputGraph(inputGraph: any, layoutGraph: any): void;
|
|
9
|
+
declare function makeSpaceForEdgeLabels(g: any): void;
|
|
10
|
+
declare function removeSelfEdges(g: any): void;
|
|
11
|
+
declare function injectEdgeLabelProxies(g: any): void;
|
|
12
|
+
declare function assignRankMinMax(g: any): void;
|
|
13
|
+
declare function removeEdgeLabelProxies(g: any): void;
|
|
14
|
+
declare function insertSelfEdges(g: any): void;
|
|
15
|
+
declare function positionSelfEdges(g: any): void;
|
|
16
|
+
declare function removeBorderNodes(g: any): void;
|
|
17
|
+
declare function fixupEdgeLabelCoords(g: any): void;
|
|
18
|
+
declare function translateGraph(g: any): void;
|
|
19
|
+
declare function assignNodeIntersects(g: any): void;
|
|
20
|
+
declare function reversePointsForReversedEdges(g: any): void;
|
|
21
|
+
|
|
22
|
+
declare namespace acyclic {
|
|
23
|
+
export { run$2 as run };
|
|
24
|
+
export { undo$2 as undo };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
declare function run$2(g: any): void;
|
|
28
|
+
declare function undo$2(g: any): void;
|
|
29
|
+
|
|
30
|
+
declare namespace nestingGraph {
|
|
31
|
+
export { run$1 as run };
|
|
32
|
+
export { cleanup };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare function run$1(g: any): void;
|
|
36
|
+
declare function cleanup(g: any): void;
|
|
37
|
+
|
|
38
|
+
declare function rank(g: any): void;
|
|
39
|
+
|
|
40
|
+
declare namespace util {
|
|
41
|
+
export { addBorderNode };
|
|
42
|
+
export { addDummyNode };
|
|
43
|
+
export { applyWithChunking };
|
|
44
|
+
export { asNonCompoundGraph };
|
|
45
|
+
export { buildLayerMatrix };
|
|
46
|
+
export { intersectRect };
|
|
47
|
+
export { mapValues };
|
|
48
|
+
export { maxRank };
|
|
49
|
+
export { normalizeRanks };
|
|
50
|
+
export { notime };
|
|
51
|
+
export { partition };
|
|
52
|
+
export { pick };
|
|
53
|
+
export { predecessorWeights };
|
|
54
|
+
export { range };
|
|
55
|
+
export { removeEmptyRanks };
|
|
56
|
+
export { simplify };
|
|
57
|
+
export { successorWeights };
|
|
58
|
+
export { time };
|
|
59
|
+
export { uniqueId };
|
|
60
|
+
export { zipObject };
|
|
61
|
+
}
|
|
62
|
+
declare function addBorderNode(g: any, prefix: any, rank: any, order: any, ...args: any[]): string;
|
|
63
|
+
declare function addDummyNode(g: any, type: any, attrs: any, name: any): string;
|
|
64
|
+
declare function applyWithChunking(fn: any, argsArray: any): any;
|
|
65
|
+
declare function asNonCompoundGraph(g: any): Graph;
|
|
66
|
+
declare function buildLayerMatrix(g: any): never[][];
|
|
67
|
+
declare function intersectRect(rect: any, point: any): {
|
|
68
|
+
x: any;
|
|
69
|
+
y: any;
|
|
70
|
+
};
|
|
71
|
+
declare function mapValues(obj: any, funcOrProp: any): {};
|
|
72
|
+
declare function maxRank(g: any): any;
|
|
73
|
+
declare function normalizeRanks(g: any): void;
|
|
74
|
+
declare function notime(name: any, fn: any): any;
|
|
75
|
+
declare function partition(collection: any, fn: any): {
|
|
76
|
+
lhs: never[];
|
|
77
|
+
rhs: never[];
|
|
78
|
+
};
|
|
79
|
+
declare function pick(source: any, keys: any): {};
|
|
80
|
+
declare function predecessorWeights(g: any): any;
|
|
81
|
+
declare function range(start: any, limit: any, step?: number): any[];
|
|
82
|
+
declare function removeEmptyRanks(g: any): void;
|
|
83
|
+
declare function simplify(g: any): Graph;
|
|
84
|
+
declare function successorWeights(g: any): any;
|
|
85
|
+
declare function time(name: any, fn: any): any;
|
|
86
|
+
declare function uniqueId(prefix: any): string;
|
|
87
|
+
declare function zipObject(props: any, values: any): any;
|
|
88
|
+
|
|
89
|
+
declare namespace normalize {
|
|
90
|
+
export { run };
|
|
91
|
+
export { undo$1 as undo };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
declare function run(g: any): void;
|
|
95
|
+
declare function undo$1(g: any): void;
|
|
96
|
+
|
|
97
|
+
declare function parentDummyChains(g: any): void;
|
|
98
|
+
|
|
99
|
+
declare function addBorderSegments(g: any): void;
|
|
100
|
+
|
|
101
|
+
declare function order(g: any, opts: any): void;
|
|
102
|
+
|
|
103
|
+
declare namespace coordinateSystem {
|
|
104
|
+
export { adjust };
|
|
105
|
+
export { undo };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
declare function adjust(g: any): void;
|
|
109
|
+
declare function undo(g: any): void;
|
|
110
|
+
|
|
111
|
+
declare function position(g: any): void;
|
|
112
|
+
|
|
113
|
+
declare namespace dagreLib {
|
|
114
|
+
export { layout };
|
|
115
|
+
export { buildLayoutGraph };
|
|
116
|
+
export { updateInputGraph };
|
|
117
|
+
export { makeSpaceForEdgeLabels };
|
|
118
|
+
export { removeSelfEdges };
|
|
119
|
+
export { acyclic };
|
|
120
|
+
export { nestingGraph };
|
|
121
|
+
export { rank };
|
|
122
|
+
export { util };
|
|
123
|
+
export { injectEdgeLabelProxies };
|
|
124
|
+
export { removeEmptyRanks };
|
|
125
|
+
export { normalizeRanks };
|
|
126
|
+
export { assignRankMinMax };
|
|
127
|
+
export { removeEdgeLabelProxies };
|
|
128
|
+
export { normalize };
|
|
129
|
+
export { parentDummyChains };
|
|
130
|
+
export { addBorderSegments };
|
|
131
|
+
export { order };
|
|
132
|
+
export { insertSelfEdges };
|
|
133
|
+
export { coordinateSystem };
|
|
134
|
+
export { position };
|
|
135
|
+
export { positionSelfEdges };
|
|
136
|
+
export { removeBorderNodes };
|
|
137
|
+
export { fixupEdgeLabelCoords };
|
|
138
|
+
export { translateGraph };
|
|
139
|
+
export { assignNodeIntersects };
|
|
140
|
+
export { reversePointsForReversedEdges };
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
declare const createFreeAutoLayoutPlugin: _flowgram_ai_core.PluginCreator<unknown>;
|
|
144
|
+
|
|
145
|
+
declare class LayoutStore {
|
|
146
|
+
private indexMap;
|
|
147
|
+
private init;
|
|
148
|
+
private store;
|
|
149
|
+
get initialized(): boolean;
|
|
150
|
+
getNode(id: string): LayoutNode | undefined;
|
|
151
|
+
getNodeByIndex(index: string): LayoutNode | undefined;
|
|
152
|
+
getEdge(id: string): LayoutEdge | undefined;
|
|
153
|
+
get nodes(): LayoutNode[];
|
|
154
|
+
get edges(): LayoutEdge[];
|
|
155
|
+
create(params: LayoutParams): void;
|
|
156
|
+
/** 创建布局数据 */
|
|
157
|
+
private createStore;
|
|
158
|
+
/** 创建节点索引映射 */
|
|
159
|
+
private createIndexMap;
|
|
160
|
+
/** 节点排序 */
|
|
161
|
+
private sortNodes;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
interface LayoutNode {
|
|
165
|
+
id: string;
|
|
166
|
+
/** 节点索引 */
|
|
167
|
+
index: string;
|
|
168
|
+
/** 节点实体 */
|
|
169
|
+
entity: WorkflowNodeEntity;
|
|
170
|
+
/** 层级 */
|
|
171
|
+
rank: number;
|
|
172
|
+
/** 顺序 */
|
|
173
|
+
order: number;
|
|
174
|
+
/** 位置 */
|
|
175
|
+
position: {
|
|
176
|
+
x: number;
|
|
177
|
+
y: number;
|
|
178
|
+
};
|
|
179
|
+
/** 偏移量 */
|
|
180
|
+
offset: {
|
|
181
|
+
x: number;
|
|
182
|
+
y: number;
|
|
183
|
+
};
|
|
184
|
+
/** 宽高 */
|
|
185
|
+
size: {
|
|
186
|
+
width: number;
|
|
187
|
+
height: number;
|
|
188
|
+
};
|
|
189
|
+
/** 是否存在子节点 */
|
|
190
|
+
hasChildren: boolean;
|
|
191
|
+
/** 被跟随节点 */
|
|
192
|
+
followedBy?: string[];
|
|
193
|
+
/** 跟随节点 */
|
|
194
|
+
followTo?: string;
|
|
195
|
+
}
|
|
196
|
+
interface LayoutEdge {
|
|
197
|
+
id: string;
|
|
198
|
+
/** 线条实体 */
|
|
199
|
+
entity: WorkflowLineEntity;
|
|
200
|
+
/** 起点 */
|
|
201
|
+
from: string;
|
|
202
|
+
/** 终点 */
|
|
203
|
+
to: string;
|
|
204
|
+
/** 起点索引 */
|
|
205
|
+
fromIndex: string;
|
|
206
|
+
/** 终点索引 */
|
|
207
|
+
toIndex: string;
|
|
208
|
+
/** 线条名称 */
|
|
209
|
+
name: string;
|
|
210
|
+
}
|
|
211
|
+
interface LayoutParams {
|
|
212
|
+
nodes: WorkflowNodeEntity[];
|
|
213
|
+
edges: WorkflowLineEntity[];
|
|
214
|
+
}
|
|
215
|
+
interface LayoutOptions {
|
|
216
|
+
getFollowNode?: GetFollowNode;
|
|
217
|
+
}
|
|
218
|
+
type GetFollowNode = (node: LayoutNode, context: {
|
|
219
|
+
store: LayoutStore;
|
|
220
|
+
/** 业务自定义参数 */
|
|
221
|
+
[key: string]: any;
|
|
222
|
+
}) => {
|
|
223
|
+
followTo?: string;
|
|
224
|
+
} | undefined;
|
|
225
|
+
|
|
226
|
+
declare class Layout {
|
|
227
|
+
private readonly _store;
|
|
228
|
+
private readonly _layout;
|
|
229
|
+
private readonly _position;
|
|
230
|
+
constructor();
|
|
231
|
+
init(params: LayoutParams, options?: LayoutOptions): void;
|
|
232
|
+
layout(): void;
|
|
233
|
+
position(): Promise<void>;
|
|
234
|
+
setFollowNode(getFollowNode?: GetFollowNode): void;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
declare class AutoLayoutService {
|
|
238
|
+
private readonly document;
|
|
239
|
+
layout(options?: LayoutOptions): Promise<void>;
|
|
240
|
+
private layoutNode;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export { AutoLayoutService, type GetFollowNode, Layout, type LayoutEdge, type LayoutNode, type LayoutOptions, LayoutStore, createFreeAutoLayoutPlugin, dagreLib };
|