@eclipse-glsp/client 2.2.0-next.329 → 2.2.0-next.331

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 (224) hide show
  1. package/css/change-bounds.css +15 -0
  2. package/css/glsp-sprotty.css +22 -0
  3. package/lib/base/default.module.js +1 -1
  4. package/lib/base/default.module.js.map +1 -1
  5. package/lib/base/drag-aware-mouse-listener.d.ts +5 -2
  6. package/lib/base/drag-aware-mouse-listener.d.ts.map +1 -1
  7. package/lib/base/drag-aware-mouse-listener.js +11 -0
  8. package/lib/base/drag-aware-mouse-listener.js.map +1 -1
  9. package/lib/base/feedback/css-feedback.d.ts +4 -0
  10. package/lib/base/feedback/css-feedback.d.ts.map +1 -1
  11. package/lib/base/feedback/css-feedback.js +4 -0
  12. package/lib/base/feedback/css-feedback.js.map +1 -1
  13. package/lib/base/feedback/feeback-emitter.d.ts +67 -0
  14. package/lib/base/feedback/feeback-emitter.d.ts.map +1 -0
  15. package/lib/base/feedback/feeback-emitter.js +109 -0
  16. package/lib/base/feedback/feeback-emitter.js.map +1 -0
  17. package/lib/base/feedback/feedback-action-dispatcher.d.ts +17 -5
  18. package/lib/base/feedback/feedback-action-dispatcher.d.ts.map +1 -1
  19. package/lib/base/feedback/feedback-action-dispatcher.js +23 -3
  20. package/lib/base/feedback/feedback-action-dispatcher.js.map +1 -1
  21. package/lib/base/feedback/index.d.ts +1 -0
  22. package/lib/base/feedback/index.d.ts.map +1 -1
  23. package/lib/base/feedback/index.js +1 -0
  24. package/lib/base/feedback/index.js.map +1 -1
  25. package/lib/base/index.d.ts +1 -1
  26. package/lib/base/index.d.ts.map +1 -1
  27. package/lib/base/index.js +1 -1
  28. package/lib/base/index.js.map +1 -1
  29. package/lib/base/selection-service.d.ts +3 -2
  30. package/lib/base/selection-service.d.ts.map +1 -1
  31. package/lib/base/selection-service.js.map +1 -1
  32. package/lib/{features/routing/glsp-manhattan-edge-router.d.ts → base/ui-extension/index.d.ts} +4 -6
  33. package/lib/base/ui-extension/index.d.ts.map +1 -0
  34. package/lib/base/ui-extension/index.js +34 -0
  35. package/lib/base/ui-extension/index.js.map +1 -0
  36. package/lib/base/{ui-extension-registry.d.ts → ui-extension/ui-extension-registry.d.ts} +1 -1
  37. package/lib/base/ui-extension/ui-extension-registry.d.ts.map +1 -0
  38. package/lib/base/ui-extension/ui-extension-registry.js.map +1 -0
  39. package/lib/base/ui-extension/ui-extension.d.ts +39 -0
  40. package/lib/base/ui-extension/ui-extension.d.ts.map +1 -0
  41. package/lib/base/ui-extension/ui-extension.js +120 -0
  42. package/lib/base/ui-extension/ui-extension.js.map +1 -0
  43. package/lib/features/accessibility/element-navigation/local-element-navigator.d.ts +3 -3
  44. package/lib/features/accessibility/element-navigation/local-element-navigator.d.ts.map +1 -1
  45. package/lib/features/accessibility/element-navigation/local-element-navigator.js.map +1 -1
  46. package/lib/features/accessibility/move-zoom/move-handler.d.ts +4 -2
  47. package/lib/features/accessibility/move-zoom/move-handler.d.ts.map +1 -1
  48. package/lib/features/accessibility/move-zoom/move-handler.js +10 -4
  49. package/lib/features/accessibility/move-zoom/move-handler.js.map +1 -1
  50. package/lib/features/accessibility/resize-key-tool/resize-key-handler.d.ts +4 -2
  51. package/lib/features/accessibility/resize-key-tool/resize-key-handler.d.ts.map +1 -1
  52. package/lib/features/accessibility/resize-key-tool/resize-key-handler.js +11 -3
  53. package/lib/features/accessibility/resize-key-tool/resize-key-handler.js.map +1 -1
  54. package/lib/features/change-bounds/model.d.ts +8 -8
  55. package/lib/features/change-bounds/model.d.ts.map +1 -1
  56. package/lib/features/change-bounds/model.js +17 -5
  57. package/lib/features/change-bounds/model.js.map +1 -1
  58. package/lib/features/change-bounds/movement-restrictor.d.ts +3 -2
  59. package/lib/features/change-bounds/movement-restrictor.d.ts.map +1 -1
  60. package/lib/features/change-bounds/movement-restrictor.js.map +1 -1
  61. package/lib/features/command-palette/command-palette.d.ts.map +1 -1
  62. package/lib/features/command-palette/command-palette.js +4 -3
  63. package/lib/features/command-palette/command-palette.js.map +1 -1
  64. package/lib/features/element-template/mouse-tracking-element-position-listener.d.ts +15 -5
  65. package/lib/features/element-template/mouse-tracking-element-position-listener.d.ts.map +1 -1
  66. package/lib/features/element-template/mouse-tracking-element-position-listener.js +27 -38
  67. package/lib/features/element-template/mouse-tracking-element-position-listener.js.map +1 -1
  68. package/lib/features/helper-lines/helper-line-manager-default.d.ts +4 -2
  69. package/lib/features/helper-lines/helper-line-manager-default.d.ts.map +1 -1
  70. package/lib/features/helper-lines/helper-line-manager-default.js +8 -12
  71. package/lib/features/helper-lines/helper-line-manager-default.js.map +1 -1
  72. package/lib/features/hints/type-hint-provider.d.ts +3 -0
  73. package/lib/features/hints/type-hint-provider.d.ts.map +1 -1
  74. package/lib/features/hints/type-hint-provider.js +10 -1
  75. package/lib/features/hints/type-hint-provider.js.map +1 -1
  76. package/lib/features/label-edit-ui/label-edit-ui.d.ts.map +1 -1
  77. package/lib/features/label-edit-ui/label-edit-ui.js +4 -3
  78. package/lib/features/label-edit-ui/label-edit-ui.js.map +1 -1
  79. package/lib/features/routing/edge-router.d.ts +30 -0
  80. package/lib/features/routing/edge-router.d.ts.map +1 -0
  81. package/lib/features/routing/edge-router.js +116 -0
  82. package/lib/features/routing/edge-router.js.map +1 -0
  83. package/lib/features/routing/index.d.ts +1 -1
  84. package/lib/features/routing/index.d.ts.map +1 -1
  85. package/lib/features/routing/index.js +1 -1
  86. package/lib/features/routing/index.js.map +1 -1
  87. package/lib/features/routing/routing-module.d.ts.map +1 -1
  88. package/lib/features/routing/routing-module.js +4 -4
  89. package/lib/features/routing/routing-module.js.map +1 -1
  90. package/lib/features/select/select-mouse-listener.d.ts +4 -3
  91. package/lib/features/select/select-mouse-listener.d.ts.map +1 -1
  92. package/lib/features/select/select-mouse-listener.js.map +1 -1
  93. package/lib/features/tools/base-tools.d.ts +23 -4
  94. package/lib/features/tools/base-tools.d.ts.map +1 -1
  95. package/lib/features/tools/base-tools.js +11 -6
  96. package/lib/features/tools/base-tools.js.map +1 -1
  97. package/lib/features/tools/change-bounds/change-bounds-tool-feedback.d.ts +1 -35
  98. package/lib/features/tools/change-bounds/change-bounds-tool-feedback.d.ts.map +1 -1
  99. package/lib/features/tools/change-bounds/change-bounds-tool-feedback.js +5 -206
  100. package/lib/features/tools/change-bounds/change-bounds-tool-feedback.js.map +1 -1
  101. package/lib/features/tools/change-bounds/change-bounds-tool-module.d.ts +1 -0
  102. package/lib/features/tools/change-bounds/change-bounds-tool-module.d.ts.map +1 -1
  103. package/lib/features/tools/change-bounds/change-bounds-tool-module.js +1 -0
  104. package/lib/features/tools/change-bounds/change-bounds-tool-module.js.map +1 -1
  105. package/lib/features/tools/change-bounds/change-bounds-tool-move-feedback.d.ts +67 -0
  106. package/lib/features/tools/change-bounds/change-bounds-tool-move-feedback.d.ts.map +1 -0
  107. package/lib/features/tools/change-bounds/change-bounds-tool-move-feedback.js +227 -0
  108. package/lib/features/tools/change-bounds/change-bounds-tool-move-feedback.js.map +1 -0
  109. package/lib/features/tools/change-bounds/change-bounds-tool.d.ts +34 -24
  110. package/lib/features/tools/change-bounds/change-bounds-tool.d.ts.map +1 -1
  111. package/lib/features/tools/change-bounds/change-bounds-tool.js +172 -180
  112. package/lib/features/tools/change-bounds/change-bounds-tool.js.map +1 -1
  113. package/lib/features/tools/change-bounds/index.d.ts +1 -0
  114. package/lib/features/tools/change-bounds/index.d.ts.map +1 -1
  115. package/lib/features/tools/change-bounds/index.js +1 -0
  116. package/lib/features/tools/change-bounds/index.js.map +1 -1
  117. package/lib/features/tools/change-bounds/view.d.ts +1 -1
  118. package/lib/features/tools/change-bounds/view.d.ts.map +1 -1
  119. package/lib/features/tools/change-bounds/view.js +3 -0
  120. package/lib/features/tools/change-bounds/view.js.map +1 -1
  121. package/lib/features/tools/deletion/delete-tool.d.ts +16 -1
  122. package/lib/features/tools/deletion/delete-tool.d.ts.map +1 -1
  123. package/lib/features/tools/deletion/delete-tool.js +5 -2
  124. package/lib/features/tools/deletion/delete-tool.js.map +1 -1
  125. package/lib/features/tools/edge-creation/dangling-edge-feedback.d.ts +17 -1
  126. package/lib/features/tools/edge-creation/dangling-edge-feedback.d.ts.map +1 -1
  127. package/lib/features/tools/edge-creation/dangling-edge-feedback.js +3 -1
  128. package/lib/features/tools/edge-creation/dangling-edge-feedback.js.map +1 -1
  129. package/lib/features/tools/edge-creation/edge-creation-tool-feedback.d.ts +3 -1
  130. package/lib/features/tools/edge-creation/edge-creation-tool-feedback.d.ts.map +1 -1
  131. package/lib/features/tools/edge-creation/edge-creation-tool-feedback.js +4 -7
  132. package/lib/features/tools/edge-creation/edge-creation-tool-feedback.js.map +1 -1
  133. package/lib/features/tools/edge-creation/edge-creation-tool.d.ts +20 -2
  134. package/lib/features/tools/edge-creation/edge-creation-tool.d.ts.map +1 -1
  135. package/lib/features/tools/edge-creation/edge-creation-tool.js +23 -18
  136. package/lib/features/tools/edge-creation/edge-creation-tool.js.map +1 -1
  137. package/lib/features/tools/edge-edit/edge-edit-tool-feedback.d.ts +3 -1
  138. package/lib/features/tools/edge-edit/edge-edit-tool-feedback.d.ts.map +1 -1
  139. package/lib/features/tools/edge-edit/edge-edit-tool-feedback.js +5 -8
  140. package/lib/features/tools/edge-edit/edge-edit-tool-feedback.js.map +1 -1
  141. package/lib/features/tools/edge-edit/edge-edit-tool.d.ts +4 -4
  142. package/lib/features/tools/edge-edit/edge-edit-tool.d.ts.map +1 -1
  143. package/lib/features/tools/edge-edit/edge-edit-tool.js +27 -44
  144. package/lib/features/tools/edge-edit/edge-edit-tool.js.map +1 -1
  145. package/lib/features/tools/marquee-selection/marquee-mouse-tool.d.ts +3 -2
  146. package/lib/features/tools/marquee-selection/marquee-mouse-tool.d.ts.map +1 -1
  147. package/lib/features/tools/marquee-selection/marquee-mouse-tool.js +4 -2
  148. package/lib/features/tools/marquee-selection/marquee-mouse-tool.js.map +1 -1
  149. package/lib/features/tools/node-creation/node-creation-tool.d.ts +14 -5
  150. package/lib/features/tools/node-creation/node-creation-tool.d.ts.map +1 -1
  151. package/lib/features/tools/node-creation/node-creation-tool.js +58 -24
  152. package/lib/features/tools/node-creation/node-creation-tool.js.map +1 -1
  153. package/lib/features/validation/marker-navigator.d.ts +7 -6
  154. package/lib/features/validation/marker-navigator.d.ts.map +1 -1
  155. package/lib/features/validation/marker-navigator.js.map +1 -1
  156. package/lib/features/validation/validate.d.ts +2 -5
  157. package/lib/features/validation/validate.d.ts.map +1 -1
  158. package/lib/features/validation/validate.js +4 -16
  159. package/lib/features/validation/validate.js.map +1 -1
  160. package/lib/utils/gmodel-util.d.ts +27 -2
  161. package/lib/utils/gmodel-util.d.ts.map +1 -1
  162. package/lib/utils/gmodel-util.js +30 -1
  163. package/lib/utils/gmodel-util.js.map +1 -1
  164. package/lib/utils/layout-utils.d.ts +8 -7
  165. package/lib/utils/layout-utils.d.ts.map +1 -1
  166. package/lib/utils/layout-utils.js +2 -4
  167. package/lib/utils/layout-utils.js.map +1 -1
  168. package/lib/utils/viewpoint-util.d.ts +4 -4
  169. package/lib/utils/viewpoint-util.d.ts.map +1 -1
  170. package/lib/utils/viewpoint-util.js.map +1 -1
  171. package/package.json +3 -3
  172. package/src/base/default.module.ts +1 -1
  173. package/src/base/drag-aware-mouse-listener.ts +16 -2
  174. package/src/base/feedback/css-feedback.ts +4 -0
  175. package/src/base/feedback/feeback-emitter.ts +112 -0
  176. package/src/base/feedback/feedback-action-dispatcher.ts +41 -6
  177. package/src/base/feedback/index.ts +1 -0
  178. package/src/base/index.ts +1 -1
  179. package/src/base/selection-service.spec.ts +5 -0
  180. package/src/base/selection-service.ts +2 -3
  181. package/src/base/ui-extension/index.ts +17 -0
  182. package/src/base/{ui-extension-registry.ts → ui-extension/ui-extension-registry.ts} +1 -1
  183. package/src/base/ui-extension/ui-extension.ts +119 -0
  184. package/src/features/accessibility/element-navigation/local-element-navigator.ts +4 -4
  185. package/src/features/accessibility/move-zoom/move-handler.ts +10 -5
  186. package/src/features/accessibility/resize-key-tool/resize-key-handler.ts +11 -7
  187. package/src/features/change-bounds/model.ts +25 -13
  188. package/src/features/change-bounds/movement-restrictor.ts +5 -4
  189. package/src/features/command-palette/command-palette.ts +2 -1
  190. package/src/features/element-template/mouse-tracking-element-position-listener.ts +44 -44
  191. package/src/features/helper-lines/helper-line-manager-default.ts +12 -21
  192. package/src/features/hints/type-hint-provider.spec.ts +4 -1
  193. package/src/features/hints/type-hint-provider.ts +9 -2
  194. package/src/features/label-edit-ui/label-edit-ui.ts +2 -1
  195. package/src/features/routing/{glsp-manhattan-edge-router.ts → edge-router.ts} +72 -2
  196. package/src/features/routing/index.ts +1 -1
  197. package/src/features/routing/routing-module.ts +3 -5
  198. package/src/features/select/select-mouse-listener.ts +4 -3
  199. package/src/features/tools/base-tools.ts +15 -8
  200. package/src/features/tools/change-bounds/change-bounds-tool-feedback.ts +6 -232
  201. package/src/features/tools/change-bounds/change-bounds-tool-module.ts +1 -0
  202. package/src/features/tools/change-bounds/change-bounds-tool-move-feedback.ts +254 -0
  203. package/src/features/tools/change-bounds/change-bounds-tool.ts +217 -226
  204. package/src/features/tools/change-bounds/index.ts +1 -0
  205. package/src/features/tools/change-bounds/view.tsx +4 -1
  206. package/src/features/tools/deletion/delete-tool.ts +6 -6
  207. package/src/features/tools/edge-creation/dangling-edge-feedback.ts +7 -4
  208. package/src/features/tools/edge-creation/edge-creation-tool-feedback.ts +9 -9
  209. package/src/features/tools/edge-creation/edge-creation-tool.ts +33 -23
  210. package/src/features/tools/edge-edit/edge-edit-tool-feedback.ts +8 -8
  211. package/src/features/tools/edge-edit/edge-edit-tool.ts +42 -49
  212. package/src/features/tools/marquee-selection/marquee-mouse-tool.ts +7 -6
  213. package/src/features/tools/node-creation/node-creation-tool.ts +69 -25
  214. package/src/features/validation/marker-navigator.ts +6 -8
  215. package/src/features/validation/validate.ts +5 -20
  216. package/src/utils/gmodel-util.ts +44 -1
  217. package/src/utils/layout-utils.ts +9 -20
  218. package/src/utils/viewpoint-util.ts +3 -4
  219. package/lib/base/ui-extension-registry.d.ts.map +0 -1
  220. package/lib/base/ui-extension-registry.js.map +0 -1
  221. package/lib/features/routing/glsp-manhattan-edge-router.d.ts.map +0 -1
  222. package/lib/features/routing/glsp-manhattan-edge-router.js +0 -68
  223. package/lib/features/routing/glsp-manhattan-edge-router.js.map +0 -1
  224. /package/lib/base/{ui-extension-registry.js → ui-extension/ui-extension-registry.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"viewpoint-util.d.ts","sourceRoot":"","sources":["../../src/utils/viewpoint-util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EACH,MAAM,EACN,WAAW,EACX,SAAS,EACT,aAAa,EACb,aAAa,EACb,UAAU,EACV,KAAK,EACL,QAAQ,EAMX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,GAAG,KAAK,CAExF;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,CAYrF;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAI/E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,WAAW,GAAG,MAAM,CAO7E;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,WAAW,GAAG,KAAK,CAE7E;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,WAAW,GAAG,SAAS,CAE7E;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,aAAa,EAAE,aAAa,EA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C,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC3B,KAAK,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,MAAM,CAC7D,CAAC;AACN,CAAC;AAPD,8CAOC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-glsp/client",
3
- "version": "2.2.0-next.329+d53e2e2",
3
+ "version": "2.2.0-next.331+38f93e2",
4
4
  "description": "A sprotty-based client for GLSP",
5
5
  "keywords": [
6
6
  "eclipse",
@@ -46,7 +46,7 @@
46
46
  "watch": "tsc -w"
47
47
  },
48
48
  "dependencies": {
49
- "@eclipse-glsp/sprotty": "2.2.0-next.329+d53e2e2",
49
+ "@eclipse-glsp/sprotty": "2.2.0-next.331+38f93e2",
50
50
  "autocompleter": "^9.1.0",
51
51
  "file-saver": "^2.0.5",
52
52
  "lodash": "4.17.21"
@@ -61,5 +61,5 @@
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "d53e2e2ab356951621fb85eea3d0a32541ff9b23"
64
+ "gitHead": "38f93e230513f08105858216ea7a365522f6b154"
65
65
  }
@@ -51,7 +51,7 @@ import { SelectionClearingMouseListener } from './selection-clearing-mouse-liste
51
51
  import { SelectionService } from './selection-service';
52
52
  import { EnableDefaultToolsAction, EnableToolsAction } from './tool-manager/tool';
53
53
  import { DefaultToolsEnablingKeyListener, ToolManager, ToolManagerActionHandler } from './tool-manager/tool-manager';
54
- import { GLSPUIExtensionRegistry } from './ui-extension-registry';
54
+ import { GLSPUIExtensionRegistry } from './ui-extension/ui-extension-registry';
55
55
  import { GLSPKeyTool } from './view/key-tool';
56
56
  import { GLSPMouseTool } from './view/mouse-tool';
57
57
  import { GViewRegistry } from './view/view-registry';
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { Action, MouseListener, GModelElement } from '@eclipse-glsp/sprotty';
16
+ import { Action, Disposable, GModelElement, MouseListener } from '@eclipse-glsp/sprotty';
17
17
 
18
18
  /**
19
19
  * A mouse listener that is aware of prior mouse dragging.
@@ -23,7 +23,7 @@ import { Action, MouseListener, GModelElement } from '@eclipse-glsp/sprotty';
23
23
  * `draggingMouseUp` and/or `nonDraggingMouseUp` to react to only these specific kinds
24
24
  * of mouse up events.
25
25
  */
26
- export class DragAwareMouseListener extends MouseListener {
26
+ export class DragAwareMouseListener extends MouseListener implements Disposable {
27
27
  protected _isMouseDown = false;
28
28
  protected _isMouseDrag = false;
29
29
 
@@ -35,7 +35,16 @@ export class DragAwareMouseListener extends MouseListener {
35
35
  override mouseMove(target: GModelElement, event: MouseEvent): Action[] {
36
36
  if (this._isMouseDown) {
37
37
  this._isMouseDrag = true;
38
+ return this.draggingMouseMove(target, event);
38
39
  }
40
+ return this.nonDraggingMouseMove(target, event);
41
+ }
42
+
43
+ protected draggingMouseMove(target: GModelElement, event: MouseEvent): Action[] {
44
+ return [];
45
+ }
46
+
47
+ protected nonDraggingMouseMove(target: GModelElement, event: MouseEvent): Action[] {
39
48
  return [];
40
49
  }
41
50
 
@@ -64,4 +73,9 @@ export class DragAwareMouseListener extends MouseListener {
64
73
  get isMouseDown(): boolean {
65
74
  return this._isMouseDown;
66
75
  }
76
+
77
+ dispose(): void {
78
+ this._isMouseDrag = false;
79
+ this._isMouseDown = false;
80
+ }
67
81
  }
@@ -84,6 +84,10 @@ export enum CursorCSS {
84
84
  ELEMENT_DELETION = 'element-deletion-mode',
85
85
  RESIZE_NESW = 'resize-nesw-mode',
86
86
  RESIZE_NWSE = 'resize-nwse-mode',
87
+ RESIZE_NW = 'resize-nw-mode',
88
+ RESIZE_NE = 'resize-ne-mode',
89
+ RESIZE_SW = 'resize-sw-mode',
90
+ RESIZE_SE = 'resize-se-mode',
87
91
  MOVE = 'move-mode',
88
92
  MARQUEE = 'marquee-mode'
89
93
  }
@@ -0,0 +1,112 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2024 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ import { Action, Disposable, arrayOf } from '@eclipse-glsp/sprotty';
18
+ import { IFeedbackActionDispatcher, IFeedbackEmitter, MaybeActions } from './feedback-action-dispatcher';
19
+
20
+ /**
21
+ * A helper object to collect, submit and undo feedback consisting of several actions.
22
+ */
23
+ export class FeedbackEmitter implements IFeedbackEmitter, Disposable {
24
+ protected feedbackActions: (Action | undefined)[] = [];
25
+ protected cleanupActions: MaybeActions[] = [];
26
+ protected deregistration?: Disposable;
27
+
28
+ constructor(protected feedbackDispatcher: IFeedbackActionDispatcher) {}
29
+
30
+ /**
31
+ * Adds an action as part of this emitters feedback. Please note that the action is only applied as feedback
32
+ * once the {@link submit} method is called.
33
+ *
34
+ * @param action feedback action
35
+ * @param cleanupAction action that undoes the feedback action. This is only triggered when {@link revert} is called.
36
+ */
37
+ add(action: Action, cleanupAction?: MaybeActions): this {
38
+ const idx = this.feedbackActions.length;
39
+ this.feedbackActions[idx] = action;
40
+ if (cleanupAction) {
41
+ this.cleanupActions[idx] = cleanupAction;
42
+ }
43
+ return this;
44
+ }
45
+
46
+ /**
47
+ * Removes the action as part of this emitters feedback. If the action cannot be found, this is a no-op.
48
+ * Please note that this also removed the corresponding cleanup action.
49
+ * If the feedback has already been submitted as part of the {@link submit} method, the whole feedback must be de-registered
50
+ * or a new feedback without the given action needs to be registered.
51
+ *
52
+ * @param action feedback action
53
+ */
54
+ remove(action: Action): this {
55
+ const idx = this.feedbackActions.indexOf(action);
56
+ if (idx) {
57
+ delete this.feedbackActions[idx];
58
+ delete this.cleanupActions[idx];
59
+ }
60
+ return this;
61
+ }
62
+
63
+ /**
64
+ * Clears any, not yet registered feedback actions and their corresponding cleanup actions.
65
+ */
66
+ clear(): this {
67
+ this.feedbackActions = [];
68
+ this.cleanupActions = [];
69
+ return this;
70
+ }
71
+
72
+ /**
73
+ * Registers any pending actions as feedback. Any previously submitted feedback becomes invalid.
74
+ */
75
+ submit(): this {
76
+ // with 'arrayOf' we skip undefined entries that are created for non-cleanup actions
77
+ const actions = arrayOf(...this.feedbackActions);
78
+ const cleanupActions = arrayOf(...this.cleanupActions);
79
+ this.deregistration = this.feedbackDispatcher.registerFeedback(this, actions, () => cleanupActions.flatMap(MaybeActions.asArray));
80
+ this.clear();
81
+ return this;
82
+ }
83
+
84
+ /**
85
+ * Removes the registered feedback WITHOUT calling any potential cleanup actions
86
+ * Any pending actions can still be registerd with the {@link submit} method.
87
+ */
88
+ discard(): this {
89
+ this.feedbackDispatcher.deregisterFeedback(this);
90
+ this.deregistration = undefined;
91
+ return this;
92
+ }
93
+
94
+ /**
95
+ * Removes the registered feedback and calls the registered cleanup actions.
96
+ * Any pending actions can still be registerd with the {@link submit} method.
97
+ */
98
+ revert(): this {
99
+ this.deregistration?.dispose();
100
+ this.deregistration = undefined;
101
+ return this;
102
+ }
103
+
104
+ /**
105
+ * Disposes any registered feedback and any pending, not yet registered feedback actions.
106
+ */
107
+ dispose(): this {
108
+ this.revert();
109
+ this.clear();
110
+ return this;
111
+ }
112
+ }
@@ -20,17 +20,34 @@ import {
20
20
  CommandActionHandler,
21
21
  CommandExecutionContext,
22
22
  Disposable,
23
+ GModelElement,
23
24
  IActionDispatcher,
24
25
  ICommand,
25
26
  ILogger,
27
+ MaybeFunction,
26
28
  TYPES,
29
+ call,
30
+ asArray as toArray,
27
31
  toTypeGuard
28
32
  } from '@eclipse-glsp/sprotty';
29
33
  import { inject, injectable } from 'inversify';
30
34
  import { getFeedbackRank } from './feedback-command';
35
+ import { FeedbackEmitter } from './feeback-emitter';
31
36
 
32
37
  export interface IFeedbackEmitter {}
33
38
 
39
+ export const feedbackFeature = Symbol('feedbackFeature');
40
+
41
+ export type MaybeActions = MaybeFunction<Action[] | Action | undefined>;
42
+
43
+ export namespace MaybeActions {
44
+ // eslint-disable-next-line @typescript-eslint/no-shadow
45
+ export function asArray(actions?: MaybeActions): Action[] {
46
+ const cleanup = actions ? call(actions) : [];
47
+ return cleanup ? toArray(cleanup) : [];
48
+ }
49
+ }
50
+
34
51
  /**
35
52
  * Dispatcher for actions that are meant to show visual feedback on
36
53
  * the diagram that is not part of the diagram sent from the server
@@ -52,7 +69,7 @@ export interface IFeedbackActionDispatcher {
52
69
  * @param cleanupActions the actions to be sent out when the feedback is de-registered through the returned Disposable.
53
70
  * @returns A 'Disposable' that de-registers the feedback and cleans up any pending feedback with the given `cleanupActions`.
54
71
  */
55
- registerFeedback(feedbackEmitter: IFeedbackEmitter, feedbackActions: Action[], cleanupActions?: Action[]): Disposable;
72
+ registerFeedback(feedbackEmitter: IFeedbackEmitter, feedbackActions: Action[], cleanupActions?: MaybeActions): Disposable;
56
73
 
57
74
  /**
58
75
  * Deregisters a `feedbackEmitter` from this dispatcher and thereafter
@@ -64,7 +81,7 @@ export interface IFeedbackActionDispatcher {
64
81
  * to reset the normal state of the diagram without the feedback (e.g., reset a
65
82
  * CSS class that was set by a feedbackEmitter).
66
83
  */
67
- deregisterFeedback(feedbackEmitter: IFeedbackEmitter, cleanupActions?: Action[]): void;
84
+ deregisterFeedback(feedbackEmitter: IFeedbackEmitter, cleanupActions?: MaybeActions): void;
68
85
 
69
86
  /**
70
87
  * Retrieve all `actions` sent out by currently registered `feedbackEmitter`.
@@ -80,6 +97,12 @@ export interface IFeedbackActionDispatcher {
80
97
  * Applies all current feedback commands to the given command execution context.
81
98
  */
82
99
  applyFeedbackCommands(context: CommandExecutionContext): Promise<void>;
100
+
101
+ /**
102
+ * Creates a new feedback emitter helper object. While anything can serve as a feedback emitter,
103
+ * this method ensures that the emitter is stable and does not change between model updates.
104
+ */
105
+ createEmitter(): FeedbackEmitter;
83
106
  }
84
107
 
85
108
  @injectable()
@@ -91,7 +114,14 @@ export class FeedbackActionDispatcher implements IFeedbackActionDispatcher {
91
114
 
92
115
  @inject(ActionHandlerRegistry) protected actionHandlerRegistry: ActionHandlerRegistry;
93
116
 
94
- registerFeedback(feedbackEmitter: IFeedbackEmitter, feedbackActions: Action[], cleanupActions?: Action[] | undefined): Disposable {
117
+ registerFeedback(feedbackEmitter: IFeedbackEmitter, feedbackActions: Action[], cleanupActions?: MaybeActions): Disposable {
118
+ if (feedbackEmitter instanceof GModelElement) {
119
+ this.logger.log(
120
+ this,
121
+ // eslint-disable-next-line max-len
122
+ 'GModelElements as feedback emitters are discouraged, as they usually change between model updates and are considered unstable.'
123
+ );
124
+ }
95
125
  if (feedbackActions.length > 0) {
96
126
  this.registeredFeedback.set(feedbackEmitter, feedbackActions);
97
127
  this.dispatchFeedback(feedbackActions, feedbackEmitter);
@@ -99,10 +129,11 @@ export class FeedbackActionDispatcher implements IFeedbackActionDispatcher {
99
129
  return Disposable.create(() => this.deregisterFeedback(feedbackEmitter, cleanupActions));
100
130
  }
101
131
 
102
- deregisterFeedback(feedbackEmitter: IFeedbackEmitter, cleanupActions?: Action[] | undefined): void {
132
+ deregisterFeedback(feedbackEmitter: IFeedbackEmitter, cleanupActions?: MaybeActions): void {
103
133
  this.registeredFeedback.delete(feedbackEmitter);
104
- if (cleanupActions && cleanupActions.length > 0) {
105
- this.dispatchFeedback(cleanupActions, feedbackEmitter);
134
+ const actions = MaybeActions.asArray(cleanupActions);
135
+ if (actions.length > 0) {
136
+ this.dispatchFeedback(actions, feedbackEmitter);
106
137
  }
107
138
  }
108
139
 
@@ -145,6 +176,10 @@ export class FeedbackActionDispatcher implements IFeedbackActionDispatcher {
145
176
  );
146
177
  }
147
178
 
179
+ createEmitter(): FeedbackEmitter {
180
+ return new FeedbackEmitter(this);
181
+ }
182
+
148
183
  protected async dispatchFeedback(actions: Action[], feedbackEmitter: IFeedbackEmitter): Promise<void> {
149
184
  try {
150
185
  const actionDispatcher = await this.actionDispatcher();
@@ -14,6 +14,7 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
  export * from './css-feedback';
17
+ export * from './feeback-emitter';
17
18
  export * from './feedback-action-dispatcher';
18
19
  export * from './feedback-command';
19
20
  export * from './set-model-command';
package/src/base/index.ts CHANGED
@@ -28,5 +28,5 @@ export * from './ranked';
28
28
  export * from './selection-clearing-mouse-listener';
29
29
  export * from './selection-service';
30
30
  export * from './tool-manager';
31
- export * from './ui-extension-registry';
31
+ export * from './ui-extension';
32
32
  export * from './view';
@@ -18,6 +18,7 @@ import { AssertionError, expect } from 'chai';
18
18
  import { Container, injectable } from 'inversify';
19
19
  import * as sinon from 'sinon';
20
20
  import { defaultModule } from './default.module';
21
+ import { FeedbackEmitter } from './feedback/feeback-emitter';
21
22
  import { IFeedbackActionDispatcher, IFeedbackEmitter } from './feedback/feedback-action-dispatcher';
22
23
  import { ISelectionListener, SelectFeedbackAction, SelectionService } from './selection-service';
23
24
 
@@ -49,6 +50,10 @@ class MockFeedbackActionDispatcher implements IFeedbackActionDispatcher {
49
50
  return [];
50
51
  }
51
52
 
53
+ createEmitter(): FeedbackEmitter {
54
+ return new FeedbackEmitter(this);
55
+ }
56
+
52
57
  async applyFeedbackCommands(context: CommandExecutionContext): Promise<void> {}
53
58
  }
54
59
 
@@ -28,7 +28,6 @@ import {
28
28
  LazyInjector,
29
29
  SelectAction,
30
30
  SelectAllAction,
31
- Selectable,
32
31
  SprottySelectAllCommand,
33
32
  SprottySelectCommand,
34
33
  TYPES,
@@ -37,7 +36,7 @@ import {
37
36
  pluck
38
37
  } from '@eclipse-glsp/sprotty';
39
38
  import { inject, injectable, postConstruct, preDestroy } from 'inversify';
40
- import { getElements, getMatchingElements } from '../utils/gmodel-util';
39
+ import { SelectableElement, getElements, getMatchingElements } from '../utils/gmodel-util';
41
40
  import { IGModelRootListener } from './editor-context-service';
42
41
  import { IFeedbackActionDispatcher } from './feedback/feedback-action-dispatcher';
43
42
  import { IDiagramStartup } from './model';
@@ -164,7 +163,7 @@ export class SelectionService implements IGModelRootListener, Disposable, IDiagr
164
163
  return this.root;
165
164
  }
166
165
 
167
- getSelectedElements(): Readonly<GModelElement & Selectable>[] {
166
+ getSelectedElements(): Readonly<SelectableElement>[] {
168
167
  return !this.root ? [] : getElements(this.root.index, Array.from(this.selectedElementIDs), isSelectable);
169
168
  }
170
169
 
@@ -0,0 +1,17 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2024 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ export * from './ui-extension';
17
+ export * from './ui-extension-registry';
@@ -16,7 +16,7 @@
16
16
 
17
17
  import { IUIExtension, LazyInjector, MaybePromise, TYPES, UIExtensionRegistry } from '@eclipse-glsp/sprotty';
18
18
  import { inject, injectable, optional } from 'inversify';
19
- import { IDiagramStartup } from './model';
19
+ import { IDiagramStartup } from '../model';
20
20
 
21
21
  @injectable()
22
22
  export class GLSPUIExtensionRegistry extends UIExtensionRegistry implements IDiagramStartup {
@@ -0,0 +1,119 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2024 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ import { AbstractUIExtension } from '@eclipse-glsp/sprotty';
18
+ import { injectable } from 'inversify';
19
+
20
+ export const CSS_UI_EXTENSION_CLASS = 'ui-extension';
21
+ export const CSS_HIDDEN_EXTENSION_CLASS = 'hidden';
22
+
23
+ /**
24
+ * Reusable abstract base implementation for UI extensions.
25
+ * Intended for UI extensions that directly interact with the DOM API to create and manage UI elements.
26
+ */
27
+ @injectable()
28
+ export abstract class GLSPAbstractUIExtension extends AbstractUIExtension {
29
+ protected get diagramContainerId(): string {
30
+ return this.options.baseDiv;
31
+ }
32
+
33
+ protected get parentContainerSelector(): string {
34
+ return '#' + this.diagramContainerId;
35
+ }
36
+
37
+ protected get containerSelector(): string {
38
+ return '#' + this.id();
39
+ }
40
+
41
+ protected get initialized(): boolean {
42
+ return !!this.containerElement;
43
+ }
44
+
45
+ protected override initialize(): boolean {
46
+ if (this.initialized) {
47
+ return true;
48
+ }
49
+ try {
50
+ this.containerElement = this.getOrCreateContainer();
51
+ this.initializeContainer(this.containerElement);
52
+ this.initializeContents(this.containerElement);
53
+ } catch (error) {
54
+ const msg = error instanceof Error ? error.message : `Could not retrieve container element for UI extension ${this.id}`;
55
+ this.logger.error(this, msg);
56
+ return false;
57
+ }
58
+ return true;
59
+ }
60
+
61
+ protected override getOrCreateContainer(): HTMLElement {
62
+ if (this.containerElement) {
63
+ return this.containerElement;
64
+ }
65
+ // check if the container already exists, independent from any potential parent container
66
+ // this allows us to use existing elements defined anywhere in the document
67
+ const existingContainer = this.getContainer();
68
+ if (existingContainer) {
69
+ return existingContainer;
70
+ }
71
+ // to create a container the parent container
72
+ const parent = this.getParentContainer();
73
+ if (!parent?.isConnected) {
74
+ throw new Error(`Could not obtain attached parent for initializing UI extension ${this.id}`);
75
+ }
76
+ const container = this.createContainer(parent);
77
+ this.insertContainerIntoParent(container, parent);
78
+ return container;
79
+ }
80
+
81
+ protected getContainer(): HTMLElement | null {
82
+ return document.querySelector<HTMLElement>(this.containerSelector);
83
+ }
84
+
85
+ protected createContainer(parent: HTMLElement): HTMLElement {
86
+ const container = document.createElement('div');
87
+ container.id = parent.id + '_' + this.id();
88
+ return container;
89
+ }
90
+
91
+ protected initializeContainer(container: HTMLElement): void {
92
+ container.classList.add(CSS_UI_EXTENSION_CLASS, this.containerClass());
93
+ }
94
+
95
+ protected getParentContainer(): HTMLElement | null {
96
+ return document.querySelector<HTMLElement>(this.parentContainerSelector)!;
97
+ }
98
+
99
+ protected insertContainerIntoParent(container: HTMLElement, parent: HTMLElement): void {
100
+ parent.insertBefore(container, parent.firstChild);
101
+ }
102
+
103
+ protected override setContainerVisible(visible: boolean): void {
104
+ // the parent class simply sets the style directly, however classes provide more fine-grained control
105
+ if (visible) {
106
+ this.containerElement?.classList.remove(CSS_HIDDEN_EXTENSION_CLASS);
107
+ } else {
108
+ this.containerElement?.classList.add(CSS_HIDDEN_EXTENSION_CLASS);
109
+ }
110
+ }
111
+
112
+ protected isContainerVisible(): boolean {
113
+ return !this.containerElement?.classList.contains(CSS_HIDDEN_EXTENSION_CLASS);
114
+ }
115
+
116
+ protected toggleContainerVisible(): void {
117
+ this.setContainerVisible(!this.isContainerVisible());
118
+ }
119
+ }
@@ -13,13 +13,13 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { BoundsAware, EdgeRouterRegistry, GConnectableElement, GModelElement, GModelRoot, TYPES } from '@eclipse-glsp/sprotty';
16
+ import { EdgeRouterRegistry, GConnectableElement, GModelElement, GModelRoot, TYPES } from '@eclipse-glsp/sprotty';
17
17
  import { inject, injectable, optional } from 'inversify';
18
18
  import { GLSPActionDispatcher } from '../../../base/action-dispatcher';
19
19
  import { applyCssClasses, deleteCssClasses } from '../../../base/feedback/css-feedback';
20
- import { SelectableBoundsAware } from '../../../utils/gmodel-util';
21
- import { ElementNavigator } from './element-navigator';
22
20
  import { GEdge } from '../../../model';
21
+ import { BoundsAwareModelElement, SelectableBoundsAware } from '../../../utils/gmodel-util';
22
+ import { ElementNavigator } from './element-navigator';
23
23
 
24
24
  @injectable()
25
25
  export class LocalElementNavigator implements ElementNavigator {
@@ -91,7 +91,7 @@ export class LocalElementNavigator implements ElementNavigator {
91
91
 
92
92
  protected getIterables(
93
93
  current: SelectableBoundsAware,
94
- previousCurrent?: GModelElement & BoundsAware,
94
+ previousCurrent?: BoundsAwareModelElement,
95
95
  predicate: (element: GModelElement) => boolean = () => true
96
96
  ): GModelElement[] {
97
97
  const elements: GModelElement[] = [];
@@ -17,7 +17,6 @@
17
17
  import {
18
18
  Action,
19
19
  ChangeBoundsOperation,
20
- DisposableCollection,
21
20
  ElementAndBounds,
22
21
  ElementMove,
23
22
  GModelRoot,
@@ -34,8 +33,9 @@ import {
34
33
  isBoundsAware,
35
34
  isViewport
36
35
  } from '@eclipse-glsp/sprotty';
37
- import { inject, injectable, optional } from 'inversify';
36
+ import { inject, injectable, optional, postConstruct } from 'inversify';
38
37
  import { DebouncedFunc, debounce } from 'lodash';
38
+ import { FeedbackEmitter } from '../../../base';
39
39
  import { EditorContextService } from '../../../base/editor-context-service';
40
40
  import { IFeedbackActionDispatcher } from '../../../base/feedback/feedback-action-dispatcher';
41
41
  import { SelectableBoundsAware, getElements, isSelectableAndBoundsAware } from '../../../utils/gmodel-util';
@@ -164,7 +164,12 @@ export class MoveElementHandler implements IActionHandler {
164
164
  readonly movementRestrictor?: IMovementRestrictor;
165
165
 
166
166
  protected debouncedChangeBounds?: DebouncedFunc<() => void>;
167
- protected disposableFeedback = new DisposableCollection();
167
+ protected moveFeedback: FeedbackEmitter;
168
+
169
+ @postConstruct()
170
+ protected init(): void {
171
+ this.moveFeedback = this.feedbackDispatcher.createEmitter();
172
+ }
168
173
 
169
174
  handle(action: Action): void | Action | ICommand {
170
175
  if (MoveElementAction.is(action)) {
@@ -199,7 +204,7 @@ export class MoveElementHandler implements IActionHandler {
199
204
 
200
205
  this.dispatcher.dispatchAll(viewportActions);
201
206
  const moveAction = MoveAction.create(elementMoves, { animate: false });
202
- this.disposableFeedback.push(this.feedbackDispatcher.registerFeedback(this, [moveAction]));
207
+ this.moveFeedback.add(moveAction).submit();
203
208
 
204
209
  this.scheduleChangeBounds(this.toElementAndBounds(elementMoves));
205
210
  }
@@ -219,7 +224,7 @@ export class MoveElementHandler implements IActionHandler {
219
224
  protected scheduleChangeBounds(elementAndBounds: ElementAndBounds[]): void {
220
225
  this.debouncedChangeBounds?.cancel();
221
226
  this.debouncedChangeBounds = debounce(() => {
222
- this.disposableFeedback.dispose();
227
+ this.moveFeedback.dispose();
223
228
  this.dispatcher.dispatchAll([ChangeBoundsOperation.create(elementAndBounds)]);
224
229
  this.debouncedChangeBounds = undefined;
225
230
  }, 300);