@eclipse-glsp/client 1.1.0-RC01 → 1.1.0-RC03
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/lib/base/container-modules.js +37 -36
- package/lib/base/container-modules.js.map +1 -1
- package/lib/features/bounds/di.config.d.ts +20 -0
- package/lib/features/bounds/di.config.d.ts.map +1 -0
- package/lib/features/bounds/di.config.js +36 -0
- package/lib/features/bounds/di.config.js.map +1 -0
- package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts +34 -0
- package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts.map +1 -0
- package/lib/features/bounds/glsp-hidden-bounds-updater.js +98 -0
- package/lib/features/bounds/glsp-hidden-bounds-updater.js.map +1 -0
- package/lib/features/export/glsp-svg-exporter.d.ts +22 -0
- package/lib/features/export/glsp-svg-exporter.d.ts.map +1 -0
- package/lib/features/export/glsp-svg-exporter.js +45 -0
- package/lib/features/export/glsp-svg-exporter.js.map +1 -0
- package/lib/features/tools/change-bounds-tool.d.ts.map +1 -1
- package/lib/features/tools/change-bounds-tool.js +13 -10
- package/lib/features/tools/change-bounds-tool.js.map +1 -1
- package/lib/features/tools/di.config.d.ts.map +1 -1
- package/lib/features/tools/di.config.js +7 -1
- package/lib/features/tools/di.config.js.map +1 -1
- package/lib/features/tools/edge-edit-tool.d.ts +2 -2
- package/lib/features/tools/edge-edit-tool.d.ts.map +1 -1
- package/lib/features/tools/edge-edit-tool.js +3 -2
- package/lib/features/tools/edge-edit-tool.js.map +1 -1
- package/lib/features/tools/glsp-manhattan-edge-router.d.ts +20 -0
- package/lib/features/tools/glsp-manhattan-edge-router.d.ts.map +1 -0
- package/lib/features/tools/glsp-manhattan-edge-router.js +69 -0
- package/lib/features/tools/glsp-manhattan-edge-router.js.map +1 -0
- package/lib/utils/smodel-util.d.ts +32 -2
- package/lib/utils/smodel-util.d.ts.map +1 -1
- package/lib/utils/smodel-util.js +50 -2
- package/lib/utils/smodel-util.js.map +1 -1
- package/package.json +3 -3
- package/src/base/container-modules.ts +2 -2
- package/src/features/bounds/di.config.ts +39 -0
- package/src/features/bounds/glsp-hidden-bounds-updater.ts +88 -0
- package/src/features/export/glsp-svg-exporter.ts +50 -0
- package/src/features/tools/change-bounds-tool.ts +16 -13
- package/src/features/tools/di.config.ts +10 -2
- package/src/features/tools/edge-edit-tool.ts +5 -6
- package/src/features/tools/glsp-manhattan-edge-router.ts +57 -0
- package/src/utils/smodel-util.ts +60 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edge-edit-tool.js","sourceRoot":"","sources":["../../../src/features/tools/edge-edit-tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAsG;AACtG,yCAAyD;AACzD,qCAaiB;AACjB,oFAA8E;AAC9E,4CAAyC;AACzC,
|
|
1
|
+
{"version":3,"file":"edge-edit-tool.js","sourceRoot":"","sources":["../../../src/features/tools/edge-edit-tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAsG;AACtG,yCAAyD;AACzD,qCAaiB;AACjB,oFAA8E;AAC9E,4CAAyC;AACzC,yDAAmG;AACnG,8CAAwI;AACxI,mEAAkF;AAClF,oFAA2H;AAC3H,gEAAgF;AAChF,sFAQkD;AAClD,qDAAgD;AAGhD,IAAa,YAAY,oBAAzB,MAAa,YAAa,SAAQ,6BAAY;IAa1C,IAAI,EAAE;QACF,OAAO,cAAY,CAAC,EAAE,CAAC;IAC3B,CAAC;IAED,MAAM;QACF,IAAI,CAAC,gBAAgB,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC/C,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAEtD,oEAAoE;QACpE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GAAG,IAAA,6BAAmB,EAAC,OAAO,EAAE,wBAAU,CAAC,CAAC;oBACtD,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;wBACxB,uBAAuB;wBACvB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;wBAC3B,OAAO;qBACV;iBACJ;aACJ;YAED,IAAI,CAAC,KAAK,EAAE,CAAC;SAChB;IACL,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,SAAS,EAAE,CAAC;IACrB,CAAC;IAES,SAAS;QACf,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;QAC/B,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;QAChC,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;IACnC,CAAC;IAES,aAAa;QACnB,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,IAAI,IAAI,CAAC,IAAI,EAAE;YACX,MAAM,CAAC,IAAI,CAAC,iDAAuB,CAAC,MAAM,CAAC,EAAE,oBAAoB,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;SACzF;QACD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,gEAAsC,CAAC,MAAM,EAAE,EAAE,IAAA,mCAAoB,GAAE,EAAE,iDAAwB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC7H,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC;IAC5C,CAAC;CACJ"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2022 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
import { ManhattanEdgeRouter, ResolvedHandleMove, SRoutableElement } from 'sprotty';
|
|
17
|
+
export declare class GSLPManhattanEdgeRouter extends ManhattanEdgeRouter {
|
|
18
|
+
protected applyInnerHandleMoves(edge: SRoutableElement, moves: ResolvedHandleMove[]): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=glsp-manhattan-edge-router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-manhattan-edge-router.d.ts","sourceRoot":"","sources":["../../../src/features/tools/glsp-manhattan-edge-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAGlF,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEpF,qBAAa,uBAAwB,SAAQ,mBAAmB;cACzC,qBAAqB,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,kBAAkB,EAAE,GAAG,IAAI;CAoCtG"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2022 EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
*
|
|
9
|
+
* This Source Code may also be made available under the following Secondary
|
|
10
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
* with the GNU Classpath Exception which is available at
|
|
13
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
*
|
|
15
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
********************************************************************************/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.GSLPManhattanEdgeRouter = void 0;
|
|
19
|
+
const protocol_1 = require("@eclipse-glsp/protocol");
|
|
20
|
+
const sprotty_1 = require("sprotty");
|
|
21
|
+
class GSLPManhattanEdgeRouter extends sprotty_1.ManhattanEdgeRouter {
|
|
22
|
+
applyInnerHandleMoves(edge, moves) {
|
|
23
|
+
const route = this.route(edge);
|
|
24
|
+
const routingPoints = edge.routingPoints;
|
|
25
|
+
const minimalPointDistance = this.getOptions(edge).minimalPointDistance;
|
|
26
|
+
moves.forEach(move => {
|
|
27
|
+
const handle = move.handle;
|
|
28
|
+
const index = handle.pointIndex;
|
|
29
|
+
const correctedX = this.correctX(routingPoints, index, move.toPosition.x, minimalPointDistance);
|
|
30
|
+
const correctedY = this.correctY(routingPoints, index, move.toPosition.y, minimalPointDistance);
|
|
31
|
+
switch (handle.kind) {
|
|
32
|
+
case 'manhattan-50%':
|
|
33
|
+
if (index < 0) {
|
|
34
|
+
if (routingPoints.length === 0) {
|
|
35
|
+
routingPoints.push({ x: correctedX, y: correctedY });
|
|
36
|
+
move.handle.pointIndex = 0;
|
|
37
|
+
}
|
|
38
|
+
else if ((0, protocol_1.almostEquals)(route[0].x, route[1].x)) {
|
|
39
|
+
this.alignX(routingPoints, 0, correctedX);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this.alignY(routingPoints, 0, correctedY);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else if (index < routingPoints.length - 1) {
|
|
46
|
+
if ((0, protocol_1.almostEquals)(routingPoints[index].x, routingPoints[index + 1].x)) {
|
|
47
|
+
this.alignX(routingPoints, index, correctedX);
|
|
48
|
+
this.alignX(routingPoints, index + 1, correctedX);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
this.alignY(routingPoints, index, correctedY);
|
|
52
|
+
this.alignY(routingPoints, index + 1, correctedY);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
if ((0, protocol_1.almostEquals)(route[route.length - 2].x, route[route.length - 1].x)) {
|
|
57
|
+
this.alignX(routingPoints, routingPoints.length - 1, correctedX);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
this.alignY(routingPoints, routingPoints.length - 1, correctedY);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.GSLPManhattanEdgeRouter = GSLPManhattanEdgeRouter;
|
|
69
|
+
//# sourceMappingURL=glsp-manhattan-edge-router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glsp-manhattan-edge-router.js","sourceRoot":"","sources":["../../../src/features/tools/glsp-manhattan-edge-router.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,qDAAsD;AACtD,qCAAoF;AAEpF,MAAa,uBAAwB,SAAQ,6BAAmB;IACzC,qBAAqB,CAAC,IAAsB,EAAE,KAA2B;QACxF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/B,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QACzC,MAAM,oBAAoB,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,oBAAoB,CAAC;QACxE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EA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4BAC9C,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;yBACrD;6BAAM;4BACH,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;4BAC9C,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;yBACrD;qBACJ;yBAAM;wBACH,IAAI,IAAA,uBAAY,EAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;4BACpE,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;yBACpE;6BACI;4BAAE,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;yBAAE;qBAC7E;oBACD,MAAM;aACb;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AArCD,0DAqCC"}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import { ElementAndBounds, ElementAndRoutingPoints, SModelElementSchema, TypeGuard } from '@eclipse-glsp/protocol';
|
|
17
|
-
import { BoundsAware, ModelIndexImpl, Selectable, SModelElement, SRoutableElement, SRoutingHandle } from 'sprotty';
|
|
17
|
+
import { BoundsAware, EdgeRouterRegistry, ModelIndexImpl, RoutedPoint, Selectable, SModelElement, SRoutableElement, SRoutingHandle } from 'sprotty';
|
|
18
18
|
import { FluentIterable } from 'sprotty/lib/utils/iterable';
|
|
19
19
|
/**
|
|
20
20
|
* Helper type to represent a filter predicate for {@link SModelElement}s. This is used to retrieve
|
|
@@ -127,11 +127,41 @@ export declare type BoundsAwareModelElement = SModelElement & BoundsAware;
|
|
|
127
127
|
export declare function toElementAndBounds(element: BoundsAwareModelElement): ElementAndBounds;
|
|
128
128
|
/**
|
|
129
129
|
* Helper function to translate a given {@link SRoutableElement} into its corresponding
|
|
130
|
-
* {@ElementAndRoutingPoints
|
|
130
|
+
* {@link ElementAndRoutingPoints} representation.
|
|
131
131
|
* @param element The element to translate.
|
|
132
132
|
* @returns The corresponding {@link ElementAndRoutingPoints} for the given element.
|
|
133
133
|
*/
|
|
134
134
|
export declare function toElementAndRoutingPoints(element: SRoutableElement): ElementAndRoutingPoints;
|
|
135
|
+
/** Pure routing point data kinds. */
|
|
136
|
+
export declare const ROUTING_POINT_KINDS: string[];
|
|
137
|
+
/** Pure route data kinds. */
|
|
138
|
+
export declare const ROUTE_KINDS: string[];
|
|
139
|
+
/**
|
|
140
|
+
* Helper function to calculate the {@link ElementAndRoutingPoints} for a given {@link SRoutableElement}.
|
|
141
|
+
* If client layout is activated, i.e., the edge routing registry is given and has a router for the element, then the routing
|
|
142
|
+
* points from the calculated route are used, otherwise we use the already specified routing points of the {@link SRoutableElement}.
|
|
143
|
+
* @param element The element to translate.
|
|
144
|
+
* @param routerRegistry the edge router registry.
|
|
145
|
+
* @returns The corresponding {@link ElementAndRoutingPoints} for the given element.
|
|
146
|
+
*/
|
|
147
|
+
export declare function calcElementAndRoutingPoints(element: SRoutableElement, routerRegistry?: EdgeRouterRegistry): ElementAndRoutingPoints;
|
|
148
|
+
/**
|
|
149
|
+
* Helper function to calculate the route for a given {@link SRoutableElement}.
|
|
150
|
+
* If client layout is activated, i.e., the edge routing registry is given and has a router for the element, then the points
|
|
151
|
+
* from the calculated route are used, otherwise we use the already specified routing points of the {@link SRoutableElement}.
|
|
152
|
+
* @param element The element to translate.
|
|
153
|
+
* @param routerRegistry the edge router registry.
|
|
154
|
+
* @returns The corresponding route for the given element.
|
|
155
|
+
*/
|
|
156
|
+
export declare function calcElementAndRoute(element: SRoutableElement, routerRegistry?: EdgeRouterRegistry): ElementAndRoutingPoints;
|
|
157
|
+
/**
|
|
158
|
+
* Helper function to calculate the route for a given {@link SRoutableElement}.
|
|
159
|
+
* @param element The element to translate.
|
|
160
|
+
* @param routerRegistry the edge router registry.
|
|
161
|
+
* @param pointKinds the routing point kinds that should be considered.
|
|
162
|
+
* @returns The corresponding route for the given element.
|
|
163
|
+
*/
|
|
164
|
+
export declare function calcRoute(element: SRoutableElement, routerRegistry: EdgeRouterRegistry, pointKinds?: string[]): RoutedPoint[] | undefined;
|
|
135
165
|
/**
|
|
136
166
|
* Checks if the model is compatible with the passed type string.
|
|
137
167
|
* (either has the same type or a subtype of this type)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smodel-util.d.ts","sourceRoot":"","sources":["../../src/utils/smodel-util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,
|
|
1
|
+
{"version":3,"file":"smodel-util.d.ts","sourceRoot":"","sources":["../../src/utils/smodel-util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACU,gBAAgB,EAAE,uBAAuB,EAAiB,mBAAmB,EAC1F,SAAS,EACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACH,WAAW,EACX,kBAAkB,EAIN,cAAc,EAC1B,WAAW,EACX,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,cAAc,EACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D;;;;GAIG;AACH,oBAAY,oBAAoB,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,aAAa,KAAK,YAAY,IAAI,aAAa,GAAG,CAAC,CAAC;AAEzG;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,oBAAoB,CAAC,CAAC,CAAC,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AAE,aAAa,GAAG,mBAAmB,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAG5G;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,aAAa,GAAG,mBAAmB,GAAG,MAAM,GAAG,MAAM,CAM5F"}
|
package/lib/utils/smodel-util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getElementTypeId = exports.hasCompatibleType = exports.toElementAndRoutingPoints = exports.toElementAndBounds = exports.isSelectableAndBoundsAware = exports.isRoutingHandle = exports.isRoutable = exports.isNonRoutableSelectedBoundsAware = exports.isNonRoutableSelectedMovableBoundsAware = exports.removeCssClasses = exports.addCssClasses = exports.isNotUndefined = exports.hasSelectedElements = exports.getSelectedElementCount = exports.getElements = exports.getMatchingElements = exports.forEachElement = exports.filter = void 0;
|
|
3
|
+
exports.getElementTypeId = exports.hasCompatibleType = exports.calcRoute = exports.calcElementAndRoute = exports.calcElementAndRoutingPoints = exports.ROUTE_KINDS = exports.ROUTING_POINT_KINDS = exports.toElementAndRoutingPoints = exports.toElementAndBounds = exports.isSelectableAndBoundsAware = exports.isRoutingHandle = exports.isRoutable = exports.isNonRoutableSelectedBoundsAware = exports.isNonRoutableSelectedMovableBoundsAware = exports.removeCssClasses = exports.addCssClasses = exports.isNotUndefined = exports.hasSelectedElements = exports.getSelectedElementCount = exports.getElements = exports.getMatchingElements = exports.forEachElement = exports.filter = void 0;
|
|
4
4
|
/********************************************************************************
|
|
5
5
|
* Copyright (c) 2019-2022 EclipseSource and others.
|
|
6
6
|
*
|
|
@@ -185,7 +185,7 @@ function toElementAndBounds(element) {
|
|
|
185
185
|
exports.toElementAndBounds = toElementAndBounds;
|
|
186
186
|
/**
|
|
187
187
|
* Helper function to translate a given {@link SRoutableElement} into its corresponding
|
|
188
|
-
* {@ElementAndRoutingPoints
|
|
188
|
+
* {@link ElementAndRoutingPoints} representation.
|
|
189
189
|
* @param element The element to translate.
|
|
190
190
|
* @returns The corresponding {@link ElementAndRoutingPoints} for the given element.
|
|
191
191
|
*/
|
|
@@ -196,6 +196,54 @@ function toElementAndRoutingPoints(element) {
|
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
198
|
exports.toElementAndRoutingPoints = toElementAndRoutingPoints;
|
|
199
|
+
/** Pure routing point data kinds. */
|
|
200
|
+
exports.ROUTING_POINT_KINDS = ['linear', 'bezier-junction'];
|
|
201
|
+
/** Pure route data kinds. */
|
|
202
|
+
exports.ROUTE_KINDS = [...exports.ROUTING_POINT_KINDS, 'source', 'target'];
|
|
203
|
+
/**
|
|
204
|
+
* Helper function to calculate the {@link ElementAndRoutingPoints} for a given {@link SRoutableElement}.
|
|
205
|
+
* If client layout is activated, i.e., the edge routing registry is given and has a router for the element, then the routing
|
|
206
|
+
* points from the calculated route are used, otherwise we use the already specified routing points of the {@link SRoutableElement}.
|
|
207
|
+
* @param element The element to translate.
|
|
208
|
+
* @param routerRegistry the edge router registry.
|
|
209
|
+
* @returns The corresponding {@link ElementAndRoutingPoints} for the given element.
|
|
210
|
+
*/
|
|
211
|
+
function calcElementAndRoutingPoints(element, routerRegistry) {
|
|
212
|
+
const newRoutingPoints = routerRegistry ? calcRoute(element, routerRegistry, exports.ROUTING_POINT_KINDS) : element.routingPoints;
|
|
213
|
+
return { elementId: element.id, newRoutingPoints };
|
|
214
|
+
}
|
|
215
|
+
exports.calcElementAndRoutingPoints = calcElementAndRoutingPoints;
|
|
216
|
+
/**
|
|
217
|
+
* Helper function to calculate the route for a given {@link SRoutableElement}.
|
|
218
|
+
* If client layout is activated, i.e., the edge routing registry is given and has a router for the element, then the points
|
|
219
|
+
* from the calculated route are used, otherwise we use the already specified routing points of the {@link SRoutableElement}.
|
|
220
|
+
* @param element The element to translate.
|
|
221
|
+
* @param routerRegistry the edge router registry.
|
|
222
|
+
* @returns The corresponding route for the given element.
|
|
223
|
+
*/
|
|
224
|
+
function calcElementAndRoute(element, routerRegistry) {
|
|
225
|
+
var _a, _b;
|
|
226
|
+
let route = routerRegistry ? calcRoute(element, routerRegistry, exports.ROUTE_KINDS) : undefined;
|
|
227
|
+
if (!route) {
|
|
228
|
+
// add source and target to the routing points
|
|
229
|
+
route = [...element.routingPoints];
|
|
230
|
+
route.splice(0, 0, ((_a = element.source) === null || _a === void 0 ? void 0 : _a.position) || protocol_1.Point.ORIGIN);
|
|
231
|
+
route.push(((_b = element.target) === null || _b === void 0 ? void 0 : _b.position) || protocol_1.Point.ORIGIN);
|
|
232
|
+
}
|
|
233
|
+
return { elementId: element.id, newRoutingPoints: route };
|
|
234
|
+
}
|
|
235
|
+
exports.calcElementAndRoute = calcElementAndRoute;
|
|
236
|
+
/**
|
|
237
|
+
* Helper function to calculate the route for a given {@link SRoutableElement}.
|
|
238
|
+
* @param element The element to translate.
|
|
239
|
+
* @param routerRegistry the edge router registry.
|
|
240
|
+
* @param pointKinds the routing point kinds that should be considered.
|
|
241
|
+
* @returns The corresponding route for the given element.
|
|
242
|
+
*/
|
|
243
|
+
function calcRoute(element, routerRegistry, pointKinds) {
|
|
244
|
+
return routerRegistry === null || routerRegistry === void 0 ? void 0 : routerRegistry.get(element.routerKind).route(element).filter((point, idx, fullRoute) => idx === fullRoute.findIndex(otherPoint => otherPoint.x === point.x && otherPoint.y === point.y)).filter(point => !pointKinds || pointKinds.includes(point.kind));
|
|
245
|
+
}
|
|
246
|
+
exports.calcRoute = calcRoute;
|
|
199
247
|
/**
|
|
200
248
|
* Checks if the model is compatible with the passed type string.
|
|
201
249
|
* (either has the same type or a subtype of this type)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smodel-util.js","sourceRoot":"","sources":["../../src/utils/smodel-util.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"smodel-util.js","sourceRoot":"","sources":["../../src/utils/smodel-util.ts"],"names":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C,KAAK,KAAK,CAAC,CAAC,CAAC,EACjI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,UAAU,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AACzE,CAAC;AAJD,8BAIC;AAED;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,KAAmD,EAAE,IAAY;IAC/F,MAAM,SAAS,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC1C,OAAO,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC3E,CAAC;AAHD,8CAGC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,KAAmD;IAChF,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC3B,OAAO,KAAe,CAAC;KAC1B;SAAM;QACH,OAAQ,KAAa,CAAC,MAAM,CAAW,CAAC;KAC3C;AACL,CAAC;AAND,4CAMC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp/client",
|
|
3
|
-
"version": "1.1.0-
|
|
3
|
+
"version": "1.1.0-RC03",
|
|
4
4
|
"description": "A sprotty-based client for GLSP",
|
|
5
5
|
"license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
|
|
6
6
|
"keywords": [
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"css"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@eclipse-glsp/protocol": "1.1.0-
|
|
37
|
+
"@eclipse-glsp/protocol": "1.1.0-RC03",
|
|
38
38
|
"autocompleter": "5.1.0",
|
|
39
39
|
"sprotty": "0.13.0-next.1c4343c.328"
|
|
40
40
|
},
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
},
|
|
59
59
|
"main": "lib/index",
|
|
60
60
|
"types": "lib/index",
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "8e03379e6cb4a12fbcb92d10f0037ae3aa9a6938"
|
|
62
62
|
}
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
import { Container, ContainerModule } from 'inversify';
|
|
18
18
|
import {
|
|
19
|
-
boundsModule,
|
|
20
19
|
buttonModule,
|
|
21
20
|
defaultModule,
|
|
22
21
|
edgeIntersectionModule,
|
|
@@ -30,6 +29,7 @@ import {
|
|
|
30
29
|
routingModule,
|
|
31
30
|
zorderModule
|
|
32
31
|
} from 'sprotty';
|
|
32
|
+
import glspBoundsModule from '../features/bounds/di.config';
|
|
33
33
|
import glspCommandPaletteModule from '../features/command-palette/di.config';
|
|
34
34
|
import glspContextMenuModule from '../features/context-menu/di.config';
|
|
35
35
|
import { glspServerCopyPasteModule } from '../features/copy-paste/di.config';
|
|
@@ -52,13 +52,13 @@ import defaultGLSPModule from './di.config';
|
|
|
52
52
|
export const DEFAULT_MODULES = [
|
|
53
53
|
defaultModule,
|
|
54
54
|
defaultGLSPModule,
|
|
55
|
-
boundsModule,
|
|
56
55
|
buttonModule,
|
|
57
56
|
edgeIntersectionModule,
|
|
58
57
|
edgeLayoutModule,
|
|
59
58
|
expandModule,
|
|
60
59
|
exportModule,
|
|
61
60
|
fadeModule,
|
|
61
|
+
glspBoundsModule,
|
|
62
62
|
glspCommandPaletteModule,
|
|
63
63
|
glspContextMenuModule,
|
|
64
64
|
glspDecorationModule,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2022 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
import { ContainerModule } from 'inversify';
|
|
17
|
+
import {
|
|
18
|
+
configureCommand, configureLayout, HBoxLayouter, HiddenBoundsUpdater, Layouter,
|
|
19
|
+
LayoutRegistry, RequestBoundsCommand, SetBoundsCommand, StackLayouter, VBoxLayouter
|
|
20
|
+
} from 'sprotty';
|
|
21
|
+
import '../../../css/command-palette.css';
|
|
22
|
+
import { TYPES } from '../../base/types';
|
|
23
|
+
import { GLSPHiddenBoundsUpdater } from './glsp-hidden-bounds-updater';
|
|
24
|
+
|
|
25
|
+
const glspBoundsModule = new ContainerModule((bind, _unbind, isBound, _rebind) => {
|
|
26
|
+
configureCommand({ bind, isBound }, SetBoundsCommand);
|
|
27
|
+
configureCommand({ bind, isBound }, RequestBoundsCommand);
|
|
28
|
+
bind(HiddenBoundsUpdater).toSelf().inSingletonScope();
|
|
29
|
+
bind(GLSPHiddenBoundsUpdater).toSelf().inSingletonScope();
|
|
30
|
+
bind(TYPES.HiddenVNodePostprocessor).toService(GLSPHiddenBoundsUpdater);
|
|
31
|
+
bind(TYPES.Layouter).to(Layouter).inSingletonScope();
|
|
32
|
+
bind(TYPES.LayoutRegistry).to(LayoutRegistry).inSingletonScope();
|
|
33
|
+
|
|
34
|
+
configureLayout({ bind, isBound }, VBoxLayouter.KIND, VBoxLayouter);
|
|
35
|
+
configureLayout({ bind, isBound }, HBoxLayouter.KIND, HBoxLayouter);
|
|
36
|
+
configureLayout({ bind, isBound }, StackLayouter.KIND, StackLayouter);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export default glspBoundsModule;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2022 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
Action, ComputedBoundsAction, Deferred, ElementAndRoutingPoints, RequestAction,
|
|
19
|
+
ResponseAction
|
|
20
|
+
} from '@eclipse-glsp/protocol';
|
|
21
|
+
import { inject, injectable, optional } from 'inversify';
|
|
22
|
+
import { VNode } from 'snabbdom';
|
|
23
|
+
import { EdgeRouterRegistry, HiddenBoundsUpdater, IActionDispatcher, SModelElement, SRoutableElement } from 'sprotty';
|
|
24
|
+
import { calcElementAndRoute, isRoutable } from '../../utils/smodel-util';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Grabs the bounds from hidden SVG DOM elements, applies layouts, collects routes and fires {@link ComputedBoundsAction}s.
|
|
28
|
+
*
|
|
29
|
+
* The actions will contain the bound, alignment, and routing points of elements.
|
|
30
|
+
*/
|
|
31
|
+
@injectable()
|
|
32
|
+
export class GLSPHiddenBoundsUpdater extends HiddenBoundsUpdater {
|
|
33
|
+
|
|
34
|
+
@inject(EdgeRouterRegistry) @optional() protected readonly edgeRouterRegistry?: EdgeRouterRegistry;
|
|
35
|
+
|
|
36
|
+
protected element2route: ElementAndRoutingPoints[] = [];
|
|
37
|
+
protected edges: SRoutableElement[] = [];
|
|
38
|
+
protected nodes: VNode[] = [];
|
|
39
|
+
|
|
40
|
+
override decorate(vnode: VNode, element: SModelElement): VNode {
|
|
41
|
+
super.decorate(vnode, element);
|
|
42
|
+
if (isRoutable(element)) {
|
|
43
|
+
this.element2route.push(calcElementAndRoute(element, this.edgeRouterRegistry));
|
|
44
|
+
}
|
|
45
|
+
return vnode;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override postUpdate(cause?: Action): void {
|
|
49
|
+
const actions = this.captureActions(() => super.postUpdate(cause));
|
|
50
|
+
actions.filter(action => ComputedBoundsAction.is(action))
|
|
51
|
+
.forEach(action => this.actionDispatcher.dispatch(this.enhanceAction(action as ComputedBoundsAction)));
|
|
52
|
+
this.element2route = [];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
protected captureActions(call: () => void): Action[] {
|
|
56
|
+
const capturingActionDispatcher = new CapturingActionDispatcher();
|
|
57
|
+
const actualActionDispatcher = this.actionDispatcher;
|
|
58
|
+
this.actionDispatcher = capturingActionDispatcher;
|
|
59
|
+
try {
|
|
60
|
+
call();
|
|
61
|
+
return capturingActionDispatcher.actions;
|
|
62
|
+
} finally {
|
|
63
|
+
this.actionDispatcher = actualActionDispatcher;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
protected enhanceAction(action: ComputedBoundsAction): ComputedBoundsAction {
|
|
68
|
+
action.routes = this.element2route.length === 0 ? undefined : this.element2route;
|
|
69
|
+
return action;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
class CapturingActionDispatcher implements IActionDispatcher {
|
|
74
|
+
readonly actions: Action[] = [];
|
|
75
|
+
|
|
76
|
+
async dispatch(action: Action): Promise<void> {
|
|
77
|
+
this.actions.push(action);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async dispatchAll(actions: Action[]): Promise<void> {
|
|
81
|
+
this.actions.push(...actions);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async request<Res extends ResponseAction>(action: RequestAction<Res>): Promise<Res> {
|
|
85
|
+
// ignore, not needed for our purposes
|
|
86
|
+
return new Deferred<Res>().promise;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2022 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
import { RequestAction } from '@eclipse-glsp/protocol';
|
|
17
|
+
import { injectable } from 'inversify';
|
|
18
|
+
import { ExportSvgAction, SModelRoot, SvgExporter } from 'sprotty';
|
|
19
|
+
import { v4 as uuid } from 'uuid';
|
|
20
|
+
|
|
21
|
+
@injectable()
|
|
22
|
+
export class GLSPSvgExporter extends SvgExporter {
|
|
23
|
+
override export(root: SModelRoot, _request?: RequestAction<ExportSvgAction>): void {
|
|
24
|
+
if (typeof document !== 'undefined') {
|
|
25
|
+
const svgElement = this.findSvgElement();
|
|
26
|
+
if (svgElement) {
|
|
27
|
+
// createSvg requires the svg to have a non-empty id, so we generate one if necessary
|
|
28
|
+
const originalId = svgElement.id;
|
|
29
|
+
try {
|
|
30
|
+
svgElement.id = originalId || uuid();
|
|
31
|
+
// provide generated svg code with respective sizing for proper viewing in browser and remove undesired border
|
|
32
|
+
const bounds = this.getBounds(root);
|
|
33
|
+
const svg = this.createSvg(svgElement, root)
|
|
34
|
+
.replace('style="',
|
|
35
|
+
`style="width: ${bounds.width}px !important;height: ${bounds.height}px !important;border: none !important;`);
|
|
36
|
+
// do not give request/response id here as otherwise the action is treated as an unrequested response
|
|
37
|
+
this.actionDispatcher.dispatch(ExportSvgAction.create(svg, ''));
|
|
38
|
+
} finally {
|
|
39
|
+
svgElement.id = originalId;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
protected findSvgElement(): SVGSVGElement | null {
|
|
46
|
+
const div = document.getElementById(this.options.hiddenDiv);
|
|
47
|
+
// search for first svg element as hierarchy within Sprotty might change
|
|
48
|
+
return div && div.querySelector('svg');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
17
|
Action,
|
|
18
18
|
Bounds,
|
|
19
19
|
ChangeBoundsOperation,
|
|
@@ -44,10 +44,10 @@ import { DragAwareMouseListener } from '../../base/drag-aware-mouse-listener';
|
|
|
44
44
|
import { TYPES } from '../../base/types';
|
|
45
45
|
import { isValidMove, isValidSize } from '../../utils/layout-utils';
|
|
46
46
|
import {
|
|
47
|
+
calcElementAndRoutingPoints,
|
|
47
48
|
forEachElement,
|
|
48
49
|
isNonRoutableSelectedMovableBoundsAware,
|
|
49
|
-
toElementAndBounds
|
|
50
|
-
toElementAndRoutingPoints
|
|
50
|
+
toElementAndBounds
|
|
51
51
|
} from '../../utils/smodel-util';
|
|
52
52
|
import { isBoundsAwareMoveable, isResizable, Resizable, ResizeHandleLocation, SResizeHandle } from '../change-bounds/model';
|
|
53
53
|
import {
|
|
@@ -237,19 +237,22 @@ export class ChangeBoundsListener extends DragAwareMouseListener implements Sele
|
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
protected handleMoveRoutingPointsOnServer(target: SModelElement): Operation[] {
|
|
240
|
-
const result: Operation[] = [];
|
|
241
240
|
const newRoutingPoints: ElementAndRoutingPoints[] = [];
|
|
242
|
-
|
|
241
|
+
const routerRegistry = this.tool.edgeRouterRegistry;
|
|
242
|
+
if (routerRegistry) {
|
|
243
243
|
// If client routing is enabled -> delegate routingpoints of connected edges to server
|
|
244
|
-
|
|
245
|
-
element
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
244
|
+
forEachElement(target.index, isNonRoutableSelectedMovableBoundsAware, element => {
|
|
245
|
+
if (element instanceof SConnectableElement) {
|
|
246
|
+
element.incomingEdges.map(connectable => calcElementAndRoutingPoints(connectable, routerRegistry))
|
|
247
|
+
.forEach(ear => newRoutingPoints.push(ear));
|
|
248
|
+
element.outgoingEdges.map(connectable => calcElementAndRoutingPoints(connectable, routerRegistry))
|
|
249
|
+
.forEach(ear => newRoutingPoints.push(ear));
|
|
250
|
+
}
|
|
251
|
+
});
|
|
251
252
|
}
|
|
252
|
-
return
|
|
253
|
+
return newRoutingPoints.length > 0
|
|
254
|
+
? [ChangeRoutingPointsOperation.create(newRoutingPoints)]
|
|
255
|
+
: [];
|
|
253
256
|
}
|
|
254
257
|
|
|
255
258
|
protected handleResize(activeResizeHandle: SResizeHandle): Action[] {
|