@eclipse-glsp/client 1.1.0-next.4fe94e1.224 → 1.1.0-next.5a004c2.229
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.d.ts +15 -7
- package/lib/base/container-modules.d.ts.map +1 -1
- package/lib/base/container-modules.js +14 -4
- package/lib/base/container-modules.js.map +1 -1
- package/lib/features/tool-feedback/creation-tool-feedback.d.ts +6 -6
- package/lib/features/tool-feedback/creation-tool-feedback.d.ts.map +1 -1
- package/lib/features/tool-feedback/creation-tool-feedback.js +4 -8
- package/lib/features/tool-feedback/creation-tool-feedback.js.map +1 -1
- package/package.json +3 -3
- package/src/base/container-modules.ts +21 -9
- package/src/features/tool-feedback/creation-tool-feedback.ts +20 -14
|
@@ -13,18 +13,24 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
import { MaybeArray } from '@eclipse-glsp/protocol';
|
|
16
17
|
import { Container, ContainerModule } from 'inversify';
|
|
17
18
|
export declare const DEFAULT_MODULES: readonly [ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule, ContainerModule];
|
|
18
19
|
/**
|
|
19
20
|
* Creates a GLSP Diagram container with the GLSP default modules and the specified custom `modules`.
|
|
20
|
-
*
|
|
21
|
-
*
|
|
21
|
+
* Additional modules can be passed as direct arguments or as part of a {@link ModuleConfiguration}.
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const container= createDiagramContainer(myModule1, myModule2)
|
|
24
|
+
* // or
|
|
25
|
+
* const container= createDiagramContainer({ add: [myModule1, myModule2]})
|
|
26
|
+
* ```
|
|
27
|
+
* Default modules can be excluded using {@link ModuleConfiguration}s.
|
|
22
28
|
* This means, you can still customize the default modules in two ways.
|
|
23
29
|
*
|
|
24
30
|
* First, you can exclude default modules and add a module with your custom code.
|
|
25
31
|
*
|
|
26
32
|
* ```typescript
|
|
27
|
-
* const container = createDiagramContainer(
|
|
33
|
+
* const container = createDiagramContainer({ add:myModelSourceWatcherModule, remove: modelSourceWatcherModule} );
|
|
28
34
|
* ```
|
|
29
35
|
*
|
|
30
36
|
* Second, you can unbind or rebind implementations that are originally bound in one of the default modules.
|
|
@@ -37,12 +43,14 @@ export declare const DEFAULT_MODULES: readonly [ContainerModule, ContainerModule
|
|
|
37
43
|
* @param options Options to customize the module loading
|
|
38
44
|
* @returns The created container.
|
|
39
45
|
*/
|
|
40
|
-
export declare function createDiagramContainer(...customModules: Array<ContainerModule |
|
|
46
|
+
export declare function createDiagramContainer(...customModules: Array<ContainerModule | ModuleConfiguration>): Container;
|
|
41
47
|
/**
|
|
42
|
-
* Can be passed to the {@link createDiagramContainer} utility function to
|
|
48
|
+
* Can be passed to the {@link createDiagramContainer} utility function to configure additional modules or
|
|
49
|
+
* remove (i.e. not load) default modules.
|
|
43
50
|
*/
|
|
44
|
-
export interface
|
|
45
|
-
|
|
51
|
+
export interface ModuleConfiguration {
|
|
52
|
+
add?: MaybeArray<ContainerModule>;
|
|
53
|
+
remove?: MaybeArray<ContainerModule>;
|
|
46
54
|
}
|
|
47
55
|
/**
|
|
48
56
|
* Creates a GLSP Client container with the GLSP default modules and the specified custom `modules`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container-modules.d.ts","sourceRoot":"","sources":["../../src/base/container-modules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;
|
|
1
|
+
{"version":3,"file":"container-modules.d.ts","sourceRoot":"","sources":["../../src/base/container-modules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAwB,UAAU,EAAU,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAmCvD,eAAO,MAAM,eAAe,4jBAkClB,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,aAAa,EAAE,KAAK,CAAC,eAAe,GAAG,mBAAmB,CAAC,GAAG,SAAS,CAkBhH;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAChC,GAAG,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;IAClC,MAAM,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,OAAO,EAAE,eAAe,EAAE,GAAG,SAAS,CAE9E"}
|
|
@@ -76,14 +76,19 @@ exports.DEFAULT_MODULES = [
|
|
|
76
76
|
];
|
|
77
77
|
/**
|
|
78
78
|
* Creates a GLSP Diagram container with the GLSP default modules and the specified custom `modules`.
|
|
79
|
-
*
|
|
80
|
-
*
|
|
79
|
+
* Additional modules can be passed as direct arguments or as part of a {@link ModuleConfiguration}.
|
|
80
|
+
* ```typescript
|
|
81
|
+
* const container= createDiagramContainer(myModule1, myModule2)
|
|
82
|
+
* // or
|
|
83
|
+
* const container= createDiagramContainer({ add: [myModule1, myModule2]})
|
|
84
|
+
* ```
|
|
85
|
+
* Default modules can be excluded using {@link ModuleConfiguration}s.
|
|
81
86
|
* This means, you can still customize the default modules in two ways.
|
|
82
87
|
*
|
|
83
88
|
* First, you can exclude default modules and add a module with your custom code.
|
|
84
89
|
*
|
|
85
90
|
* ```typescript
|
|
86
|
-
* const container = createDiagramContainer(
|
|
91
|
+
* const container = createDiagramContainer({ add:myModelSourceWatcherModule, remove: modelSourceWatcherModule} );
|
|
87
92
|
* ```
|
|
88
93
|
*
|
|
89
94
|
* Second, you can unbind or rebind implementations that are originally bound in one of the default modules.
|
|
@@ -104,7 +109,12 @@ function createDiagramContainer(...customModules) {
|
|
|
104
109
|
modules.push(customModule);
|
|
105
110
|
}
|
|
106
111
|
else {
|
|
107
|
-
(
|
|
112
|
+
if (customModule.remove) {
|
|
113
|
+
(0, protocol_1.remove)(modules, ...(0, protocol_1.asArray)(customModule.remove));
|
|
114
|
+
}
|
|
115
|
+
if (customModule.add) {
|
|
116
|
+
(0, protocol_1.distinctAdd)(modules, ...(0, protocol_1.asArray)(customModule.add));
|
|
117
|
+
}
|
|
108
118
|
}
|
|
109
119
|
});
|
|
110
120
|
container.load(...modules);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container-modules.js","sourceRoot":"","sources":["../../src/base/container-modules.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,
|
|
1
|
+
{"version":3,"file":"container-modules.js","sourceRoot":"","sources":["../../src/base/container-modules.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,qDAAkF;AAClF,yCAAuD;AACvD,qCAYiB;AACjB,4DAA4D;AAC5D,qEAA6E;AAC7E,kEAAuE;AACvE,gEAA6E;AAC7E,gEAAoE;AACpE,gEAAmE;AACnE,4DAA4D;AAC5D,2DAA2D;AAC3D,2DAA0D;AAC1D,6DAAwD;AACxD,iEAAmE;AACnE,iEAAoE;AACpE,6DAA4D;AAC5D,2EAAkF;AAClF,oEAAqE;AACrE,mEAAmE;AACnE,4DAA+F;AAC/F,iEAA2F;AAC3F,+DAAgE;AAChE,4CAA4C;AAE/B,QAAA,eAAe,GAAG;IAC3B,uBAAa;IACb,oBAAiB;IACjB,sBAAY;IACZ,gCAAsB;IACtB,0BAAgB;IAChB,sBAAY;IACZ,mBAAgB;IAChB,oBAAU;IACV,mBAAgB;IAChB,mBAAwB;IACxB,mBAAqB;IACr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,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 { Action, Point } from '@eclipse-glsp/protocol';
|
|
17
|
-
import { AnchorComputerRegistry, CommandExecutionContext, CommandReturn, MouseListener, SConnectableElement, SDanglingAnchor,
|
|
16
|
+
import { Action, Point, SEdgeSchema } from '@eclipse-glsp/protocol';
|
|
17
|
+
import { AnchorComputerRegistry, CommandExecutionContext, CommandReturn, MouseListener, SConnectableElement, SDanglingAnchor, SModelElement, SModelRoot, SRoutableElement } from 'sprotty';
|
|
18
18
|
import { FeedbackCommand } from './model';
|
|
19
19
|
export interface DrawFeedbackEdgeAction extends Action {
|
|
20
20
|
kind: typeof DrawFeedbackEdgeAction.KIND;
|
|
21
21
|
elementTypeId: string;
|
|
22
22
|
sourceId: string;
|
|
23
|
-
edgeSchema?: SEdgeSchema
|
|
23
|
+
edgeSchema?: Partial<SEdgeSchema>;
|
|
24
24
|
}
|
|
25
25
|
export declare namespace DrawFeedbackEdgeAction {
|
|
26
26
|
const KIND = "drawFeedbackEdge";
|
|
@@ -28,7 +28,7 @@ export declare namespace DrawFeedbackEdgeAction {
|
|
|
28
28
|
function create(options: {
|
|
29
29
|
elementTypeId: string;
|
|
30
30
|
sourceId: string;
|
|
31
|
-
edgeSchema?: SEdgeSchema
|
|
31
|
+
edgeSchema?: Partial<SEdgeSchema>;
|
|
32
32
|
}): DrawFeedbackEdgeAction;
|
|
33
33
|
}
|
|
34
34
|
export declare class DrawFeedbackEdgeCommand extends FeedbackCommand {
|
|
@@ -65,7 +65,7 @@ export declare class FeedbackEdgeEndMovingMouseListener extends MouseListener {
|
|
|
65
65
|
}
|
|
66
66
|
export declare function feedbackEdgeId(root: SModelRoot): string;
|
|
67
67
|
export declare function feedbackEdgeEndId(root: SModelRoot): string;
|
|
68
|
-
export declare const defaultFeedbackEdgeSchema: SEdgeSchema
|
|
69
|
-
export declare function drawFeedbackEdge(context: CommandExecutionContext, sourceId: string, elementTypeId: string,
|
|
68
|
+
export declare const defaultFeedbackEdgeSchema: Partial<SEdgeSchema>;
|
|
69
|
+
export declare function drawFeedbackEdge(context: CommandExecutionContext, sourceId: string, elementTypeId: string, edgeTemplate?: Partial<SEdgeSchema>): void;
|
|
70
70
|
export declare function removeFeedbackEdge(root: SModelRoot): void;
|
|
71
71
|
//# sourceMappingURL=creation-tool-feedback.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"creation-tool-feedback.d.ts","sourceRoot":"","sources":["../../../src/features/tool-feedback/creation-tool-feedback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAU,KAAK,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"creation-tool-feedback.d.ts","sourceRoot":"","sources":["../../../src/features/tool-feedback/creation-tool-feedback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAU,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE5E,OAAO,EACH,sBAAsB,EACtB,uBAAuB,EACvB,aAAa,EAKb,aAAa,EAGb,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,UAAU,EACV,gBAAgB,EAEnB,MAAM,SAAS,CAAC;AAIjB,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,MAAM,WAAW,sBAAuB,SAAQ,MAAM;IAClD,IAAI,EAAE,OAAO,sBAAsB,CAAC,IAAI,CAAC;IACzC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CACrC;AAED,yBAAiB,sBAAsB,CAAC;IAC7B,MAAM,IAAI,qBAAqB,CAAC;IAEvC,SAAgB,EAAE,CAAC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,aAAa;IACrD,SAAS,CAAC,cAAc,EAAE,sBAAsB;gBAAtC,cAAc,EAAE,sBAAsB;IAInD,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,EAAE;IAyBtE,SAAS,CAAC,qBAAqB,CAAC,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK;CAevH;AA6BD,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAEvD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAE1D;AAED,eAAO,MAAM,yBAAyB,EAAE,OAAO,CAAC,WAAW,CAG1D,CAAC;AAEF,wBAAgB,gBAAgB,CAC5B,OAAO,EAAE,uBAAuB,EAChC,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,YAAY,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GACpC,IAAI,CA+BN;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CASzD"}
|
|
@@ -53,8 +53,7 @@ let DrawFeedbackEdgeCommand = class DrawFeedbackEdgeCommand extends model_1.Feed
|
|
|
53
53
|
this.action = action;
|
|
54
54
|
}
|
|
55
55
|
execute(context) {
|
|
56
|
-
|
|
57
|
-
drawFeedbackEdge(context, this.action.sourceId, this.action.elementTypeId, feedbackEdgeSchema);
|
|
56
|
+
drawFeedbackEdge(context, this.action.sourceId, this.action.elementTypeId, this.action.edgeSchema);
|
|
58
57
|
return context.root;
|
|
59
58
|
}
|
|
60
59
|
};
|
|
@@ -180,7 +179,7 @@ exports.defaultFeedbackEdgeSchema = {
|
|
|
180
179
|
cssClasses: ['feedback-edge'],
|
|
181
180
|
opacity: 0.3
|
|
182
181
|
};
|
|
183
|
-
function drawFeedbackEdge(context, sourceId, elementTypeId,
|
|
182
|
+
function drawFeedbackEdge(context, sourceId, elementTypeId, edgeTemplate) {
|
|
184
183
|
const root = context.root;
|
|
185
184
|
const sourceChild = root.index.getById(sourceId);
|
|
186
185
|
if (!sourceChild) {
|
|
@@ -193,11 +192,8 @@ function drawFeedbackEdge(context, sourceId, elementTypeId, feedbackEdgeSchema)
|
|
|
193
192
|
const edgeEnd = new FeedbackEdgeEnd(source.id, elementTypeId);
|
|
194
193
|
edgeEnd.id = feedbackEdgeEndId(root);
|
|
195
194
|
edgeEnd.position = (0, viewpoint_util_1.toAbsolutePosition)(source);
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
feedbackEdgeSchema.sourceId = source.id;
|
|
199
|
-
feedbackEdgeSchema.targetId = edgeEnd.id;
|
|
200
|
-
const feedbackEdge = context.modelFactory.createElement(feedbackEdgeSchema);
|
|
195
|
+
const edgeSchema = Object.assign(Object.assign({ id: feedbackEdgeId(root), type: elementTypeId, sourceId: source.id, targetId: edgeEnd.id }, exports.defaultFeedbackEdgeSchema), edgeTemplate);
|
|
196
|
+
const feedbackEdge = context.modelFactory.createElement(edgeSchema);
|
|
201
197
|
if ((0, smodel_util_1.isRoutable)(feedbackEdge)) {
|
|
202
198
|
edgeEnd.feedbackEdge = feedbackEdge;
|
|
203
199
|
root.add(edgeEnd);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"creation-tool-feedback.js","sourceRoot":"","sources":["../../../src/features/tool-feedback/creation-tool-feedback.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"creation-tool-feedback.js","sourceRoot":"","sources":["../../../src/features/tool-feedback/creation-tool-feedback.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAA4E;AAC5E,yCAA+C;AAC/C,qCAiBiB;AACjB,0DAA0D;AAC1D,yDAA8E;AAC9E,+DAAuG;AACvG,mCAA0C;AAQ1C,IAAiB,sBAAs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E;QAC1B,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC;QACpC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAClB,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;KAC1B;AACL,CAAC;AApCD,4CAoCC;AAED,SAAgB,kBAAkB,CAAC,IAAgB;IAC/C,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9D,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;IACpE,IAAI,YAAY,YAAY,uBAAa,EAAE;QACvC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;KAC7B;IACD,IAAI,eAAe,YAAY,uBAAa,EAAE;QAC1C,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;KAChC;AACL,CAAC;AATD,gDASC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp/client",
|
|
3
|
-
"version": "1.1.0-next.
|
|
3
|
+
"version": "1.1.0-next.5a004c2.229+5a004c2",
|
|
4
4
|
"description": "A sprotty-based client for GLSP",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eclipse",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"watch": "tsc -w"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@eclipse-glsp/protocol": "1.1.0-next.
|
|
50
|
+
"@eclipse-glsp/protocol": "1.1.0-next.5a004c2.229+5a004c2",
|
|
51
51
|
"autocompleter": "5.1.0",
|
|
52
52
|
"sprotty": "0.13.0-next.f4445dd.342"
|
|
53
53
|
},
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "5a004c27d59ab9d3c452e12258bd915ab0d6f3c3"
|
|
61
61
|
}
|
|
@@ -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
|
|
|
17
|
-
import { remove } from '@eclipse-glsp/protocol';
|
|
17
|
+
import { asArray, distinctAdd, MaybeArray, remove } from '@eclipse-glsp/protocol';
|
|
18
18
|
import { Container, ContainerModule } from 'inversify';
|
|
19
19
|
import {
|
|
20
20
|
buttonModule,
|
|
@@ -88,14 +88,19 @@ export const DEFAULT_MODULES = [
|
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
90
|
* Creates a GLSP Diagram container with the GLSP default modules and the specified custom `modules`.
|
|
91
|
-
*
|
|
92
|
-
*
|
|
91
|
+
* Additional modules can be passed as direct arguments or as part of a {@link ModuleConfiguration}.
|
|
92
|
+
* ```typescript
|
|
93
|
+
* const container= createDiagramContainer(myModule1, myModule2)
|
|
94
|
+
* // or
|
|
95
|
+
* const container= createDiagramContainer({ add: [myModule1, myModule2]})
|
|
96
|
+
* ```
|
|
97
|
+
* Default modules can be excluded using {@link ModuleConfiguration}s.
|
|
93
98
|
* This means, you can still customize the default modules in two ways.
|
|
94
99
|
*
|
|
95
100
|
* First, you can exclude default modules and add a module with your custom code.
|
|
96
101
|
*
|
|
97
102
|
* ```typescript
|
|
98
|
-
* const container = createDiagramContainer(
|
|
103
|
+
* const container = createDiagramContainer({ add:myModelSourceWatcherModule, remove: modelSourceWatcherModule} );
|
|
99
104
|
* ```
|
|
100
105
|
*
|
|
101
106
|
* Second, you can unbind or rebind implementations that are originally bound in one of the default modules.
|
|
@@ -108,7 +113,7 @@ export const DEFAULT_MODULES = [
|
|
|
108
113
|
* @param options Options to customize the module loading
|
|
109
114
|
* @returns The created container.
|
|
110
115
|
*/
|
|
111
|
-
export function createDiagramContainer(...customModules: Array<ContainerModule |
|
|
116
|
+
export function createDiagramContainer(...customModules: Array<ContainerModule | ModuleConfiguration>): Container {
|
|
112
117
|
const container = new Container();
|
|
113
118
|
|
|
114
119
|
const modules = [...DEFAULT_MODULES];
|
|
@@ -116,7 +121,12 @@ export function createDiagramContainer(...customModules: Array<ContainerModule |
|
|
|
116
121
|
if (customModule instanceof ContainerModule) {
|
|
117
122
|
modules.push(customModule);
|
|
118
123
|
} else {
|
|
119
|
-
|
|
124
|
+
if (customModule.remove) {
|
|
125
|
+
remove(modules, ...asArray(customModule.remove));
|
|
126
|
+
}
|
|
127
|
+
if (customModule.add) {
|
|
128
|
+
distinctAdd(modules, ...asArray(customModule.add));
|
|
129
|
+
}
|
|
120
130
|
}
|
|
121
131
|
});
|
|
122
132
|
container.load(...modules);
|
|
@@ -124,10 +134,12 @@ export function createDiagramContainer(...customModules: Array<ContainerModule |
|
|
|
124
134
|
}
|
|
125
135
|
|
|
126
136
|
/**
|
|
127
|
-
* Can be passed to the {@link createDiagramContainer} utility function to
|
|
137
|
+
* Can be passed to the {@link createDiagramContainer} utility function to configure additional modules or
|
|
138
|
+
* remove (i.e. not load) default modules.
|
|
128
139
|
*/
|
|
129
|
-
export interface
|
|
130
|
-
|
|
140
|
+
export interface ModuleConfiguration {
|
|
141
|
+
add?: MaybeArray<ContainerModule>;
|
|
142
|
+
remove?: MaybeArray<ContainerModule>;
|
|
131
143
|
}
|
|
132
144
|
|
|
133
145
|
/**
|
|
@@ -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,
|
|
@@ -42,7 +41,7 @@ export interface DrawFeedbackEdgeAction extends Action {
|
|
|
42
41
|
kind: typeof DrawFeedbackEdgeAction.KIND;
|
|
43
42
|
elementTypeId: string;
|
|
44
43
|
sourceId: string;
|
|
45
|
-
edgeSchema?: SEdgeSchema
|
|
44
|
+
edgeSchema?: Partial<SEdgeSchema>;
|
|
46
45
|
}
|
|
47
46
|
|
|
48
47
|
export namespace DrawFeedbackEdgeAction {
|
|
@@ -52,7 +51,11 @@ export namespace DrawFeedbackEdgeAction {
|
|
|
52
51
|
return Action.hasKind(object, KIND);
|
|
53
52
|
}
|
|
54
53
|
|
|
55
|
-
export function create(options: {
|
|
54
|
+
export function create(options: {
|
|
55
|
+
elementTypeId: string;
|
|
56
|
+
sourceId: string;
|
|
57
|
+
edgeSchema?: Partial<SEdgeSchema>;
|
|
58
|
+
}): DrawFeedbackEdgeAction {
|
|
56
59
|
return {
|
|
57
60
|
kind: KIND,
|
|
58
61
|
...options
|
|
@@ -69,8 +72,7 @@ export class DrawFeedbackEdgeCommand extends FeedbackCommand {
|
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
execute(context: CommandExecutionContext): CommandReturn {
|
|
72
|
-
|
|
73
|
-
drawFeedbackEdge(context, this.action.sourceId, this.action.elementTypeId, feedbackEdgeSchema);
|
|
75
|
+
drawFeedbackEdge(context, this.action.sourceId, this.action.elementTypeId, this.action.edgeSchema);
|
|
74
76
|
return context.root;
|
|
75
77
|
}
|
|
76
78
|
}
|
|
@@ -195,16 +197,16 @@ export function feedbackEdgeEndId(root: SModelRoot): string {
|
|
|
195
197
|
return root.id + '_feedback_anchor';
|
|
196
198
|
}
|
|
197
199
|
|
|
198
|
-
export const defaultFeedbackEdgeSchema: SEdgeSchema = {
|
|
200
|
+
export const defaultFeedbackEdgeSchema: Partial<SEdgeSchema> = {
|
|
199
201
|
cssClasses: ['feedback-edge'],
|
|
200
202
|
opacity: 0.3
|
|
201
|
-
}
|
|
203
|
+
};
|
|
202
204
|
|
|
203
205
|
export function drawFeedbackEdge(
|
|
204
206
|
context: CommandExecutionContext,
|
|
205
207
|
sourceId: string,
|
|
206
208
|
elementTypeId: string,
|
|
207
|
-
|
|
209
|
+
edgeTemplate?: Partial<SEdgeSchema>
|
|
208
210
|
): void {
|
|
209
211
|
const root = context.root;
|
|
210
212
|
const sourceChild = root.index.getById(sourceId);
|
|
@@ -221,12 +223,16 @@ export function drawFeedbackEdge(
|
|
|
221
223
|
edgeEnd.id = feedbackEdgeEndId(root);
|
|
222
224
|
edgeEnd.position = toAbsolutePosition(source);
|
|
223
225
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
226
|
+
const edgeSchema: SEdgeSchema = {
|
|
227
|
+
id: feedbackEdgeId(root),
|
|
228
|
+
type: elementTypeId,
|
|
229
|
+
sourceId: source.id,
|
|
230
|
+
targetId: edgeEnd.id,
|
|
231
|
+
...defaultFeedbackEdgeSchema,
|
|
232
|
+
...edgeTemplate
|
|
233
|
+
};
|
|
228
234
|
|
|
229
|
-
const feedbackEdge = context.modelFactory.createElement(
|
|
235
|
+
const feedbackEdge = context.modelFactory.createElement(edgeSchema);
|
|
230
236
|
if (isRoutable(feedbackEdge)) {
|
|
231
237
|
edgeEnd.feedbackEdge = feedbackEdge;
|
|
232
238
|
root.add(edgeEnd);
|