@eclipse-glsp/client 0.10.0-next.06ee84f.156 → 0.10.0-next.4ce46ea.160
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/css/glsp-sprotty.css +110 -8
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.d.ts +16 -0
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.d.ts.map +1 -1
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.js +36 -8
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.js.map +1 -1
- package/lib/features/hover/di.config.d.ts +1 -1
- package/lib/features/hover/di.config.d.ts.map +1 -1
- package/lib/features/hover/di.config.js +4 -2
- package/lib/features/hover/di.config.js.map +1 -1
- package/lib/features/hover/hover.d.ts +13 -3
- package/lib/features/hover/hover.d.ts.map +1 -1
- package/lib/features/hover/hover.js +21 -1
- package/lib/features/hover/hover.js.map +1 -1
- package/lib/features/tool-feedback/feedback-action-dispatcher.d.ts +2 -2
- package/lib/features/tools/base-glsp-tool.d.ts +3 -3
- package/lib/features/tools/base-glsp-tool.d.ts.map +1 -1
- package/lib/features/tools/base-glsp-tool.js +5 -5
- package/lib/features/tools/base-glsp-tool.js.map +1 -1
- package/lib/model-source/glsp-diagram-server.d.ts.map +1 -1
- package/lib/model-source/glsp-diagram-server.js +1 -0
- package/lib/model-source/glsp-diagram-server.js.map +1 -1
- package/package.json +3 -3
- package/src/features/context-menu/selection-service-aware-context-menu-mouse-listener.ts +40 -11
- package/src/features/hover/di.config.ts +4 -2
- package/src/features/hover/hover.ts +26 -2
- package/src/features/tool-feedback/feedback-action-dispatcher.ts +2 -2
- package/src/features/tools/base-glsp-tool.ts +7 -7
- package/src/model-source/glsp-diagram-server.ts +2 -0
package/css/glsp-sprotty.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
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
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
border: 1px solid;
|
|
39
39
|
max-width: 400px;
|
|
40
40
|
min-width: 100px;
|
|
41
|
+
z-index: 1;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
.sprotty-popup > div {
|
|
@@ -50,23 +51,55 @@
|
|
|
50
51
|
|
|
51
52
|
.sprotty-resize-handle {
|
|
52
53
|
/* radius does not work in Firefox */
|
|
53
|
-
r:
|
|
54
|
-
fill: #
|
|
54
|
+
r: 5px;
|
|
55
|
+
fill: #1d80d1;
|
|
55
56
|
stroke: none;
|
|
56
57
|
z-index: 1000;
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
.sprotty-resize-handle.selected {
|
|
60
|
-
fill: #
|
|
61
|
+
fill: #1d80d1;
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
.sprotty-resize-handle.active {
|
|
64
|
-
fill: #
|
|
65
|
+
fill: #1d80d1;
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
.sprotty-
|
|
68
|
-
|
|
69
|
-
stroke-width: 1;
|
|
68
|
+
.sprotty-edge {
|
|
69
|
+
fill: none;
|
|
70
|
+
stroke-width: 1.5px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.sprotty-edge.selected {
|
|
74
|
+
stroke-width: 1.5px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.sprotty-edge.mouseover:not(.selected) path {
|
|
78
|
+
stroke-width: 1.5px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.sprotty-node:not(.selected) {
|
|
82
|
+
stroke-width: 0px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.sprotty-node.mouseover:not(.selected),
|
|
86
|
+
.sprotty-edge.mouseover:not(.selected) {
|
|
87
|
+
opacity: 60%;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.sprotty-node.selected,
|
|
91
|
+
.sprotty-edge.selected {
|
|
92
|
+
stroke: #1d80d1;
|
|
93
|
+
stroke-width: 1.5px;
|
|
94
|
+
stroke-dashoffset: 5;
|
|
95
|
+
stroke-dasharray: 5, 5;
|
|
96
|
+
stroke-linecap: round;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.sprotty-edge.mouseover:not(.selected) .arrow,
|
|
100
|
+
.sprotty-edge.selected .arrow {
|
|
101
|
+
stroke-dashoffset: none;
|
|
102
|
+
stroke-dasharray: none;
|
|
70
103
|
}
|
|
71
104
|
|
|
72
105
|
.node-creation-mode {
|
|
@@ -113,3 +146,72 @@
|
|
|
113
146
|
.marquee-mode {
|
|
114
147
|
cursor: crosshair;
|
|
115
148
|
}
|
|
149
|
+
|
|
150
|
+
.sprotty-node.marquee {
|
|
151
|
+
fill: lightgray;
|
|
152
|
+
opacity: 0.2;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.sprotty-edge > .sprotty-routing-handle {
|
|
156
|
+
r: 5px;
|
|
157
|
+
fill: #1d80d1;
|
|
158
|
+
stroke: none;
|
|
159
|
+
z-index: 1000;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.sprotty-edge > .sprotty-routing-handle[data-kind='line'] {
|
|
163
|
+
opacity: 0.35;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.sprotty-edge > .sprotty-routing-handle.selected {
|
|
167
|
+
fill: #1d80d1;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.sprotty-edge > .sprotty-routing-handle.mouseover {
|
|
171
|
+
stroke: #1d80d1a1;
|
|
172
|
+
stroke-width: 1;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.sprotty-missing {
|
|
176
|
+
stroke-width: 1;
|
|
177
|
+
stroke: #f00;
|
|
178
|
+
fill: #f00;
|
|
179
|
+
font-size: 14pt;
|
|
180
|
+
text-anchor: middle;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
g .movement-not-allowed > .sprotty-node {
|
|
184
|
+
stroke: var(--glsp-error-foreground) !important;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.sprotty-resize-handle.movement-not-allowed {
|
|
188
|
+
stroke: var(--glsp-error-foreground) !important;
|
|
189
|
+
fill: var(--glsp-error-foreground) !important;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.error > .sprotty-node {
|
|
193
|
+
filter: drop-shadow(0px 0px 2px var(--glsp-error-foreground)) !important;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.warning > .sprotty-node {
|
|
197
|
+
filter: drop-shadow(0px 0px 2px var(--glsp-warning-foreground)) !important;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.info > .sprotty-node {
|
|
201
|
+
filter: drop-shadow(0px 0px 2px var(--glsp-info-foreground)) !important;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
svg {
|
|
205
|
+
border-style: solid;
|
|
206
|
+
border-width: 1px;
|
|
207
|
+
border-color: #bbb;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
text {
|
|
211
|
+
stroke-width: 0;
|
|
212
|
+
stroke: #000;
|
|
213
|
+
fill: #000;
|
|
214
|
+
font-family: sans-serif;
|
|
215
|
+
font-size: 8pt;
|
|
216
|
+
text-anchor: middle;
|
|
217
|
+
}
|
|
@@ -4,6 +4,22 @@ export declare class SelectionServiceAwareContextMenuMouseListener extends Mouse
|
|
|
4
4
|
protected readonly contextMenuService: IContextMenuServiceProvider;
|
|
5
5
|
protected readonly menuProvider: ContextMenuProviderRegistry;
|
|
6
6
|
protected selectionService: SelectionService;
|
|
7
|
+
/**
|
|
8
|
+
* Opens the context menu on right-click.
|
|
9
|
+
*/
|
|
7
10
|
mouseDown(target: SModelElement, event: MouseEvent): (Action | Promise<Action>)[];
|
|
11
|
+
/**
|
|
12
|
+
* Opens the context menu.
|
|
13
|
+
*
|
|
14
|
+
* - query the element on the click-target
|
|
15
|
+
* - select the element
|
|
16
|
+
* - query the context menu service and the context menu elements
|
|
17
|
+
* - show the context menu
|
|
18
|
+
* - send a focus state change to indicate that the diagram becomes inactive, once the context menu is shown
|
|
19
|
+
*
|
|
20
|
+
* When the context menu is closed, we focus the diagram element again.
|
|
21
|
+
*/
|
|
22
|
+
protected openContextMenu(event: MouseEvent, target: SModelElement): Promise<Action>[];
|
|
23
|
+
protected focusEventTarget(event: MouseEvent): void;
|
|
8
24
|
}
|
|
9
25
|
//# sourceMappingURL=selection-service-aware-context-menu-mouse-listener.d.ts.map
|
package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection-service-aware-context-menu-mouse-listener.d.ts","sourceRoot":"","sources":["../../../src/features/context-menu/selection-service-aware-context-menu-mouse-listener.ts"],"names":[],"mappings":"AAgBA,OAAO,EACH,MAAM,EACN,2BAA2B,EAE3B,2BAA2B,EAE3B,aAAa,EACb,aAAa,EAEhB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,qBACa,6CAA8C,SAAQ,aAAa;IACrB,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,2BAA2B,CAAC;IAClE,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAC;IAChF,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAElF,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"selection-service-aware-context-menu-mouse-listener.d.ts","sourceRoot":"","sources":["../../../src/features/context-menu/selection-service-aware-context-menu-mouse-listener.ts"],"names":[],"mappings":"AAgBA,OAAO,EACH,MAAM,EACN,2BAA2B,EAE3B,2BAA2B,EAE3B,aAAa,EACb,aAAa,EAEhB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,qBACa,6CAA8C,SAAQ,aAAa;IACrB,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,2BAA2B,CAAC;IAClE,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAC;IAChF,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAElF;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE;IAOjF;;;;;;;;;;OAUG;IACH,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE;IAetF,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;CAOtD"}
|
|
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.SelectionServiceAwareContextMenuMouseListener = void 0;
|
|
13
13
|
/********************************************************************************
|
|
14
|
-
* Copyright (c) 2019-
|
|
14
|
+
* Copyright (c) 2019-2022 EclipseSource and others.
|
|
15
15
|
*
|
|
16
16
|
* This program and the accompanying materials are made available under the
|
|
17
17
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -27,21 +27,49 @@ exports.SelectionServiceAwareContextMenuMouseListener = void 0;
|
|
|
27
27
|
********************************************************************************/
|
|
28
28
|
const inversify_1 = require("inversify");
|
|
29
29
|
const sprotty_1 = require("sprotty");
|
|
30
|
+
const focus_change_action_1 = require("../../base/actions/focus-change-action");
|
|
30
31
|
const types_1 = require("../../base/types");
|
|
31
32
|
const selection_service_1 = require("../select/selection-service");
|
|
32
33
|
let SelectionServiceAwareContextMenuMouseListener = class SelectionServiceAwareContextMenuMouseListener extends sprotty_1.MouseListener {
|
|
34
|
+
/**
|
|
35
|
+
* Opens the context menu on right-click.
|
|
36
|
+
*/
|
|
33
37
|
mouseDown(target, event) {
|
|
34
38
|
if (event.button === 2 && this.contextMenuService && this.menuProvider) {
|
|
35
|
-
|
|
36
|
-
const selectableTarget = sprotty_1.findParentByFeature(target, sprotty_1.isSelectable);
|
|
37
|
-
if (selectableTarget) {
|
|
38
|
-
selectableTarget.selected = true;
|
|
39
|
-
this.selectionService.updateSelection(target.root, [selectableTarget.id], []);
|
|
40
|
-
}
|
|
41
|
-
Promise.all([this.contextMenuService(), this.menuProvider.getItems(target.root, mousePosition)]).then(([menuService, menuItems]) => menuService.show(menuItems, mousePosition));
|
|
39
|
+
return this.openContextMenu(event, target);
|
|
42
40
|
}
|
|
43
41
|
return [];
|
|
44
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Opens the context menu.
|
|
45
|
+
*
|
|
46
|
+
* - query the element on the click-target
|
|
47
|
+
* - select the element
|
|
48
|
+
* - query the context menu service and the context menu elements
|
|
49
|
+
* - show the context menu
|
|
50
|
+
* - send a focus state change to indicate that the diagram becomes inactive, once the context menu is shown
|
|
51
|
+
*
|
|
52
|
+
* When the context menu is closed, we focus the diagram element again.
|
|
53
|
+
*/
|
|
54
|
+
openContextMenu(event, target) {
|
|
55
|
+
const mousePosition = { x: event.x, y: event.y };
|
|
56
|
+
const selectableTarget = sprotty_1.findParentByFeature(target, sprotty_1.isSelectable);
|
|
57
|
+
if (selectableTarget) {
|
|
58
|
+
selectableTarget.selected = true;
|
|
59
|
+
this.selectionService.updateSelection(target.root, [selectableTarget.id], []);
|
|
60
|
+
}
|
|
61
|
+
const result = Promise.all([this.contextMenuService(), this.menuProvider.getItems(target.root, mousePosition)])
|
|
62
|
+
.then(([menuService, menuItems]) => menuService.show(menuItems, mousePosition, () => this.focusEventTarget(event)))
|
|
63
|
+
.then(() => new focus_change_action_1.FocusStateChangedAction(false));
|
|
64
|
+
return [result];
|
|
65
|
+
}
|
|
66
|
+
focusEventTarget(event) {
|
|
67
|
+
const targetElement = event.target instanceof SVGElement ? event.target : undefined;
|
|
68
|
+
const svgParentElement = targetElement === null || targetElement === void 0 ? void 0 : targetElement.closest('svg');
|
|
69
|
+
if (svgParentElement) {
|
|
70
|
+
svgParentElement.focus();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
45
73
|
};
|
|
46
74
|
__decorate([
|
|
47
75
|
inversify_1.inject(sprotty_1.TYPES.IContextMenuServiceProvider),
|
package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selection-service-aware-context-menu-mouse-listener.js","sourceRoot":"","sources":["../../../src/features/context-menu/selection-service-aware-context-menu-mouse-listener.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,yCAAyD;AACzD,qCASiB;
|
|
1
|
+
{"version":3,"file":"selection-service-aware-context-menu-mouse-listener.js","sourceRoot":"","sources":["../../../src/features/context-menu/selection-service-aware-context-menu-mouse-listener.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,yCAAyD;AACzD,qCASiB;AACjB,gFAAiF;AACjF,4CAA8C;AAC9C,mEAA+D;AAG/D,IAAa,6CAA6C,GAA1D,MAAa,6CAA8C,SAAQ,uBAAa;IAK5E;;OAEG;IACH,SAAS,CAAC,MAAqB,EAAE,KAAiB;QAC9C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,YAAY,EAAE;YACpE,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;SAC9C;QACD,OAAO,EAAE,CAAC;IACd,CAAC;IAED;;;;;;;;;;OAUG;IACO,eAAe,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CAAA;AA/C0D;IAAtD,kBAAM,CAAC,eAAK,CAAC,2BAA2B,CAAC;IAAE,oBAAQ,EAAE;;yFAAoE;AAClE;IAAvD,kBAAM,CAAC,eAAK,CAAC,4BAA4B,CAAC;IAAE,oBAAQ,EAAE;8BAAkC,qCAA2B;mFAAC;AAChF;IAApC,kBAAM,CAAC,kBAAU,CAAC,gBAAgB,CAAC;8BAA6B,oCAAgB;uFAAC;AAHzE,6CAA6C;IADzD,sBAAU,EAAE;GACA,6CAA6C,CAgDzD;AAhDY,sGAA6C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"di.config.d.ts","sourceRoot":"","sources":["../../../src/features/hover/di.config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAoB5C,QAAA,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"di.config.d.ts","sourceRoot":"","sources":["../../../src/features/hover/di.config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAoB5C,QAAA,MAAM,eAAe,iBAwBnB,CAAC;AAEH,eAAe,eAAe,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/********************************************************************************
|
|
4
|
-
* Copyright (c) 2020-
|
|
4
|
+
* Copyright (c) 2020-2022 EclipseSource and others.
|
|
5
5
|
*
|
|
6
6
|
* This program and the accompanying materials are made available under the
|
|
7
7
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -22,7 +22,8 @@ const focus_change_action_1 = require("../../base/actions/focus-change-action");
|
|
|
22
22
|
const hover_1 = require("./hover");
|
|
23
23
|
const glspHoverModule = new inversify_1.ContainerModule((bind, _unbind, isBound) => {
|
|
24
24
|
bind(sprotty_1.TYPES.PopupVNodePostprocessor).to(popup_position_updater_1.PopupPositionUpdater).inSingletonScope();
|
|
25
|
-
bind(
|
|
25
|
+
bind(hover_1.GlspHoverMouseListener).toSelf().inSingletonScope();
|
|
26
|
+
bind(sprotty_1.TYPES.MouseListener).toService(hover_1.GlspHoverMouseListener);
|
|
26
27
|
bind(sprotty_1.TYPES.PopupMouseListener).to(sprotty_1.PopupHoverMouseListener);
|
|
27
28
|
bind(sprotty_1.TYPES.KeyListener).to(sprotty_1.HoverKeyListener);
|
|
28
29
|
bind(sprotty_1.TYPES.HoverState).toConstantValue({
|
|
@@ -41,6 +42,7 @@ const glspHoverModule = new inversify_1.ContainerModule((bind, _unbind, isBound)
|
|
|
41
42
|
sprotty_1.configureActionHandler(context, sprotty_1.SetViewportCommand.KIND, sprotty_1.ClosePopupActionHandler);
|
|
42
43
|
sprotty_1.configureActionHandler(context, sprotty_1.MoveCommand.KIND, sprotty_1.ClosePopupActionHandler);
|
|
43
44
|
sprotty_1.configureActionHandler(context, focus_change_action_1.FocusStateChangedAction.KIND, sprotty_1.ClosePopupActionHandler);
|
|
45
|
+
sprotty_1.configureActionHandler(context, focus_change_action_1.FocusStateChangedAction.KIND, hover_1.GlspHoverMouseListener);
|
|
44
46
|
});
|
|
45
47
|
exports.default = glspHoverModule;
|
|
46
48
|
//# sourceMappingURL=di.config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"di.config.js","sourceRoot":"","sources":["../../../src/features/hover/di.config.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,yCAA4C;AAC5C,qCAciB;AACjB,8FAAyF;AACzF,gFAAiF;A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AAO,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAClC,0BAAgB,CAAC,OAAO,EAAE,8BAAoB,CAAC,CAAC;IAChD,0BAAgB,CAAC,OAAO,EAAE,8BAAoB,CAAC,CAAC;IAChD,gCAAsB,CAAC,OAAO,EAAE,8BAAoB,CAAC,IAAI,EAAE,iCAAuB,CAAC,CAAC;IACpF,gCAAsB,CAAC,OAAO,EAAE,4BAAkB,CAAC,IAAI,EAAE,iCAAuB,CAAC,CAAC;IAClF,gCAAsB,CAAC,OAAO,EAAE,uBAAa,CAAC,IAAI,EAAE,iCAAuB,CAAC,CAAC;IAC7E,gCAAsB,CAAC,OAAO,EAAE,4BAAkB,CAAC,IAAI,EAAE,iCAAuB,CAAC,CAAC;IAClF,gCAAsB,CAAC,OAAO,EAAE,qBAAW,CAAC,IAAI,EAAE,iCAAuB,CAAC,CAAC;IAC3E,gCAAsB,CAAC,OAAO,EAAE,6CAAuB,CAAC,IAAI,EAAE,iCAAuB,CAAC,CAAC;IACvF,gCAAsB,CAAC,OAAO,EAAE,6CAAuB,CAAC,IAAI,EAAE,8BAAsB,CAAC,CAAC;AAC1F,CAAC,CAAC,CAAC;AAEH,kBAAe,eAAe,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
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
|
|
@@ -14,9 +14,19 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import { Action, Bounds } from '@eclipse-glsp/protocol';
|
|
17
|
-
import { HoverMouseListener, SIssueMarker, SIssueSeverity, SModelElement, SModelElementSchema, SModelRootSchema } from 'sprotty';
|
|
17
|
+
import { HoverMouseListener, IActionHandler, ICommand, SIssueMarker, SIssueSeverity, SModelElement, SModelElementSchema, SModelRootSchema } from 'sprotty';
|
|
18
18
|
import { GIssueMarker } from '../validation/issue-marker';
|
|
19
|
-
export declare class GlspHoverMouseListener extends HoverMouseListener {
|
|
19
|
+
export declare class GlspHoverMouseListener extends HoverMouseListener implements IActionHandler {
|
|
20
|
+
/**
|
|
21
|
+
* Stops mouse over timer and remove hover feedback, if focus is lost.
|
|
22
|
+
*
|
|
23
|
+
* This fixes strange effects that appear if the mouse left the element via e.g. a context menu,
|
|
24
|
+
* which explicitly removes the focus of the diagram.
|
|
25
|
+
* @see SelectionServiceAwareContextMenuMouseListener
|
|
26
|
+
* @param action should be a `FocusStateChangedAction`
|
|
27
|
+
* @returns a `HoverFeedbackAction` resetting the state, if the specified action indicates lost focus
|
|
28
|
+
*/
|
|
29
|
+
handle(action: Action): void | Action | ICommand;
|
|
20
30
|
protected startMouseOverTimer(target: SModelElement, event: MouseEvent): Promise<Action>;
|
|
21
31
|
protected createPopupModel(marker: GIssueMarker, bounds: Bounds): SModelRootSchema;
|
|
22
32
|
protected createMarkerIssuePopup(marker: GIssueMarker): SModelElementSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../../../src/features/hover/hover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAgD,MAAM,wBAAwB,CAAC;AAEtG,OAAO,
|
|
1
|
+
{"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../../../src/features/hover/hover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAgD,MAAM,wBAAwB,CAAC;AAEtG,OAAO,EAGH,kBAAkB,EAClB,cAAc,EACd,QAAQ,EAER,YAAY,EACZ,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EACnB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,qBACa,sBAAuB,SAAQ,kBAAmB,YAAW,cAAc;IACpF;;;;;;;;OAQG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ;IAWhD,SAAS,CAAC,mBAAmB,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAiBxF,SAAS,CAAC,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,gBAAgB;IAYlF,SAAS,CAAC,sBAAsB,CAAC,MAAM,EAAE,YAAY,GAAG,mBAAmB;IAS3E,SAAS,CAAC,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM;IAI1D,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;CAGjD;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,cAAc,CAWhE"}
|
|
@@ -8,7 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.getSeverity = exports.GlspHoverMouseListener = void 0;
|
|
10
10
|
/********************************************************************************
|
|
11
|
-
* Copyright (c) 2020-
|
|
11
|
+
* Copyright (c) 2020-2022 EclipseSource and others.
|
|
12
12
|
*
|
|
13
13
|
* This program and the accompanying materials are made available under the
|
|
14
14
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -25,8 +25,28 @@ exports.getSeverity = exports.GlspHoverMouseListener = void 0;
|
|
|
25
25
|
const protocol_1 = require("@eclipse-glsp/protocol");
|
|
26
26
|
const inversify_1 = require("inversify");
|
|
27
27
|
const sprotty_1 = require("sprotty");
|
|
28
|
+
const focus_change_action_1 = require("../../base/actions/focus-change-action");
|
|
28
29
|
const issue_marker_1 = require("../validation/issue-marker");
|
|
29
30
|
let GlspHoverMouseListener = class GlspHoverMouseListener extends sprotty_1.HoverMouseListener {
|
|
31
|
+
/**
|
|
32
|
+
* Stops mouse over timer and remove hover feedback, if focus is lost.
|
|
33
|
+
*
|
|
34
|
+
* This fixes strange effects that appear if the mouse left the element via e.g. a context menu,
|
|
35
|
+
* which explicitly removes the focus of the diagram.
|
|
36
|
+
* @see SelectionServiceAwareContextMenuMouseListener
|
|
37
|
+
* @param action should be a `FocusStateChangedAction`
|
|
38
|
+
* @returns a `HoverFeedbackAction` resetting the state, if the specified action indicates lost focus
|
|
39
|
+
*/
|
|
40
|
+
handle(action) {
|
|
41
|
+
if (focus_change_action_1.isFocusStateChangedAction(action) && !action.hasFocus) {
|
|
42
|
+
this.stopMouseOverTimer();
|
|
43
|
+
if (this.lastHoverFeedbackElementId) {
|
|
44
|
+
const previousTargetId = this.lastHoverFeedbackElementId;
|
|
45
|
+
this.lastHoverFeedbackElementId = undefined;
|
|
46
|
+
return new sprotty_1.HoverFeedbackAction(previousTargetId, false);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
30
50
|
startMouseOverTimer(target, event) {
|
|
31
51
|
this.stopMouseOverTimer();
|
|
32
52
|
return new Promise(resolve => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hover.js","sourceRoot":"","sources":["../../../src/features/hover/hover.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAsG;AACtG,yCAAuC;AACvC,
|
|
1
|
+
{"version":3,"file":"hover.js","sourceRoot":"","sources":["../../../src/features/hover/hover.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAsG;AACtG,yCAAuC;AACvC,qCAYiB;AACjB,gFAAmF;AACnF,6DAA0D;AAG1D,IAAa,sBAAsB,GAAnC,MAAa,sBAAuB,SAAQ,4BAAkB;IAC1D;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CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE;QACvD,IAAI,QAAQ,KAAK,OAAO,EAAE;YACtB,OAAO,QAAQ,CAAC;SACnB;QACD,IAAI,QAAQ,KAAK,SAAS,IAAI,eAAe,KAAK,MAAM,EAAE;YACtD,eAAe,GAAG,QAAQ,CAAC;SAC9B;KACJ;IACD,OAAO,eAAe,CAAC;AAC3B,CAAC;AAXD,kCAWC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
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
|
|
@@ -28,7 +28,7 @@ export interface IFeedbackEmitter {
|
|
|
28
28
|
* extending the `SModelRoot`. Therefore, tools can register themselves
|
|
29
29
|
* as feedback emitters with actions they want to place for showing
|
|
30
30
|
* feedback. This dispatcher will then re-establish all feedback actions
|
|
31
|
-
* of the registered
|
|
31
|
+
* of the registered emitters, whenever the `SModelRoot` has been set or updated.
|
|
32
32
|
*/
|
|
33
33
|
export interface IFeedbackActionDispatcher {
|
|
34
34
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
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
|
|
@@ -29,8 +29,8 @@ export declare abstract class BaseGLSPTool implements GLSPTool {
|
|
|
29
29
|
abstract disable(): void;
|
|
30
30
|
abstract id: string;
|
|
31
31
|
get isEditTool(): boolean;
|
|
32
|
-
dispatchFeedback(actions: Action[], feedbackeEmitter?: IFeedbackEmitter): void;
|
|
33
32
|
dispatchActions(actions: Action[]): void;
|
|
34
|
-
|
|
33
|
+
dispatchFeedback(actions: Action[], feedbackEmitter?: IFeedbackEmitter): void;
|
|
34
|
+
deregisterFeedback(actions: Action[], feedbackEmitter?: IFeedbackEmitter): void;
|
|
35
35
|
}
|
|
36
36
|
//# sourceMappingURL=base-glsp-tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-glsp-tool.d.ts","sourceRoot":"","sources":["../../../src/features/tools/base-glsp-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAS,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAE1G,8BACsB,YAAa,YAAW,QAAQ;IACJ,SAAS,CAAC,kBAAkB,EAAE,yBAAyB,CAAC;IACrE,SAAS,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;IACjD,SAAS,CAAC,SAAS,EAAE,UAAU,CAAC;IAC7C,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC;IACd,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAC;IAErF,QAAQ,CAAC,MAAM,IAAI,IAAI;IACvB,QAAQ,CAAC,OAAO,IAAI,IAAI;IAExB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,
|
|
1
|
+
{"version":3,"file":"base-glsp-tool.d.ts","sourceRoot":"","sources":["../../../src/features/tools/base-glsp-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAS,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAE1G,8BACsB,YAAa,YAAW,QAAQ;IACJ,SAAS,CAAC,kBAAkB,EAAE,yBAAyB,CAAC;IACrE,SAAS,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;IACjD,SAAS,CAAC,SAAS,EAAE,UAAU,CAAC;IAC7C,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC;IACd,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAC;IAErF,QAAQ,CAAC,MAAM,IAAI,IAAI;IACvB,QAAQ,CAAC,OAAO,IAAI,IAAI;IAExB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IAIxC,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,eAAe,CAAC,EAAE,gBAAgB,GAAG,IAAI;IAI7E,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,eAAe,CAAC,EAAE,gBAAgB,GAAG,IAAI;CAGlF"}
|
|
@@ -18,14 +18,14 @@ let BaseGLSPTool = class BaseGLSPTool {
|
|
|
18
18
|
get isEditTool() {
|
|
19
19
|
return true;
|
|
20
20
|
}
|
|
21
|
-
dispatchFeedback(actions, feedbackeEmitter) {
|
|
22
|
-
this.feedbackDispatcher.registerFeedback(feedbackeEmitter ? feedbackeEmitter : this, actions);
|
|
23
|
-
}
|
|
24
21
|
dispatchActions(actions) {
|
|
25
22
|
this.actionDispatcher.dispatchAll(actions);
|
|
26
23
|
}
|
|
27
|
-
|
|
28
|
-
this.feedbackDispatcher.
|
|
24
|
+
dispatchFeedback(actions, feedbackEmitter) {
|
|
25
|
+
this.feedbackDispatcher.registerFeedback(feedbackEmitter !== null && feedbackEmitter !== void 0 ? feedbackEmitter : this, actions);
|
|
26
|
+
}
|
|
27
|
+
deregisterFeedback(actions, feedbackEmitter) {
|
|
28
|
+
this.feedbackDispatcher.deregisterFeedback(feedbackEmitter !== null && feedbackEmitter !== void 0 ? feedbackEmitter : this, actions);
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-glsp-tool.js","sourceRoot":"","sources":["../../../src/features/tools/base-glsp-tool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,yCAA+C;AAC/C,qCAA4D;AAC5D,8EAAyE;AAEzE,4CAA8C;AAK9C,IAAsB,YAAY,GAAlC,MAAsB,YAAY;IAY9B,IAAI,UAAU;QACV,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,
|
|
1
|
+
{"version":3,"file":"base-glsp-tool.js","sourceRoot":"","sources":["../../../src/features/tools/base-glsp-tool.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,yCAA+C;AAC/C,qCAA4D;AAC5D,8EAAyE;AAEzE,4CAA8C;AAK9C,IAAsB,YAAY,GAAlC,MAAsB,YAAY;IAY9B,IAAI,UAAU;QACV,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,eAAe,CAAC,OAAiB;QAC7B,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED,gBAAgB,CAAC,OAAiB,EAAE,eAAkC;QAClE,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/E,CAAC;IAED,kBAAkB,CAAC,OAAiB,EAAE,eAAkC;QACpE,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,IAAI,EAAE,OAAO,CAAC,CAAC;IACjF,CAAC;CACJ,CAAA;AA1BiD;IAA7C,kBAAM,CAAC,kBAAU,CAAC,yBAAyB,CAAC;;wDAAyD;AACrE;IAAhC,kBAAM,CAAC,eAAK,CAAC,iBAAiB,CAAC;;sDAA+C;AACjD;IAA7B,kBAAM,CAAC,kBAAU,CAAC,SAAS,CAAC;;+CAAiC;AAC7C;IAAhB,kBAAM,CAAC,iBAAO,CAAC;8BAAoB,iBAAO;6CAAC;AACd;IAA7B,kBAAM,CAAC,6CAAoB,CAAC;8BAAmC,6CAAoB;mDAAC;AALnE,YAAY;IADjC,sBAAU,EAAE;GACS,YAAY,CA2BjC;AA3BqB,oCAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-diagram-server.d.ts","sourceRoot":"","sources":["../../src/model-source/glsp-diagram-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACH,MAAM,EACN,oBAAoB,
|
|
1
|
+
{"version":3,"file":"glsp-diagram-server.d.ts","sourceRoot":"","sources":["../../src/model-source/glsp-diagram-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACH,MAAM,EACN,oBAAoB,EAEpB,UAAU,EAIV,mBAAmB,EACnB,iBAAiB,EACpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAA6C,MAAM,SAAS,CAAC;AACnI,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI1D,qBACa,iBAAkB,SAAQ,aAAc,YAAW,cAAc;IAC1E,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC;IACnC,SAAS,CAAC,KAAK,UAAS;IAElB,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAOtD,IAAW,UAAU,IAAI,UAAU,GAAG,SAAS,CAE9C;IAED,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAQnD,UAAU,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI;IAOjD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,GAAG,MAAM;IAOhD,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAUtC,SAAS,CAAC,yBAAyB,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO;IAKzE,SAAS,CAAC,oBAAoB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO;IAItE,SAAS,CAAC,uBAAuB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO;IAI9D,YAAY,IAAI,MAAM;CAGhC;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,qBAAqB,EAAE,aAAa,EAAE,aAAa,GAAG,IAAI,CAQpH"}
|
|
@@ -94,6 +94,7 @@ exports.isReceivedFromServer = isReceivedFromServer;
|
|
|
94
94
|
function registerDefaultGLSPServerActions(registry, diagramServer) {
|
|
95
95
|
registry.register(protocol_1.ServerMessageAction.KIND, diagramServer);
|
|
96
96
|
registry.register(sprotty_1.ServerStatusAction.KIND, diagramServer);
|
|
97
|
+
registry.register(protocol_1.ExportSvgAction.KIND, diagramServer);
|
|
97
98
|
// Register an empty handler for SwitchEditMode, to avoid runtime exceptions.
|
|
98
99
|
// We don't support SwitchEditMode, but Sprotty still sends those actions, so ignore them.
|
|
99
100
|
registry.register(sprotty_1.SwitchEditModeCommand.KIND, { handle: action => undefined });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-diagram-server.js","sourceRoot":"","sources":["../../src/model-source/glsp-diagram-server.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"glsp-diagram-server.js","sourceRoot":"","sources":["../../src/model-source/glsp-diagram-server.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAUgC;AAChC,yCAAuC;AACvC,qCAAmI;AAGnI,MAAM,0BAA0B,GAAG,sBAAsB,CAAC;AAG1D,IAAa,iBAAiB,GAA9B,MAAa,iBAAkB,SAAQ,uBAAa;IAApD;;QAGc,UAAK,GAAG,KAAK,CAAC;IA6D5B,CAAC;IA3DG,KAAK,CAAC,OAAO,CAAC,MAAkB;QAC5B,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACrB,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;QACjE,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;QAC1B,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAES,WAAW,CAAC,OAAsB;QACxC,IAAI,IAAI,CAAC,UAAU,EAAE;YACjB,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;SAC9C;aAAM;YACH,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;SAClD;IACL,CAAC;IAED,UAAU,CAAC,QAA+B;QACtC,gCAAgC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAChB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;SAC9C;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BAAmB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC3D,QAAQ,CAAC,QAAQ,CAAC,4BAAkB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC1D,QAAQ,CAAC,QAAQ,CAAC,0BAAe,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAEvD,6EAA6E;IAC7E,0FAA0F;IAC1F,QAAQ,CAAC,QAAQ,CAAC,+BAAqB,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;AACnF,CAAC;AARD,4EAQC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp/client",
|
|
3
|
-
"version": "0.10.0-next.
|
|
3
|
+
"version": "0.10.0-next.4ce46ea.160+4ce46ea",
|
|
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": "0.10.0-next.
|
|
37
|
+
"@eclipse-glsp/protocol": "0.10.0-next.4ce46ea.160+4ce46ea",
|
|
38
38
|
"autocompleter": "5.1.0",
|
|
39
39
|
"sprotty": "0.10.0"
|
|
40
40
|
},
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
},
|
|
68
68
|
"main": "lib/index",
|
|
69
69
|
"types": "lib/index",
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "4ce46ea0ab66bbb85785cdffee15faf1d1b43442"
|
|
71
71
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
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
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
SModelElement,
|
|
25
25
|
TYPES
|
|
26
26
|
} from 'sprotty';
|
|
27
|
-
|
|
27
|
+
import { FocusStateChangedAction } from '../../base/actions/focus-change-action';
|
|
28
28
|
import { GLSP_TYPES } from '../../base/types';
|
|
29
29
|
import { SelectionService } from '../select/selection-service';
|
|
30
30
|
|
|
@@ -34,18 +34,47 @@ export class SelectionServiceAwareContextMenuMouseListener extends MouseListener
|
|
|
34
34
|
@inject(TYPES.IContextMenuProviderRegistry) @optional() protected readonly menuProvider: ContextMenuProviderRegistry;
|
|
35
35
|
@inject(GLSP_TYPES.SelectionService) protected selectionService: SelectionService;
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Opens the context menu on right-click.
|
|
39
|
+
*/
|
|
37
40
|
mouseDown(target: SModelElement, event: MouseEvent): (Action | Promise<Action>)[] {
|
|
38
41
|
if (event.button === 2 && this.contextMenuService && this.menuProvider) {
|
|
39
|
-
|
|
40
|
-
const selectableTarget = findParentByFeature(target, isSelectable);
|
|
41
|
-
if (selectableTarget) {
|
|
42
|
-
selectableTarget.selected = true;
|
|
43
|
-
this.selectionService.updateSelection(target.root, [selectableTarget.id], []);
|
|
44
|
-
}
|
|
45
|
-
Promise.all([this.contextMenuService(), this.menuProvider.getItems(target.root, mousePosition)]).then(
|
|
46
|
-
([menuService, menuItems]) => menuService.show(menuItems, mousePosition)
|
|
47
|
-
);
|
|
42
|
+
return this.openContextMenu(event, target);
|
|
48
43
|
}
|
|
49
44
|
return [];
|
|
50
45
|
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Opens the context menu.
|
|
49
|
+
*
|
|
50
|
+
* - query the element on the click-target
|
|
51
|
+
* - select the element
|
|
52
|
+
* - query the context menu service and the context menu elements
|
|
53
|
+
* - show the context menu
|
|
54
|
+
* - send a focus state change to indicate that the diagram becomes inactive, once the context menu is shown
|
|
55
|
+
*
|
|
56
|
+
* When the context menu is closed, we focus the diagram element again.
|
|
57
|
+
*/
|
|
58
|
+
protected openContextMenu(event: MouseEvent, target: SModelElement): Promise<Action>[] {
|
|
59
|
+
const mousePosition = { x: event.x, y: event.y };
|
|
60
|
+
const selectableTarget = findParentByFeature(target, isSelectable);
|
|
61
|
+
if (selectableTarget) {
|
|
62
|
+
selectableTarget.selected = true;
|
|
63
|
+
this.selectionService.updateSelection(target.root, [selectableTarget.id], []);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const result = Promise.all([this.contextMenuService(), this.menuProvider.getItems(target.root, mousePosition)])
|
|
67
|
+
.then(([menuService, menuItems]) => menuService.show(menuItems, mousePosition, () => this.focusEventTarget(event)))
|
|
68
|
+
.then((): Action => new FocusStateChangedAction(false));
|
|
69
|
+
|
|
70
|
+
return [result];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
protected focusEventTarget(event: MouseEvent): void {
|
|
74
|
+
const targetElement = event.target instanceof SVGElement ? event.target : undefined;
|
|
75
|
+
const svgParentElement = targetElement?.closest('svg');
|
|
76
|
+
if (svgParentElement) {
|
|
77
|
+
svgParentElement.focus();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
51
80
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
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
|
|
@@ -35,7 +35,8 @@ import { GlspHoverMouseListener } from './hover';
|
|
|
35
35
|
|
|
36
36
|
const glspHoverModule = new ContainerModule((bind, _unbind, isBound) => {
|
|
37
37
|
bind(TYPES.PopupVNodePostprocessor).to(PopupPositionUpdater).inSingletonScope();
|
|
38
|
-
bind(
|
|
38
|
+
bind(GlspHoverMouseListener).toSelf().inSingletonScope();
|
|
39
|
+
bind(TYPES.MouseListener).toService(GlspHoverMouseListener);
|
|
39
40
|
bind(TYPES.PopupMouseListener).to(PopupHoverMouseListener);
|
|
40
41
|
bind(TYPES.KeyListener).to(HoverKeyListener);
|
|
41
42
|
bind<HoverState>(TYPES.HoverState).toConstantValue({
|
|
@@ -55,6 +56,7 @@ const glspHoverModule = new ContainerModule((bind, _unbind, isBound) => {
|
|
|
55
56
|
configureActionHandler(context, SetViewportCommand.KIND, ClosePopupActionHandler);
|
|
56
57
|
configureActionHandler(context, MoveCommand.KIND, ClosePopupActionHandler);
|
|
57
58
|
configureActionHandler(context, FocusStateChangedAction.KIND, ClosePopupActionHandler);
|
|
59
|
+
configureActionHandler(context, FocusStateChangedAction.KIND, GlspHoverMouseListener);
|
|
58
60
|
});
|
|
59
61
|
|
|
60
62
|
export default glspHoverModule;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
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
|
|
@@ -17,7 +17,10 @@ import { Action, Bounds, RequestPopupModelAction, SetPopupModelAction } from '@e
|
|
|
17
17
|
import { injectable } from 'inversify';
|
|
18
18
|
import {
|
|
19
19
|
EMPTY_ROOT,
|
|
20
|
+
HoverFeedbackAction,
|
|
20
21
|
HoverMouseListener,
|
|
22
|
+
IActionHandler,
|
|
23
|
+
ICommand,
|
|
21
24
|
PreRenderedElementSchema,
|
|
22
25
|
SIssueMarker,
|
|
23
26
|
SIssueSeverity,
|
|
@@ -25,10 +28,31 @@ import {
|
|
|
25
28
|
SModelElementSchema,
|
|
26
29
|
SModelRootSchema
|
|
27
30
|
} from 'sprotty';
|
|
31
|
+
import { isFocusStateChangedAction } from '../../base/actions/focus-change-action';
|
|
28
32
|
import { GIssueMarker } from '../validation/issue-marker';
|
|
29
33
|
|
|
30
34
|
@injectable()
|
|
31
|
-
export class GlspHoverMouseListener extends HoverMouseListener {
|
|
35
|
+
export class GlspHoverMouseListener extends HoverMouseListener implements IActionHandler {
|
|
36
|
+
/**
|
|
37
|
+
* Stops mouse over timer and remove hover feedback, if focus is lost.
|
|
38
|
+
*
|
|
39
|
+
* This fixes strange effects that appear if the mouse left the element via e.g. a context menu,
|
|
40
|
+
* which explicitly removes the focus of the diagram.
|
|
41
|
+
* @see SelectionServiceAwareContextMenuMouseListener
|
|
42
|
+
* @param action should be a `FocusStateChangedAction`
|
|
43
|
+
* @returns a `HoverFeedbackAction` resetting the state, if the specified action indicates lost focus
|
|
44
|
+
*/
|
|
45
|
+
handle(action: Action): void | Action | ICommand {
|
|
46
|
+
if (isFocusStateChangedAction(action) && !action.hasFocus) {
|
|
47
|
+
this.stopMouseOverTimer();
|
|
48
|
+
if (this.lastHoverFeedbackElementId) {
|
|
49
|
+
const previousTargetId = this.lastHoverFeedbackElementId;
|
|
50
|
+
this.lastHoverFeedbackElementId = undefined;
|
|
51
|
+
return new HoverFeedbackAction(previousTargetId, false);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
32
56
|
protected startMouseOverTimer(target: SModelElement, event: MouseEvent): Promise<Action> {
|
|
33
57
|
this.stopMouseOverTimer();
|
|
34
58
|
return new Promise(resolve => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
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
|
|
@@ -30,7 +30,7 @@ export interface IFeedbackEmitter {}
|
|
|
30
30
|
* extending the `SModelRoot`. Therefore, tools can register themselves
|
|
31
31
|
* as feedback emitters with actions they want to place for showing
|
|
32
32
|
* feedback. This dispatcher will then re-establish all feedback actions
|
|
33
|
-
* of the registered
|
|
33
|
+
* of the registered emitters, whenever the `SModelRoot` has been set or updated.
|
|
34
34
|
*/
|
|
35
35
|
export interface IFeedbackActionDispatcher {
|
|
36
36
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
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
|
|
@@ -39,15 +39,15 @@ export abstract class BaseGLSPTool implements GLSPTool {
|
|
|
39
39
|
return true;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
dispatchFeedback(actions: Action[], feedbackeEmitter?: IFeedbackEmitter): void {
|
|
43
|
-
this.feedbackDispatcher.registerFeedback(feedbackeEmitter ? feedbackeEmitter : this, actions);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
42
|
dispatchActions(actions: Action[]): void {
|
|
47
43
|
this.actionDispatcher.dispatchAll(actions);
|
|
48
44
|
}
|
|
49
45
|
|
|
50
|
-
|
|
51
|
-
this.feedbackDispatcher.
|
|
46
|
+
dispatchFeedback(actions: Action[], feedbackEmitter?: IFeedbackEmitter): void {
|
|
47
|
+
this.feedbackDispatcher.registerFeedback(feedbackEmitter ?? this, actions);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
deregisterFeedback(actions: Action[], feedbackEmitter?: IFeedbackEmitter): void {
|
|
51
|
+
this.feedbackDispatcher.deregisterFeedback(feedbackEmitter ?? this, actions);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import {
|
|
17
17
|
Action,
|
|
18
18
|
ComputedBoundsAction,
|
|
19
|
+
ExportSvgAction,
|
|
19
20
|
GLSPClient,
|
|
20
21
|
isRequestModelAction,
|
|
21
22
|
isServerMessageAction,
|
|
@@ -103,6 +104,7 @@ export function isReceivedFromServer(action: Action): boolean {
|
|
|
103
104
|
export function registerDefaultGLSPServerActions(registry: ActionHandlerRegistry, diagramServer: DiagramServer): void {
|
|
104
105
|
registry.register(ServerMessageAction.KIND, diagramServer);
|
|
105
106
|
registry.register(ServerStatusAction.KIND, diagramServer);
|
|
107
|
+
registry.register(ExportSvgAction.KIND, diagramServer);
|
|
106
108
|
|
|
107
109
|
// Register an empty handler for SwitchEditMode, to avoid runtime exceptions.
|
|
108
110
|
// We don't support SwitchEditMode, but Sprotty still sends those actions, so ignore them.
|