@eclipse-glsp-examples/workflow-glsp 0.9.0-rc-01 → 0.10.0-next.146a812.165

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.
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2019 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,14 +13,14 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { GEdgeView, IView, Point, RenderingContext, SEdge } from '@eclipse-glsp/client';
17
- import { VNode } from 'snabbdom/vnode';
16
+ import { Point, PolylineEdgeViewWithGapsOnIntersections, RenderingContext, SEdge } from '@eclipse-glsp/client';
17
+ import { VNode } from 'snabbdom';
18
+ import { ShapeView } from 'sprotty';
18
19
  import { Icon } from './model';
19
- export declare class WorkflowEdgeView extends GEdgeView {
20
+ export declare class WorkflowEdgeView extends PolylineEdgeViewWithGapsOnIntersections {
20
21
  protected renderAdditionals(edge: SEdge, segments: Point[], context: RenderingContext): VNode[];
21
22
  }
22
- export declare class IconView implements IView {
23
- render(element: Icon, context: RenderingContext): VNode;
24
- getRadius(): number;
23
+ export declare class IconView extends ShapeView {
24
+ render(element: Icon, context: RenderingContext): VNode | undefined;
25
25
  }
26
26
  //# sourceMappingURL=workflow-views.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-views.d.ts","sourceRoot":"","sources":["../src/workflow-views.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAEH,SAAS,EACT,KAAK,EACL,KAAK,EACL,gBAAgB,EAChB,KAAK,EAER,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAK/B,qBACa,gBAAiB,SAAQ,SAAS;IAC3C,SAAS,CAAC,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,gBAAgB,GAAG,KAAK,EAAE;CASlG;AAED,qBACa,QAAS,YAAW,KAAK;IAClC,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,GAAG,KAAK;IAQvD,SAAS,IAAI,MAAM;CAGtB"}
1
+ {"version":3,"file":"workflow-views.d.ts","sourceRoot":"","sources":["../src/workflow-views.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAGH,KAAK,EACL,uCAAuC,EACvC,gBAAgB,EAChB,KAAK,EAGR,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAuB,SAAS,EAAO,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAc,MAAM,SAAS,CAAC;AAK3C,qBACa,gBAAiB,SAAQ,uCAAuC;cACtD,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,gBAAgB,GAAG,KAAK,EAAE;CAiB3G;AAED,qBACa,QAAS,SAAQ,SAAS;IACnC,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,GAAG,KAAK,GAAG,SAAS;CAsCtE"}
@@ -1,17 +1,4 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- extendStatics(d, b);
11
- function __() { this.constructor = d; }
12
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
- };
14
- })();
15
2
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
16
3
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
17
4
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -21,7 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
21
8
  Object.defineProperty(exports, "__esModule", { value: true });
22
9
  exports.IconView = exports.WorkflowEdgeView = void 0;
23
10
  /********************************************************************************
24
- * Copyright (c) 2019 EclipseSource and others.
11
+ * Copyright (c) 2019-2022 EclipseSource and others.
25
12
  *
26
13
  * This program and the accompanying materials are made available under the
27
14
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -35,46 +22,61 @@ exports.IconView = exports.WorkflowEdgeView = void 0;
35
22
  *
36
23
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
37
24
  ********************************************************************************/
