@eclipse-glsp/client 1.1.0-next.6ec1da0.211 → 1.1.0-next.6efef44.226

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 (57) hide show
  1. package/README.md +1 -1
  2. package/lib/base/container-modules.d.ts +32 -2
  3. package/lib/base/container-modules.d.ts.map +1 -1
  4. package/lib/base/container-modules.js +72 -34
  5. package/lib/base/container-modules.js.map +1 -1
  6. package/lib/base/selection-clearing-mouse-listener.js +1 -1
  7. package/lib/features/command-palette/command-palette-tool.js +1 -1
  8. package/lib/features/export/di.config.d.ts +19 -0
  9. package/lib/features/export/di.config.d.ts.map +1 -0
  10. package/lib/features/export/di.config.js +29 -0
  11. package/lib/features/export/di.config.js.map +1 -0
  12. package/lib/features/layout/tests/layouter-test-util.d.ts +1 -1
  13. package/lib/features/layout/tests/layouter-test-util.js +2 -2
  14. package/lib/features/layout/tests/layouter-test-util.js.map +1 -1
  15. package/lib/features/save/model.d.ts +1 -1
  16. package/lib/features/source-model-watcher/di.config.js +1 -1
  17. package/lib/features/tool-feedback/creation-tool-feedback.d.ts +4 -4
  18. package/lib/features/tool-feedback/creation-tool-feedback.d.ts.map +1 -1
  19. package/lib/features/tool-feedback/creation-tool-feedback.js +4 -8
  20. package/lib/features/tool-feedback/creation-tool-feedback.js.map +1 -1
  21. package/lib/features/tool-feedback/edge-edit-tool-feedback.d.ts +1 -2
  22. package/lib/features/tool-feedback/edge-edit-tool-feedback.d.ts.map +1 -1
  23. package/lib/features/tool-feedback/edge-edit-tool-feedback.js +1 -7
  24. package/lib/features/tool-feedback/edge-edit-tool-feedback.js.map +1 -1
  25. package/lib/features/tools/di.config.d.ts.map +1 -1
  26. package/lib/features/tools/di.config.js +1 -4
  27. package/lib/features/tools/di.config.js.map +1 -1
  28. package/lib/features/validation/issue-marker.d.ts +1 -1
  29. package/lib/features/validation/issue-marker.js +1 -1
  30. package/lib/lib/model.d.ts +7 -3
  31. package/lib/lib/model.d.ts.map +1 -1
  32. package/lib/lib/model.js +48 -1
  33. package/lib/lib/model.js.map +1 -1
  34. package/lib/utils/html-utils.d.ts +1 -1
  35. package/lib/utils/html-utils.js +1 -1
  36. package/lib/views/base-view-module.js +1 -1
  37. package/lib/views/glsp-projection-view.d.ts +1 -1
  38. package/lib/views/glsp-projection-view.js +1 -1
  39. package/lib/views/index.d.ts +1 -1
  40. package/lib/views/index.js +1 -1
  41. package/package.json +17 -17
  42. package/src/base/container-modules.ts +51 -7
  43. package/src/base/selection-clearing-mouse-listener.ts +1 -1
  44. package/src/features/command-palette/command-palette-tool.ts +1 -1
  45. package/src/features/export/di.config.ts +28 -0
  46. package/src/features/layout/tests/layouter-test-util.ts +3 -3
  47. package/src/features/save/model.ts +1 -1
  48. package/src/features/source-model-watcher/di.config.ts +1 -1
  49. package/src/features/tool-feedback/creation-tool-feedback.ts +14 -12
  50. package/src/features/tool-feedback/edge-edit-tool-feedback.ts +1 -9
  51. package/src/features/tools/di.config.ts +1 -5
  52. package/src/features/validation/issue-marker.ts +1 -1
  53. package/src/lib/model.ts +35 -3
  54. package/src/utils/html-utils.ts +1 -1
  55. package/src/views/base-view-module.ts +1 -1
  56. package/src/views/glsp-projection-view.tsx +1 -1
  57. package/src/views/index.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2019-2021 EclipseSource and others.
