@eclipse-glsp/client 2.5.0 → 2.6.0-next.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/css/command-palette.css +2 -0
  2. package/css/navigation.css +2 -2
  3. package/css/search.css +12 -3
  4. package/lib/base/action-dispatcher.d.ts +7 -1
  5. package/lib/base/action-dispatcher.d.ts.map +1 -1
  6. package/lib/base/action-dispatcher.js +82 -15
  7. package/lib/base/action-dispatcher.js.map +1 -1
  8. package/lib/base/auto-complete/auto-complete-widget.d.ts +2 -2
  9. package/lib/base/auto-complete/auto-complete-widget.d.ts.map +1 -1
  10. package/lib/base/auto-complete/auto-complete-widget.js +5 -2
  11. package/lib/base/auto-complete/auto-complete-widget.js.map +1 -1
  12. package/lib/base/auto-complete/autocomplete-suggestion-provider.d.ts +56 -0
  13. package/lib/base/auto-complete/autocomplete-suggestion-provider.d.ts.map +1 -0
  14. package/lib/base/auto-complete/autocomplete-suggestion-provider.js +56 -0
  15. package/lib/base/auto-complete/autocomplete-suggestion-provider.js.map +1 -0
  16. package/lib/base/auto-complete/base-autocomplete-palette.d.ts +4 -9
  17. package/lib/base/auto-complete/base-autocomplete-palette.d.ts.map +1 -1
  18. package/lib/base/auto-complete/base-autocomplete-palette.js +2 -2
  19. package/lib/base/auto-complete/base-autocomplete-palette.js.map +1 -1
  20. package/lib/base/default.module.d.ts.map +1 -1
  21. package/lib/base/default.module.js +4 -0
  22. package/lib/base/default.module.js.map +1 -1
  23. package/lib/base/messages.json +68 -57
  24. package/lib/base/tool-manager/tool-manager.d.ts +2 -2
  25. package/lib/base/tool-manager/tool-manager.d.ts.map +1 -1
  26. package/lib/base/tool-manager/tool-manager.js +4 -4
  27. package/lib/base/tool-manager/tool-manager.js.map +1 -1
  28. package/lib/default-modules.d.ts +1 -1
  29. package/lib/default-modules.d.ts.map +1 -1
  30. package/lib/default-modules.js +4 -1
  31. package/lib/default-modules.js.map +1 -1
  32. package/lib/features/accessibility/accessibility-module.d.ts.map +1 -1
  33. package/lib/features/accessibility/accessibility-module.js +2 -4
  34. package/lib/features/accessibility/accessibility-module.js.map +1 -1
  35. package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-palette.d.ts +21 -15
  36. package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-palette.d.ts.map +1 -1
  37. package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-palette.js +59 -45
  38. package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-palette.js.map +1 -1
  39. package/lib/features/accessibility/element-navigation/diagram-navigation-tool.d.ts.map +1 -1
  40. package/lib/features/accessibility/element-navigation/diagram-navigation-tool.js +2 -3
  41. package/lib/features/accessibility/element-navigation/diagram-navigation-tool.js.map +1 -1
  42. package/lib/features/accessibility/{keyboard-pointer/keyboard-pointer-module.d.ts → keyboard/keyboard-module.d.ts} +2 -2
  43. package/lib/features/accessibility/keyboard/keyboard-module.d.ts.map +1 -0
  44. package/lib/features/accessibility/{keyboard-pointer/keyboard-pointer-module.js → keyboard/keyboard-module.js} +7 -4
  45. package/lib/features/accessibility/keyboard/keyboard-module.js.map +1 -0
  46. package/lib/features/accessibility/keyboard-grid/keyboard-grid-search-palette.d.ts +15 -12
  47. package/lib/features/accessibility/keyboard-grid/keyboard-grid-search-palette.d.ts.map +1 -1
  48. package/lib/features/accessibility/keyboard-grid/keyboard-grid-search-palette.js +40 -22
  49. package/lib/features/accessibility/keyboard-grid/keyboard-grid-search-palette.js.map +1 -1
  50. package/lib/features/accessibility/keyboard-grid/keyboard-node-grid.d.ts +1 -1
  51. package/lib/features/accessibility/keyboard-grid/keyboard-node-grid.js +2 -2
  52. package/lib/features/accessibility/keyboard-grid/keyboard-node-grid.js.map +1 -1
  53. package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts +1 -1
  54. package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts.map +1 -1
  55. package/lib/features/bounds/glsp-hidden-bounds-updater.js +4 -1
  56. package/lib/features/bounds/glsp-hidden-bounds-updater.js.map +1 -1
  57. package/lib/features/change-bounds/movement-restrictor.d.ts +12 -4
  58. package/lib/features/change-bounds/movement-restrictor.d.ts.map +1 -1
  59. package/lib/features/change-bounds/movement-restrictor.js +44 -17
  60. package/lib/features/change-bounds/movement-restrictor.js.map +1 -1
  61. package/lib/features/command-palette/command-palette.d.ts +3 -1
  62. package/lib/features/command-palette/command-palette.d.ts.map +1 -1
  63. package/lib/features/command-palette/command-palette.js +37 -0
  64. package/lib/features/command-palette/command-palette.js.map +1 -1
  65. package/lib/features/context-menu/delete-element-context-menu.d.ts +4 -4
  66. package/lib/features/context-menu/delete-element-context-menu.d.ts.map +1 -1
  67. package/lib/features/context-menu/delete-element-context-menu.js +6 -2
  68. package/lib/features/context-menu/delete-element-context-menu.js.map +1 -1
  69. package/lib/features/context-menu/server-context-menu-provider.d.ts +4 -4
  70. package/lib/features/context-menu/server-context-menu-provider.d.ts.map +1 -1
  71. package/lib/features/context-menu/server-context-menu-provider.js +4 -5
  72. package/lib/features/context-menu/server-context-menu-provider.js.map +1 -1
  73. package/lib/features/copy-paste/copy-paste-context-menu.d.ts +22 -5
  74. package/lib/features/copy-paste/copy-paste-context-menu.d.ts.map +1 -1
  75. package/lib/features/copy-paste/copy-paste-context-menu.js +16 -11
  76. package/lib/features/copy-paste/copy-paste-context-menu.js.map +1 -1
  77. package/lib/features/decoration/decoration-module.d.ts +1 -1
  78. package/lib/features/decoration/decoration-module.d.ts.map +1 -1
  79. package/lib/features/decoration/decoration-module.js +2 -1
  80. package/lib/features/decoration/decoration-module.js.map +1 -1
  81. package/lib/features/decoration/decoration-placer.d.ts +9 -3
  82. package/lib/features/decoration/decoration-placer.d.ts.map +1 -1
  83. package/lib/features/decoration/decoration-placer.js +32 -1
  84. package/lib/features/decoration/decoration-placer.js.map +1 -1
  85. package/{src/features/accessibility/edge-autocomplete/edge-autocomplete-context.ts → lib/features/search-palette/search-palette-key-listener.d.ts} +5 -9
  86. package/lib/features/search-palette/search-palette-key-listener.d.ts.map +1 -0
  87. package/lib/features/search-palette/search-palette-key-listener.js +45 -0
  88. package/lib/features/search-palette/search-palette-key-listener.js.map +1 -0
  89. package/lib/features/{accessibility/search → search-palette}/search-palette-module.d.ts +4 -3
  90. package/lib/features/search-palette/search-palette-module.d.ts.map +1 -0
  91. package/lib/features/search-palette/search-palette-module.js +39 -0
  92. package/lib/features/search-palette/search-palette-module.js.map +1 -0
  93. package/lib/features/search-palette/search-palette.d.ts +51 -0
  94. package/lib/features/search-palette/search-palette.d.ts.map +1 -0
  95. package/lib/features/search-palette/search-palette.js +141 -0
  96. package/lib/features/search-palette/search-palette.js.map +1 -0
  97. package/{src/base/auto-complete/autocomplete-suggestion-providers.ts → lib/features/search-palette/suggestions/edge-element-suggestions.d.ts} +11 -22
  98. package/lib/features/search-palette/suggestions/edge-element-suggestions.d.ts.map +1 -0
  99. package/lib/features/search-palette/suggestions/edge-element-suggestions.js +72 -0
  100. package/lib/features/search-palette/suggestions/edge-element-suggestions.js.map +1 -0
  101. package/lib/features/search-palette/suggestions/named-element-suggestions.d.ts +30 -0
  102. package/lib/features/search-palette/suggestions/named-element-suggestions.d.ts.map +1 -0
  103. package/lib/features/search-palette/suggestions/named-element-suggestions.js +83 -0
  104. package/lib/features/search-palette/suggestions/named-element-suggestions.js.map +1 -0
  105. package/lib/features/validation/marker-navigator.d.ts +3 -3
  106. package/lib/features/validation/marker-navigator.d.ts.map +1 -1
  107. package/lib/features/validation/marker-navigator.js +8 -7
  108. package/lib/features/validation/marker-navigator.js.map +1 -1
  109. package/lib/features/viewport/reposition.d.ts.map +1 -1
  110. package/lib/features/viewport/reposition.js +1 -5
  111. package/lib/features/viewport/reposition.js.map +1 -1
  112. package/lib/index.d.ts +7 -6
  113. package/lib/index.d.ts.map +1 -1
  114. package/lib/index.js +7 -6
  115. package/lib/index.js.map +1 -1
  116. package/lib/standalone-modules.d.ts +1 -1
  117. package/lib/standalone-modules.d.ts.map +1 -1
  118. package/lib/standalone-modules.js +2 -0
  119. package/lib/standalone-modules.js.map +1 -1
  120. package/lib/utils/gmodel-util.d.ts +32 -2
  121. package/lib/utils/gmodel-util.d.ts.map +1 -1
  122. package/lib/utils/gmodel-util.js +29 -1
  123. package/lib/utils/gmodel-util.js.map +1 -1
  124. package/package.json +4 -4
  125. package/src/base/action-dispatcher.ts +88 -15
  126. package/src/base/auto-complete/auto-complete-widget.ts +7 -4
  127. package/src/base/auto-complete/autocomplete-suggestion-provider.ts +86 -0
  128. package/src/base/auto-complete/base-autocomplete-palette.ts +6 -6
  129. package/src/base/default.module.ts +5 -0
  130. package/src/base/messages.json +68 -57
  131. package/src/base/tool-manager/tool-manager.ts +4 -4
  132. package/src/default-modules.ts +4 -1
  133. package/src/features/accessibility/accessibility-module.ts +1 -3
  134. package/src/features/accessibility/edge-autocomplete/edge-autocomplete-palette.ts +75 -52
  135. package/src/features/accessibility/element-navigation/diagram-navigation-tool.ts +2 -4
  136. package/src/features/accessibility/{keyboard-pointer/keyboard-pointer-module.ts → keyboard/keyboard-module.ts} +12 -5
  137. package/src/features/accessibility/keyboard-grid/keyboard-grid-search-palette.ts +36 -22
  138. package/src/features/accessibility/keyboard-grid/keyboard-node-grid.ts +3 -3
  139. package/src/features/bounds/glsp-hidden-bounds-updater.ts +5 -1
  140. package/src/features/change-bounds/movement-restrictor.ts +72 -19
  141. package/src/features/command-palette/command-palette.ts +41 -1
  142. package/src/features/context-menu/delete-element-context-menu.ts +9 -5
  143. package/src/features/context-menu/server-context-menu-provider.ts +8 -9
  144. package/src/features/copy-paste/copy-paste-context-menu.ts +21 -17
  145. package/src/features/decoration/decoration-module.ts +2 -1
  146. package/src/features/decoration/decoration-placer.ts +49 -4
  147. package/src/features/{accessibility/search/search-palette-module.ts → search-palette/search-palette-key-listener.ts} +15 -14
  148. package/src/features/search-palette/search-palette-module.ts +48 -0
  149. package/src/features/search-palette/search-palette.ts +164 -0
  150. package/src/features/search-palette/suggestions/edge-element-suggestions.ts +71 -0
  151. package/src/features/search-palette/suggestions/named-element-suggestions.ts +88 -0
  152. package/src/features/validation/marker-navigator.ts +9 -8
  153. package/src/features/viewport/reposition.ts +1 -7
  154. package/src/index.ts +7 -6
  155. package/src/standalone-modules.ts +2 -0
  156. package/src/utils/gmodel-util.ts +59 -1
  157. package/lib/base/auto-complete/autocomplete-suggestion-providers.d.ts +0 -35
  158. package/lib/base/auto-complete/autocomplete-suggestion-providers.d.ts.map +0 -1
  159. package/lib/base/auto-complete/autocomplete-suggestion-providers.js +0 -18
  160. package/lib/base/auto-complete/autocomplete-suggestion-providers.js.map +0 -1
  161. package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-context.d.ts +0 -23
  162. package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-context.d.ts.map +0 -1
  163. package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-context.js +0 -18
  164. package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-context.js.map +0 -1
  165. package/lib/features/accessibility/keyboard-pointer/keyboard-pointer-module.d.ts.map +0 -1
  166. package/lib/features/accessibility/keyboard-pointer/keyboard-pointer-module.js.map +0 -1
  167. package/lib/features/accessibility/search/search-palette-module.d.ts.map +0 -1
  168. package/lib/features/accessibility/search/search-palette-module.js +0 -32
  169. package/lib/features/accessibility/search/search-palette-module.js.map +0 -1
  170. package/lib/features/accessibility/search/search-palette.d.ts +0 -51
  171. package/lib/features/accessibility/search/search-palette.d.ts.map +0 -1
  172. package/lib/features/accessibility/search/search-palette.js +0 -186
  173. package/lib/features/accessibility/search/search-palette.js.map +0 -1
  174. package/lib/features/accessibility/search/search-tool.d.ts +0 -33
  175. package/lib/features/accessibility/search/search-tool.d.ts.map +0 -1
  176. package/lib/features/accessibility/search/search-tool.js +0 -84
  177. package/lib/features/accessibility/search/search-tool.js.map +0 -1
  178. package/src/features/accessibility/search/search-palette.ts +0 -218
  179. package/src/features/accessibility/search/search-tool.ts +0 -74
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2023-2024 Business Informatics Group (TU Wien) and others.
2
+ * Copyright (c) 2023-2025 Business Informatics Group (TU Wien) 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
@@ -23,15 +23,19 @@ import {
23
23
  configureActionHandler
24
24
  } from '@eclipse-glsp/sprotty';