38
- var client_1 = require("@eclipse-glsp/client");
39
- var inversify_1 = require("inversify");
40
- var snabbdom = require("snabbdom-jsx");
25
+ const client_1 = require("@eclipse-glsp/client");
26
+ const inversify_1 = require("inversify");
27
+ const sprotty_1 = require("sprotty");
28
+ const model_1 = require("./model");
41
29
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
42
- var JSX = { createElement: snabbdom.svg };
43
- var WorkflowEdgeView = /** @class */ (function (_super) {
44
- __extends(WorkflowEdgeView, _super);
45
- function WorkflowEdgeView() {
46
- return _super !== null && _super.apply(this, arguments) || this;
47
- }
48
- WorkflowEdgeView.prototype.renderAdditionals = function (edge, segments, context) {
49
- var additionals = _super.prototype.renderAdditionals.call(this, edge, segments, context);
50
- var p1 = segments[segments.length - 2];
51
- var p2 = segments[segments.length - 1];
52
- var arrow = JSX.createElement("path", { "class-sprotty-edge": true, "class-arrow": true, d: 'M 1.5,0 L 10,-4 L 10,4 Z', transform: "rotate(" + client_1.toDegrees(client_1.angleOfPoint({ x: p1.x - p2.x, y: p1.y - p2.y })) + " " + p2.x + " " + p2.y + ") translate(" + p2.x + " " + p2.y + ")" });
30
+ const JSX = { createElement: sprotty_1.svg };
31
+ let WorkflowEdgeView = class WorkflowEdgeView extends client_1.PolylineEdgeViewWithGapsOnIntersections {
32
+ renderAdditionals(edge, segments, context) {
33
+ const additionals = super.renderAdditionals(edge, segments, context);
34
+ const p1 = segments[segments.length - 2];
35
+ const p2 = segments[segments.length - 1];
36
+ const arrow = (JSX.createElement("path", { "class-sprotty-edge": true, "class-arrow": true, d: 'M 1,0 L 10,-4 L 10,4 Z', transform: `rotate(${(0, client_1.toDegrees)((0, client_1.angleOfPoint)({ x: p1.x - p2.x, y: p1.y - p2.y }))} ${p2.x} ${p2.y}) translate(${p2.x} ${p2.y})` }));
53
37
  additionals.push(arrow);
54
38
  return additionals;
55
- };
56
- WorkflowEdgeView = __decorate([
57
- inversify_1.injectable()
58
- ], WorkflowEdgeView);
59
- return WorkflowEdgeView;
60
- }(client_1.GEdgeView));
39
+ }
40
+ };
41
+ WorkflowEdgeView = __decorate([
42
+ (0, inversify_1.injectable)()
43
+ ], WorkflowEdgeView);
61
44
  exports.WorkflowEdgeView = WorkflowEdgeView;
