@eclipse-glsp/layout-elk 0.9.0-next.66aad6e.3 → 0.9.0-next.95961ba.7

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 (47) hide show
  1. package/lib/di.config.d.ts +7 -13
  2. package/lib/di.config.d.ts.map +1 -1
  3. package/lib/di.config.js +20 -32
  4. package/lib/di.config.js.map +1 -1
  5. package/lib/di.config.spec.js +13 -16
  6. package/lib/di.config.spec.js.map +1 -1
  7. package/lib/element-filter.d.ts +45 -0
  8. package/lib/element-filter.d.ts.map +1 -0
  9. package/lib/element-filter.js +84 -0
  10. package/lib/element-filter.js.map +1 -0
  11. package/lib/glsp-elk-layout-engine.d.ts +34 -20
  12. package/lib/glsp-elk-layout-engine.d.ts.map +1 -1
  13. package/lib/glsp-elk-layout-engine.js +265 -42
  14. package/lib/glsp-elk-layout-engine.js.map +1 -1
  15. package/lib/index.d.ts +4 -6
  16. package/lib/index.d.ts.map +1 -1
  17. package/lib/index.js +4 -7
  18. package/lib/index.js.map +1 -1
  19. package/lib/{glsp-layout-configurator.d.ts → layout-configurator.d.ts} +29 -15
  20. package/lib/layout-configurator.d.ts.map +1 -0
  21. package/lib/layout-configurator.js +99 -0
  22. package/lib/layout-configurator.js.map +1 -0
  23. package/lib/{basic-type-mapper.d.ts → sprotty-elk.d.ts} +3 -11
  24. package/lib/sprotty-elk.d.ts.map +1 -0
  25. package/lib/sprotty-elk.js +5 -0
  26. package/lib/sprotty-elk.js.map +1 -0
  27. package/package.json +3 -3
  28. package/src/di.config.spec.ts +15 -18
  29. package/src/di.config.ts +29 -42
  30. package/src/element-filter.ts +84 -0
  31. package/src/glsp-elk-layout-engine.ts +305 -30
  32. package/src/index.ts +4 -6
  33. package/src/layout-configurator.ts +101 -0
  34. package/src/sprotty-elk.ts +18 -0
  35. package/lib/basic-type-mapper.d.ts.map +0 -1
  36. package/lib/basic-type-mapper.js +0 -97
  37. package/lib/basic-type-mapper.js.map +0 -1
  38. package/lib/glsp-element-filter.d.ts +0 -17
  39. package/lib/glsp-element-filter.d.ts.map +0 -1
  40. package/lib/glsp-element-filter.js +0 -53
  41. package/lib/glsp-element-filter.js.map +0 -1
  42. package/lib/glsp-layout-configurator.d.ts.map +0 -1
  43. package/lib/glsp-layout-configurator.js +0 -57
  44. package/lib/glsp-layout-configurator.js.map +0 -1
  45. package/src/basic-type-mapper.ts +0 -73
  46. package/src/glsp-element-filter.ts +0 -38
  47. package/src/glsp-layout-configurator.ts +0 -59
@@ -8,14 +8,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.GlspElkLayoutEngine = exports.BaseElkLayoutEngine = void 0;
12
+ exports.GlspElkLayoutEngine = void 0;
16
13
  /********************************************************************************
17
- * Copyright (c) 2022 STMicroelectronics and others.
18
- *
14
+ * Copyright (c) 2018-2022 TypeFox and others.
19
15
  * This program and the accompanying materials are made available under the
20
16
  * terms of the Eclipse Public License v. 2.0 which is available at
21
17
  * http://www.eclipse.org/legal/epl-2.0.
@@ -30,51 +26,278 @@ exports.GlspElkLayoutEngine = exports.BaseElkLayoutEngine = void 0;
30
26
  ********************************************************************************/
31
27
  const server_node_1 = require("@eclipse-glsp/server-node");
32
28
  const inversify_1 = require("inversify");
33
- const inversify_2 = require("sprotty-elk/lib/inversify");
34
- const basic_type_mapper_1 = require("./basic-type-mapper");
29
+ const sprotty_elk_1 = require("sprotty-elk");
30
+ const element_filter_1 = require("./element-filter");
31
+ const layout_configurator_1 = require("./layout-configurator");
35
32
  /**
36
- * Layout engine that delegates to ELK by transforming the graphical model into an ELK graph.
33
+ * An implementation of GLSP's {@link LayoutEngine} interface that retrieves the graphical model from the {@link ModelState},
34
+ * transforms this model into an ELK graph and then invokes the underlying ELK instance for layout computation.
37
35
  */