2
+ * Copyright (c) 2019-2022 EclipseSource 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
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSeverity = exports.createSIssue = exports.getSIssueMarker = exports.getOrCreateSIssueMarker = exports.GIssueMarker = void 0;
4
4
  /********************************************************************************
5
- * Copyright (c) 2019-2021 EclipseSource and others.
5
+ * Copyright (c) 2019-2022 EclipseSource and others.
6
6
  *
7
7
  * This program and the accompanying materials are made available under the
8
8
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2019-2022 EclipseSource and others.
2
+ * Copyright (c) 2019-2023 EclipseSource 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,8 +13,8 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { SModelElementSchema } from '@eclipse-glsp/protocol';
17
- import { SGraph, SModelElement } from 'sprotty';
16
+ import { Bounds, Point, SModelElementSchema } from '@eclipse-glsp/protocol';
17
+ import { SEdge, SGraph, SModelElement } from 'sprotty';
18
18
  import { Containable } from '../features/hints/model';
19
19
  import { Saveable } from '../features/save/model';
20
20
  export declare class GLSPGraph extends SGraph implements Saveable, Containable {
@@ -22,4 +22,8 @@ export declare class GLSPGraph extends SGraph implements Saveable, Containable {
22
22
  dirty: boolean;
23
23
  isContainableElement(input: string | SModelElement | SModelElementSchema): boolean;
24
24
  }
25
+ export declare class GEdge extends SEdge {
26
+ localToParent(point: Point | Bounds): Bounds;
27
+ parentToLocal(point: Point | Bounds): Bounds;
28
+ }
25
29
  //# sourceMappingURL=model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/lib/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAiB,MAAM,EAAE,aAAa,EAAmB,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,WAAW,EAAoB,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAe,MAAM,wBAAwB,CAAC;AAE/D,qBAAa,SAAU,SAAQ,MAAO,YAAW,QAAQ,EAAE,WAAW;IAClE,gBAAyB,gBAAgB,WAAmE;IAC5G,KAAK,UAAS;IACd,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,mBAAmB,GAAG,OAAO;CAGrF"}
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/lib/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAY,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAiC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAmB,MAAM,SAAS,CAAC;AACvG,OAAO,EAAE,WAAW,EAAoB,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAe,MAAM,wBAAwB,CAAC;AAE/D,qBAAa,SAAU,SAAQ,MAAO,YAAW,QAAQ,EAAE,WAAW;IAClE,gBAAyB,gBAAgB,WAAmE;IAC5G,KAAK,UAAS;IACd,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,mBAAmB,GAAG,OAAO;CAGrF;AAED,qBAAa,KAAM,SAAQ,KAAK;IACnB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM;IAe5C,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM;CAcxD"}
package/lib/lib/model.js CHANGED
@@ -1,6 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GLSPGraph = void 0;
3
+ exports.GEdge = exports.GLSPGraph = void 0;
4
+ /********************************************************************************
5
+ * Copyright (c) 2019-2023 EclipseSource and others.
6
+ *
7
+ * This program and the accompanying materials are made available under the
8
+ * terms of the Eclipse Public License v. 2.0 which is available at
9
+ * http://www.eclipse.org/legal/epl-2.0.
10
+ *
11
+ * This Source Code may also be made available under the following Secondary
12
+ * Licenses when the conditions for such availability set forth in the Eclipse
13
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
14
+ * with the GNU Classpath Exception which is available at
15
+ * https://www.gnu.org/software/classpath/license.html.
16
+ *
17
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
18
+ ********************************************************************************/
19
+ const protocol_1 = require("@eclipse-glsp/protocol");
4
20
  const sprotty_1 = require("sprotty");