25
25
  import { SetEdgeTargetSelectionAction } from '../edge-autocomplete/action';
26
- import { EdgeAutocompletePalette } from '../edge-autocomplete/edge-autocomplete-palette';
26
+ import { EdgeAutocompletePalette, SetEdgeTargetGridSuggestionProvider } from '../edge-autocomplete/edge-autocomplete-palette';
27
27
  import { EdgeAutocompletePaletteTool } from '../edge-autocomplete/edge-autocomplete-tool';
28
28
  import { GlobalKeyListenerTool } from '../global-keylistener-tool';
29
29
  import { EnableKeyboardGridAction, KeyboardGridCellSelectedAction } from '../keyboard-grid/action';
30
30
  import { KeyboardGrid } from '../keyboard-grid/keyboard-grid';
31
- import { GridSearchPalette } from '../keyboard-grid/keyboard-grid-search-palette';
31
+ import {
32
+ GridSearchPalette,
33
+ RevealGridEdgeSuggestionProvider,
34
+ RevealGridNamedElementSuggestionProvider
35
+ } from '../keyboard-grid/keyboard-grid-search-palette';
32
36
  import { KeyboardNodeGrid } from '../keyboard-grid/keyboard-node-grid';
33
- import { SetKeyboardPointerRenderPositionAction } from './actions';
34
- import { KeyboardPointer } from './keyboard-pointer';
37
+ import { SetKeyboardPointerRenderPositionAction } from '../keyboard-pointer/actions';
38
+ import { KeyboardPointer } from '../keyboard-pointer/keyboard-pointer';
35
39
 
