@eclipse-glsp/client 0.10.0-next.4ce46ea.160 → 0.10.0-next.6bee8eb.163

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 (312) hide show
  1. package/lib/base/action-dispatcher.d.ts +1 -1
  2. package/lib/base/action-dispatcher.d.ts.map +1 -1
  3. package/lib/base/action-dispatcher.js +3 -3
  4. package/lib/base/action-dispatcher.js.map +1 -1
  5. package/lib/base/auto-complete/auto-complete-widget.js +8 -8
  6. package/lib/base/auto-complete/auto-complete-widget.js.map +1 -1
  7. package/lib/base/auto-complete/validation-decorator.js +2 -2
  8. package/lib/base/auto-complete/validation-decorator.js.map +1 -1
  9. package/lib/base/command-stack.d.ts.map +1 -1
  10. package/lib/base/command-stack.js +3 -3
  11. package/lib/base/command-stack.js.map +1 -1
  12. package/lib/base/di.config.js +4 -4
  13. package/lib/base/di.config.js.map +1 -1
  14. package/lib/base/drag-aware-mouse-listener.d.ts +1 -1
  15. package/lib/base/drag-aware-mouse-listener.d.ts.map +1 -1
  16. package/lib/base/drag-aware-mouse-listener.js.map +1 -1
  17. package/lib/base/editor-context-service.js +10 -9
  18. package/lib/base/editor-context-service.js.map +1 -1
  19. package/lib/base/focus-tracker.js +3 -3
  20. package/lib/base/focus-tracker.js.map +1 -1
  21. package/lib/base/model/model-registry.d.ts.map +1 -1
  22. package/lib/base/model/model-registry.js +2 -2
  23. package/lib/base/model/model-registry.js.map +1 -1
  24. package/lib/base/model/update-model-command.d.ts +1 -1
  25. package/lib/base/model/update-model-command.d.ts.map +1 -1
  26. package/lib/base/model/update-model-command.js +12 -12
  27. package/lib/base/model/update-model-command.js.map +1 -1
  28. package/lib/base/model-initialization-constraint.d.ts +2 -2
  29. package/lib/base/model-initialization-constraint.d.ts.map +1 -1
  30. package/lib/base/model-initialization-constraint.js +9 -10
  31. package/lib/base/model-initialization-constraint.js.map +1 -1
  32. package/lib/base/selection-clearing-mouse-listener.d.ts.map +1 -1
  33. package/lib/base/selection-clearing-mouse-listener.js +1 -1
  34. package/lib/base/selection-clearing-mouse-listener.js.map +1 -1
  35. package/lib/base/tool-manager/glsp-tool-manager.d.ts +1 -1
  36. package/lib/base/tool-manager/glsp-tool-manager.d.ts.map +1 -1
  37. package/lib/base/tool-manager/glsp-tool-manager.js +10 -10
  38. package/lib/base/tool-manager/glsp-tool-manager.js.map +1 -1
  39. package/lib/base/view/view-registry.d.ts.map +1 -1
  40. package/lib/base/view/view-registry.js +2 -2
  41. package/lib/base/view/view-registry.js.map +1 -1
  42. package/lib/features/change-bounds/model.d.ts +1 -1
  43. package/lib/features/change-bounds/model.d.ts.map +1 -1
  44. package/lib/features/change-bounds/model.js +3 -3
  45. package/lib/features/change-bounds/model.js.map +1 -1
  46. package/lib/features/change-bounds/movement-restrictor.js +4 -4
  47. package/lib/features/change-bounds/movement-restrictor.js.map +1 -1
  48. package/lib/features/change-bounds/snap.js +1 -1
  49. package/lib/features/change-bounds/snap.js.map +1 -1
  50. package/lib/features/command-palette/command-palette-tool.js +3 -3
  51. package/lib/features/command-palette/command-palette-tool.js.map +1 -1
  52. package/lib/features/command-palette/server-command-palette-provider.js +4 -4
  53. package/lib/features/command-palette/server-command-palette-provider.js.map +1 -1
  54. package/lib/features/context-menu/delete-element-context-menu.js +2 -2
  55. package/lib/features/context-menu/delete-element-context-menu.js.map +1 -1
  56. package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.d.ts.map +1 -1
  57. package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.js +7 -7
  58. package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.js.map +1 -1
  59. package/lib/features/context-menu/server-context-menu-provider.js +4 -4
  60. package/lib/features/context-menu/server-context-menu-provider.js.map +1 -1
  61. package/lib/features/copy-paste/copy-paste-context-menu.js +3 -3
  62. package/lib/features/copy-paste/copy-paste-context-menu.js.map +1 -1
  63. package/lib/features/copy-paste/copy-paste-handler.js +7 -7
  64. package/lib/features/copy-paste/copy-paste-handler.js.map +1 -1
  65. package/lib/features/copy-paste/di.config.js +3 -3
  66. package/lib/features/copy-paste/di.config.js.map +1 -1
  67. package/lib/features/decoration/decoration-placer.d.ts +1 -1
  68. package/lib/features/decoration/decoration-placer.d.ts.map +1 -1
  69. package/lib/features/decoration/decoration-placer.js +2 -2
  70. package/lib/features/decoration/decoration-placer.js.map +1 -1
  71. package/lib/features/edit-label/di.config.js +1 -1
  72. package/lib/features/edit-label/di.config.js.map +1 -1
  73. package/lib/features/edit-label/edit-label-tool.js +1 -1
  74. package/lib/features/edit-label/edit-label-tool.js.map +1 -1
  75. package/lib/features/edit-label/edit-label-validator.js +4 -4
  76. package/lib/features/edit-label/edit-label-validator.js.map +1 -1
  77. package/lib/features/hints/di.config.js +2 -2
  78. package/lib/features/hints/di.config.js.map +1 -1
  79. package/lib/features/hints/type-hints.d.ts +1 -1
  80. package/lib/features/hints/type-hints.d.ts.map +1 -1
  81. package/lib/features/hints/type-hints.js +13 -13
  82. package/lib/features/hints/type-hints.js.map +1 -1
  83. package/lib/features/hover/di.config.js +9 -9
  84. package/lib/features/hover/di.config.js.map +1 -1
  85. package/lib/features/hover/hover.d.ts.map +1 -1
  86. package/lib/features/hover/hover.js +2 -2
  87. package/lib/features/hover/hover.js.map +1 -1
  88. package/lib/features/layout/di.config.js +3 -3
  89. package/lib/features/layout/di.config.js.map +1 -1
  90. package/lib/features/layout/freeform-layout.d.ts.map +1 -1
  91. package/lib/features/layout/freeform-layout.js +3 -3
  92. package/lib/features/layout/freeform-layout.js.map +1 -1
  93. package/lib/features/layout/layout-commands.d.ts +1 -1
  94. package/lib/features/layout/layout-commands.d.ts.map +1 -1
  95. package/lib/features/layout/layout-commands.js +23 -20
  96. package/lib/features/layout/layout-commands.js.map +1 -1
  97. package/lib/features/layout/layout-commands.spec.js +6 -6
  98. package/lib/features/layout/layout-commands.spec.js.map +1 -1
  99. package/lib/features/layout/vbox-layout.d.ts.map +1 -1
  100. package/lib/features/layout/vbox-layout.js +7 -7
  101. package/lib/features/layout/vbox-layout.js.map +1 -1
  102. package/lib/features/model-source-watcher/di.config.js +1 -1
  103. package/lib/features/model-source-watcher/di.config.js.map +1 -1
  104. package/lib/features/model-source-watcher/model-source-changed-action-handler.js +7 -7
  105. package/lib/features/model-source-watcher/model-source-changed-action-handler.js.map +1 -1
  106. package/lib/features/mouse-tool/mouse-tool.d.ts +9 -5
  107. package/lib/features/mouse-tool/mouse-tool.d.ts.map +1 -1
  108. package/lib/features/mouse-tool/mouse-tool.js +9 -45
  109. package/lib/features/mouse-tool/mouse-tool.js.map +1 -1
  110. package/lib/features/navigation/di.config.js +4 -4
  111. package/lib/features/navigation/di.config.js.map +1 -1
  112. package/lib/features/navigation/navigation-action-handler.js +9 -9
  113. package/lib/features/navigation/navigation-action-handler.js.map +1 -1
  114. package/lib/features/navigation/navigation-target-resolver.js +5 -5
  115. package/lib/features/navigation/navigation-target-resolver.js.map +1 -1
  116. package/lib/features/navigation/navigation-target-resolver.spec.js +9 -9
  117. package/lib/features/navigation/navigation-target-resolver.spec.js.map +1 -1
  118. package/lib/features/reconnect/model.d.ts +1 -1
  119. package/lib/features/reconnect/model.d.ts.map +1 -1
  120. package/lib/features/reconnect/model.js +1 -1
  121. package/lib/features/reconnect/model.js.map +1 -1
  122. package/lib/features/save/save-keylistener.d.ts +1 -1
  123. package/lib/features/save/save-keylistener.d.ts.map +1 -1
  124. package/lib/features/save/save-keylistener.js +2 -2
  125. package/lib/features/save/save-keylistener.js.map +1 -1
  126. package/lib/features/select/di.config.js +4 -4
  127. package/lib/features/select/di.config.js.map +1 -1
  128. package/lib/features/select/select-feedback-action.js +4 -4
  129. package/lib/features/select/select-feedback-action.js.map +1 -1
  130. package/lib/features/select/selection-service.d.ts +3 -3
  131. package/lib/features/select/selection-service.d.ts.map +1 -1
  132. package/lib/features/select/selection-service.js +20 -18
  133. package/lib/features/select/selection-service.js.map +1 -1
  134. package/lib/features/select/selection-service.spec.js +19 -19
  135. package/lib/features/select/selection-service.spec.js.map +1 -1
  136. package/lib/features/tool-feedback/change-bounds-tool-feedback.d.ts +1 -1
  137. package/lib/features/tool-feedback/change-bounds-tool-feedback.d.ts.map +1 -1
  138. package/lib/features/tool-feedback/change-bounds-tool-feedback.js +19 -19
  139. package/lib/features/tool-feedback/change-bounds-tool-feedback.js.map +1 -1
  140. package/lib/features/tool-feedback/creation-tool-feedback.d.ts +1 -1
  141. package/lib/features/tool-feedback/creation-tool-feedback.d.ts.map +1 -1
  142. package/lib/features/tool-feedback/creation-tool-feedback.js +19 -17
  143. package/lib/features/tool-feedback/creation-tool-feedback.js.map +1 -1
  144. package/lib/features/tool-feedback/css-feedback.js +5 -5
  145. package/lib/features/tool-feedback/css-feedback.js.map +1 -1
  146. package/lib/features/tool-feedback/di.config.js +14 -14
  147. package/lib/features/tool-feedback/di.config.js.map +1 -1
  148. package/lib/features/tool-feedback/edge-edit-tool-feedback.d.ts +1 -1
  149. package/lib/features/tool-feedback/edge-edit-tool-feedback.d.ts.map +1 -1
  150. package/lib/features/tool-feedback/edge-edit-tool-feedback.js +32 -32
  151. package/lib/features/tool-feedback/edge-edit-tool-feedback.js.map +1 -1
  152. package/lib/features/tool-feedback/feedback-action-dispatcher.js +3 -3
  153. package/lib/features/tool-feedback/feedback-action-dispatcher.js.map +1 -1
  154. package/lib/features/tool-feedback/marquee-tool-feedback.d.ts +1 -1
  155. package/lib/features/tool-feedback/marquee-tool-feedback.d.ts.map +1 -1
  156. package/lib/features/tool-feedback/marquee-tool-feedback.js +3 -3
  157. package/lib/features/tool-feedback/marquee-tool-feedback.js.map +1 -1
  158. package/lib/features/tool-feedback/model.d.ts +1 -2
  159. package/lib/features/tool-feedback/model.d.ts.map +1 -1
  160. package/lib/features/tool-feedback/model.js +1 -1
  161. package/lib/features/tool-feedback/model.js.map +1 -1
  162. package/lib/features/tool-feedback/view.js +4 -4
  163. package/lib/features/tool-feedback/view.js.map +1 -1
  164. package/lib/features/tool-palette/di.config.js +2 -2
  165. package/lib/features/tool-palette/di.config.js.map +1 -1
  166. package/lib/features/tool-palette/palette-item.js +2 -2
  167. package/lib/features/tool-palette/palette-item.js.map +1 -1
  168. package/lib/features/tool-palette/tool-palette.d.ts +1 -1
  169. package/lib/features/tool-palette/tool-palette.d.ts.map +1 -1
  170. package/lib/features/tool-palette/tool-palette.js +16 -14
  171. package/lib/features/tool-palette/tool-palette.js.map +1 -1
  172. package/lib/features/tools/base-glsp-tool.js +6 -6
  173. package/lib/features/tools/base-glsp-tool.js.map +1 -1
  174. package/lib/features/tools/change-bounds-tool.d.ts +1 -1
  175. package/lib/features/tools/change-bounds-tool.d.ts.map +1 -1
  176. package/lib/features/tools/change-bounds-tool.js +31 -31
  177. package/lib/features/tools/change-bounds-tool.js.map +1 -1
  178. package/lib/features/tools/delete-tool.d.ts +1 -1
  179. package/lib/features/tools/delete-tool.d.ts.map +1 -1
  180. package/lib/features/tools/delete-tool.js +14 -14
  181. package/lib/features/tools/delete-tool.js.map +1 -1
  182. package/lib/features/tools/di.config.js +3 -3
  183. package/lib/features/tools/di.config.js.map +1 -1
  184. package/lib/features/tools/edge-creation-tool.d.ts +1 -1
  185. package/lib/features/tools/edge-creation-tool.d.ts.map +1 -1
  186. package/lib/features/tools/edge-creation-tool.js +14 -14
  187. package/lib/features/tools/edge-creation-tool.js.map +1 -1
  188. package/lib/features/tools/edge-edit-tool.d.ts +1 -1
  189. package/lib/features/tools/edge-edit-tool.d.ts.map +1 -1
  190. package/lib/features/tools/edge-edit-tool.js +23 -23
  191. package/lib/features/tools/edge-edit-tool.js.map +1 -1
  192. package/lib/features/tools/marquee-behavior.spec.js +63 -63
  193. package/lib/features/tools/marquee-behavior.spec.js.map +1 -1
  194. package/lib/features/tools/marquee-mouse-tool.d.ts +1 -1
  195. package/lib/features/tools/marquee-mouse-tool.d.ts.map +1 -1
  196. package/lib/features/tools/marquee-mouse-tool.js +15 -15
  197. package/lib/features/tools/marquee-mouse-tool.js.map +1 -1
  198. package/lib/features/tools/marquee-tool.d.ts +1 -1
  199. package/lib/features/tools/marquee-tool.d.ts.map +1 -1
  200. package/lib/features/tools/marquee-tool.js +3 -3
  201. package/lib/features/tools/marquee-tool.js.map +1 -1
  202. package/lib/features/tools/model.d.ts +1 -1
  203. package/lib/features/tools/model.d.ts.map +1 -1
  204. package/lib/features/tools/model.js +1 -1
  205. package/lib/features/tools/model.js.map +1 -1
  206. package/lib/features/tools/node-creation-tool.d.ts +1 -1
  207. package/lib/features/tools/node-creation-tool.d.ts.map +1 -1
  208. package/lib/features/tools/node-creation-tool.js +13 -13
  209. package/lib/features/tools/node-creation-tool.js.map +1 -1
  210. package/lib/features/tools/view.d.ts.map +1 -1
  211. package/lib/features/tools/view.js +2 -2
  212. package/lib/features/tools/view.js.map +1 -1
  213. package/lib/features/validation/di.config.js +4 -4
  214. package/lib/features/validation/di.config.js.map +1 -1
  215. package/lib/features/validation/marker-navigator.d.ts +1 -1
  216. package/lib/features/validation/marker-navigator.d.ts.map +1 -1
  217. package/lib/features/validation/marker-navigator.js +21 -21
  218. package/lib/features/validation/marker-navigator.js.map +1 -1
  219. package/lib/features/validation/marker-navigator.spec.js +21 -21
  220. package/lib/features/validation/marker-navigator.spec.js.map +1 -1
  221. package/lib/features/validation/validate.d.ts +1 -1
  222. package/lib/features/validation/validate.d.ts.map +1 -1
  223. package/lib/features/validation/validate.js +21 -21
  224. package/lib/features/validation/validate.js.map +1 -1
  225. package/lib/features/viewport/di.config.js +6 -6
  226. package/lib/features/viewport/di.config.js.map +1 -1
  227. package/lib/features/viewport/glsp-scroll-mouse-listener.d.ts +1 -1
  228. package/lib/features/viewport/glsp-scroll-mouse-listener.d.ts.map +1 -1
  229. package/lib/features/viewport/glsp-scroll-mouse-listener.js +1 -1
  230. package/lib/features/viewport/glsp-scroll-mouse-listener.js.map +1 -1
  231. package/lib/index.js +7 -3
  232. package/lib/index.js.map +1 -1
  233. package/lib/lib/model.d.ts +1 -1
  234. package/lib/lib/model.d.ts.map +1 -1
  235. package/lib/lib/model.js +1 -1
  236. package/lib/lib/model.js.map +1 -1
  237. package/lib/model-source/glsp-diagram-server.d.ts +1 -1
  238. package/lib/model-source/glsp-diagram-server.d.ts.map +1 -1
  239. package/lib/model-source/glsp-diagram-server.js +5 -5
  240. package/lib/model-source/glsp-diagram-server.js.map +1 -1
  241. package/lib/protocol-reexport.js +7 -2
  242. package/lib/protocol-reexport.js.map +1 -1
  243. package/lib/utils/argument-utils.js +5 -5
  244. package/lib/utils/argument-utils.js.map +1 -1
  245. package/lib/utils/smodel-util.d.ts +106 -9
  246. package/lib/utils/smodel-util.d.ts.map +1 -1
  247. package/lib/utils/smodel-util.js +124 -38
  248. package/lib/utils/smodel-util.js.map +1 -1
  249. package/lib/utils/viewpoint-util.js +3 -3
  250. package/lib/utils/viewpoint-util.js.map +1 -1
  251. package/lib/views/base-view-module.js +19 -19
  252. package/lib/views/base-view-module.js.map +1 -1
  253. package/lib/views/compartments.js +1 -1
  254. package/lib/views/compartments.js.map +1 -1
  255. package/lib/views/glsp-edge-view.d.ts +1 -1
  256. package/lib/views/glsp-edge-view.d.ts.map +1 -1
  257. package/lib/views/glsp-edge-view.js +1 -1
  258. package/lib/views/glsp-edge-view.js.map +1 -1
  259. package/lib/views/index.js +6 -2
  260. package/lib/views/index.js.map +1 -1
  261. package/lib/views/issue-marker-view.d.ts.map +1 -1
  262. package/lib/views/issue-marker-view.js +3 -3
  263. package/lib/views/issue-marker-view.js.map +1 -1
  264. package/lib/views/rounded-corner-view.d.ts.map +1 -1
  265. package/lib/views/rounded-corner-view.js +2 -2
  266. package/lib/views/rounded-corner-view.js.map +1 -1
  267. package/package.json +6 -17
  268. package/src/base/action-dispatcher.ts +4 -4
  269. package/src/base/command-stack.ts +3 -3
  270. package/src/base/drag-aware-mouse-listener.ts +4 -4
  271. package/src/base/model/model-registry.ts +2 -2
  272. package/src/base/model/update-model-command.ts +2 -2
  273. package/src/base/model-initialization-constraint.ts +8 -9
  274. package/src/base/selection-clearing-mouse-listener.ts +1 -1
  275. package/src/base/tool-manager/glsp-tool-manager.ts +7 -7
  276. package/src/base/view/view-registry.ts +2 -2
  277. package/src/features/change-bounds/model.ts +5 -5
  278. package/src/features/context-menu/selection-service-aware-context-menu-mouse-listener.ts +1 -1
  279. package/src/features/decoration/decoration-placer.ts +2 -2
  280. package/src/features/hints/type-hints.ts +2 -2
  281. package/src/features/hover/hover.ts +1 -1
  282. package/src/features/layout/freeform-layout.ts +3 -3
  283. package/src/features/layout/layout-commands.ts +9 -9
  284. package/src/features/layout/vbox-layout.ts +16 -12
  285. package/src/features/mouse-tool/mouse-tool.ts +14 -50
  286. package/src/features/reconnect/model.ts +2 -2
  287. package/src/features/save/save-keylistener.ts +2 -2
  288. package/src/features/select/selection-service.ts +5 -4
  289. package/src/features/tool-feedback/change-bounds-tool-feedback.ts +10 -9
  290. package/src/features/tool-feedback/creation-tool-feedback.ts +10 -10
  291. package/src/features/tool-feedback/edge-edit-tool-feedback.ts +15 -15
  292. package/src/features/tool-feedback/marquee-tool-feedback.ts +2 -2
  293. package/src/features/tool-feedback/model.ts +1 -3
  294. package/src/features/tool-palette/tool-palette.ts +5 -3
  295. package/src/features/tools/change-bounds-tool.ts +6 -6
  296. package/src/features/tools/delete-tool.ts +3 -3
  297. package/src/features/tools/edge-creation-tool.ts +3 -3
  298. package/src/features/tools/edge-edit-tool.ts +5 -5
  299. package/src/features/tools/marquee-mouse-tool.ts +6 -6
  300. package/src/features/tools/marquee-tool.ts +2 -2
  301. package/src/features/tools/model.ts +2 -2
  302. package/src/features/tools/node-creation-tool.ts +3 -3
  303. package/src/features/tools/view.tsx +2 -3
  304. package/src/features/validation/marker-navigator.ts +6 -4
  305. package/src/features/validation/validate.ts +4 -4
  306. package/src/features/viewport/glsp-scroll-mouse-listener.ts +2 -2
  307. package/src/lib/model.ts +2 -3
  308. package/src/model-source/glsp-diagram-server.ts +5 -5
  309. package/src/utils/smodel-util.ts +121 -41
  310. package/src/views/glsp-edge-view.tsx +4 -4
  311. package/src/views/issue-marker-view.tsx +2 -2
  312. package/src/views/rounded-corner-view.tsx +2 -3