5
21
  const model_1 = require("../features/hints/model");
6
22
  const model_2 = require("../features/save/model");
@@ -15,4 +31,35 @@ class GLSPGraph extends sprotty_1.SGraph {
15
31
  }
16
32
  exports.GLSPGraph = GLSPGraph;
17
33
  GLSPGraph.DEFAULT_FEATURES = [sprotty_1.viewportFeature, sprotty_1.exportFeature, model_2.saveFeature, model_1.containerFeature];
34
+ class GEdge extends sprotty_1.SEdge {
35
+ localToParent(point) {
36
+ const bounds = (0, sprotty_1.getRouteBounds)(this.routingPoints);
37
+ const result = {
38
+ x: point.x + bounds.x,
39
+ y: point.y + bounds.y,
40
+ width: -1,
41
+ height: -1
42
+ };
43
+ if ((0, protocol_1.isBounds)(point)) {
44
+ result.width = point.width;
45
+ result.height = point.height;
46
+ }
47
+ return result;
48
+ }
49
+ parentToLocal(point) {
50
+ const bounds = (0, sprotty_1.getRouteBounds)(this.routingPoints);
51
+ const result = {
52
+ x: point.x - bounds.x,
53
+ y: point.y - bounds.y,
54
+ width: -1,
55
+ height: -1
56
+ };
57
+ if ((0, protocol_1.isBounds)(point)) {
58
+ result.width = point.width;
59
+ result.height = point.height;
60
+ }
61
+ return result;
62
+ }
63
+ }
64
+ exports.GEdge = GEdge;
18
65
  //# sourceMappingURL=model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/lib/model.ts"],"names":[],"mappings":";;;AAgBA,qCAAgF;AAChF,mDAAwE;AACxE,kDAA+D;AAE/D,MAAa,SAAU,SAAQ,gBAAM;IAArC;;QAEI,UAAK,GAAG,KAAK,CAAC;IAIlB,CAAC;IAHG,oBAAoB,CAAC,KAAmD;QACpE,OAAO,IAAI,CAAC;IAChB,CAAC;;AALL,8BAMC;AAL4B,0BAAgB,GAAG,CAAC,yBAAe,EAAE,uBAAa,EAAE,mBAAW,EAAE,wBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/lib/model.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAsF;AACtF,qCAAuG;AACvG,mDAAwE;AACxE,kDAA+D;AAE/D,MAAa,SAAU,SAAQ,gBAAM;IAArC;;QAEI,UAAK,GAAG,KAAK,CAAC;IAIlB,CAAC;IAHG,oBAAoB,CAAC,KAAmD;QACpE,OAAO,IAAI,CAAC;IAChB,CAAC;;AALL,8BAMC;AAL4B,0BAAgB,GAAG,CAAC,yBAAe,EAAE,uBAAa,EAAE,mBAAW,EAAE,wBAAgB,CAAC,CAAC;AAOhH,MAAa,KAAM,SAAQ,eAAK;IACnB,aAAa,CAAC,KAAqB;QACxC,MAAM,MAAM,GAAG,IAAA,wBAAc,EAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG;YACX,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;YACrB,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;YACrB,KAAK,EAAE,CAAC,CAAC;YACT,MAAM,EAAE,CAAC,CAAC;SACb,CAAC;QACF,IAAI,IAAA,mBAAQ,EAAC,KAAK,CAAC,EAAE;YACjB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;YAC3B,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;SAChC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAEQ,aAAa,CAAC,KAAqB;QACxC,MAAM,MAAM,GAAG,IAAA,wBAAc,EAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG;YACX,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;YACrB,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;YACrB,KAAK,EAAE,CAAC,CAAC;YACT,MAAM,EAAE,CAAC,CAAC;SACb,CAAC;QACF,IAAI,IAAA,mBAAQ,EAAC,KAAK,CAAC,EAAE;YACjB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;YAC3B,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;SAChC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA9BD,sBA8BC"}
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2019 EclipseSource and others.
2
+ * Copyright (c) 2019-2020 EclipseSource 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
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createElementFromHTML = void 0;
4
4
  /********************************************************************************
5
- * Copyright (c) 2019 EclipseSource and others.
5
+ * Copyright (c) 2019-2020 EclipseSource and others.
6
6
  *
7
7
  * This program and the accompanying materials are made available under the
8
8
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.configureDefaultModelElements = void 0;
4
4
  /********************************************************************************
5
- * Copyright (c) 2021 EclipseSource and others.
5
+ * Copyright (c) 2021-2022 EclipseSource and others.
6
6
  *
7
7
  * This program and the accompanying materials are made available under the
8
8
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2017-2018 TypeFox and others.
2
+ * Copyright (c) 2017-2022 TypeFox 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
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /********************************************************************************
3
- * Copyright (c) 2017-2018 TypeFox and others.
3
+ * Copyright (c) 2017-2022 TypeFox and others.
4
4
  *
5
5
  * This program and the accompanying materials are made available under the
6
6
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2021 EclipseSource and others.
2
+ * Copyright (c) 2019-2022 EclipseSource 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
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  /********************************************************************************
18
- * Copyright (c) 2021 EclipseSource and others.
18
+ * Copyright (c) 2019-2022 EclipseSource and others.
19
19
  *
20
20
  * This program and the accompanying materials are made available under the
21
21
  * terms of the Eclipse Public License v. 2.0 which is available at
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@eclipse-glsp/client",
3
- "version": "1.1.0-next.6ec1da0.211+6ec1da0",
3
+ "version": "1.1.0-next.6efef44.226+6efef44",
4
4
  "description": "A sprotty-based client for GLSP",
5
- "license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
6
5
  "keywords": [
7
6
  "eclipse",
8
7
  "graphics",
@@ -12,15 +11,16 @@
12
11
  "glsp",
13
12
  "diagram editor"
14
13
  ],
15
- "author": {
16
- "name": "Eclipse GLSP"
17
- },
18
14
  "homepage": "https://www.eclipse.org/glsp/",
15
+ "bugs": "https://github.com/eclipse-glsp/glsp/issues",
19
16
  "repository": {
20
17
  "type": "git",
21
18
  "url": "https://github.com/eclipse-glsp/glsp-client.git"
22
19
  },
23
- "bugs": "https://github.com/eclipse-glsp/glsp/issues",
20
+ "license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
21
+ "author": {
22
+ "name": "Eclipse GLSP"
23
+ },
24
24
  "contributors": [
25
25
  {
26
26
  "name": "Eclipse GLSP Project",
@@ -28,19 +28,13 @@
28
28
  "url": "https://projects.eclipse.org/projects/ecd.glsp"
29
29
  }
30
30
  ],
31
+ "main": "lib/index",
32
+ "types": "lib/index",
31
33
  "files": [
32
34
  "lib",
33
35
  "src",
34
36
  "css"
35
37
  ],
36
- "dependencies": {
37
- "@eclipse-glsp/protocol": "1.1.0-next.6ec1da0.211+6ec1da0",
38
- "autocompleter": "5.1.0",
39
- "sprotty": "0.13.0-next.f4445dd.342"
40
- },
41
- "devDependencies": {
42
- "@vscode/codicons": "^0.0.25"
43
- },
44
38
  "scripts": {
45
39
  "build": "tsc -b",
46
40
  "clean": "rimraf lib tsconfig.tsbuildinfo coverage .nyc_output",
@@ -52,10 +46,16 @@
52
46
  "test:coverage": "nyc yarn test",
53
47
  "watch": "tsc -w"
54
48
  },
49
+ "dependencies": {
50
+ "@eclipse-glsp/protocol": "1.1.0-next.6efef44.226+6efef44",
51
+ "autocompleter": "5.1.0",
52
+ "sprotty": "0.13.0-next.f4445dd.342"
53
+ },
54
+ "devDependencies": {
55
+ "@vscode/codicons": "^0.0.25"
56
+ },
55
57
  "publishConfig": {
56
58
  "access": "public"
57
59
  },
58
- "main": "lib/index",
59
- "types": "lib/index",
60
- "gitHead": "6ec1da0e9ac292b05d1cc77790a2d063aae8f281"
60
+ "gitHead": "6efef44234a98cafc891ecefc015b6f6578d2f47"
61
61
  }
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2021 EclipseSource and others.
2
+ * Copyright (c) 2021-2023 EclipseSource 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
@@ -14,6 +14,7 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
 
17
+ import { remove } from '@eclipse-glsp/protocol';
17
18
  import { Container, ContainerModule } from 'inversify';
18
19
  import {
19
20
  buttonModule,
@@ -21,7 +22,6 @@ import {
21
22
  edgeIntersectionModule,
22
23
  edgeLayoutModule,
23
24
  expandModule,
24
- exportModule,
25
25
  fadeModule,
26
26
  labelEditUiModule,
27
27
  modelSourceModule,
@@ -35,6 +35,7 @@ import glspContextMenuModule from '../features/context-menu/di.config';
35
35
  import { glspServerCopyPasteModule } from '../features/copy-paste/di.config';
36
36
  import glspDecorationModule from '../features/decoration/di.config';
37
37
  import glspEditLabelModule from '../features/edit-label/di.config';
38
+ import glspExportModule from '../features/export/di.config';
38
39
  import modelHintsModule from '../features/hints/di.config';
39
40
  import glspHoverModule from '../features/hover/di.config';
40
41
  import layoutModule from '../features/layout/di.config';
@@ -56,7 +57,7 @@ export const DEFAULT_MODULES = [
56
57
  edgeIntersectionModule,
57
58
  edgeLayoutModule,
58
59
  expandModule,
59
- exportModule,
60
+ glspExportModule,
60
61
  fadeModule,
61
62
  glspBoundsModule,
62
63
  glspCommandPaletteModule,
@@ -83,7 +84,51 @@ export const DEFAULT_MODULES = [
83
84
  enableDefaultToolsOnFocusLossModule,
84
85
  validationModule,
85
86
  zorderModule
86
- ];
87
+ ] as const;
88
+
89
+ /**
90
+ * Creates a GLSP Diagram container with the GLSP default modules and the specified custom `modules`.
91
+ * Default modules can be excluded using {@link ExcludeDescription}s.
92
+ *
93
+ * This means, you can still customize the default modules in two ways.
94
+ *
95
+ * First, you can exclude default modules and add a module with your custom code.
96
+ *
97
+ * ```typescript
98
+ * const container = createDiagramContainer(myModule1, {exclude: modelSourceWatcherModule},myModelSourceWatcherModule );
99
+ * ```
100
+ *
101
+ * Second, you can unbind or rebind implementations that are originally bound in one of the default modules.
102
+ *
103
+ * ```typescript
104
+ * rebind(NavigationTargetResolver).to(MyNavigationTargetResolver);
105
+ * ```
106
+ *
107
+ * @param customModules Custom modules to be loaded in addition to the default modules and/or default modules that should be excluded.
108
+ * @param options Options to customize the module loading
109
+ * @returns The created container.
110
+ */
111
+ export function createDiagramContainer(...customModules: Array<ContainerModule | ExcludeDescription>): Container {
112
+ const container = new Container();
113
+
114
+ const modules = [...DEFAULT_MODULES];
115
+ customModules.forEach(customModule => {
116
+ if (customModule instanceof ContainerModule) {
117
+ modules.push(customModule);
118
+ } else {
119
+ remove(modules, customModule.exclude);
120
+ }
121
+ });
122
+ container.load(...modules);
123
+ return container;
124
+ }
125
+
126
+ /**
127
+ * Can be passed to the {@link createDiagramContainer} utility function to exclude (i.e. not load) a specific default module.
128
+ */
129
+ export interface ExcludeDescription {
130
+ exclude: ContainerModule;
131
+ }
87
132
 