36
40
  /**
37
41
  * Handles the pointer used via grid to position new elements.
@@ -55,6 +59,7 @@ export function configureKeyboardControlTools(context: BindingContext): void {
55
59
 
56
60
  bindAsService(context, TYPES.IUIExtension, EdgeAutocompletePalette);
57
61
  bindAsService(context, TYPES.IDefaultTool, EdgeAutocompletePaletteTool);
62
+ bindAsService(context, TYPES.IAutocompleteSuggestionProvider, SetEdgeTargetGridSuggestionProvider);
58
63
 
59
64
  configureActionHandler(context, EnableKeyboardGridAction.KIND, KeyboardGrid);
60
65
  configureActionHandler(context, KeyboardGridCellSelectedAction.KIND, KeyboardPointer);
@@ -63,4 +68,6 @@ export function configureKeyboardControlTools(context: BindingContext): void {
63
68
  configureActionHandler(context, SetEdgeTargetSelectionAction.KIND, EdgeAutocompletePalette);
64
69
 
65
70
  bindAsService(context, TYPES.IUIExtension, GridSearchPalette);
71
+ bindAsService(context, TYPES.IAutocompleteSuggestionProvider, RevealGridEdgeSuggestionProvider);
72
+ bindAsService(context, TYPES.IAutocompleteSuggestionProvider, RevealGridNamedElementSuggestionProvider);
66
73
  }
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2023 Business Informatics Group (TU Wien) and others.
2
+ * Copyright (c) 2023-2025 Business Informatics Group (TU Wien) and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -15,36 +15,40 @@
15
15
  ********************************************************************************/