62
- var IconView = /** @class */ (function () {
63
- function IconView() {
45
+ let IconView = class IconView extends sprotty_1.ShapeView {
46
+ render(element, context) {
47
+ const taskNode = (0, sprotty_1.findParentByFeature)(element, model_1.isTaskNode);
48
+ if (!taskNode || !this.isVisible(element, context)) {
49
+ return undefined;
50
+ }
51
+ let icon;
52
+ if (taskNode.type === 'task:manual') {
53
+ // From codicons: https://github.com/microsoft/vscode-codicons/blob/main/src/icons/account.svg?short_path=8135b2d
54
+ icon =
55
+ // eslint-disable-next-line max-len
56
+ 'M16 7.992C16 3.58 12.416 0 8 0S0 3.58 0 7.992c0 2.43 1.104 4.62 2.832 6.09.016.016.032.016.032.032.144.112.288.224.448.336.08.048.144.111.224.175A7.98 7.98 0 0 0 8.016 16a7.98 7.98 0 0 0 4.48-1.375c.08-.048.144-.111.224-.16.144-.111.304-.223.448-.335.016-.016.032-.016.032-.032 1.696-1.487 2.8-3.676 2.8-6.106zm-8 7.001c-1.504 0-2.88-.48-4.016-1.279.016-.128.048-.255.08-.383a4.17 4.17 0 0 1 .416-.991c.176-.304.384-.576.64-.816.24-.24.528-.463.816-.639.304-.176.624-.304.976-.4A4.15 4.15 0 0 1 8 10.342a4.185 4.185 0 0 1 2.928 1.166c.368.368.656.8.864 1.295.112.288.192.592.24.911A7.03 7.03 0 0 1 8 14.993zm-2.448-7.4a2.49 2.49 0 0 1-.208-1.024c0-.351.064-.703.208-1.023.144-.32.336-.607.576-.847.24-.24.528-.431.848-.575.32-.144.672-.208 1.024-.208.368 0 .704.064 1.024.208.32.144.608.336.848.575.24.24.432.528.576.847.144.32.208.672.208 1.023 0 .368-.064.704-.208 1.023a2.84 2.84 0 0 1-.576.848 2.84 2.84 0 0 1-.848.575 2.715 2.715 0 0 1-2.064 0 2.84 2.84 0 0 1-.848-.575 2.526 2.526 0 0 1-.56-.848zm7.424 5.306c0-.032-.016-.048-.016-.08a5.22 5.22 0 0 0-.688-1.406 4.883 4.883 0 0 0-1.088-1.135 5.207 5.207 0 0 0-1.04-.608 2.82 2.82 0 0 0 .464-.383 4.2 4.2 0 0 0 .624-.784 3.624 3.624 0 0 0 .528-1.934 3.71 3.71 0 0 0-.288-1.47 3.799 3.799 0 0 0-.816-1.199 3.845 3.845 0 0 0-1.2-.8 3.72 3.72 0 0 0-1.472-.287 3.72 3.72 0 0 0-1.472.288 3.631 3.631 0 0 0-1.2.815 3.84 3.84 0 0 0-.8 1.199 3.71 3.71 0 0 0-.288 1.47c0 .352.048.688.144 1.007.096.336.224.64.4.927.16.288.384.544.624.784.144.144.304.271.48.383a5.12 5.12 0 0 0-1.04.624c-.416.32-.784.703-1.088 1.119a4.999 4.999 0 0 0-.688 1.406c-.016.032-.016.064-.016.08C1.776 11.636.992 9.91.992 7.992.992 4.14 4.144.991 8 .991s7.008 3.149 7.008 7.001a6.96 6.96 0 0 1-2.032 4.907z';
57
+ }
58
+ else {
59
+ // From codicons: https://github.com/microsoft/vscode-codicons/blob/main/src/icons/gear.svg?short_path=8ee3ec4
60
+ icon =
61
+ // eslint-disable-next-line max-len
62
+ 'M9.1 4.4L8.6 2H7.4l-.5 2.4-.7.3-2-1.3-.9.8 1.3 2-.2.7-2.4.5v1.2l2.4.5.3.8-1.3 2 .8.8 2-1.3.8.3.4 2.3h1.2l.5-2.4.8-.3 2 1.3.8-.8-1.3-2 .3-.8 2.3-.4V7.4l-2.4-.5-.3-.8 1.3-2-.8-.8-2 1.3-.7-.2zM9.4 1l.5 2.4L12 2.1l2 2-1.4 2.1 2.4.4v2.8l-2.4.5L14 12l-2 2-2.1-1.4-.5 2.4H6.6l-.5-2.4L4 13.9l-2-2 1.4-2.1L1 9.4V6.6l2.4-.5L2.1 4l2-2 2.1 1.4.4-2.4h2.8zm.6 7c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zM8 9c.6 0 1-.4 1-1s-.4-1-1-1-1 .4-1 1 .4 1 1 1z';
63
+ }
64
+ const vnode = (JSX.createElement("g", null,
65
+ JSX.createElement("path", { transform: 'scale(1.15),translate(0.75,0.75)',
66
+ // From codicons: https://github.com/microsoft/vscode-codicons/blob/main/src/icons/terminal.svg?short_path=2ffc08e
67
+ // eslint-disable-next-line max-len
68
+ d: icon }),
69
+ JSX.createElement("rect", { "class-icon-background": true, x: 0, y: 0, width: 25, height: 20 }),
70
+ context.renderChildren(element)));
71
+ const subType = (0, client_1.getSubType)(element);
72
+ if (subType) {
73
+ (0, client_1.setAttr)(vnode, 'class', subType);
74
+ }
75
+ return vnode;
64
76
  }
65
- IconView.prototype.render = function (element, context) {
66
- var radius = this.getRadius();
67
- return JSX.createElement("g", null,
68
- JSX.createElement("circle", { "class-sprotty-icon": true, r: radius, cx: radius, cy: radius }),
69
- context.renderChildren(element));
70
- };
71
- IconView.prototype.getRadius = function () {
72
- return 16;
73
- };
74
- IconView = __decorate([
75
- inversify_1.injectable()
76
- ], IconView);
77
- return IconView;
78
- }());
77
+ };
78
+ IconView = __decorate([
79
+ (0, inversify_1.injectable)()
80
+ ], IconView);
79
81
  exports.IconView = IconView;
80
82
  //# sourceMappingURL=workflow-views.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-views.js","sourceRoot":"","sources":["../src/workflow-views.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,+CAQ8B;AAC9B,uCAAuC;AACvC,uCAAyC;AAKzC,6DAA6D;AAC7D,IAAM,GAAG,GAAG,EAAE,aAAa,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC;AAG5C;IAAsC,oCAAS;IAA/C;;IAUA,CAAC;IATa,4CAAiB,GAA3B,UAA4B,IAAW,EAAE,QAAiB,EAAE,OAAyB;QACjF,IAAM,WAAW,GAAG,iBAAM,iBAAiB,YAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QACrE,IAAM,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACzC,IAAM,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACzC,IAAM,KAAK,GAAG,kDAA0B,IAAI,iBAAe,IAAI,EAAE,CAAC,EAAC,0BAA0B,EACzF,SAAS,EAAE,YAAU,kBAAS,CAAC,qBAAY,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,SAAI,EAAE,CAAC,CAAC,SAAI,EAAE,CAAC,CAAC,oBAAe,E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,kCAAkC;gBAC7C,kHAAkH;gBAClH,mCAAmC;gBACnC,CAAC,EAAE,IAAI,GACT;YACF,2DAA4B,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,GAAI;YAChE,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAChC,CACP,CAAC;QAEF,MAAM,OAAO,GAAG,IAAA,mBAAU,EAAC,OAAO,CAAC,CAAC;QACpC,IAAI,OAAO,EAAE;YACT,IAAA,gBAAO,EAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SACpC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ,CAAA;AAvCY,QAAQ;IADpB,IAAA,sBAAU,GAAE;GACA,QAAQ,CAuCpB;AAvCY,4BAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-glsp-examples/workflow-glsp",
3
- "version": "0.9.0-rc-01",
3
+ "version": "0.10.0-next.146a812.165+146a812",
4
4
  "description": "GLSP diagrams for the Workflow DSL",
5
5
  "license": "(EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)",
6
6
  "keywords": [
@@ -20,33 +20,21 @@
20
20
  "bugs": "https://github.com/eclipse-glsp/glsp/issues",
21
21
  "contributors": [
22
22
  {
23
- "name": "Philip Langer",
24
- "email": "planger@eclipsesource.com",
25
- "url": "https://www.eclipsesource.com"
26
- },
27
- {
28
- "name": "Tobias Ortmayr",
29
- "email": "tortmayr@eclipsesource.com",
30
- "url": "https://www.eclipsesource.com"
31
- },
32
- {
33
- "name": "Martin Fleck",
34
- "email": "mfleck@eclipsesource.com",
35
- "url": "https://www.eclipsesource.com"
23
+ "name": "Eclipse GLSP Project",
24
+ "email": "glsp-dev@eclipse.org",
25
+ "url": "https://projects.eclipse.org/projects/ecd.glsp"
36
26
  }
37
27
  ],
38
28
  "dependencies": {
39
- "@eclipse-glsp/client": "0.9.0-rc-01",
29
+ "@eclipse-glsp/client": "0.10.0-next.146a812.165+146a812",
40
30
  "balloon-css": "^0.5.0"
41
31
  },
42
32
  "devDependencies": {
43
- "mvn-artifact-download": "5.1.0",
44
- "rimraf": "^2.6.1",
45
- "typescript": "^3.9.2"
33
+ "mvn-artifact-download": "5.1.0"
46
34
  },
47
35
  "scripts": {
48
36
  "prepare": "yarn clean && yarn build && yarn lint",
49
- "clean": "rimraf lib",
37
+ "clean": "rimraf tsconfig.tsbuildinfo lib",
50
38
  "build": "tsc",
51
39
  "lint": "eslint -c ./.eslintrc.js --ext .ts,.tsx ./src",
52
40
  "watch": "tsc -w"
@@ -62,5 +50,6 @@
62
50
  "types": "lib/index",
63
51
  "publishConfig": {
64
52
  "access": "public"
65
- }
53
+ },
54
+ "gitHead": "146a8123986421e7a3a9e867d0ded74dd6dec2c0"
66
55
  }
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2020 EclipseSource and others.
2
+ * Copyright (c) 2020-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
@@ -13,20 +13,23 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import download from "mvn-artifact-download";
17
- import { join, resolve } from "path";
16
+ import download from 'mvn-artifact-download';
17
+ import { join, resolve } from 'path';
18
18
 
19
- const downloadDir = resolve(join(__dirname)) + "/../../..";
20
- const mavenRepository = "https://oss.sonatype.org/content/repositories/snapshots/";
21
- const groupId = "org.eclipse.glsp.example";
22
- const artifactId = "org.eclipse.glsp.example.workflow";
23
- const version = "0.9.0";
24
- const classifier = "glsp";
19
+ const downloadDir = resolve(join(__dirname)) + '/../../..';
20
+ const mavenRepository = 'https://oss.sonatype.org/content/repositories/snapshots/';
21
+ const groupId = 'org.eclipse.glsp.example';
22
+ const artifactId = 'org.eclipse.glsp.example.workflow';
23
+ const version = '0.9.0';
24
+ const classifier = 'glsp';
25
25
 
26
- console.log("Downloading latest version of the Workflow Example Java Server from the maven repository...");
27
- download({ groupId, artifactId, version, classifier, isSnapShot: true }, downloadDir, mavenRepository)
28
- .then(() => console.log("Download completed. Start the server using this command: \njava -jar org.eclipse.glsp.example.workflow-"
29
- + version + "-SNAPSHOT-glsp.jar org.eclipse.glsp.example.workflow.launch.ExampleServerLauncher --port=8081 --websocket\n\n"
30
- + "After starting the server, access the following file locally in your browser to see the running example:\n"
31
- + "./examples/workflow-standalone/app/diagram.html"
32
- ));
26
+ console.log('Downloading latest version of the Workflow Example Java Server from the maven repository...');
27
+ download({ groupId, artifactId, version, classifier, isSnapShot: true }, downloadDir, mavenRepository).then(() =>
28
+ console.log(
29
+ 'Download completed. Start the server using this command: \njava -jar org.eclipse.glsp.example.workflow-' +
30
+ version +
31
+ '-SNAPSHOT-glsp.jar org.eclipse.glsp.example.workflow.launch.ExampleServerLauncher --port=8081 --websocket\n\n' +
32
+ 'After starting the server, access the following file locally in your browser to see the running example:\n' +
33
+ './examples/workflow-standalone/app/diagram.html'
34
+ )
35
+ );
package/src/di.config.ts CHANGED
@@ -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
@@ -13,74 +13,40 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import '../css/diagram.css';
17
- import 'balloon-css/balloon.min.css';
18
- import 'sprotty/css/edit-label.css';
19
-
20
16
  import {
21
- boundsModule,
22
- buttonModule,
23
17
  configureDefaultModelElements,
24
18
  configureModelElement,
25
19
  ConsoleLogger,
26
- defaultGLSPModule,
27
- defaultModule,
28
- DefaultTypes,
20
+ createClientContainer,
29
21
  DeleteElementContextMenuItemProvider,
30
22
  DiamondNodeView,
31
- edgeLayoutModule,
32
23
  editLabelFeature,
33
- expandModule,
34
- exportModule,
35
- fadeModule,
36
- GLSP_TYPES,
37
- glspCommandPaletteModule,
38
- glspContextMenuModule,
39
- glspDecorationModule,
40
- glspEditLabelModule,
41
- glspHoverModule,
42
- glspMouseToolModule,
43
- glspSelectModule,
44
- glspServerCopyPasteModule,
45
- glspViewportModule,
46
24
  GridSnapper,
47
- labelEditUiModule,
48
- layoutCommandsModule,
49
25
  LogLevel,
50
- markerNavigatorModule,
51
- modelHintsModule,
52
- modelSourceModule,
53
- modelSourceWatcherModule,
54
- navigationModule,
55
- NoOverlapMovmentRestrictor,
56
- openModule,
57
26
  overrideViewerOptions,
58
- paletteModule,
27
+ RectangularNodeView,
59
28
  RevealNamedElementActionProvider,
60
29
  RoundedCornerNodeView,
61
- routingModule,
62
30
  SCompartment,
63
31
  SCompartmentView,
64
32
  SEdge,
65
33
  SLabel,
66
34
  SLabelView,
67
- toolFeedbackModule,
68
- toolsModule,
69
- TYPES,
70
- validationModule,
71
- zorderModule,
72
- RectangularNodeView
35
+ StructureCompartmentView,
36
+ TYPES
73
37
  } from '@eclipse-glsp/client';
38
+ import { DefaultTypes } from '@eclipse-glsp/protocol';
39
+ import 'balloon-css/balloon.min.css';
74
40
  import { Container, ContainerModule } from 'inversify';
75
-
41
+ import 'sprotty/css/edit-label.css';
42
+ import '../css/diagram.css';
76
43
  import { directTaskEditor } from './direct-task-editing/di.config';
77
- import { ActivityNode, Icon, TaskNode, WeightedEdge } from './model';
44
+ import { ActivityNode, CategoryNode, Icon, TaskNode, WeightedEdge } from './model';
78
45
  import { IconView, WorkflowEdgeView } from './workflow-views';
79
46
 
80
47
  const workflowDiagramModule = new ContainerModule((bind, unbind, isBound, rebind) => {
81
48
  rebind(TYPES.ILogger).to(ConsoleLogger).inSingletonScope();
82
49
  rebind(TYPES.LogLevel).toConstantValue(LogLevel.warn);
83
- bind(GLSP_TYPES.IMovementRestrictor).to(NoOverlapMovmentRestrictor).inSingletonScope();
84
50
  bind(TYPES.ISnapper).to(GridSnapper);
85
51
  bind(TYPES.ICommandPaletteActionProvider).to(RevealNamedElementActionProvider);
86
52
  bind(TYPES.IContextMenuItemProvider).to(DeleteElementContextMenuItemProvider);
@@ -100,21 +66,16 @@ const workflowDiagramModule = new ContainerModule((bind, unbind, isBound, rebind
100
66
  configureModelElement(context, 'activityNode:decision', ActivityNode, DiamondNodeView);
101
67
  configureModelElement(context, 'activityNode:fork', ActivityNode, RectangularNodeView);
102
68
  configureModelElement(context, 'activityNode:join', ActivityNode, RectangularNodeView);
69
+
70
+ configureModelElement(context, 'category', CategoryNode, RoundedCornerNodeView);
71
+ configureModelElement(context, 'struct', SCompartment, StructureCompartmentView);
103
72
  });
104
73
 
105
74
  export default function createContainer(widgetId: string): Container {
106
- const container = new Container();
107
-
108
- container.load(defaultModule, defaultGLSPModule, glspMouseToolModule, validationModule, glspSelectModule, boundsModule, glspViewportModule, toolsModule,
109
- glspHoverModule, fadeModule, exportModule, expandModule, openModule, buttonModule, modelSourceModule, labelEditUiModule, glspEditLabelModule,
110
- workflowDiagramModule, toolFeedbackModule, modelHintsModule, glspContextMenuModule, glspServerCopyPasteModule, modelSourceWatcherModule,
111
- glspCommandPaletteModule, paletteModule, routingModule, glspDecorationModule, edgeLayoutModule, zorderModule,
112
- layoutCommandsModule, directTaskEditor, navigationModule, markerNavigatorModule);
113
-
75
+ const container = createClientContainer(workflowDiagramModule, directTaskEditor);
114
76
  overrideViewerOptions(container, {
115
77
  baseDiv: widgetId,
116
78
  hiddenDiv: widgetId + '_hidden'
117
79
  });
118
-
119
80
  return container;
120
81
  }
@@ -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
@@ -34,20 +34,18 @@ import {
34
34
  ViewerOptions
35
35
  } from '@eclipse-glsp/client';
36
36
  import { inject, injectable } from 'inversify';
37
- import { TYPES } from 'sprotty/lib';
37
+ import { SModelIndex, TYPES } from 'sprotty/lib';
38
38
  import { DOMHelper } from 'sprotty/lib/base/views/dom-helper';
39
-
40
39
  import { isTaskNode, TaskNode } from '../model';
41
40
 
42
41
  export class ApplyTaskEditOperation implements Action {
43
42
  static readonly KIND = 'applyTaskEdit';
44
43
  readonly kind = ApplyTaskEditOperation.KIND;
45
- constructor(readonly taskId: string, readonly expression: string) { }
44
+ constructor(readonly taskId: string, readonly expression: string) {}
46
45
  }
47
46
 
48
47
  @injectable()
49
48
  export class TaskEditor extends AbstractUIExtension {
50
-
51
49
  static readonly ID = 'task-editor';
52
50
  readonly autoSuggestionSettings = {
53
51
  noSuggestionsMessage: 'No suggestions available',
@@ -69,7 +67,7 @@ export class TaskEditor extends AbstractUIExtension {
69
67
  protected domHelper: DOMHelper;
70
68
 
71
69
  @inject(TYPES.ILogger)
72
- protected logger: ILogger;
70
+ protected override logger: ILogger;
73
71
 
74
72
  protected task: TaskNode;
75
73
  protected autoSuggestion: AutoCompleteWidget;
@@ -86,24 +84,26 @@ export class TaskEditor extends AbstractUIExtension {
86
84
  this.autoSuggestionSettings,
87
85
  { provideSuggestions: input => this.retrieveSuggestions(input) },
88
86
  { executeFromSuggestion: input => this.executeFromSuggestion(input) },
89
- () => this.hide(), this.logger);
87
+ () => this.hide(),
88
+ this.logger
89
+ );
90
90
  this.autoSuggestion.configureValidation(
91
91
  { validate: input => this.validateInput(input) },
92
92
  new ValidationDecorator(containerElement)
93
93
  );
94
- this.autoSuggestion.configureTextSubmitHandler(
95
- { executeFromTextOnlyInput: (input: string) => this.executeFromTextOnlyInput(input) }
96
- );
94
+ this.autoSuggestion.configureTextSubmitHandler({
95
+ executeFromTextOnlyInput: (input: string) => this.executeFromTextOnlyInput(input)
96
+ });
97
97
  this.autoSuggestion.initialize(containerElement);
98
98
  }
99
99
 
100
- show(root: Readonly<SModelRoot>, ...contextElementIds: string[]): void {
100
+ override show(root: Readonly<SModelRoot>, ...contextElementIds: string[]): void {
101
101
  super.show(root, ...contextElementIds);
102
102
  this.autoSuggestion.open(root);
103
103
  }
104
104
 
105
- protected onBeforeShow(containerElement: HTMLElement, root: Readonly<SModelRoot>, ...contextElementIds: string[]): void {
106
- this.task = getTask(contextElementIds, root)[0];
105
+ protected override onBeforeShow(containerElement: HTMLElement, root: Readonly<SModelRoot>, ...contextElementIds: string[]): void {
106
+ this.task = getTask(contextElementIds, root.index)[0];
107
107
  this.autoSuggestion.inputField.value = '';
108
108
  this.setPosition(containerElement);
109
109
  }
@@ -124,8 +124,9 @@ export class TaskEditor extends AbstractUIExtension {
124
124
  }
125
125
 
126
126
  protected async retrieveSuggestions(input: string): Promise<LabeledAction[]> {
127
- const response = await this.actionDispatcher.request(new RequestContextActions(TaskEditor.ID,
128
- this.editorContextService.get({ ['text']: input })));
127
+ const response = await this.actionDispatcher.request(
128
+ new RequestContextActions(TaskEditor.ID, this.editorContextService.get({ ['text']: input }))
129
+ );
129
130
  if (isSetContextActionsAction(response)) {
130
131
  return response.actions;
131
132
  }
@@ -149,12 +150,12 @@ export class TaskEditor extends AbstractUIExtension {
149
150
  this.actionDispatcher.dispatch(action);
150
151
  }
151
152
 
152
- hide(): void {
153
+ override hide(): void {
153
154
  this.autoSuggestion.dispose();
154
155
  super.hide();
155
156
  }
156
157
  }
157
158
 
158
- function getTask(ids: string[], element: SModelElement): TaskNode[] {
159
- return ids.map(id => element.index.getById(id)).filter(isTaskNode);
159
+ function getTask(ids: string[], index: SModelIndex<SModelElement>): TaskNode[] {
160
+ return ids.map(id => index.getById(id)).filter(element => element && isTaskNode(element)) as TaskNode[];
160
161
  }
package/src/index.ts CHANGED
@@ -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
@@ -19,4 +19,3 @@ export * from './model';
19
19
  export * from './workflow-views';
20
20
  export * from './direct-task-editing/direct-task-editor';
21
21
  export { createWorkflowDiagramContainer };
22
-
package/src/model.ts CHANGED
@@ -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
@@ -40,23 +40,35 @@ import {
40
40
  } from '@eclipse-glsp/client';
41
41
 
42
42
  export class TaskNode extends RectangularNode implements Nameable, WithEditableLabel {
43
- static readonly DEFAULT_FEATURES = [connectableFeature, deletableFeature, selectFeature, boundsFeature,
44
- moveFeature, layoutContainerFeature, fadeFeature, hoverFeedbackFeature, popupFeature, nameFeature, withEditLabelFeature];
45
- name = '';
43
+ static override readonly DEFAULT_FEATURES = [
44
+ connectableFeature,
45
+ deletableFeature,
46
+ selectFeature,
47
+ boundsFeature,
48
+ moveFeature,
49
+ layoutContainerFeature,
50
+ fadeFeature,
51
+ hoverFeedbackFeature,
52
+ popupFeature,
53
+ nameFeature,
54
+ withEditLabelFeature
55
+ ];
46
56
  duration?: number;
47
57
  taskType?: string;
48
58
  reference?: string;
49
59
 
50
60
  get editableLabel(): (SChildElement & EditableLabel) | undefined {
51
- const headerComp = this.children.find(element => element.type === 'comp:header');
52
- if (headerComp) {
53
- const label = headerComp.children.find(element => element.type === 'label:heading');
54
- if (label && isEditableLabel(label)) {
55
- return label;
56
- }
61
+ const label = this.children.find(element => element.type === 'label:heading');
62
+ if (label && isEditableLabel(label)) {
63
+ return label;
57
64
  }
58
65
  return undefined;
59
66
  }
67
+
68
+ get name(): string {
69
+ const labelText = this.editableLabel?.text;
70
+ return labelText ? labelText : '<unknown>';
71
+ }
60
72
  }
61
73
 
62
74
  export function isTaskNode(element: SModelElement): element is TaskNode {
@@ -69,14 +81,13 @@ export class WeightedEdge extends SEdge {
69
81
 
70
82
  export class ActivityNode extends DiamondNode {
71
83
  nodeType: string = ActivityNode.Type.UNDEFINED;
72
- size = {
84
+ override size = {
73
85
  width: 32,
74
86
  height: 32
75
87
  };
76
- strokeWidth = 1;
88
+ override strokeWidth = 1;
77
89
  }
78
90
 
79
- // eslint-disable-next-line no-redeclare
80
91
  export namespace ActivityNode {
81
92
  export namespace Type {
82
93
  export const INITIAL = 'initalNode';
@@ -93,9 +104,34 @@ export class Icon extends SShapeElement implements LayoutContainer {
93
104
  static readonly DEFAULT_FEATURES = [boundsFeature, layoutContainerFeature, layoutableChildFeature, fadeFeature];
94
105
 
95
106
  layout: string;
96
- layoutOptions?: { [key: string]: string | number | boolean };
97
- size = {
107
+ override layoutOptions?: { [key: string]: string | number | boolean };
108
+ override size = {
98
109
  width: 32,
99
110
  height: 32
100
111
  };
101
112
  }
113
+
114
+ export class CategoryNode extends RectangularNode implements Nameable, WithEditableLabel {
115
+ static override readonly DEFAULT_FEATURES = [
116
+ deletableFeature,
117
+ selectFeature,
118
+ boundsFeature,
119
+ moveFeature,
120
+ layoutContainerFeature,
121
+ fadeFeature,
122
+ hoverFeedbackFeature,
123
+ popupFeature,
124
+ nameFeature,
125
+ withEditLabelFeature
126
+ ];
127
+
128
+ name = '';
129
+
130
+ get editableLabel(): (SChildElement & EditableLabel) | undefined {
131
+ const label = this.children.find(element => element.type === 'label:heading');
132
+ if (label && isEditableLabel(label)) {
133
+ return label;
134
+ }
135
+ return undefined;
136
+ }
137
+ }