88
133
  /**
89
134
  * Creates a GLSP Client container with the GLSP default modules and the specified custom `modules`.
@@ -105,9 +150,8 @@ export const DEFAULT_MODULES = [
105
150
  * ```
106
151
  * @param modules Custom modules to be loaded in addition to the default modules.
107
152
  * @returns The created container.
153
+ * @deprecated Please use `createDiagramContainer` from `@eclipse-glsp/client` instead
108
154
  */
109
155
  export function createClientContainer(...modules: ContainerModule[]): Container {
110
- const container = new Container();
111
- container.load(...DEFAULT_MODULES, ...modules);
112
- return container;
156
+ return createDiagramContainer(...modules);
113
157
  }
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2020 EclipseSource and others.
2
+ * Copyright (c) 2020-2022 EclipseSource 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
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2020 EclipseSource and others.
2
+ * Copyright (c) 2019-2021 EclipseSource 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
@@ -0,0 +1,28 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023 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 { configureCommand, ExportSvgCommand, ExportSvgKeyListener, ExportSvgPostprocessor, TYPES } from 'sprotty';
18
+ import { GLSPSvgExporter } from './glsp-svg-exporter';
19
+
20
+ const glspExportSvgModule = new ContainerModule((bind, _unbind, isBound) => {
21
+ bind(ExportSvgKeyListener).toSelf().inSingletonScope();
22
+ bind(TYPES.KeyListener).toService(ExportSvgKeyListener);
23
+ bind(TYPES.HiddenVNodePostprocessor).to(ExportSvgPostprocessor).inSingletonScope();
24
+ configureCommand({ bind, isBound }, ExportSvgCommand);
25
+ bind(TYPES.SvgExporter).to(GLSPSvgExporter).inSingletonScope();
26
+ });
27
+
28
+ export default glspExportSvgModule;
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2022 STMicroelectronics and others.
2
+ * Copyright (c) 2022-2023 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
@@ -30,7 +30,7 @@ import {
30
30
  SParentElement,
31
31
  TYPES
32
32
  } from 'sprotty';