38
- let BaseElkLayoutEngine = class BaseElkLayoutEngine extends inversify_2.ElkLayoutEngine {
39
- constructor(elkFactory, filter, configurator, typeMapper) {
40
- super(elkFactory, filter, configurator);
36
+ let GlspElkLayoutEngine = class GlspElkLayoutEngine {
37
+ constructor(elkFactory, filter, configurator, modelState) {
41
38
  this.filter = filter;
42
39
  this.configurator = configurator;
43
- this.typeMapper = typeMapper;
40
+ this.modelState = modelState;
41
+ this.elk = elkFactory();
44
42
  }
45
- getBasicType(smodel) {
46
- return this.typeMapper.getBasicType(smodel);
43
+ layout() {
44
+ const root = this.modelState.root;
45
+ if (!(root instanceof server_node_1.GGraph)) {
46
+ return root;
47
+ }
48
+ this.elkEdges = [];
49
+ this.idToElkElement = new Map();
50
+ const elkGraph = this.transformToElk(root);
51
+ return this.elk.layout(elkGraph).then(result => {
52
+ this.applyLayout(result);
53
+ return root;
54
+ });
47
55
  }
48
- };
49
- BaseElkLayoutEngine = __decorate([
50
- inversify_1.injectable(),
51
- __param(0, inversify_1.inject(inversify_2.ElkFactory)),
52
- __param(1, inversify_1.inject(inversify_2.IElementFilter)),
53
- __param(2, inversify_1.inject(inversify_2.ILayoutConfigurator)),
54
- __param(3, inversify_1.inject(basic_type_mapper_1.BasicTypeMapper)),
55
- __metadata("design:paramtypes", [Function, Object, Object, basic_type_mapper_1.BasicTypeMapper])
56
- ], BaseElkLayoutEngine);
57
- exports.BaseElkLayoutEngine = BaseElkLayoutEngine;
58
- /**
59
- * A implement of GLSP's {@link LayoutEngine} interface that retrieves the graphical model from the {@link ModelState}
60
- * and delegates the to an underlying {@link BaseElkLayoutEngine} instance for computing the layout.
61
- */
62
- let GlspElkLayoutEngine = class GlspElkLayoutEngine {
63
- async layout() {
64
- const graph = this.modelState.root;
65
- await this.elkLayoutEngine.layout(graph);
56
+ transformToElk(model) {
57
+ if (model instanceof server_node_1.GGraph) {
58
+ const graph = this.transformGraph(model);
59
+ this.elkEdges.forEach(elkEdge => {
60
+ const parent = this.findCommonAncestor(elkEdge);
61
+ if (parent) {
62
+ parent.edges.push(elkEdge);
63
+ }
64
+ });
65
+ return graph;
66
+ }
67
+ else if (model instanceof server_node_1.GNode) {
68
+ return this.transformNode(model);
69
+ }
70
+ else if (model instanceof server_node_1.GEdge) {
71
+ return this.transformEdge(model);
72
+ }
73
+ else if (model instanceof server_node_1.GLabel) {
74
+ return this.transformPort(model);
75
+ }
76
+ else if (model instanceof server_node_1.GPort) {
77
+ return this.transformPort(model);
78
+ }
79
+ throw new Error('Type not supported: ' + model.type);
80
+ }
81
+ /**
82
+ * Searches for all children of the given element that are an instance of the given {@link GModelElementConstructor}
83
+ * and are included by the {@link ElementFilter}. Also considers children that are nested inside of {@link GCompartment}s.
84
+ * @param element The element whose children should be queried.
85
+ * @param constructor The class instance that should be matched
86
+ * @returns A list of all matching children.
87
+ */
88
+ findChildren(element, constructor) {
89
+ const result = [];
90
+ element.children.forEach(child => {
91
+ if (child instanceof constructor && this.filter.apply(element)) {
92
+ result.push(child);
93
+ }
94
+ else if (child instanceof server_node_1.GCompartment) {
95
+ result.push(...this.findChildren(child, constructor));
96
+ }
97
+ });
98
+ return result;
99
+ }
100
+ findCommonAncestor(elkEdge) {
101
+ const source = this.modelState.index.get(elkEdge.source);
102
+ const target = this.modelState.index.get(elkEdge.target);
103
+ if (!source || !target) {
104
+ return undefined;
105
+ }
106
+ const sourceParent = server_node_1.findParent(source.parent, parent => parent instanceof server_node_1.GNode || parent instanceof server_node_1.GGraph);
107
+ const targetParent = server_node_1.findParent(target.parent, parent => parent instanceof server_node_1.GNode || parent instanceof server_node_1.GGraph);
108
+ if (!sourceParent || !targetParent) {
109
+ return undefined;
110
+ }
111
+ if (sourceParent === targetParent) {
112
+ return this.idToElkElement.get(sourceParent.id);
113
+ }
114
+ else if (source === targetParent) {
115
+ return this.idToElkElement.get(source.id);
116
+ }
117
+ else if (target === sourceParent) {
118
+ return this.idToElkElement.get(target.id);
119
+ }
120
+ return undefined;
121
+ }
122
+ transformGraph(graph) {
123
+ const elkGraph = {
124
+ id: graph.id,
125
+ layoutOptions: this.configurator.apply(graph)
126
+ };
127
+ if (graph.children) {
128
+ elkGraph.children = this.findChildren(graph, server_node_1.GNode).map(child => this.transformToElk(child));
129
+ elkGraph.edges = [];
130
+ this.elkEdges.push(...this.findChildren(graph, server_node_1.GEdge).map(child => this.transformToElk(child)));
131
+ }
132
+ this.idToElkElement.set(graph.id, elkGraph);
133
+ return elkGraph;
134
+ }
135
+ transformNode(node) {
136
+ const elkNode = {
137
+ id: node.id,
138
+ layoutOptions: this.configurator.apply(node)
139
+ };
140
+ if (node.children) {
141
+ elkNode.children = this.findChildren(node, server_node_1.GNode).map(child => this.transformToElk(child));
142
+ elkNode.edges = [];
143
+ this.elkEdges.push(...this.findChildren(node, server_node_1.GEdge).map(child => this.transformToElk(child)));
144
+ elkNode.labels = this.findChildren(node, server_node_1.GLabel).map(child => this.transformToElk(child));
145
+ elkNode.ports = this.findChildren(node, server_node_1.GPort).map(child => this.transformToElk(child));
146
+ }
147
+ this.transformShape(elkNode, node);
148
+ this.idToElkElement.set(node.id, elkNode);
149
+ return elkNode;
150
+ }
151
+ transformShape(elkShape, shape) {
152
+ if (shape.position) {
153
+ elkShape.x = shape.position.x;
154
+ elkShape.y = shape.position.y;
155
+ }
156
+ if (shape.size) {
157
+ elkShape.width = shape.size.width;
158
+ elkShape.height = shape.size.height;
159
+ }
160
+ }
161
+ transformEdge(edge) {
162
+ const elkEdge = {
163
+ id: edge.id,
164
+ source: edge.sourceId,
165
+ target: edge.targetId,
166
+ layoutOptions: this.configurator.apply(edge)
167
+ };
168
+ const sourceElement = this.modelState.index.get(edge.sourceId);
169
+ if (sourceElement instanceof server_node_1.GPort) {
170
+ const parentNode = server_node_1.findParentByClass(sourceElement, server_node_1.GNode);
171
+ if (parentNode) {
172
+ elkEdge.source = parentNode.id;
173
+ elkEdge.sourcePort = sourceElement.id;
174
+ }
175
+ }
176
+ const targetElement = this.modelState.index.get(edge.targetId);
177
+ if (sourceElement instanceof server_node_1.GPort) {
178
+ const parentNode = server_node_1.findParentByClass(targetElement, server_node_1.GNode);
179
+ if (parentNode) {
180
+ elkEdge.target = parentNode.id;
181
+ elkEdge.targetPort = targetElement.id;
182
+ }
183
+ }
184
+ if (edge.children) {
185
+ elkEdge.labels = this.findChildren(edge, server_node_1.GLabel).map(child => this.transformToElk(child));
186
+ }
187
+ const points = edge.routingPoints;
188
+ if (points && points.length >= 2) {
189
+ elkEdge.sourcePoint = points[0];
190
+ elkEdge.bendPoints = points.slice(1, points.length - 1);
191
+ elkEdge.targetPoint = points[points.length - 1];
192
+ }
193
+ this.idToElkElement.set(edge.id, elkEdge);
194
+ return elkEdge;
195
+ }
196
+ transformLabel(label) {
197
+ const elkLabel = {
198
+ id: label.id,
199
+ text: label.text,
200
+ layoutOptions: this.configurator.apply(label)
201
+ };
202
+ this.transformShape(elkLabel, label);
203
+ this.idToElkElement.set(label.id, elkLabel);
204
+ return elkLabel;
205
+ }
206
+ transformPort(port) {
207
+ const elkPort = {
208
+ id: port.id,
209
+ layoutOptions: this.configurator.apply(port)
210
+ };
211
+ if (port.children) {
212
+ elkPort.labels = this.findChildren(port, server_node_1.GLabel).map(child => this.transformToElk(child));
213
+ }
214
+ this.transformShape(elkPort, port);
215
+ this.idToElkElement.set(port.id, elkPort);
216
+ return elkPort;
217
+ }
218
+ applyLayout(elkNode) {
219
+ const element = this.modelState.index.get(elkNode.id);
220
+ if (element instanceof server_node_1.GNode) {
221
+ this.applyShape(element, elkNode);
222
+ }
223
+ if (elkNode.children) {
224
+ for (const child of elkNode.children) {
225
+ this.applyLayout(child);
226
+ }
227
+ }
228
+ if (elkNode.edges) {
229
+ for (const elkEdge of elkNode.edges) {
230
+ const edge = this.modelState.index.get(elkEdge.id);
231
+ if (edge instanceof server_node_1.GEdge) {
232
+ this.applyEdge(edge, elkEdge);
233
+ }
234
+ }
235
+ }
236
+ if (elkNode.ports) {
237
+ for (const elkPort of elkNode.ports) {
238
+ const port = this.modelState.index.findByClass(elkPort.id, server_node_1.GPort);
239
+ if (port) {
240
+ this.applyShape(port, elkPort);
241
+ }
242
+ }
243
+ }
244
+ }
245
+ applyShape(shape, elkShape) {
246
+ if (elkShape.x !== undefined && elkShape.y !== undefined) {
247
+ shape.position = { x: elkShape.x, y: elkShape.y };
248
+ }
249
+ if (elkShape.width !== undefined && elkShape.height !== undefined) {
250
+ shape.size = { width: elkShape.width, height: elkShape.height };
251
+ }
252
+ if (elkShape.labels) {
253
+ for (const elkLabel of elkShape.labels) {
254
+ const label = this.modelState.index.findByClass(elkLabel.id, server_node_1.GLabel);
255
+ if (label) {
256
+ this.applyShape(label, elkLabel);
257
+ }
258
+ }
259
+ }
260
+ }
261
+ applyEdge(edge, elkEdge) {
262
+ const points = [];
263
+ if (elkEdge.sections && elkEdge.sections.length > 0) {
264
+ const section = elkEdge.sections[0];
265
+ if (section.startPoint) {
266
+ points.push(section.startPoint);
267
+ }
268
+ if (section.bendPoints) {
269
+ points.push(...section.bendPoints);
270
+ }
271
+ if (section.endPoint) {
272
+ points.push(section.endPoint);
273
+ }
274
+ }
275
+ else {
276
+ const section = elkEdge;
277
+ if (section.sourcePoint) {
278
+ points.push(section.sourcePoint);
279
+ }
280
+ if (section.bendPoints) {
281
+ points.push(...section.bendPoints);
282
+ }
283
+ if (section.targetPoint) {
284
+ points.push(section.targetPoint);
285
+ }
286
+ }
287
+ edge.routingPoints = points;
288
+ if (elkEdge.labels) {
289
+ elkEdge.labels.forEach(elkLabel => {
290
+ const label = this.modelState.index.findByClass(elkLabel.id, server_node_1.GLabel);
291
+ if (label) {
292
+ this.applyShape(label, elkLabel);
293
+ }
294
+ });
295
+ }
66
296
  }
67
297
  };
68
- __decorate([
69
- inversify_1.inject(server_node_1.ModelState),
70
- __metadata("design:type", Object)
71
- ], GlspElkLayoutEngine.prototype, "modelState", void 0);
72
- __decorate([
73
- inversify_1.inject(BaseElkLayoutEngine),
74
- __metadata("design:type", BaseElkLayoutEngine)
75
- ], GlspElkLayoutEngine.prototype, "elkLayoutEngine", void 0);
76
298
  GlspElkLayoutEngine = __decorate([
77
- inversify_1.injectable()
299
+ inversify_1.injectable(),
300
+ __metadata("design:paramtypes", [Function, Object, Object, Object])
78
301
  ], GlspElkLayoutEngine);
79
302
  exports.GlspElkLayoutEngine = GlspElkLayoutEngine;
80
303
  //# sourceMappingURL=glsp-elk-layout-engine.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"glsp-elk-layout-engine.js","sourceRoot":"","sources":["../src/glsp-elk-layout-engine.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,2DAAqE;AACrE,yCAA+C;AAC/C,yDAA6G;AAE7G,2DAAsD;AAEtD;;GAEG;AAEH,IAAa,mBAAmB,GAAhC,MAAa,mBAAoB,SAAQ,2BAAe;IACpD,YACwB,UAAsB,EACC,MAAsB,EACjB,YAAiC,EAC9C,UAA2B;QAE9D,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;QAJG,WAAM,GAAN,MAAM,CAAgB;QACjB,iBAAY,GAAZ,YAAY,CAAqB;QAC9C,eAAU,GAAV,UAAU,CAAiB;IAGlE,CAAC;IAES,YAAY,CAAC,MAAqB;QACxC,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;CACJ,CAAA;AAbY,mBAAmB;IAD/B,sBAAU,EAAE;IAGJ,WAAA,kBAAM,CAAC,sBAAU,CAAC,CAAA;IAClB,WAAA,kBAAM,CAAC,0BAAc,CAAC,CAAA;IACtB,WAAA,kBAAM,CAAC,+BAAmB,CAAC,CAAA;IAC3B,WAAA,kBAAM,CAAC,mCAAe,CAAC,CAAA;+DAAuB,mCAAe;GALzD,mBAAmB,CAa/B;AAbY,kDAAmB;AAehC;;;GA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M;YACH,MAAM,OAAO,GAAG,OAA2B,CAAC;YAC5C,IAAI,OAAO,CAAC,WAAW,EAAE;gBACrB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;aACpC;YACD,IAAI,OAAO,CAAC,UAAU,EAAE;gBACpB,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;aACtC;YACD,IAAI,OAAO,CAAC,WAAW,EAAE;gBACrB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;aACpC;SACJ;QACD,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC;QAE5B,IAAI,OAAO,CAAC,MAAM,EAAE;YAChB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,EAAE,oBAAM,CAAC,CAAC;gBACrE,IAAI,KAAK,EAAE;oBACP,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;iBACpC;YACL,CAAC,CAAC,CAAC;SACN;IACL,CAAC;CACJ,CAAA;AAhSY,mBAAmB;IAD/B,sBAAU,EAAE;;GACA,mBAAmB,CAgS/B;AAhSY,kDAAmB"}
package/lib/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2022 EclipseSource and others.
2
+ * Copyright (c) 2022 STMicroelectronics and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -13,11 +13,9 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- export * from 'sprotty-elk';
17
- export { SModelIndex } from 'sprotty-protocol/lib/utils/model-utils';
18
- export * from './basic-type-mapper';
19
16
  export * from './di.config';
20
- export * from './glsp-element-filter';
17
+ export * from './element-filter';
21
18
  export * from './glsp-elk-layout-engine';
22
- export * from './glsp-layout-configurator';
19
+ export * from './layout-configurator';
20
+ export * from './sprotty-elk';
23
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC"}
package/lib/index.js CHANGED
@@ -11,7 +11,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  /********************************************************************************
14
- * Copyright (c) 2022 EclipseSource and others.
14
+ * Copyright (c) 2022 STMicroelectronics and others.
15
15
  *
16
16
  * This program and the accompanying materials are made available under the
17
17
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -25,12 +25,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
25
25
  *
26
26
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
27
27
  ********************************************************************************/
28
- __exportStar(require("sprotty-elk"), exports);
29
- var model_utils_1 = require("sprotty-protocol/lib/utils/model-utils");
30
- Object.defineProperty(exports, "SModelIndex", { enumerable: true, get: function () { return model_utils_1.SModelIndex; } });
31
- __exportStar(require("./basic-type-mapper"), exports);
32
28
  __exportStar(require("./di.config"), exports);
33
- __exportStar(require("./glsp-element-filter"), exports);
29
+ __exportStar(require("./element-filter"), exports);
34
30
  __exportStar(require("./glsp-elk-layout-engine"), exports);
35
- __exportStar(require("./glsp-layout-configurator"), exports);
31
+ __exportStar(require("./layout-configurator"), exports);
32
+ __exportStar(require("./sprotty-elk"), exports);
36
33
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,8CAA4B;AAC5B,sEAAqE;AAA5D,0GAAA,WAAW,OAAA;AACpB,sDAAoC;AACpC,8CAA4B;AAC5B,wDAAsC;AACtC,2DAAyC;AACzC,6DAA2C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,8CAA4B;AAC5B,mDAAiC;AACjC,2DAAyC;AACzC,wDAAsC;AACtC,gDAA8B"}
@@ -13,20 +13,35 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { LayoutOptions } from 'elkjs';
17
- import { DefaultLayoutConfigurator } from 'sprotty-elk';
18
- import { SGraph, SModelElement, SModelIndex } from 'sprotty-protocol';
19
- import { BasicTypeMapper } from './basic-type-mapper';
16
+ import { GEdge, GGraph, GLabel, GModelElement, GNode, GPort, ModelState } from '@eclipse-glsp/server-node';
17
+ import { LayoutOptions } from './sprotty-elk';
18
+ export declare const LayoutConfigurator: unique symbol;
20
19
  /**
21
20
  * Configurator for ELK layout algorithms; provides mappings of layout options for each model element.
22
- * For a list of all available layout options checkout the official ELK documentation.
23
- * A minimal configuration should at least specify the `elk.algorithm` option as
24
- * return value of {@link GlspLayoutConfigurator.graphOptions}.
21
+ * For a list of all available layout options checkout the official ELK documentation:
25
22
  * {@link https://www.eclipse.org/elk/reference/options.html}
26
23
  */
27
- export declare class GlspLayoutConfigurator extends DefaultLayoutConfigurator {
28
- protected typeMapper: BasicTypeMapper;
29
- protected getBasicType(smodel: SModelElement): string;
24
+ export interface LayoutConfigurator {
25
+ /**
26
+ * Computes the {@link LayoutOptions} for the given {@link GModelElement}.
27
+ * @param element The element for which the layout options should be computed.
28
+ * @returns The set of layout options for the given element or `undefined`.
29
+ */
30
+ apply(element: GModelElement): LayoutOptions | undefined;
31
+ }
32
+ /**
33
+ * Abstract default implementation of {@link LayoutConfigurator}.
34
+ * A minimal configuration should at least specify the `elk.algorithm` option as
35
+ * return value of {@link DefaultLayoutConfigurator.graphOptions}.
36
+ */
37
+ export declare abstract class AbstractLayoutConfigurator implements LayoutConfigurator {
38
+ protected modelState: ModelState;
39
+ apply(element: GModelElement): LayoutOptions | undefined;
40
+ protected graphOptions(graph: GGraph): LayoutOptions | undefined;
41
+ protected nodeOptions(node: GNode): LayoutOptions | undefined;
42
+ protected edgeOptions(edge: GEdge): LayoutOptions | undefined;
43
+ protected labelOptions(label: GLabel): LayoutOptions | undefined;
44
+ protected portOptions(sport: GPort): LayoutOptions | undefined;
30
45
  }
31
46
  /**
32
47
  * A fallback configurator that is used in the `configureELKLayoutModule` utility method.
@@ -34,10 +49,9 @@ export declare class GlspLayoutConfigurator extends DefaultLayoutConfigurator {
34
49
  * bound as replacement. Basic layout options for the root graph element are derived from the
35
50
  * configuration parameters that haven been passed to the `configureELKLayoutModule` function.
36
51
  */
37
- export declare class FallbackGlspLayoutConfigurator extends GlspLayoutConfigurator {
38
- protected typeMapper: BasicTypeMapper;
52
+ export declare class FallbackLayoutConfigurator extends AbstractLayoutConfigurator {
39
53
  protected fallbackGraphOptions: LayoutOptions;
40
- constructor(typeMapper: BasicTypeMapper, algorithms: string[], defaultLayoutOptions?: LayoutOptions);
41
- protected graphOptions(sgraph: SGraph, index: SModelIndex): LayoutOptions | undefined;
54
+ constructor(algorithms: string[], defaultLayoutOptions?: LayoutOptions);
55
+ protected graphOptions(sgraph: GGraph): LayoutOptions | undefined;
42
56
  }
43
- //# sourceMappingURL=glsp-layout-configurator.d.ts.map
57
+ //# sourceMappingURL=layout-configurator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout-configurator.d.ts","sourceRoot":"","sources":["../src/layout-configurator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE3G,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,eAAO,MAAM,kBAAkB,eAA+B,CAAC;AAC/D;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,GAAG,SAAS,CAAC;CAC5D;AAED;;;;GAIG;AACH,8BACsB,0BAA2B,YAAW,kBAAkB;IAE1E,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;IAEjC,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,GAAG,SAAS;IAexD,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAIhE,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,GAAG,aAAa,GAAG,SAAS;IAI7D,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,GAAG,aAAa,GAAG,SAAS;IAI7D,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAIhE,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,aAAa,GAAG,SAAS;CAGjE;AAED;;;;;GAKG;AACH,qBACa,0BAA2B,SAAQ,0BAA0B;IACtE,SAAS,CAAC,oBAAoB,EAAE,aAAa,CAAC;gBAClC,UAAU,EAAE,MAAM,EAAE,EAAE,oBAAoB,GAAE,aAAkB;IAQ1E,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;CAGpE"}
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.FallbackLayoutConfigurator = exports.AbstractLayoutConfigurator = exports.LayoutConfigurator = void 0;
13
+ /********************************************************************************
14
+ * Copyright (c) 2022 STMicroelectronics and others.
15
+ *
16
+ * This program and the accompanying materials are made available under the
17
+ * terms of the Eclipse Public License v. 2.0 which is available at
18
+ * http://www.eclipse.org/legal/epl-2.0.
19
+ *
20
+ * This Source Code may also be made available under the following Secondary
21
+ * Licenses when the conditions for such availability set forth in the Eclipse
22
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
23
+ * with the GNU Classpath Exception which is available at
24
+ * https://www.gnu.org/software/classpath/license.html.
25
+ *
26
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
27
+ ********************************************************************************/
28
+ const server_node_1 = require("@eclipse-glsp/server-node");
29
+ const inversify_1 = require("inversify");
30
+ exports.LayoutConfigurator = Symbol('LayoutConfigurator');
31
+ /**
32
+ * Abstract default implementation of {@link LayoutConfigurator}.
33
+ * A minimal configuration should at least specify the `elk.algorithm` option as
34
+ * return value of {@link DefaultLayoutConfigurator.graphOptions}.
35
+ */
36
+ let AbstractLayoutConfigurator = class AbstractLayoutConfigurator {
37
+ apply(element) {
38
+ if (element instanceof server_node_1.GGraph) {
39
+ return this.graphOptions(element);
40
+ }
41
+ else if (element instanceof server_node_1.GNode) {
42
+ return this.nodeOptions(element);
43
+ }
44
+ else if (element instanceof server_node_1.GEdge) {
45
+ return this.edgeOptions(element);
46
+ }
47
+ else if (element instanceof server_node_1.GLabel) {
48
+ this.labelOptions(element);
49
+ }
50
+ else if (element instanceof server_node_1.GPort) {
51
+ this.portOptions(element);
52
+ }
53
+ return undefined;
54
+ }
55
+ graphOptions(graph) {
56
+ return undefined;
57
+ }
58
+ nodeOptions(node) {
59
+ return undefined;
60
+ }
61
+ edgeOptions(edge) {
62
+ return undefined;
63
+ }
64
+ labelOptions(label) {
65
+ return undefined;
66
+ }
67
+ portOptions(sport) {
68
+ return undefined;
69
+ }
70
+ };
71
+ __decorate([
72
+ inversify_1.inject(server_node_1.ModelState),
73
+ __metadata("design:type", Object)
74
+ ], AbstractLayoutConfigurator.prototype, "modelState", void 0);
75
+ AbstractLayoutConfigurator = __decorate([
76
+ inversify_1.injectable()
77
+ ], AbstractLayoutConfigurator);
78
+ exports.AbstractLayoutConfigurator = AbstractLayoutConfigurator;
79
+ /**
80
+ * A fallback configurator that is used in the `configureELKLayoutModule` utility method.
81
+ * If no explicit layout configurator binding is provided a new instance of the fallback configurator is
82
+ * bound as replacement. Basic layout options for the root graph element are derived from the
83
+ * configuration parameters that haven been passed to the `configureELKLayoutModule` function.
84
+ */
85
+ let FallbackLayoutConfigurator = class FallbackLayoutConfigurator extends AbstractLayoutConfigurator {
86
+ constructor(algorithms, defaultLayoutOptions = {}) {
87
+ super();
88
+ this.fallbackGraphOptions = Object.assign({ 'elk.algorithm': algorithms[0] }, defaultLayoutOptions);
89
+ }
90
+ graphOptions(sgraph) {
91
+ return this.fallbackGraphOptions;
92
+ }
93
+ };
94
+ FallbackLayoutConfigurator = __decorate([
95
+ inversify_1.injectable(),
96
+ __metadata("design:paramtypes", [Array, Object])
97
+ ], FallbackLayoutConfigurator);
98
+ exports.FallbackLayoutConfigurator = FallbackLayoutConfigurator;
99
+ //# sourceMappingURL=layout-configurator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout-configurator.js","sourceRoot":"","sources":["../src/layout-configurator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,2DAA2G;AAC3G,yCAA+C;AAGlC,QAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAe/D;;;;GAIG;AAEH,IAAsB,0BAA0B,GAAhD,MAAsB,0BAA0B;IAI5C,KAAK,CAAC,OAAsB;QACxB,IAAI,OAAO,YAAY,oBAAM,EAAE;YAC3B,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;SACrC;aAAM,IAAI,OAAO,YAAY,mBAAK,EAAE;YACjC,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;SACpC;aAAM,IAAI,OAAO,YAAY,mBAAK,EAAE;YACjC,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;SACpC;aAAM,IAAI,OAAO,YAAY,oBAAM,EAAE;YAClC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;SAC9B;aAAM,IAAI,OAAO,YAAY,mBAAK,EAAE;YACjC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;SAC7B;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAES,YAAY,CAAC,KAAa;QAChC,OAAO,SAAS,CAAC;IACrB,CAAC;IAES,WAAW,CAAC,IAAW;QAC7B,OAAO,SAAS,CAAC;IACrB,CAAC;IAES,WAAW,CAAC,IAAW;QAC7B,OAAO,SAAS,CAAC;IACrB,CAAC;IAES,YAAY,CAAC,KAAa;QAChC,OAAO,SAAS,CAAC;IACrB,CAAC;IAES,WAAW,CAAC,KAAY;QAC9B,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ,CAAA;AApCG;IADC,kBAAM,CAAC,wBAAU,CAAC;;8DACc;AAFf,0BAA0B;IAD/C,sBAAU,EAAE;GACS,0BAA0B,CAsC/C;AAtCqB,gEAA0B;AAwChD;;;;;GAKG;AAEH,IAAa,0BAA0B,GAAvC,MAAa,0BAA2B,SAAQ,0BAA0B;IAEtE,YAAY,UAAoB,EAAE,uBAAsC,EAAE;QACtE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,oBAAoB,mBACrB,eAAe,EAAE,UAAU,CAAC,CAAC,CAAC,IAC3B,oBAAoB,CAC1B,CAAC;IACN,CAAC;IAES,YAAY,CAAC,MAAc;QACjC,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACrC,CAAC;CACJ,CAAA;AAbY,0BAA0B;IADtC,sBAAU,EAAE;;GACA,0BAA0B,CAatC;AAbY,gEAA0B"}
@@ -13,14 +13,6 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { DiagramConfiguration, GModelElementConstructor } from '@eclipse-glsp/server-node';
17
- import { SModelElement } from 'sprotty-protocol';
18
- export declare type BasicGModelType = 'graph' | 'node' | 'edge' | 'label' | 'port' | 'unknown';
19
- export declare class BasicTypeMapper {
20
- protected diagramConfiguration: DiagramConfiguration;
21
- protected basicTypeMap: Map<string, BasicGModelType>;
22
- protected postConstruct(): void;
23
- protected toBasicType(constructor: GModelElementConstructor): BasicGModelType;
24
- getBasicType(input: SModelElement | string): BasicGModelType;
25
- }
26
- //# sourceMappingURL=basic-type-mapper.d.ts.map
16
+ export { LayoutOptions } from 'elkjs';
17
+ export { ElkFactory } from 'sprotty-elk/lib/inversify';
18
+ //# sourceMappingURL=sprotty-elk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sprotty-elk.d.ts","sourceRoot":"","sources":["../src/sprotty-elk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var inversify_1 = require("sprotty-elk/lib/inversify");
4
+ Object.defineProperty(exports, "ElkFactory", { enumerable: true, get: function () { return inversify_1.ElkFactory; } });
5
+ //# sourceMappingURL=sprotty-elk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sprotty-elk.js","sourceRoot":"","sources":["../src/sprotty-elk.ts"],"names":[],"mappings":";;AAiBA,uDAAuD;AAA9C,uGAAA,UAAU,OAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-glsp/layout-elk",
3
- "version": "0.9.0-next.66aad6e.3+66aad6e",
3
+ "version": "0.9.0-next.95961ba.7+95961ba",
4
4
  "description": "Integration of ELK graph layout algorithms in GLSP Node Server",
5
5
  "license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
6
6
  "keywords": [
@@ -38,7 +38,7 @@
38
38
  "css"
39
39
  ],
40
40
  "dependencies": {
41
- "@eclipse-glsp/server-node": "0.9.0-next.66aad6e.3+66aad6e",
41
+ "@eclipse-glsp/server-node": "0.9.0-next.95961ba.7+95961ba",
42
42
  "elkjs": "^0.7.1",
43
43
  "inversify": "^5.0.1",
44
44
  "sprotty-elk": "next"
@@ -57,5 +57,5 @@
57
57
  },
58
58
  "main": "lib/index",
59
59
  "types": "lib/index",
60
- "gitHead": "66aad6e0e10892b1041522ac165d07f1d3220730"
60
+ "gitHead": "95961ba417aa103e0a7c59273daa6462ae538dde"
61
61
  }