16
16
  import '../../../../css/keyboard.css';
17
17
 
18
- import { Action, GModelElement, GModelRoot, SetUIExtensionVisibilityAction } from '@eclipse-glsp/sprotty';
18
+ import { Action, GModelElement, SetUIExtensionVisibilityAction } from '@eclipse-glsp/sprotty';
19
19
  import { injectable } from 'inversify';
20
- import { IAutocompleteSuggestionProvider } from '../../../base/auto-complete/autocomplete-suggestion-providers';
21
- import {
22
- RevealEdgeElementAutocompleteSuggestionProvider,
23
- RevealNamedElementAutocompleteSuggestionProvider,
24
- SearchAutocompletePalette
25
- } from '../search/search-palette';
26
- import { KeyboardGridMetadata } from './constants';
27
20
  import { GEdge } from '../../../model';
28
-
29
- export namespace GridSearchPaletteMetadata {
30
- export const ID = 'grid-search-palette';
31
- }
21
+ import { SearchAutocompletePalette } from '../../search-palette/search-palette';
22
+ import { RevealEdgeElementSuggestionProvider } from '../../search-palette/suggestions/edge-element-suggestions';
23
+ import { RevealNamedElementSuggestionProvider } from '../../search-palette/suggestions/named-element-suggestions';
24
+ import { KeyboardGridMetadata } from './constants';
32
25
 
33
26
  @injectable()