33
- import { createClientContainer } from '../../../base/container-modules';
33
+ import { createDiagramContainer } from '../../../base/container-modules';
34
34
  import { GLSPGraph } from '../../../lib/model';
35
35
  import { StatefulLayouterExt } from '../layouter';
36
36
 
@@ -117,6 +117,6 @@ export function layout(
117
117
  export function setupLayoutRegistry(): LayoutRegistry {
118
118
  // Generic Test setup
119
119
  // create client container that registers all default modules including the layoutModule
120
- const layoutContainer = createClientContainer();
120
+ const layoutContainer = createDiagramContainer();
121
121
  return layoutContainer.get<LayoutRegistry>(TYPES.LayoutRegistry);
122
122
  }
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2019 EclipseSource and others.
2
+ * Copyright (c) 2019-2021 EclipseSource 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
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2020-2021 EclipseSource and others.
2
+ * Copyright (c) 2019-2022 EclipseSource 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,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 { Action, Bounds, Point } from '@eclipse-glsp/protocol';
16
+ import { Action, Bounds, Point, SEdgeSchema } from '@eclipse-glsp/protocol';
17
17
  import { inject, injectable } from 'inversify';
18
18
  import {
19
19
  AnchorComputerRegistry,
@@ -28,7 +28,6 @@ import {
28
28
  SChildElement,
29
29
  SConnectableElement,
30
30
  SDanglingAnchor,
31
- SEdge as SEdgeSchema,
32
31
  SModelElement,
33
32
  SModelRoot,
34
33
  SRoutableElement,
@@ -69,8 +68,7 @@ export class DrawFeedbackEdgeCommand extends FeedbackCommand {
69
68
  }
70
69
 
71
70
  execute(context: CommandExecutionContext): CommandReturn {
72
- const feedbackEdgeSchema = this.action.edgeSchema ? this.action.edgeSchema : defaultFeedbackEdgeSchema;
73
- drawFeedbackEdge(context, this.action.sourceId, this.action.elementTypeId, feedbackEdgeSchema);
71
+ drawFeedbackEdge(context, this.action.sourceId, this.action.elementTypeId, this.action.edgeSchema);
74
72
  return context.root;
75
73
  }
76
74
  }
@@ -195,16 +193,16 @@ export function feedbackEdgeEndId(root: SModelRoot): string {
195
193
  return root.id + '_feedback_anchor';
196
194
  }
197
195
 
198
- export const defaultFeedbackEdgeSchema: SEdgeSchema = {
196
+ export const defaultFeedbackEdgeSchema: Partial<SEdgeSchema> = {
199
197
  cssClasses: ['feedback-edge'],
200
198
  opacity: 0.3
201
- } as SEdgeSchema;
199
+ };
202
200
 
203
201
  export function drawFeedbackEdge(
204
202
  context: CommandExecutionContext,
205
203
  sourceId: string,
206
204
  elementTypeId: string,
207
- feedbackEdgeSchema: SEdgeSchema
205
+ edgeTemplate?: Partial<SEdgeSchema>
208
206
  ): void {
209
207
  const root = context.root;
210
208
  const sourceChild = root.index.getById(sourceId);
@@ -221,12 +219,16 @@ export function drawFeedbackEdge(
221
219
  edgeEnd.id = feedbackEdgeEndId(root);
222
220
  edgeEnd.position = toAbsolutePosition(source);
223
221
 
224
- feedbackEdgeSchema.id = feedbackEdgeId(root);
225
- feedbackEdgeSchema.type = elementTypeId;
226
- feedbackEdgeSchema.sourceId = source.id;
227
- feedbackEdgeSchema.targetId = edgeEnd.id;
222
+ const edgeSchema: SEdgeSchema = {
223
+ id: feedbackEdgeId(root),
224
+ type: elementTypeId,
225
+ sourceId: source.id,
226
+ targetId: edgeEnd.id,
227
+ ...defaultFeedbackEdgeSchema,
228
+ ...edgeTemplate
229
+ };
228
230
 
229
- const feedbackEdge = context.modelFactory.createElement(feedbackEdgeSchema);
231
+ const feedbackEdge = context.modelFactory.createElement(edgeSchema);
230
232
  if (isRoutable(feedbackEdge)) {
231
233
  edgeEnd.feedbackEdge = feedbackEdge;
232
234
  root.add(edgeEnd);
@@ -32,7 +32,6 @@ import {
32
32
  PolylineEdgeRouter,
33
33
  SConnectableElement,
34
34
  SModelElement,
35
- SModelRoot,
36
35
  SRoutingHandle,
37
36
  SwitchEditModeAction,
38
37
  SwitchEditModeCommand,
@@ -326,14 +325,7 @@ export class FeedbackEdgeRouteMovingMouseListener extends MouseListener {
326
325
  return undefined;
327
326
  }
328
327
 
329
- override mouseEnter(target: SModelElement, event: MouseEvent): Action[] {
330
- if (target instanceof SModelRoot && event.buttons === 0) {
331
- this.mouseUp(target, event);
332
- }
333
- return [];
334
- }
335
-
336
- override mouseUp(_target: SModelElement, event: MouseEvent): Action[] {
328
+ override mouseUp(_target: SModelElement, _event: MouseEvent): Action[] {
337
329
  this.pointPositionUpdater.resetPosition();
338
330
  return [];
339
331
  }
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2019-2022 EclipseSource and others.
2
+ * Copyright (c) 2019-2023 EclipseSource 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
@@ -18,7 +18,6 @@ import { ContainerModule, interfaces } from 'inversify';
18
18
  import { configureActionHandler, configureModelElement, ManhattanEdgeRouter } from 'sprotty';
19
19
  import { FocusStateChangedAction } from '../../base/actions/focus-change-action';
20
20
  import { TYPES } from '../../base/types';
21
- import { GLSPSvgExporter } from '../export/glsp-svg-exporter';
22
21
  import { MARQUEE } from '../tool-feedback/marquee-tool-feedback';
23
22
  import { ChangeBoundsTool } from './change-bounds-tool';
24
23
  import { DelKeyDeleteTool, MouseDeleteTool } from './delete-tool';
@@ -53,9 +52,6 @@ export const toolsModule = new ContainerModule((bind, _unbind, isBound, rebind)
53
52
  configureActionHandler({ bind, isBound }, TriggerNodeCreationAction.KIND, NodeCreationTool);
54
53
  configureActionHandler({ bind, isBound }, TriggerEdgeCreationAction.KIND, EdgeCreationTool);
55
54
 
56
- bind(GLSPSvgExporter).toSelf().inSingletonScope();
57
- rebind(TYPES.SvgExporter).toService(GLSPSvgExporter);
58
-
59
55
  bind(GSLPManhattanEdgeRouter).toSelf().inSingletonScope();
60
56
  rebind(ManhattanEdgeRouter).toService(GSLPManhattanEdgeRouter);
61
57
  });
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2019-2021 EclipseSource and others.
2
+ * Copyright (c) 2019-2022 EclipseSource 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
package/src/lib/model.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2019-2022 EclipseSource and others.
2
+ * Copyright (c) 2019-2023 EclipseSource 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,8 +13,8 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { SModelElementSchema } from '@eclipse-glsp/protocol';
17
- import { exportFeature, SGraph, SModelElement, viewportFeature } from 'sprotty';
16
+ import { Bounds, isBounds, Point, SModelElementSchema } from '@eclipse-glsp/protocol';
17
+ import { exportFeature, getRouteBounds, SEdge, SGraph, SModelElement, viewportFeature } from 'sprotty';
18
18
  import { Containable, containerFeature } from '../features/hints/model';
19
19
  import { Saveable, saveFeature } from '../features/save/model';
20
20
 
@@ -25,3 +25,35 @@ export class GLSPGraph extends SGraph implements Saveable, Containable {
25
25
  return true;
26
26
  }
27
27
  }
28
+
29
+ export class GEdge extends SEdge {
30
+ override localToParent(point: Point | Bounds): Bounds {
31
+ const bounds = getRouteBounds(this.routingPoints);
32
+ const result = {
33
+ x: point.x + bounds.x,
34
+ y: point.y + bounds.y,
35
+ width: -1,
36
+ height: -1
37
+ };
38
+ if (isBounds(point)) {
39
+ result.width = point.width;
40
+ result.height = point.height;
41
+ }
42
+ return result;
43
+ }
44
+
45
+ override parentToLocal(point: Point | Bounds): Bounds {
46
+ const bounds = getRouteBounds(this.routingPoints);
47
+ const result = {
48
+ x: point.x - bounds.x,
49
+ y: point.y - bounds.y,
50
+ width: -1,
51
+ height: -1
52
+ };
53
+ if (isBounds(point)) {
54
+ result.width = point.width;
55
+ result.height = point.height;
56
+ }
57
+ return result;
58
+ }
59
+ }
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2019 EclipseSource and others.
2
+ * Copyright (c) 2019-2020 EclipseSource 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
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2021 EclipseSource and others.
2
+ * Copyright (c) 2021-2022 EclipseSource 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
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2017-2018 TypeFox and others.
2
+ * Copyright (c) 2017-2022 TypeFox 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