@@ -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
@@ -151,7 +151,7 @@ export class ApplyMarkersAction implements MarkersAction {
151
151
  @injectable()
152
152
  export class ApplyMarkersCommand extends FeedbackCommand {
153
153
  static KIND = 'applyMarkers';
154
- readonly priority = 0;
154
+ override readonly priority = 0;
155
155
 
156
156
  constructor(@inject(TYPES.Action) protected action: ApplyMarkersAction) {
157
157
  super();
@@ -171,11 +171,11 @@ export class ApplyMarkersCommand extends FeedbackCommand {
171
171
  return context.root;
172
172
  }
173
173
 
174
- undo(context: CommandExecutionContext): CommandReturn {
174
+ override undo(context: CommandExecutionContext): CommandReturn {
175
175
  return context.root;
176
176
  }
177
177
 
178
- redo(context: CommandExecutionContext): CommandReturn {
178
+ override redo(context: CommandExecutionContext): CommandReturn {
179
179
  return this.execute(context);
180
180
  }
181
181
  }
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2021 EclipseSource and others.
2
+ * Copyright (c) 2021-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
@@ -32,7 +32,7 @@ export class GLSPScrollMouseListener extends ScrollMouseListener implements IAct
32
32
  }
33
33
  }
34
34
 
35
- mouseDown(target: SModelElement, event: MouseEvent): (Action | Promise<Action>)[] {
35
+ override mouseDown(target: SModelElement, event: MouseEvent): (Action | Promise<Action>)[] {
36
36
  if (this.preventScrolling) {
37
37
  return [];
38
38
  }
package/src/lib/model.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2019 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
@@ -14,12 +14,11 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
  import { exportFeature, SGraph, SModelElement, SModelElementSchema, viewportFeature } from 'sprotty/lib';
17
-
18
17
  import { Containable, containerFeature } from '../features/hints/model';
19
18
  import { Saveable, saveFeature } from '../features/save/model';
20
19
 
21
20
  export class GLSPGraph extends SGraph implements Saveable, Containable {
22
- static readonly DEFAULT_FEATURES = [viewportFeature, exportFeature, saveFeature, containerFeature];
21
+ static override readonly DEFAULT_FEATURES = [viewportFeature, exportFeature, saveFeature, containerFeature];
23
22
  dirty = false;
24
23
  isContainableElement(input: string | SModelElement | SModelElementSchema): boolean {
25
24
  return true;
@@ -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
@@ -55,21 +55,21 @@ export class GLSPDiagramServer extends DiagramServer implements SourceUriAware {
55
55
  }
56
56
  }
57
57
 
58
- initialize(registry: ActionHandlerRegistry): void {
58
+ override initialize(registry: ActionHandlerRegistry): void {
59
59
  registerDefaultGLSPServerActions(registry, this);
60
60
  if (!this.clientId) {
61
61
  this.clientId = this.viewerOptions.baseDiv;
62
62
  }
63
63
  }
64
64
 
65
- handle(action: Action): void | ICommand | Action {
65
+ override handle(action: Action): void | ICommand | Action {
66
66
  if (isRequestModelAction(action) && action.options) {
67
67
  this._sourceUri = action.options.sourceUri as string;
68
68
  }
69
69
  return super.handle(action);
70
70
  }
71
71
 
72
- handleLocally(action: Action): boolean {
72
+ override handleLocally(action: Action): boolean {
73
73
  if (isServerMessageAction(action)) {
74
74
  return this.handleServerMessageAction(action);
75
75
  }
@@ -84,7 +84,7 @@ export class GLSPDiagramServer extends DiagramServer implements SourceUriAware {
84
84
  return false;
85
85
  }
86
86
 
87
- protected handleComputedBounds(_action: ComputedBoundsAction): boolean {
87
+ protected override handleComputedBounds(_action: ComputedBoundsAction): boolean {
88
88
  return true;
89
89
  }
90
90
 
@@ -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
@@ -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 { ElementAndRoutingPoints } from '@eclipse-glsp/protocol';
16
+ import { distinctAdd, ElementAndRoutingPoints, remove } from '@eclipse-glsp/protocol';
17
17
  import {
18
18
  BoundsAware,
19
19
  ElementAndBounds,
@@ -28,93 +28,161 @@ import {
28
28
  SRoutableElement,
29
29
  SRoutingHandle
30
30
  } from 'sprotty';
31
+ import { FluentIterable } from 'sprotty/lib/utils/iterable';
31
32
 
32
- export function getIndex(element: SModelElement): SModelIndex<SModelElement> {
33
- return element.root.index;
33
+ /**
34
+ * Helper type to represent a filter predicate for {@link SModelElement}s. This is used to retrieve
35
+ * elements from the {@link SModelIndex} that also conform to a second type `T`. Its mainly used for
36
+ * retrieving elements that also implement a certain model features (e.g. selectable)
37
+ */
38
+ export type ModelFilterPredicate<T> = (modelElement: SModelElement) => modelElement is SModelElement & T;
39
+
40
+ /**
41
+ * Retrieves all elements from the given {@link SModelIndex} that match the given {@link ModelFilterPredicate}
42
+ * @param index The {@link SModelIndex}.
43
+ * @param predicate The {@link ModelFilterPredicate} that should be used.
44
+ * @returns A {@link FluentIterable} of all indexed element that match the predicate
45
+ * (correctly casted to also include the additional type of the predicate).
46
+ */
47
+ export function filter<T>(index: SModelIndex<SModelElement>, predicate: ModelFilterPredicate<T>): FluentIterable<SModelElement & T> {
48
+ return index.all().filter(predicate) as FluentIterable<SModelElement & T>;
34
49
  }
35
50
 
51
+ /**
52
+ * Retrieves all elements from the given {@link SModelIndex} that match the given {@link ModelFilterPredicate} and executes
53
+ * the given runnable for each element of the result set.
54
+ * @param index The {@link SModelIndex}.
55
+ * @param predicate The {@link ModelFilterPredicate} that should be used.
56
+ * @param runnable The runnable that should be executed for each matching element.
57
+ */
36
58
  export function forEachElement<T>(
37
- element: SModelElement,
38
- predicate: (modelElement: SModelElement) => modelElement is SModelElement & T,
59
+ index: SModelIndex<SModelElement>,
60
+ predicate: ModelFilterPredicate<T>,
39
61
  runnable: (modelElement: SModelElement & T) => void
40
62
  ): void {
41
- getIndex(element).all().filter(predicate).forEach(runnable);
42
- }
43
-
44
- export function getMatchingElements<T>(
45
- element: SModelElement,
46
- predicate: (modelElement: SModelElement) => modelElement is SModelElement & T
47
- ): (SModelElement & T)[] {
48
- const matching: (SModelElement & T)[] = [];
49
- forEachElement(element, predicate, item => matching.push(item));
50
- return matching;
63
+ filter(index, predicate).forEach(runnable);
51
64
  }
52
65
 
53
- export function hasSelectedElements(element: SModelElement): boolean {
54
- return getSelectedElementCount(element) > 0;
66
+ /**
67
+ * Retrieves an array of all elements that match the given {@link ModelFilterPredicate} from the given {@link SModelIndex}.
68
+ * @param index The {@link SModelIndex}.
69
+ * @param predicate The {@link ModelFilterPredicate} that should be used.
70
+ * @returns An array of all indexed element that match the predicate
71
+ * (correctly casted to also include the additional type of the predicate).
72
+ */
73
+ export function getMatchingElements<T>(index: SModelIndex<SModelElement>, predicate: ModelFilterPredicate<T>): (SModelElement & T)[] {
74
+ return Array.from(filter(index, predicate));
55
75
  }
56
76
 
57
- export function getSelectedElementCount(element: SModelElement): number {
77
+ /**
78
+ * Retrieves the amount of currently selected elements in the given {@link SModelIndex}.
79
+ * @param index The {@link SModelIndex}.
80
+ * @returns The amount of selected elements.
81
+ */
82
+ export function getSelectedElementCount(index: SModelIndex<SModelElement>): number {
58
83
  let selected = 0;
59
- getIndex(element)
60
- .all()
61
- .filter(isSelected)
62
- .forEach(e => (selected = selected + 1));
84
+ forEachElement(index, isSelected, element => selected++);
63
85
  return selected;
64
86
  }
65
87
 
88
+ /**
89
+ * Helper function to check wether an any element is selected in the given {@link SModelIndex}.
90
+ * @param index The {@link SModelIndex}.
91
+ * @returns `true` if at least one element is selected, `false` otherwise.
92
+ */
93
+ export function hasSelectedElements(index: SModelIndex<SModelElement>): boolean {
94
+ return getSelectedElementCount(index) > 0;
95
+ }
96
+
97
+ /**
98
+ * Helper function to check wether an element is defined. Can be used as {@link ModelFilterPredicate}.
99
+ * @param element The element that should be checked.
100
+ * @returns the type predicate for `T`
101
+ */
66
102
  export function isNotUndefined<T>(element: T | undefined): element is T {
67
103
  return element !== undefined;
68
104
  }
69
105
 
70
- export function addCssClasses(root: SModelElement, cssClasses: string[]): void {
71
- if (root.cssClasses === undefined) {
72
- root.cssClasses = [];
73
- }
74
- for (const cssClass of cssClasses) {
75
- if (root.cssClasses.indexOf(cssClass) < 0) {
76
- root.cssClasses.push(cssClass);
77
- }
78
- }
106
+ /**
107
+ * Adds a set of css classes to the given {@link SModelElement}.
108
+ * @param element The element to which the css classes should be added.
109
+ * @param cssClasses The set of css classes as string array.
110
+ */
111
+ export function addCssClasses(element: SModelElement, cssClasses: string[]): void {
112
+ const elementCssClasses: string[] = element.cssClasses ?? [];
113
+ distinctAdd(elementCssClasses, ...cssClasses);
114
+ element.cssClasses = elementCssClasses;
79
115
  }
80
116
 
117
+ /**
118
+ * Removes a set of css classes from the given {@link SModelElement}.
119
+ * @param element The element from which the css classes should be removed.
120
+ * @param cssClasses The set of css classes as string array.
121
+ */
81
122
  export function removeCssClasses(root: SModelElement, cssClasses: string[]): void {
82
- if (root.cssClasses === undefined || root.cssClasses.length === 0) {
123
+ if (!root.cssClasses || root.cssClasses.length === 0) {
83
124
  return;
84
125
  }
85
- for (const cssClass of cssClasses) {
86
- const index = root.cssClasses.indexOf(cssClass);
87
- if (index !== -1) {
88
- root.cssClasses.splice(root.cssClasses.indexOf(cssClass), 1);
89
- }
90
- }
126
+ remove(root.cssClasses, ...cssClasses);
91
127
  }
92
128
 
93
129
  export function isNonRoutableSelectedMovableBoundsAware(element: SModelElement): element is SelectableBoundsAware {
94
130
  return isNonRoutableSelectedBoundsAware(element) && isMoveable(element);
95
131
  }
96
132
 
133
+ /**
134
+ * A typeguard function to check wether a given {@link SModelElement} implements the {@link BoundsAware} model feature,
135
+ * the {@link Selectable} model feature and is actually selected. In addition, the element must not be a {@link SRoutableElement}.
136
+ * @param element The element to check.
137
+ * @returns A type predicate indicating wether the element is of type {@link SelectableBoundsAware}.
138
+ */
97
139
  export function isNonRoutableSelectedBoundsAware(element: SModelElement): element is SelectableBoundsAware {
98
140
  return isBoundsAware(element) && isSelected(element) && !isRoutable(element);
99
141
  }
100
142
 
143
+ /**
144
+ * A type guard function to check wether a given {@link SModelElement} is a {@link SRoutableElement}.
145
+ * @param element The element to check.
146
+ * @returns A type predicate indicating wether the element is a {@link SRoutableElement}.
147
+ */
101
148
  export function isRoutable<T extends SModelElement>(element: T): element is T & SRoutableElement {
102
149
  return element instanceof SRoutableElement && (element as any).routingPoints !== undefined;
103
150
  }
104
151
 
152
+ /**
153
+ * A typeguard function to check wether a given {@link SModelElement} is a {@link SRoutingHandle}.
154
+ * @param element The element to check.
155
+ * @returns A type predicate indicating wether the element is a {@link SRoutingHandle}
156
+ */
105
157
  export function isRoutingHandle(element: SModelElement | undefined): element is SRoutingHandle {
106
158
  return element !== undefined && element instanceof SRoutingHandle;
107
159
  }
108
160
 
109
- export function isSelectableAndBoundsAware(element: SModelElement): element is BoundsAware & Selectable & SModelElement {
161
+ /**
162
+ * A typeguard function to check wether a given {@link SModelElement} implements the {@link Selectable} model feature and
163
+ * the {@link BoundsAware} model feature.
164
+ * @returns A type predicate indicating wether the element is of type {@link SelectableBoundsAware}.
165
+ */
166
+ export function isSelectableAndBoundsAware(element: SModelElement): element is SelectableBoundsAware {
110
167
  return isSelectable(element) && isBoundsAware(element);
111
168
  }
112
169
 
170
+ /**
171
+ * Union type to describe {@link SModelElement}s that implement the {@link Selectable} and {@link BoundsAware} feature.
172
+ */
113
173
  export type SelectableBoundsAware = SModelElement & BoundsAware & Selectable;
114
174
 
175
+ /**
176
+ * Union type to describe {@link SModelElement}s that implement the {@link BoundsAware} feature.
177
+ */
115
178
  export type BoundsAwareModelElement = SModelElement & BoundsAware;
116
179
 
117
- export function toElementAndBounds(element: SModelElement & BoundsAware): ElementAndBounds {
180
+ /**
181
+ * Helper function to translate a given {@link SModelElement} into its corresponding {@link ElementAndBounds} representation.
182
+ * @param element The element to translate.
183
+ * @returns The corresponding {@link ElementAndBounds} for the given element.
184
+ */
185
+ export function toElementAndBounds(element: BoundsAwareModelElement): ElementAndBounds {
118
186
  return {
119
187
  elementId: element.id,
120
188
  newPosition: {
@@ -128,6 +196,12 @@ export function toElementAndBounds(element: SModelElement & BoundsAware): Elemen
128
196
  };
129
197
  }
130
198
 
199
+ /**
200
+ * Helper function to translate a given {@link SRoutableElement} into its corresponding
201
+ * {@ElementAndRoutingPoints ElementAndBounds} representation.
202
+ * @param element The element to translate.
203
+ * @returns The corresponding {@link ElementAndRoutingPoints} for the given element.
204
+ */
131
205
  export function toElementAndRoutingPoints(element: SRoutableElement): ElementAndRoutingPoints {
132
206
  return {
133
207
  elementId: element.id,
@@ -144,6 +218,12 @@ export function hasCompatibleType(input: SModelElement | SModelElementSchema | s
144
218
  return inputType === type ? true : inputType.split(':').includes(type);
145
219
  }
146
220
 
221
+ /**
222
+ * Convenience function to retrieve the model element type from a given input. The input
223
+ * can either be a {@link SModelElement}, {@link SModelElementSchema} or a string.
224
+ * @param input The type input.
225
+ * @returns The corresponding model type as string.
226
+ */
147
227
  export function getElementTypeId(input: SModelElement | SModelElementSchema | string): string {
148
228
  if (typeof input === 'string') {
149
229
  return input as string;
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2021 EclipseSource and others.
2
+ * Copyright (c) 2021-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 @@ const JSX = { createElement: svg };
24
24
 
25
25
  @injectable()
26
26
  export class GEdgeView extends PolylineEdgeView {
27
- render(edge: Readonly<SEdge>, context: RenderingContext): VNode {
27
+ override render(edge: Readonly<SEdge>, context: RenderingContext): VNode {
28
28
  const router = this.edgeRouterRegistry.get(edge.routerKind);
29
29
  const route = router.route(edge);
30
30
  if (route.length === 0) {
@@ -44,11 +44,11 @@ export class GEdgeView extends PolylineEdgeView {
44
44
  return {};
45
45
  }
46
46
 
47
- protected renderLine(_edge: SEdge, segments: Point[], _context: RenderingContext): VNode {
47
+ protected override renderLine(_edge: SEdge, segments: Point[], _context: RenderingContext): VNode {
48
48
  return <path d={this.createPathForSegments(segments)} />;
49
49
  }
50
50
 
51
- protected renderAdditionals(edge: SEdge, segments: Point[], _context: RenderingContext): VNode[] {
51
+ protected override renderAdditionals(edge: SEdge, segments: Point[], _context: RenderingContext): VNode[] {
52
52
  // for additional padding we draw another transparent path with larger stroke width
53
53
  const edgePadding = EdgePadding.from(edge);
54
54
  return edgePadding ? [this.renderMouseHandle(segments, edgePadding)] : [];
@@ -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
@@ -23,7 +23,7 @@ const JSX = { createElement: svg };
23
23
 
24
24
  @injectable()
25
25
  export class GIssueMarkerView extends IssueMarkerView {
26
- render(marker: SIssueMarker, _context: RenderingContext): VNode {
26
+ override render(marker: SIssueMarker, _context: RenderingContext): VNode {
27
27
  const maxSeverity = super.getMaxSeverity(marker);
28
28
  const group = (
29
29
  <g class-sprotty-issue={true}>
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2021 EclipseSource and others.
2
+ * Copyright (c) 2021-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
@@ -16,7 +16,6 @@
16
16
  import { injectable } from 'inversify';
17
17
  import { Classes, VNode } from 'snabbdom';
18
18
  import { Hoverable, RectangularNodeView, RenderingContext, Selectable, SNode, SPort, SShapeElement, svg } from 'sprotty';
19
-
20
19
  import { CornerRadius } from '../utils/argument-utils';
21
20
  import { RoundedCornerWrapper } from './rounded-corner';
22
21
 
@@ -25,7 +24,7 @@ const JSX = { createElement: svg };
25
24
 
26
25
  @injectable()
27
26
  export class RoundedCornerNodeView extends RectangularNodeView {
28
- render(node: Readonly<SShapeElement & Hoverable & Selectable>, context: RenderingContext): VNode | undefined {
27
+ override render(node: Readonly<SShapeElement & Hoverable & Selectable>, context: RenderingContext): VNode | undefined {
29
28
  const cornerRadius = CornerRadius.from(node);
30
29
  if (!cornerRadius) {
31
30
  return this.renderWithoutRadius(node, context);