34
27
  export class GridSearchPalette extends SearchAutocompletePalette {
28
+ static override readonly ID: string = 'glsp.grid-search-palette';
29
+
35
30
  override id(): string {
36
- return GridSearchPaletteMetadata.ID;
31
+ return GridSearchPalette.ID;
37
32
  }
38
33
 
39
- protected override getSuggestionProviders(root: Readonly<GModelRoot>, input: string): IAutocompleteSuggestionProvider[] {
40
- return [new GridRevealNamedElementSuggestionProvider(), new GridRevealEdgeSuggestionProvider()];
34
+ override get searchContext(): string[] {
35
+ return [GridSearchPalette.ID];
41
36
  }
42
37
  }
43
38
 
44
- export class GridRevealEdgeSuggestionProvider extends RevealEdgeElementAutocompleteSuggestionProvider {
45
- protected override getActions(edge: GEdge): Action[] {
39
+ @injectable()
40
+ export class RevealGridEdgeSuggestionProvider extends RevealEdgeElementSuggestionProvider {
41
+ override get id(): string {
42
+ return 'glsp.reveal-grid-edge-suggestion';
43
+ }
44
+
45
+ override canHandle(searchContext: string): boolean {
46
+ return searchContext === GridSearchPalette.ID;
47
+ }
48
+
49
+ protected override createActions(edge: GEdge): Action[] {
46
50
  return [
47
- ...super.getActions(edge),
51
+ ...super.createActions(edge),
48
52
  SetUIExtensionVisibilityAction.create({
49
53
  extensionId: KeyboardGridMetadata.ID,
50
54
  visible: true
@@ -52,10 +56,20 @@ export class GridRevealEdgeSuggestionProvider extends RevealEdgeElementAutocompl
52
56
  ];
53
57
  }
54
58
  }
55
- export class GridRevealNamedElementSuggestionProvider extends RevealNamedElementAutocompleteSuggestionProvider {
56
- protected override getActions(nameable: GModelElement): Action[] {
59
+
60
+ @injectable()
61
+ export class RevealGridNamedElementSuggestionProvider extends RevealNamedElementSuggestionProvider {
62
+ override get id(): string {
63
+ return 'glsp.reveal-grid-named-element-suggestion';
64
+ }
65
+
66
+ override canHandle(searchContext: string): boolean {
67
+ return searchContext === GridSearchPalette.ID;
68
+ }
69
+
70
+ protected override createActions(nameable: GModelElement): Action[] {
57
71
  return [
58
- ...super.getActions(nameable),
72
+ ...super.createActions(nameable),
59
73
  SetUIExtensionVisibilityAction.create({
60
74
  extensionId: KeyboardGridMetadata.ID,
61
75
  visible: true
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2023-2024 Business Informatics Group (TU Wien) and others.
2
+ * Copyright (c) 2023-2025 Business Informatics Group (TU Wien) 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
@@ -21,7 +21,7 @@ import { KeyboardPointerMetadata } from '../keyboard-pointer/constants';
21
21
  import { KeyboardPointer } from '../keyboard-pointer/keyboard-pointer';
22
22
  import { KeyboardNodeGridMetadata } from './constants';
23
23
  import { KeyboardGrid } from './keyboard-grid';
24
- import { GridSearchPaletteMetadata } from './keyboard-grid-search-palette';
24
+ import { GridSearchPalette } from './keyboard-grid-search-palette';
25
25
 
26
26
  @injectable()
27
27
  export class KeyboardNodeGrid extends KeyboardGrid {
@@ -52,7 +52,7 @@ export class KeyboardNodeGrid extends KeyboardGrid {
52
52
  event.preventDefault();
53
53
  this.actionDispatcher.dispatch(
54
54
  SetUIExtensionVisibilityAction.create({
55
- extensionId: GridSearchPaletteMetadata.ID,
55
+ extensionId: GridSearchPalette.ID,
56
56
  visible: true
57
57
  })
58
58
  );
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2022-2024 EclipseSource and others.
2
+ * Copyright (c) 2022-2025 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
@@ -65,6 +65,10 @@ export class GLSPHiddenBoundsUpdater extends HiddenBoundsUpdater {
65
65
  }
66
66
 
67
67
  override postUpdate(cause?: Action): void {
68
+ if (cause === undefined || cause.kind !== RequestBoundsAction.KIND) {
69
+ return;
70
+ }
71
+
68
72
  if (LocalRequestBoundsAction.is(cause) && cause.elementIDs) {
69
73
  this.focusOnElements(cause.elementIDs);
70
74
  }
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2019-2024 EclipseSource and others.
2
+ * Copyright (c) 2019-2025 EclipseSource and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -13,11 +13,23 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { Bounds, Dimension, GModelElement, GNode, GParentElement, Point, isBoundsAware, isMoveable } from '@eclipse-glsp/sprotty';
16
+ import {
17
+ Bounds,
18
+ Dimension,
19
+ GChildElement,
20
+ GModelElement,
21
+ GNode,
22
+ GParentElement,
23
+ isBoundsAware,
24
+ isMoveable,
25
+ Point,
26
+ toTypeGuard
27
+ } from '@eclipse-glsp/sprotty';
17
28
  import { injectable } from 'inversify';
18
- import { ModifyCSSFeedbackAction } from '../../base/feedback/css-feedback';
19
- import { BoundsAwareModelElement } from '../../utils/gmodel-util';
29
+ import { CSS_GHOST_ELEMENT, ModifyCSSFeedbackAction } from '../../base/feedback/css-feedback';
30
+ import { BoundsAwareModelElement, getChildren, getParents } from '../../utils/gmodel-util';
20
31
  import { toAbsoluteBounds } from '../../utils/viewpoint-util';
32
+ import { ContainerElement, isContainable } from '../hints/model';
21
33
  import { GResizeHandle } from './model';
22
34
 
23
35
  /**
@@ -39,34 +51,75 @@ export interface IMovementRestrictor {
39
51
  cssClasses?: string[];
40
52
  }
41
53
 
54
+ export interface MoveElementContext {
55
+ element: GModelElement;
56
+ elementAtNewLocation: BoundsAwareModelElement;
57
+ parentContainers: ContainerElement[];
58
+ childNodes: GNode[];
59
+ }
60
+
42
61
  /**
43
62
  * A `IMovementRestrictor` that checks for overlapping elements. Move operations
44
- * are only valid if the element does not collide with another element after moving.
63
+ * are only valid if the element does not collide with another element/node after moving.
45
64
  */
46
65
  @injectable()
47
66
  export class NoOverlapMovementRestrictor implements IMovementRestrictor {
48
67
  cssClasses = ['movement-not-allowed'];
49
68
 
50
69
  validate(element: GModelElement, newLocation?: Point): boolean {
51
- if (!isMoveable(element) || !newLocation) {
70
+ if (!(element instanceof GChildElement) || !isMoveable(element) || !newLocation) {
52
71
  return false;
53
72
  }
54
- // Create ghost element at the newLocation
73
+
74
+ const moveContext = this.createMoveElementContext(element, newLocation);
75
+ const elementsToValidate = Array.from(element.root.index.all()).filter(e =>
76
+ this.isBoundsRelevant(e, moveContext)
77
+ ) as BoundsAwareModelElement[];
78
+
79
+ const valid = !elementsToValidate.some(e => this.areOverlapping(e, moveContext.elementAtNewLocation));
80
+ return valid;
81
+ }
82
+
83
+ protected createMoveElementContext(element: GModelElement, newLocation: Point): MoveElementContext {
84
+ const parentContainers = getParents(element, isContainable);
85
+ const childNodes = getChildren(element, toTypeGuard(GNode));
86
+ // Create a mock element at the newLocation for overlap checking
55
87
  const dimensions: Dimension = isBoundsAware(element) ? element.bounds : { width: 1, height: 1 };
56
- const ghostElement = Object.create(element) as BoundsAwareModelElement;
57
- ghostElement.bounds = { ...dimensions, ...newLocation };
58
- ghostElement.type = 'Ghost';
59
- ghostElement.id = element.id;
60
- return !Array.from(
61
- element.root.index
62
- .all()
63
- .filter(node => node.id !== ghostElement.id && node !== ghostElement.root && node instanceof GNode)
64
- .map(node => node as BoundsAwareModelElement)
65
- ).some(e => this.areOverlapping(e, ghostElement));
88
+ const elementAtNewLocation = Object.create(element) as BoundsAwareModelElement as BoundsAwareModelElement;
89
+ elementAtNewLocation.bounds = { ...dimensions, ...newLocation };
90
+
91
+ return {
92
+ element,
93
+ elementAtNewLocation,
94
+ parentContainers,
95
+ childNodes
96
+ };
66
97
  }
67
98
 
68
- protected isBoundsRelevant(element: GModelElement, ghostElement: BoundsAwareModelElement): element is BoundsAwareModelElement {
69
- return element.id !== ghostElement.id && element !== ghostElement.root && element instanceof GNode && isBoundsAware(element);
99
+ protected isBoundsRelevant(element: GModelElement, moveContext: MoveElementContext): element is BoundsAwareModelElement {
100
+ // Only consider GNodes that are not the element being moved (or one of its children)
101
+ if (
102
+ !(element instanceof GNode) ||
103
+ element.id === moveContext.element.id ||
104
+ moveContext.childNodes.some(child => child.id === element.id)
105
+ ) {
106
+ return false;
107
+ }
108
+
109
+ // Do not consider parent containers of the element being moved
110
+ if (moveContext.parentContainers.length > 0 && moveContext.parentContainers.some(container => container.id === element.id)) {
111
+ return false;
112
+ }
113
+
114
+ // If the element is a ghost element (node creation), don't consider overlap checks for potential parent containers
115
+ if (
116
+ moveContext.element.cssClasses?.includes(CSS_GHOST_ELEMENT) &&
117
+ isContainable(element) &&
118
+ element.isContainableElement(moveContext.element.type)
119
+ ) {
120
+ return false;
121
+ }
122
+ return true;
70
123
  }
71
124
 
72
125
  protected areOverlapping(element1: BoundsAwareModelElement, element2: BoundsAwareModelElement): boolean {
@@ -14,14 +14,16 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
 
17
- import { CommandPalette } from '@eclipse-glsp/sprotty';
17
+ import { Bounds, CommandPalette, getWindowScroll, GModelElement, GModelRoot } from '@eclipse-glsp/sprotty';
18
18
  import { injectable } from 'inversify';
19
19
  import { CSS_HIDDEN_EXTENSION_CLASS, CSS_UI_EXTENSION_CLASS } from '../../base/ui-extension/ui-extension';
20
+ import { getElements, isSelectableAndBoundsAware } from '../../utils/gmodel-util';
20
21
 
21
22
  @injectable()
22
23
  export class GlspCommandPalette extends CommandPalette {
23
24
  protected override initializeContents(containerElement: HTMLElement): void {
24
25
  super.initializeContents(containerElement);
26
+ containerElement.style.position = '';
25
27
  containerElement.classList.add(CSS_UI_EXTENSION_CLASS);
26
28
  }
27
29
 
@@ -32,4 +34,42 @@ export class GlspCommandPalette extends CommandPalette {
32
34
  this.containerElement?.classList.add(CSS_HIDDEN_EXTENSION_CLASS);
33
35
  }
34
36
  }
37
+
38
+ protected override onBeforeShow(containerElement: HTMLElement, root: Readonly<GModelRoot>, ...selectedElementIds: string[]): void {
39
+ let x = this.xOffset;
40
+ let y = this.yOffset;
41
+
42
+ const selectedElements = getElements(root.index, selectedElementIds, isSelectableAndBoundsAware);
43
+ if (selectedElements.length === 1) {
44
+ const bounds = this.getAbsoluteBounds(selectedElements[0]);
45
+ x += bounds.x + bounds.width;
46
+ y += bounds.y;
47
+ } else {
48
+ const bounds = this.getAbsoluteBounds(root);
49
+ x += bounds.x;
50
+ y += bounds.y;
51
+ }
52
+ containerElement.style.left = `${x}px`;
53
+ containerElement.style.top = `${y}px`;
54
+ containerElement.style.width = `${this.defaultWidth}px`;
55
+ }
56
+
57
+ protected getAbsoluteBounds(element: Readonly<GModelElement>): Bounds {
58
+ let x = 0;
59
+ let y = 0;
60
+ let width = 0;
61
+ let height = 0;
62
+
63
+ const svgElementId = this.domHelper.createUniqueDOMElementId(element);
64
+ const svgElement = document.getElementById(svgElementId);
65
+ if (svgElement) {
66
+ const rect = svgElement.getBoundingClientRect();
67
+ const scroll = getWindowScroll();
68
+ x = rect.left + scroll.x;
69
+ y = rect.top + scroll.y;
70
+ width = rect.width;
71
+ height = rect.height;
72
+ }
73
+ return { x, y, width, height };
74
+ }
35
75
  }
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2019-2024 EclipseSource and others.
2
+ * Copyright (c) 2019-2025 EclipseSource and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -13,9 +13,10 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { DeleteElementOperation, GModelRoot, IContextMenuItemProvider, MenuItem, Point, TYPES } from '@eclipse-glsp/sprotty';
16
+ import { ClientMenuItem, DeleteElementOperation, GModelRoot, IContextMenuItemProvider, Point, TYPES } from '@eclipse-glsp/sprotty';
17
17
  import { inject, injectable } from 'inversify';
18
18
  import { EditorContextService, EditorContextServiceProvider } from '../../base/editor-context-service';
19
+ import { messages } from '../../base/messages';
19
20
 
20
21
  @injectable()
21
22
  export class DeleteElementContextMenuItemProvider implements IContextMenuItemProvider {
@@ -26,14 +27,17 @@ export class DeleteElementContextMenuItemProvider implements IContextMenuItemPro
26
27
  @inject(EditorContextService)
27
28
  protected editorContext: EditorContextService;
28
29
 
29
- async getItems(_root: Readonly<GModelRoot>, _lastMousePosition?: Point): Promise<MenuItem[]> {
30
+ async getItems(_root: Readonly<GModelRoot>, _lastMousePosition?: Point): Promise<ClientMenuItem[]> {
31
+ if (this.editorContext.isReadonly) {
32
+ return [];
33
+ }
30
34
  return [this.createDeleteMenuItem()];
31
35
  }
32
36
 
33
- protected createDeleteMenuItem(): MenuItem {
37
+ protected createDeleteMenuItem(): ClientMenuItem {
34
38
  return {
35
39
  id: 'delete',
36
- label: 'Delete',
40
+ label: messages.context_menu.delete,
37
41
  sortString: 'd',
38
42
  group: 'edit',
39
43
  actions: [DeleteElementOperation.create(this.editorContext.selectedElements.map(e => e.id))],
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2019-2024 EclipseSource and others.
2
+ * Copyright (c) 2019-2025 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,11 +14,11 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
  import {
17
- Action,
17
+ ClientMenuItem,
18
18
  GModelElement,
19
19
  IActionDispatcher,
20
20
  IContextMenuItemProvider,
21
- LabeledAction,
21
+ MenuItem,
22
22
  Point,
23
23
  RequestContextActions,
24
24
  SetContextActions,
@@ -37,7 +37,7 @@ export class ServerContextMenuItemProvider implements IContextMenuItemProvider {
37
37
  @inject(TYPES.IActionDispatcher) protected actionDispatcher: IActionDispatcher;
38
38
  @inject(EditorContextService) protected editorContext: EditorContextService;
39
39
 
40
- async getItems(root: Readonly<GModelElement>, _lastMousePosition?: Point): Promise<LabeledAction[]> {
40
+ async getItems(root: Readonly<GModelElement>, _lastMousePosition?: Point): Promise<ClientMenuItem[]> {
41
41
  const selectedElementIds = Array.from(
42
42
  root.index
43
43
  .all()
@@ -50,10 +50,9 @@ export class ServerContextMenuItemProvider implements IContextMenuItemProvider {
50
50
  return response ? this.getContextActionsFromResponse(response) : [];
51
51
  }
52
52
 
53
- getContextActionsFromResponse(action: Action): LabeledAction[] {
54
- if (SetContextActions.is(action)) {
55
- return action.actions;
56
- }
57
- return [];
53
+ getContextActionsFromResponse(action: SetContextActions): ClientMenuItem[] {
54
+ return action.actions
55
+ .filter(item => MenuItem.is(item)) //
56
+ .map(item => ClientMenuItem.convert(item));
58
57
  }
59
58
  }
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2020-2023 EclipseSource and others.
2
+ * Copyright (c) 2020-2025 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,21 +14,23 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
  /* eslint-disable deprecation/deprecation */
17
- import { inject, injectable } from 'inversify';
18
17
  import {
19
18
  Action,
19
+ ClientMenuItem,
20
+ GModelRoot,
20
21
  IActionDispatcher,
21
22
  IActionHandler,
22
23
  IContextMenuItemProvider,
23
- MenuItem,
24
- Point,
25
- GModelRoot,
26
24
  MessageAction,
25
+ Point,
27
26
  StatusAction,
28
27
  TYPES,
29
28
  hasStringProp,
30
29
  isSelected
31
30
  } from '@eclipse-glsp/sprotty';
31
+ import { inject, injectable } from 'inversify';
32
+ import { EditorContextService } from '../../base/editor-context-service';
33
+ import { messages } from '../../base/messages';
32
34
 
33
35
  /**
34
36
  * An `InvokeCopyPasteAction` is dispatched by the client to initiate a cut, copy or paste operation.
@@ -89,39 +91,41 @@ export class InvokeCopyPasteActionHandler implements IActionHandler {
89
91
 
90
92
  @injectable()
91
93
  export class CopyPasteContextMenuItemProvider implements IContextMenuItemProvider {
92
- getItems(root: Readonly<GModelRoot>, _lastMousePosition?: Point): Promise<MenuItem[]> {
94
+ @inject(EditorContextService)
95
+ protected editorContext: EditorContextService;
96
+
97
+ async getItems(root: Readonly<GModelRoot>, _lastMousePosition?: Point): Promise<ClientMenuItem[]> {
98
+ if (this.editorContext.isReadonly) {
99
+ return [];
100
+ }
93
101
  const hasSelectedElements = Array.from(root.index.all().filter(isSelected)).length > 0;
94
- return Promise.resolve([
95
- this.createCopyMenuItem(hasSelectedElements),
96
- this.createCutMenuItem(hasSelectedElements),
97
- this.createPasteMenuItem()
98
- ]);
102
+ return [this.createCopyMenuItem(hasSelectedElements), this.createCutMenuItem(hasSelectedElements), this.createPasteMenuItem()];
99
103
  }
100
104
 
101
- protected createPasteMenuItem(): MenuItem {
105
+ protected createPasteMenuItem(): ClientMenuItem {
102
106
  return {
103
107
  id: 'paste',
104
- label: 'Paste',
108
+ label: messages.context_menu.paste,
105
109
  group: 'copy-paste',
106
110
  actions: [InvokeCopyPasteAction.create('paste')],
107
111
  isEnabled: () => true
108
112
  };
109
113
  }
110
114
 
111
- protected createCutMenuItem(hasSelectedElements: boolean): MenuItem {
115
+ protected createCutMenuItem(hasSelectedElements: boolean): ClientMenuItem {
112
116
  return {
113
117
  id: 'cut',
114
- label: 'Cut',
118
+ label: messages.context_menu.cut,
115
119
  group: 'copy-paste',
116
120
  actions: [InvokeCopyPasteAction.create('cut')],
117
121
  isEnabled: () => hasSelectedElements
118
122
  };
119
123
  }
120
124
 
121
- protected createCopyMenuItem(hasSelectedElements: boolean): MenuItem {
125
+ protected createCopyMenuItem(hasSelectedElements: boolean): ClientMenuItem {
122
126
  return {
123
127
  id: 'copy',
124
- label: 'Copy',
128
+ label: messages.context_menu.copy,
125
129
  group: 'copy-paste',
126
130
  actions: [InvokeCopyPasteAction.create('copy')],
127
131
  isEnabled: () => hasSelectedElements
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2019-2024 EclipseSource and others.
2
+ * Copyright (c) 2019-2025 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
@@ -20,6 +20,7 @@ import { GlspDecorationPlacer } from './decoration-placer';
20
20
  export const decorationModule = new FeatureModule(
21
21
  bind => {
22
22
  bindAsService(bind, TYPES.IVNodePostprocessor, GlspDecorationPlacer);
23
+ bind(TYPES.ISvgExportPostprocessor).toService(GlspDecorationPlacer);
23
24
  },
24
25
  { featureId: Symbol('decoration') }
25
26
  );
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2019-2023 EclipseSource and others.
2
+ * Copyright (c) 2019-2025 EclipseSource and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -13,12 +13,37 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { Decoration, DecorationPlacer, GChildElement, GModelElement, GRoutableElement, Point, isSizeable } from '@eclipse-glsp/sprotty';
17
- import { injectable } from 'inversify';
16
+ import {
17
+ Action,
18
+ DOMHelper,
19
+ Decoration,
20
+ DecorationPlacer,
21
+ GChildElement,
22
+ GModelElement,
23
+ GRoutableElement,
24
+ ISvgExportPostProcessor,
25
+ LazyInjector,
26
+ Point,
27
+ TYPES,
28
+ isDecoration,
29
+ isSizeable
30
+ } from '@eclipse-glsp/sprotty';
31
+ import { inject, injectable } from 'inversify';
32
+ import { EditorContextService } from '../../base/editor-context-service';
33
+ import { filter } from '../../utils/gmodel-util';
18
34
 
19
35
  @injectable()
20
- export class GlspDecorationPlacer extends DecorationPlacer {
36
+ export class GlspDecorationPlacer extends DecorationPlacer implements ISvgExportPostProcessor {
21
37
  protected static readonly DECORATION_OFFSET: Point = { x: 12, y: 10 };
38
+ @inject(TYPES.DOMHelper)
39
+ protected domHelper: DOMHelper;
40
+
41
+ @inject(LazyInjector)
42
+ protected lazyInjector: LazyInjector;
43
+
44
+ get editorContextService(): EditorContextService {
45
+ return this.lazyInjector.get(EditorContextService);
46
+ }
22
47
 
23
48
  protected override getPosition(element: GModelElement & Decoration): Point {
24
49
  if (element instanceof GChildElement && element.parent instanceof GRoutableElement) {
@@ -32,4 +57,24 @@ export class GlspDecorationPlacer extends DecorationPlacer {
32
57
  }
33
58
  return Point.ORIGIN;
34
59
  }
60
+ // HiddenVNodePostprocessor implementation
61
+ override postUpdate(cause?: Action): void;
62
+ // ISvgExportPostProcessor implementation
63
+ override postUpdate(element: SVGSVGElement, cause?: Action): void;
64
+ override postUpdate(elementOrCause?: SVGSVGElement | Action, _cause?: Action): void {
65
+ // Called as HiddenVNodePostprocessor => no-op
66
+ if (!elementOrCause || Action.is(elementOrCause)) {
67
+ return;
68
+ }
69
+
70
+ // Called as ISvgExportPostProcessor
71
+ // Adjust the position of all decorations in the exported SVG
72
+ const svg = elementOrCause;
73
+ const translate = `translate(-${GlspDecorationPlacer.DECORATION_OFFSET.x}px, -${GlspDecorationPlacer.DECORATION_OFFSET.y}px)`;
74
+ filter(this.editorContextService.modelRoot.index, isDecoration).forEach(decoration => {
75
+ const domId = this.domHelper.createUniqueDOMElementId(decoration);
76
+ const element = svg.querySelector<SVGElement>(`#${domId}`);
77
+ element!.style.transform = translate;
78
+ });
79
+ }
35
80
  }