@eclipse-glsp/client 0.10.0-next.06ee84f.156 → 0.10.0-next.827bd0d.158

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.
@@ -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
@@ -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;CAcpF"}
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-2021 EclipseSource and others.
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
- const mousePosition = { x: event.x, y: event.y };
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),
@@ -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;AAEjB,4CAA8C;AAC9C,mEAA+D;AAG/D,IAAa,6CAA6C,GAA1D,MAAa,6CAA8C,SAAQ,uBAAa;IAK5E,SAAS,CAAC,MAAqB,EAAE,KAAiB;QAC9C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,YAAY,EAAE;YACpE,MAAM,aAAa,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;YACjD,MAAM,gBAAgB,GAAG,6BAAmB,CAAC,MAAM,EAAE,sBAAY,CAAC,CAAC;YACnE,IAAI,gBAAgB,EAAE;gBAClB,gBAAgB,CAAC,QAAQ,GAAG,IAAI,CAAC;gBACjC,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;aACjF;YACD,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CACjG,CAAC,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAC3E,CAAC;SACL;QACD,OAAO,EAAE,CAAC;IACd,CAAC;CACJ,CAAA;AAlB0D;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,CAmBzD;AAnBY,sGAA6C"}
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,CAAC,KAAiB,EAAE,MAAqB;QAC9D,MAAM,aAAa,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;QACjD,MAAM,gBAAgB,GAAG,6BAAmB,CAAC,MAAM,EAAE,s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AChF;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-2021 EclipseSource and others.
2
+ * Copyright (c) 2020-2022 EclipseSource and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -1 +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,iBAsBnB,CAAC;AAEH,eAAe,eAAe,CAAC"}
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-2021 EclipseSource and others.
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(sprotty_1.TYPES.MouseListener).to(hover_1.GlspHoverMouseListener);
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;AACjF,mCAAiD;AAEjD,MAAM,eAAe,GAAG,IAAI,2BAAe,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IACnE,IAAI,CAAC,eAAK,CAAC,uBAAuB,CAAC,CAAC,EAAE,CAAC,6CAAoB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAChF,IAAI,CAAC,eAAK,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,8BAAsB,CAAC,CAAC;IACrD,IAAI,CAAC,eAAK,CAAC,kBAAkB,CAAC,CA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kB,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-2021 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
@@ -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,EAEH,kBAAkB,EAElB,YAAY,EACZ,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EACnB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,qBACa,sBAAuB,SAAQ,kBAAkB;IAC1D,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"}
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-2021 EclipseSource and others.
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,qCASiB;AACjB,6DAA0D;AAG1D,IAAa,sBAAsB,GAAnC,MAAa,sBAAuB,SAAQ,4BAAkB;IAChD,mBAAmB,CAAC,MAAqB,EAAE,KAAiB;QAClE,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC1B,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;YACzB,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE;gBAC/C,MAAM,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;gBACxF,IAAI,MAAM,YAAY,2BAAY,EAAE;oBAChC,OAAO,CAAC,IAAI,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M,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,qDASgC;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,UA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IAChB,CAAC;IAES,uBAAuB,CAAC,MAAyB;QACvD,OAAO,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;IAEM,YAAY;QACf,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;CACJ,CAAA;AAhEY,iBAAiB;IAD7B,sBAAU,EAAE;GACA,iBAAiB,CAgE7B;AAhEY,8CAAiB;AAkE9B,SAAgB,oBAAoB,CAAC,MAAc;IAC/C,OAAQ,MAAc,CAAC,0BAA0B,CAAC,KAAK,IAAI,CAAC;AAChE,CAAC;AAFD,oDAEC;AAED,SAAgB,gCAAgC,CAAC,QAA+B,EAAE,aAA4B;IAC1G,QAAQ,CAAC,QAAQ,CAAC,8BAAmB,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.06ee84f.156+06ee84f",
3
+ "version": "0.10.0-next.827bd0d.158+827bd0d",
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.06ee84f.156+06ee84f",
37
+ "@eclipse-glsp/protocol": "0.10.0-next.827bd0d.158+827bd0d",
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": "06ee84f267881797975e68ef02f95a03891c8235"
70
+ "gitHead": "827bd0d9c5f53f106af6f8835316daf2a378ca4b"
71
71
  }
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2019-2021 EclipseSource and others.
2
+ * Copyright (c) 2019-2022 EclipseSource and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -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
- const mousePosition = { x: event.x, y: event.y };
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-2021 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
@@ -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(TYPES.MouseListener).to(GlspHoverMouseListener);
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-2021 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
@@ -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 => {
@@ -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.