@eclipse-glsp/client 1.1.0-next.4a5a0ee.195 → 1.1.0-next.4e10035.245

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 (389) hide show
  1. package/README.md +1 -1
  2. package/{lib/features/change-bounds/snap.spec.d.ts → css/autocomplete-palette.css} +8 -3
  3. package/css/decoration.css +1 -1
  4. package/css/glsp-sprotty.css +34 -19
  5. package/lib/base/action-dispatcher.js.map +1 -1
  6. package/lib/base/auto-complete/auto-complete-widget.d.ts +10 -4
  7. package/lib/base/auto-complete/auto-complete-widget.d.ts.map +1 -1
  8. package/lib/base/auto-complete/auto-complete-widget.js +28 -9
  9. package/lib/base/auto-complete/auto-complete-widget.js.map +1 -1
  10. package/lib/base/command-stack.d.ts +1 -2
  11. package/lib/base/command-stack.d.ts.map +1 -1
  12. package/lib/base/command-stack.js +5 -14
  13. package/lib/base/command-stack.js.map +1 -1
  14. package/lib/base/container-modules.d.ts +32 -2
  15. package/lib/base/container-modules.d.ts.map +1 -1
  16. package/lib/base/container-modules.js +78 -43
  17. package/lib/base/container-modules.js.map +1 -1
  18. package/lib/base/di.config.d.ts +1 -1
  19. package/lib/base/di.config.d.ts.map +1 -1
  20. package/lib/base/di.config.js +7 -7
  21. package/lib/base/di.config.js.map +1 -1
  22. package/lib/base/editor-context-service.d.ts +4 -4
  23. package/lib/base/editor-context-service.d.ts.map +1 -1
  24. package/lib/base/editor-context-service.js +3 -3
  25. package/lib/base/editor-context-service.js.map +1 -1
  26. package/lib/base/focus-tracker.js.map +1 -1
  27. package/lib/base/model/model-registry.js.map +1 -1
  28. package/lib/base/model/update-model-command.js.map +1 -1
  29. package/lib/base/model-initialization-constraint.js.map +1 -1
  30. package/lib/base/selection-clearing-mouse-listener.js +1 -1
  31. package/lib/base/selection-clearing-mouse-listener.js.map +1 -1
  32. package/lib/base/tool-manager/glsp-tool-manager.d.ts +4 -5
  33. package/lib/base/tool-manager/glsp-tool-manager.d.ts.map +1 -1
  34. package/lib/base/tool-manager/glsp-tool-manager.js +15 -8
  35. package/lib/base/tool-manager/glsp-tool-manager.js.map +1 -1
  36. package/lib/base/view/view-registry.js.map +1 -1
  37. package/lib/features/accessibility/di.config.d.ts +21 -0
  38. package/lib/features/accessibility/di.config.d.ts.map +1 -0
  39. package/lib/features/accessibility/di.config.js +28 -0
  40. package/lib/features/accessibility/di.config.js.map +1 -0
  41. package/lib/features/accessibility/search/di.config.d.ts +20 -0
  42. package/lib/features/accessibility/search/di.config.d.ts.map +1 -0
  43. package/lib/features/accessibility/search/di.config.js +33 -0
  44. package/lib/features/accessibility/search/di.config.js.map +1 -0
  45. package/lib/features/accessibility/search/search-palette.d.ts +47 -0
  46. package/lib/features/accessibility/search/search-palette.d.ts.map +1 -0
  47. package/lib/features/accessibility/search/search-palette.js +155 -0
  48. package/lib/features/accessibility/search/search-palette.js.map +1 -0
  49. package/lib/features/accessibility/search/search-tool.d.ts +30 -0
  50. package/lib/features/accessibility/search/search-tool.d.ts.map +1 -0
  51. package/lib/features/accessibility/search/search-tool.js +73 -0
  52. package/lib/features/accessibility/search/search-tool.js.map +1 -0
  53. package/lib/features/autocomplete-palette/autocomplete-suggestion-providers.d.ts +35 -0
  54. package/lib/features/autocomplete-palette/autocomplete-suggestion-providers.d.ts.map +1 -0
  55. package/lib/features/{tools/marquee-behavior.spec.d.ts → autocomplete-palette/autocomplete-suggestion-providers.js} +4 -3
  56. package/lib/features/autocomplete-palette/autocomplete-suggestion-providers.js.map +1 -0
  57. package/lib/features/autocomplete-palette/base-autocomplete-palette.d.ts +41 -0
  58. package/lib/features/autocomplete-palette/base-autocomplete-palette.d.ts.map +1 -0
  59. package/lib/features/autocomplete-palette/base-autocomplete-palette.js +82 -0
  60. package/lib/features/autocomplete-palette/base-autocomplete-palette.js.map +1 -0
  61. package/lib/features/bounds/di.config.d.ts +4 -0
  62. package/lib/features/bounds/di.config.d.ts.map +1 -0
  63. package/lib/features/bounds/di.config.js +39 -0
  64. package/lib/features/bounds/di.config.js.map +1 -0
  65. package/lib/features/{layout → bounds}/freeform-layout.d.ts +2 -2
  66. package/lib/features/{layout → bounds}/freeform-layout.d.ts.map +1 -1
  67. package/lib/features/{layout → bounds}/freeform-layout.js +2 -2
  68. package/lib/features/{layout → bounds}/freeform-layout.js.map +1 -1
  69. package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts +34 -0
  70. package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts.map +1 -0
  71. package/lib/features/bounds/glsp-hidden-bounds-updater.js +99 -0
  72. package/lib/features/bounds/glsp-hidden-bounds-updater.js.map +1 -0
  73. package/lib/features/{layout → bounds}/hbox-layout.d.ts +1 -1
  74. package/lib/features/{layout → bounds}/hbox-layout.d.ts.map +1 -1
  75. package/lib/features/{layout → bounds}/hbox-layout.js +1 -1
  76. package/lib/features/{layout → bounds}/hbox-layout.js.map +1 -1
  77. package/lib/features/{layout → bounds}/layouter.d.ts +1 -1
  78. package/lib/features/{layout → bounds}/layouter.d.ts.map +1 -1
  79. package/lib/features/{layout → bounds}/layouter.js +1 -1
  80. package/lib/features/{layout → bounds}/layouter.js.map +1 -1
  81. package/lib/features/{layout → bounds}/vbox-layout.d.ts +1 -1
  82. package/lib/features/{layout → bounds}/vbox-layout.d.ts.map +1 -1
  83. package/lib/features/{layout → bounds}/vbox-layout.js +1 -1
  84. package/lib/features/{layout → bounds}/vbox-layout.js.map +1 -1
  85. package/lib/features/change-bounds/movement-restrictor.js.map +1 -1
  86. package/lib/features/change-bounds/snap.js.map +1 -1
  87. package/lib/features/command-palette/command-palette-tool.d.ts +1 -1
  88. package/lib/features/command-palette/command-palette-tool.d.ts.map +1 -1
  89. package/lib/features/command-palette/command-palette-tool.js +3 -3
  90. package/lib/features/command-palette/command-palette-tool.js.map +1 -1
  91. package/lib/features/command-palette/di.config.d.ts +0 -15
  92. package/lib/features/command-palette/di.config.d.ts.map +1 -1
  93. package/lib/features/command-palette/di.config.js +6 -7
  94. package/lib/features/command-palette/di.config.js.map +1 -1
  95. package/lib/features/command-palette/server-command-palette-provider.js.map +1 -1
  96. package/lib/features/context-menu/delete-element-context-menu.js.map +1 -1
  97. package/lib/features/context-menu/di.config.d.ts +0 -15
  98. package/lib/features/context-menu/di.config.d.ts.map +1 -1
  99. package/lib/features/context-menu/di.config.js +4 -3
  100. package/lib/features/context-menu/di.config.js.map +1 -1
  101. package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.js.map +1 -1
  102. package/lib/features/context-menu/server-context-menu-provider.js.map +1 -1
  103. package/lib/features/copy-paste/copy-paste-context-menu.js.map +1 -1
  104. package/lib/features/copy-paste/copy-paste-handler.d.ts +4 -4
  105. package/lib/features/copy-paste/copy-paste-handler.d.ts.map +1 -1
  106. package/lib/features/copy-paste/copy-paste-handler.js +7 -8
  107. package/lib/features/copy-paste/copy-paste-handler.js.map +1 -1
  108. package/lib/features/decoration/decoration-placer.js.map +1 -1
  109. package/lib/features/decoration/di.config.d.ts +0 -15
  110. package/lib/features/decoration/di.config.d.ts.map +1 -1
  111. package/lib/features/decoration/di.config.js +4 -4
  112. package/lib/features/decoration/di.config.js.map +1 -1
  113. package/lib/features/edit-label/di.config.d.ts +0 -15
  114. package/lib/features/edit-label/di.config.d.ts.map +1 -1
  115. package/lib/features/edit-label/di.config.js +3 -2
  116. package/lib/features/edit-label/di.config.js.map +1 -1
  117. package/lib/features/edit-label/edit-label-tool.js.map +1 -1
  118. package/lib/features/edit-label/edit-label-validator.js.map +1 -1
  119. package/lib/features/export/di.config.d.ts +4 -0
  120. package/lib/features/export/di.config.d.ts.map +1 -0
  121. package/lib/features/export/di.config.js +30 -0
  122. package/lib/features/export/di.config.js.map +1 -0
  123. package/lib/features/export/glsp-svg-exporter.d.ts +1 -1
  124. package/lib/features/export/glsp-svg-exporter.d.ts.map +1 -1
  125. package/lib/features/export/glsp-svg-exporter.js +1 -2
  126. package/lib/features/export/glsp-svg-exporter.js.map +1 -1
  127. package/lib/features/hints/type-hints.js.map +1 -1
  128. package/lib/features/hover/di.config.d.ts +0 -15
  129. package/lib/features/hover/di.config.d.ts.map +1 -1
  130. package/lib/features/hover/di.config.js +7 -7
  131. package/lib/features/hover/di.config.js.map +1 -1
  132. package/lib/features/hover/hover.d.ts.map +1 -1
  133. package/lib/features/hover/hover.js +2 -1
  134. package/lib/features/hover/hover.js.map +1 -1
  135. package/lib/features/layout/di.config.d.ts +1 -1
  136. package/lib/features/layout/di.config.d.ts.map +1 -1
  137. package/lib/features/layout/di.config.js +1 -9
  138. package/lib/features/layout/di.config.js.map +1 -1
  139. package/lib/features/layout/layout-elements-action.d.ts +4 -4
  140. package/lib/features/layout/layout-elements-action.d.ts.map +1 -1
  141. package/lib/features/layout/layout-elements-action.js +2 -2
  142. package/lib/features/layout/layout-elements-action.js.map +1 -1
  143. package/lib/features/mouse-tool/mouse-tool.d.ts +1 -1
  144. package/lib/features/mouse-tool/mouse-tool.d.ts.map +1 -1
  145. package/lib/features/mouse-tool/mouse-tool.js.map +1 -1
  146. package/lib/features/navigation/di.config.d.ts +2 -1
  147. package/lib/features/navigation/di.config.d.ts.map +1 -1
  148. package/lib/features/navigation/di.config.js +3 -3
  149. package/lib/features/navigation/di.config.js.map +1 -1
  150. package/lib/features/navigation/navigation-action-handler.d.ts +2 -2
  151. package/lib/features/navigation/navigation-action-handler.js +2 -2
  152. package/lib/features/navigation/navigation-action-handler.js.map +1 -1
  153. package/lib/features/navigation/navigation-target-resolver.js.map +1 -1
  154. package/lib/features/save/di.config.d.ts +0 -15
  155. package/lib/features/save/di.config.d.ts.map +1 -1
  156. package/lib/features/save/di.config.js +3 -2
  157. package/lib/features/save/di.config.js.map +1 -1
  158. package/lib/features/save/model.d.ts +1 -1
  159. package/lib/features/select/di.config.d.ts +0 -15
  160. package/lib/features/select/di.config.d.ts.map +1 -1
  161. package/lib/features/select/di.config.js +8 -7
  162. package/lib/features/select/di.config.js.map +1 -1
  163. package/lib/features/select/select-feedback-action.js.map +1 -1
  164. package/lib/features/select/select-mouse-listener.d.ts +1 -1
  165. package/lib/features/select/select-mouse-listener.d.ts.map +1 -1
  166. package/lib/features/select/select-mouse-listener.js +2 -1
  167. package/lib/features/select/select-mouse-listener.js.map +1 -1
  168. package/lib/features/select/selection-service.js.map +1 -1
  169. package/lib/features/source-model-watcher/di.config.js +1 -1
  170. package/lib/features/source-model-watcher/source-model-changed-action-handler.js.map +1 -1
  171. package/lib/features/svg-metadata/di.config.d.ts +19 -0
  172. package/lib/features/svg-metadata/di.config.d.ts.map +1 -0
  173. package/lib/features/svg-metadata/di.config.js +26 -0
  174. package/lib/features/svg-metadata/di.config.js.map +1 -0
  175. package/lib/features/svg-metadata/metadata-placer.d.ts +24 -0
  176. package/lib/features/svg-metadata/metadata-placer.d.ts.map +1 -0
  177. package/lib/features/svg-metadata/metadata-placer.js +63 -0
  178. package/lib/features/svg-metadata/metadata-placer.js.map +1 -0
  179. package/lib/features/tool-feedback/change-bounds-tool-feedback.d.ts +4 -3
  180. package/lib/features/tool-feedback/change-bounds-tool-feedback.d.ts.map +1 -1
  181. package/lib/features/tool-feedback/change-bounds-tool-feedback.js +5 -4
  182. package/lib/features/tool-feedback/change-bounds-tool-feedback.js.map +1 -1
  183. package/lib/features/tool-feedback/creation-tool-feedback.d.ts +7 -7
  184. package/lib/features/tool-feedback/creation-tool-feedback.d.ts.map +1 -1
  185. package/lib/features/tool-feedback/creation-tool-feedback.js +8 -11
  186. package/lib/features/tool-feedback/creation-tool-feedback.js.map +1 -1
  187. package/lib/features/tool-feedback/css-feedback.js.map +1 -1
  188. package/lib/features/tool-feedback/di.config.d.ts +0 -15
  189. package/lib/features/tool-feedback/di.config.d.ts.map +1 -1
  190. package/lib/features/tool-feedback/di.config.js +20 -18
  191. package/lib/features/tool-feedback/di.config.js.map +1 -1
  192. package/lib/features/tool-feedback/edge-edit-tool-feedback.d.ts +2 -3
  193. package/lib/features/tool-feedback/edge-edit-tool-feedback.d.ts.map +1 -1
  194. package/lib/features/tool-feedback/edge-edit-tool-feedback.js +6 -11
  195. package/lib/features/tool-feedback/edge-edit-tool-feedback.js.map +1 -1
  196. package/lib/features/tool-feedback/feedback-action-dispatcher.js.map +1 -1
  197. package/lib/features/tool-feedback/marquee-tool-feedback.js.map +1 -1
  198. package/lib/features/tool-feedback/view.js.map +1 -1
  199. package/lib/features/tool-palette/di.config.d.ts +0 -15
  200. package/lib/features/tool-palette/di.config.d.ts.map +1 -1
  201. package/lib/features/tool-palette/di.config.js +4 -4
  202. package/lib/features/tool-palette/di.config.js.map +1 -1
  203. package/lib/features/tool-palette/tool-palette.d.ts +1 -1
  204. package/lib/features/tool-palette/tool-palette.d.ts.map +1 -1
  205. package/lib/features/tool-palette/tool-palette.js +2 -2
  206. package/lib/features/tool-palette/tool-palette.js.map +1 -1
  207. package/lib/features/tools/base-glsp-tool.js.map +1 -1
  208. package/lib/features/tools/change-bounds-tool.d.ts +1 -1
  209. package/lib/features/tools/change-bounds-tool.d.ts.map +1 -1
  210. package/lib/features/tools/change-bounds-tool.js +6 -6
  211. package/lib/features/tools/change-bounds-tool.js.map +1 -1
  212. package/lib/features/tools/delete-tool.js.map +1 -1
  213. package/lib/features/tools/di.config.d.ts +18 -5
  214. package/lib/features/tools/di.config.d.ts.map +1 -1
  215. package/lib/features/tools/di.config.js +16 -17
  216. package/lib/features/tools/di.config.js.map +1 -1
  217. package/lib/features/tools/edge-creation-tool.js.map +1 -1
  218. package/lib/features/tools/edge-edit-tool.js.map +1 -1
  219. package/lib/features/tools/enable-default-tools-on-focus-loss.js.map +1 -1
  220. package/lib/features/tools/glsp-manhattan-edge-router.d.ts +20 -0
  221. package/lib/features/tools/glsp-manhattan-edge-router.d.ts.map +1 -0
  222. package/lib/features/tools/glsp-manhattan-edge-router.js +69 -0
  223. package/lib/features/tools/glsp-manhattan-edge-router.js.map +1 -0
  224. package/lib/features/tools/marquee-mouse-tool.js.map +1 -1
  225. package/lib/features/tools/marquee-tool.js.map +1 -1
  226. package/lib/features/tools/node-creation-tool.js.map +1 -1
  227. package/lib/features/tools/view.js.map +1 -1
  228. package/lib/features/validation/di.config.js +4 -4
  229. package/lib/features/validation/di.config.js.map +1 -1
  230. package/lib/features/validation/issue-marker.d.ts +1 -1
  231. package/lib/features/validation/issue-marker.js +1 -1
  232. package/lib/features/validation/marker-navigator.d.ts +1 -1
  233. package/lib/features/validation/marker-navigator.d.ts.map +1 -1
  234. package/lib/features/validation/marker-navigator.js.map +1 -1
  235. package/lib/features/validation/validate.d.ts +6 -6
  236. package/lib/features/validation/validate.d.ts.map +1 -1
  237. package/lib/features/validation/validate.js +18 -17
  238. package/lib/features/validation/validate.js.map +1 -1
  239. package/lib/features/viewport/di.config.d.ts +0 -15
  240. package/lib/features/viewport/di.config.d.ts.map +1 -1
  241. package/lib/features/viewport/di.config.js +12 -11
  242. package/lib/features/viewport/di.config.js.map +1 -1
  243. package/lib/features/viewport/glsp-scroll-mouse-listener.js.map +1 -1
  244. package/lib/index.d.ts +30 -4
  245. package/lib/index.d.ts.map +1 -1
  246. package/lib/index.js +79 -43
  247. package/lib/index.js.map +1 -1
  248. package/lib/lib/model.d.ts +7 -3
  249. package/lib/lib/model.d.ts.map +1 -1
  250. package/lib/lib/model.js +48 -1
  251. package/lib/lib/model.js.map +1 -1
  252. package/lib/model-source/glsp-diagram-server.js.map +1 -1
  253. package/lib/sprotty-reexport.d.ts +7 -7
  254. package/lib/sprotty-reexport.d.ts.map +1 -1
  255. package/lib/sprotty-reexport.js +19 -10
  256. package/lib/sprotty-reexport.js.map +1 -1
  257. package/lib/utils/html-utils.d.ts +1 -1
  258. package/lib/utils/html-utils.js +1 -1
  259. package/lib/utils/smodel-util.d.ts +28 -7
  260. package/lib/utils/smodel-util.d.ts.map +1 -1
  261. package/lib/utils/smodel-util.js +41 -8
  262. package/lib/utils/smodel-util.js.map +1 -1
  263. package/lib/views/base-view-module.d.ts +18 -6
  264. package/lib/views/base-view-module.d.ts.map +1 -1
  265. package/lib/views/base-view-module.js +1 -1
  266. package/lib/views/base-view-module.js.map +1 -1
  267. package/lib/views/compartments.js.map +1 -1
  268. package/lib/views/glsp-edge-view.d.ts +2 -2
  269. package/lib/views/glsp-edge-view.d.ts.map +1 -1
  270. package/lib/views/glsp-edge-view.js +2 -2
  271. package/lib/views/glsp-edge-view.js.map +1 -1
  272. package/lib/views/glsp-projection-view.d.ts +1 -1
  273. package/lib/views/glsp-projection-view.js +1 -1
  274. package/lib/views/glsp-projection-view.js.map +1 -1
  275. package/lib/views/index.d.ts +1 -1
  276. package/lib/views/index.js +1 -1
  277. package/lib/views/issue-marker-view.js.map +1 -1
  278. package/lib/views/rounded-corner-view.js +2 -2
  279. package/lib/views/rounded-corner-view.js.map +1 -1
  280. package/lib/views/rounded-corner.d.ts +1 -1
  281. package/lib/views/rounded-corner.js +1 -1
  282. package/package.json +25 -24
  283. package/src/base/auto-complete/auto-complete-widget.ts +34 -10
  284. package/src/base/command-stack.ts +13 -11
  285. package/src/base/container-modules.ts +44 -11
  286. package/src/base/di.config.ts +8 -8
  287. package/src/base/editor-context-service.ts +4 -4
  288. package/src/base/selection-clearing-mouse-listener.ts +1 -1
  289. package/src/base/tool-manager/glsp-tool-manager.ts +15 -12
  290. package/src/features/accessibility/di.config.ts +26 -0
  291. package/src/features/accessibility/search/di.config.ts +31 -0
  292. package/src/features/accessibility/search/search-palette.ts +181 -0
  293. package/src/features/accessibility/search/search-tool.ts +60 -0
  294. package/src/features/autocomplete-palette/autocomplete-suggestion-providers.ts +37 -0
  295. package/src/features/autocomplete-palette/base-autocomplete-palette.ts +88 -0
  296. package/src/features/bounds/di.config.ts +49 -0
  297. package/src/features/{layout/tests → bounds}/freeform-layout.spec.ts +2 -2
  298. package/src/features/{layout → bounds}/freeform-layout.ts +2 -2
  299. package/src/features/bounds/glsp-hidden-bounds-updater.ts +85 -0
  300. package/src/features/{layout/tests → bounds}/hbox-layout.spec.ts +2 -2
  301. package/src/features/{layout → bounds}/hbox-layout.ts +1 -1
  302. package/src/features/{layout/tests/layouter-test-util.ts → bounds/layouter-test-util.spec.ts} +6 -6
  303. package/src/features/{layout → bounds}/layouter.ts +1 -1
  304. package/src/features/{layout/tests → bounds}/vbox-layout.spec.ts +2 -2
  305. package/src/features/{layout → bounds}/vbox-layout.ts +1 -1
  306. package/src/features/command-palette/command-palette-tool.ts +3 -3
  307. package/src/features/command-palette/di.config.ts +6 -7
  308. package/src/features/context-menu/di.config.ts +4 -3
  309. package/src/features/copy-paste/copy-paste-handler.ts +9 -13
  310. package/src/features/decoration/di.config.ts +4 -4
  311. package/src/features/edit-label/di.config.ts +3 -2
  312. package/src/features/export/di.config.ts +29 -0
  313. package/src/features/export/glsp-svg-exporter.ts +8 -7
  314. package/src/features/hover/di.config.ts +8 -7
  315. package/src/features/hover/hover.ts +2 -1
  316. package/src/features/layout/di.config.ts +2 -11
  317. package/src/features/layout/layout-elements-action.ts +2 -1
  318. package/src/features/navigation/di.config.ts +4 -2
  319. package/src/features/navigation/navigation-action-handler.ts +2 -2
  320. package/src/features/save/di.config.ts +3 -2
  321. package/src/features/save/model.ts +1 -1
  322. package/src/features/select/di.config.ts +8 -7
  323. package/src/features/select/select-mouse-listener.ts +2 -2
  324. package/src/features/select/selection-service.spec.ts +4 -5
  325. package/src/features/source-model-watcher/di.config.ts +1 -1
  326. package/src/features/svg-metadata/di.config.ts +26 -0
  327. package/src/features/svg-metadata/metadata-placer.ts +51 -0
  328. package/src/features/tool-feedback/change-bounds-tool-feedback.ts +4 -4
  329. package/src/features/tool-feedback/creation-tool-feedback.ts +22 -16
  330. package/src/features/tool-feedback/di.config.ts +20 -18
  331. package/src/features/tool-feedback/edge-edit-tool-feedback.ts +3 -11
  332. package/src/features/tool-palette/di.config.ts +4 -4
  333. package/src/features/tool-palette/tool-palette.ts +4 -4
  334. package/src/features/tools/change-bounds-tool.ts +7 -7
  335. package/src/features/tools/di.config.ts +20 -21
  336. package/src/features/tools/glsp-manhattan-edge-router.ts +60 -0
  337. package/src/features/validation/di.config.ts +5 -5
  338. package/src/features/validation/issue-marker.ts +1 -1
  339. package/src/features/validation/validate.ts +16 -19
  340. package/src/features/viewport/di.config.ts +13 -11
  341. package/src/index.ts +41 -5
  342. package/src/lib/model.ts +35 -3
  343. package/src/sprotty-reexport.ts +24 -8
  344. package/src/utils/html-utils.ts +1 -1
  345. package/src/utils/smodel-util.ts +55 -11
  346. package/src/views/base-view-module.ts +4 -9
  347. package/src/views/glsp-edge-view.tsx +3 -3
  348. package/src/views/glsp-projection-view.tsx +1 -1
  349. package/src/views/index.ts +1 -2
  350. package/src/views/rounded-corner-view.tsx +2 -2
  351. package/src/views/rounded-corner.ts +2 -2
  352. package/lib/features/change-bounds/snap.spec.d.ts.map +0 -1
  353. package/lib/features/change-bounds/snap.spec.js +0 -82
  354. package/lib/features/change-bounds/snap.spec.js.map +0 -1
  355. package/lib/features/layout/layout-elements-action.spec.d.ts +0 -3
  356. package/lib/features/layout/layout-elements-action.spec.d.ts.map +0 -1
  357. package/lib/features/layout/layout-elements-action.spec.js +0 -325
  358. package/lib/features/layout/layout-elements-action.spec.js.map +0 -1
  359. package/lib/features/layout/tests/freeform-layout.spec.d.ts +0 -3
  360. package/lib/features/layout/tests/freeform-layout.spec.d.ts.map +0 -1
  361. package/lib/features/layout/tests/freeform-layout.spec.js +0 -201
  362. package/lib/features/layout/tests/freeform-layout.spec.js.map +0 -1
  363. package/lib/features/layout/tests/hbox-layout.spec.d.ts +0 -3
  364. package/lib/features/layout/tests/hbox-layout.spec.d.ts.map +0 -1
  365. package/lib/features/layout/tests/hbox-layout.spec.js +0 -161
  366. package/lib/features/layout/tests/hbox-layout.spec.js.map +0 -1
  367. package/lib/features/layout/tests/layouter-test-util.d.ts +0 -34
  368. package/lib/features/layout/tests/layouter-test-util.d.ts.map +0 -1
  369. package/lib/features/layout/tests/layouter-test-util.js +0 -96
  370. package/lib/features/layout/tests/layouter-test-util.js.map +0 -1
  371. package/lib/features/layout/tests/vbox-layout.spec.d.ts +0 -3
  372. package/lib/features/layout/tests/vbox-layout.spec.d.ts.map +0 -1
  373. package/lib/features/layout/tests/vbox-layout.spec.js +0 -161
  374. package/lib/features/layout/tests/vbox-layout.spec.js.map +0 -1
  375. package/lib/features/navigation/navigation-target-resolver.spec.d.ts +0 -3
  376. package/lib/features/navigation/navigation-target-resolver.spec.d.ts.map +0 -1
  377. package/lib/features/navigation/navigation-target-resolver.spec.js +0 -54
  378. package/lib/features/navigation/navigation-target-resolver.spec.js.map +0 -1
  379. package/lib/features/select/selection-service.spec.d.ts +0 -2
  380. package/lib/features/select/selection-service.spec.d.ts.map +0 -1
  381. package/lib/features/select/selection-service.spec.js +0 -347
  382. package/lib/features/select/selection-service.spec.js.map +0 -1
  383. package/lib/features/tools/marquee-behavior.spec.d.ts.map +0 -1
  384. package/lib/features/tools/marquee-behavior.spec.js +0 -165
  385. package/lib/features/tools/marquee-behavior.spec.js.map +0 -1
  386. package/lib/features/validation/marker-navigator.spec.d.ts +0 -3
  387. package/lib/features/validation/marker-navigator.spec.d.ts.map +0 -1
  388. package/lib/features/validation/marker-navigator.spec.js +0 -169
  389. package/lib/features/validation/marker-navigator.spec.js.map +0 -1
@@ -0,0 +1,181 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023 Business Informatics Group (TU Wien) 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, CenterAction, SelectAction, SelectAllAction } from '@eclipse-glsp/protocol';
18
+ import { injectable } from 'inversify';
19
+ import { isEqual } from 'lodash';
20
+ import { codiconCSSString, isNameable, LabeledAction, name, SEdge, SModelElement, SModelRoot, SNode } from 'sprotty';
21
+ import { toArray } from 'sprotty/lib/utils/iterable';
22
+ import { AutocompleteSuggestion, IAutocompleteSuggestionProvider } from '../../autocomplete-palette/autocomplete-suggestion-providers';
23
+ import { BaseAutocompletePalette } from '../../autocomplete-palette/base-autocomplete-palette';
24
+
25
+ import { applyCssClasses, deleteCssClasses } from '../../tool-feedback/css-feedback';
26
+
27
+ const CSS_SEARCH_HIDDEN = 'search-hidden';
28
+ const CSS_SEARCH_HIGHLIGHTED = 'search-highlighted';
29
+
30
+ export class RevealNamedElementAutocompleteSuggestionProvider implements IAutocompleteSuggestionProvider {
31
+ async retrieveSuggestions(root: Readonly<SModelRoot>, text: string): Promise<AutocompleteSuggestion[]> {
32
+ const nameables = toArray(root.index.all().filter(element => isNameable(element)));
33
+ return nameables.map(nameable => ({
34
+ element: nameable,
35
+ action: new LabeledAction(
36
+ `[${nameable.type}] ${name(nameable) ?? '<no-name>'}`,
37
+ this.getActions(nameable),
38
+ codiconCSSString('eye')
39
+ )
40
+ }));
41
+ }
42
+
43
+ protected getActions(nameable: SModelElement): Action[] {
44
+ return [SelectAction.create({ selectedElementsIDs: [nameable.id] }), CenterAction.create([nameable.id], { retainZoom: true })];
45
+ }
46
+ }
47
+
48
+ export class RevealEdgeElementAutocompleteSuggestionProvider implements IAutocompleteSuggestionProvider {
49
+ async retrieveSuggestions(root: Readonly<SModelRoot>, text: string): Promise<AutocompleteSuggestion[]> {
50
+ const edges = toArray(root.index.all().filter(element => element instanceof SEdge)) as SEdge[];
51
+ return edges.map(edge => ({
52
+ element: edge,
53
+ action: new LabeledAction(
54
+ `[${edge.type}] ` + this.getEdgeLabel(root, edge),
55
+ this.getActions(edge),
56
+ codiconCSSString('arrow-both')
57
+ )
58
+ }));
59
+ }
60
+ protected getActions(edge: SEdge): Action[] {
61
+ return [SelectAction.create({ selectedElementsIDs: [edge.id] }), CenterAction.create([edge.sourceId, edge.targetId])];
62
+ }
63
+ protected getEdgeLabel(root: Readonly<SModelRoot>, edge: SEdge): string {
64
+ let sourceName = '';
65
+ let targetName = '';
66
+
67
+ const sourceNode = root.index.getById(edge.sourceId);
68
+ const targetNode = root.index.getById(edge.targetId);
69
+
70
+ if (sourceNode !== undefined) {
71
+ sourceName = name(sourceNode) ?? sourceNode.type;
72
+ }
73
+ if (targetNode !== undefined) {
74
+ targetName = name(targetNode) ?? targetNode.type;
75
+ }
76
+
77
+ return sourceName + ' -> ' + targetName;
78
+ }
79
+ }
80
+ @injectable()
81
+ export class SearchAutocompletePalette extends BaseAutocompletePalette {
82
+ static readonly ID = 'search-autocomplete-palette';
83
+
84
+ protected cachedSuggestions: AutocompleteSuggestion[] = [];
85
+
86
+ id(): string {
87
+ return SearchAutocompletePalette.ID;
88
+ }
89
+
90
+ protected override initializeContents(containerElement: HTMLElement): void {
91
+ super.initializeContents(containerElement);
92
+
93
+ this.autocompleteWidget.inputField.placeholder = 'Search for elements';
94
+ }
95
+ protected getSuggestionProviders(root: Readonly<SModelRoot>, input: string): IAutocompleteSuggestionProvider[] {
96
+ return [new RevealNamedElementAutocompleteSuggestionProvider(), new RevealEdgeElementAutocompleteSuggestionProvider()];
97
+ }
98
+ protected async retrieveSuggestions(root: Readonly<SModelRoot>, input: string): Promise<LabeledAction[]> {
99
+ const providers = this.getSuggestionProviders(root, input);
100
+ const suggestions = (await Promise.all(providers.map(provider => provider.retrieveSuggestions(root, input)))).flat(1);
101
+
102
+ this.cachedSuggestions = suggestions;
103
+
104
+ return suggestions.map(s => s.action);
105
+ }
106
+
107
+ protected override async visibleSuggestionsChanged(root: Readonly<SModelRoot>, labeledActions: LabeledAction[]): Promise<void> {
108
+ await this.applyCSS(this.getHiddenElements(root, this.getSuggestionsFromLabeledActions(labeledActions)), CSS_SEARCH_HIDDEN);
109
+ await this.deleteCSS(
110
+ this.getSuggestionsFromLabeledActions(labeledActions).map(s => s.element),
111
+ CSS_SEARCH_HIDDEN
112
+ );
113
+ }
114
+
115
+ protected override async selectedSuggestionChanged(
116
+ root: Readonly<SModelRoot>,
117
+ labeledAction?: LabeledAction | undefined
118
+ ): Promise<void> {
119
+ await this.deleteAllCSS(root, CSS_SEARCH_HIGHLIGHTED);
120
+ if (labeledAction !== undefined) {
121
+ const suggestions = this.getSuggestionsFromLabeledActions([labeledAction]);
122
+
123
+ const actions: CenterAction[] = [];
124
+ suggestions.map(currElem => actions.push(CenterAction.create([currElem.element.id], { animate: true, retainZoom: true })));
125
+
126
+ this.actionDispatcher.dispatchAll(actions);
127
+ await this.applyCSS(
128
+ suggestions.map(s => s.element),
129
+ CSS_SEARCH_HIGHLIGHTED
130
+ );
131
+ }
132
+ }
133
+
134
+ public override show(root: Readonly<SModelRoot>, ...contextElementIds: string[]): void {
135
+ this.actionDispatcher.dispatch(SelectAllAction.create(false));
136
+
137
+ super.show(root, ...contextElementIds);
138
+ }
139
+
140
+ public override hide(): void {
141
+ if (this.root !== undefined) {
142
+ this.deleteAllCSS(this.root, CSS_SEARCH_HIDDEN);
143
+ this.deleteAllCSS(this.root, CSS_SEARCH_HIGHLIGHTED);
144
+ this.autocompleteWidget.inputField.value = '';
145
+ }
146
+
147
+ super.hide();
148
+ }
149
+
150
+ protected applyCSS(elements: SModelElement[], cssClass: string): Promise<void> {
151
+ const actions = elements.map(element => applyCssClasses(element, cssClass));
152
+ return this.actionDispatcher.dispatchAll(actions);
153
+ }
154
+
155
+ protected deleteCSS(elements: SModelElement[], cssClass: string): Promise<void> {
156
+ const actions = elements.map(element => deleteCssClasses(element, cssClass));
157
+ return this.actionDispatcher.dispatchAll(actions);
158
+ }
159
+
160
+ protected deleteAllCSS(root: Readonly<SModelRoot>, cssClass: string): Promise<void> {
161
+ const actions = toArray(root.index.all().map(element => deleteCssClasses(element, cssClass)));
162
+ return this.actionDispatcher.dispatchAll(actions);
163
+ }
164
+
165
+ protected getSuggestionsFromLabeledActions(labeledActions: LabeledAction[]): AutocompleteSuggestion[] {
166
+ return this.cachedSuggestions.filter(c => labeledActions.find(s => isEqual(s, c.action)));
167
+ }
168
+
169
+ protected getHiddenSuggestionsFromLabeledActions(labeledActions: LabeledAction[]): AutocompleteSuggestion[] {
170
+ return this.cachedSuggestions.filter(c => !labeledActions.find(s => isEqual(s, c.action)));
171
+ }
172
+
173
+ protected getHiddenElements(root: Readonly<SModelRoot>, suggestions: AutocompleteSuggestion[]): SModelElement[] {
174
+ return toArray(
175
+ root.index
176
+ .all()
177
+ .filter(element => element instanceof SNode || element instanceof SEdge)
178
+ .filter(element => suggestions.find(suggestion => suggestion.element.id === element.id) === undefined)
179
+ );
180
+ }
181
+ }
@@ -0,0 +1,60 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023 Business Informatics Group (TU Wien) 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 } from '@eclipse-glsp/protocol';
18
+ import { inject, injectable } from 'inversify';
19
+ import { KeyListener, KeyTool, SetUIExtensionVisibilityAction, SModelElement, Tool } from 'sprotty';
20
+ import { matchesKeystroke } from 'sprotty/lib/utils/keyboard';
21
+ import { SearchAutocompletePalette } from './search-palette';
22
+
23
+ @injectable()
24
+ export class SearchAutocompletePaletteTool implements Tool {
25
+ static readonly ID = 'glsp.search-autocomplete-palette-tool';
26
+
27
+ protected readonly keyListener = new SearchAutocompletePaletteKeyListener();
28
+
29
+ @inject(KeyTool) protected keyTool: KeyTool;
30
+
31
+ get id(): string {
32
+ return SearchAutocompletePaletteTool.ID;
33
+ }
34
+
35
+ enable(): void {
36
+ this.keyTool.register(this.keyListener);
37
+ }
38
+
39
+ disable(): void {
40
+ this.keyTool.deregister(this.keyListener);
41
+ }
42
+ }
43
+
44
+ export class SearchAutocompletePaletteKeyListener extends KeyListener {
45
+ override keyDown(element: SModelElement, event: KeyboardEvent): Action[] {
46
+ if (this.matchesSearchActivateKeystroke(event)) {
47
+ return [
48
+ SetUIExtensionVisibilityAction.create({
49
+ extensionId: SearchAutocompletePalette.ID,
50
+ visible: true
51
+ })
52
+ ];
53
+ }
54
+ return [];
55
+ }
56
+
57
+ protected matchesSearchActivateKeystroke(event: KeyboardEvent): boolean {
58
+ return matchesKeystroke(event, 'KeyF', 'ctrl');
59
+ }
60
+ }
@@ -0,0 +1,37 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023 Business Informatics Group (TU Wien) 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 { LabeledAction, SModelElement, SModelRoot } from 'sprotty';
18
+
19
+ /**
20
+ * Interface for a provider that provides suggestions that can be used to fill the autocomplete
21
+ */
22
+ export interface IAutocompleteSuggestionProvider {
23
+ /**
24
+ * Returns the suggestions based on the provided parameters.
25
+ * @param root: The root model
26
+ * @param text: The text input provided by the user.
27
+ */
28
+ retrieveSuggestions(root: Readonly<SModelRoot>, text: string): Promise<AutocompleteSuggestion[]>;
29
+ }
30
+
31
+ /**
32
+ * Interface for autocomplete suggestions.
33
+ */
34
+ export interface AutocompleteSuggestion {
35
+ element: SModelElement;
36
+ action: LabeledAction;
37
+ }
@@ -0,0 +1,88 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023 Business Informatics Group (TU Wien) 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 } from '@eclipse-glsp/protocol';
18
+ import { inject } from 'inversify';
19
+ import { AbstractUIExtension, LabeledAction, SModelRoot, TYPES } from 'sprotty';
20
+ import '../../../css/autocomplete-palette.css';
21
+ import { GLSPActionDispatcher } from '../../base/action-dispatcher';
22
+ import { AutoCompleteWidget, CloseReason, toActionArray } from '../../base/auto-complete/auto-complete-widget';
23
+
24
+ export abstract class BaseAutocompletePalette extends AbstractUIExtension {
25
+ protected readonly autoSuggestionSettings = {
26
+ noSuggestionsMessage: 'No suggestions available',
27
+ suggestionsClass: 'command-palette-suggestions',
28
+ debounceWaitMs: 50,
29
+ showOnFocus: true
30
+ };
31
+
32
+ protected root?: Readonly<SModelRoot>;
33
+ protected autocompleteWidget: AutoCompleteWidget;
34
+
35
+ @inject(TYPES.IActionDispatcher)
36
+ protected actionDispatcher: GLSPActionDispatcher;
37
+
38
+ containerClass(): string {
39
+ return 'autocomplete-palette';
40
+ }
41
+
42
+ override show(root: Readonly<SModelRoot>, ...contextElementIds: string[]): void {
43
+ super.show(root, ...contextElementIds);
44
+ this.root = root;
45
+ this.autocompleteWidget.open(root);
46
+ }
47
+
48
+ override hide(): void {
49
+ this.autocompleteWidget.dispose();
50
+ this.root = undefined;
51
+ super.hide();
52
+ }
53
+
54
+ protected initializeContents(containerElement: HTMLElement): void {
55
+ containerElement.classList.add('command-palette');
56
+
57
+ this.autocompleteWidget = new AutoCompleteWidget(
58
+ this.autoSuggestionSettings,
59
+ { provideSuggestions: input => this.retrieveSuggestions(this.root!, input) },
60
+ { executeFromSuggestion: input => this.executeSuggestion(input) },
61
+ reason => this.autocompleteHide(reason),
62
+ this.logger,
63
+ {
64
+ visibleSuggestionsChanged: suggestions => this.visibleSuggestionsChanged(this.root!, suggestions),
65
+ selectedSuggestionChanged: suggestion => this.selectedSuggestionChanged(this.root!, suggestion)
66
+ }
67
+ );
68
+ this.autocompleteWidget.initialize(containerElement);
69
+ }
70
+
71
+ protected abstract retrieveSuggestions(root: Readonly<SModelRoot>, input: string): Promise<LabeledAction[]>;
72
+
73
+ protected async visibleSuggestionsChanged(root: Readonly<SModelRoot>, labeledActions: LabeledAction[]): Promise<void> {
74
+ return;
75
+ }
76
+
77
+ protected async selectedSuggestionChanged(root: Readonly<SModelRoot>, labeledAction?: LabeledAction): Promise<void> {
78
+ return;
79
+ }
80
+
81
+ protected autocompleteHide(reason: CloseReason): void {
82
+ this.hide();
83
+ }
84
+
85
+ protected executeSuggestion(input: LabeledAction | Action[] | Action): void {
86
+ this.actionDispatcher.dispatchAll(toActionArray(input));
87
+ }
88
+ }
@@ -0,0 +1,49 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2022-2023 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
+ import { bindAsService } from '@eclipse-glsp/protocol';
17
+ import { ContainerModule } from 'inversify';
18
+ import {
19
+ configureCommand,
20
+ configureLayout,
21
+ HBoxLayouter,
22
+ HiddenBoundsUpdater,
23
+ Layouter,
24
+ LayoutRegistry,
25
+ RequestBoundsCommand,
26
+ SetBoundsCommand,
27
+ VBoxLayouter
28
+ } from 'sprotty';
29
+ import { TYPES } from '../../base/types';
30
+ import { FreeFormLayouter } from './freeform-layout';
31
+ import { GLSPHiddenBoundsUpdater } from './glsp-hidden-bounds-updater';
32
+ import { HBoxLayouterExt } from './hbox-layout';
33
+ import { VBoxLayouterExt } from './vbox-layout';
34
+
35
+ const glspBoundsModule = new ContainerModule((bind, _unbind, isBound, _rebind) => {
36
+ const context = { bind, isBound };
37
+ configureCommand(context, SetBoundsCommand);
38
+ configureCommand(context, RequestBoundsCommand);
39
+ bind(HiddenBoundsUpdater).toSelf().inSingletonScope();
40
+ bindAsService(context, TYPES.HiddenVNodePostprocessor, GLSPHiddenBoundsUpdater);
41
+ bind(TYPES.Layouter).to(Layouter).inSingletonScope();
42
+ bind(TYPES.LayoutRegistry).to(LayoutRegistry).inSingletonScope();
43
+
44
+ configureLayout(context, VBoxLayouter.KIND, VBoxLayouterExt);
45
+ configureLayout(context, HBoxLayouter.KIND, HBoxLayouterExt);
46
+ configureLayout(context, FreeFormLayouter.KIND, FreeFormLayouter);
47
+ });
48
+
49
+ export default glspBoundsModule;
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2022 STMicroelectronics and others.
2
+ * Copyright (c) 2022-2023 STMicroelectronics and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -17,7 +17,7 @@ import { expect } from 'chai';
17
17
  import 'mocha';
18
18
  import 'reflect-metadata';
19
19
  import { BoundsData, ConsoleLogger, SModelElement } from 'sprotty';
20
- import { gModel, layout, sComp, setupLayoutRegistry, sLabel, sNode } from './layouter-test-util';
20
+ import { gModel, layout, sComp, setupLayoutRegistry, sLabel, sNode } from './layouter-test-util.spec';
21
21
 
22
22
  describe('FreeFormLayouter', () => {
23
23
  const layoutRegistry = setupLayoutRegistry();
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2021-2022 EclipseSource and others.
2
+ * Copyright (c) 2021-2023 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,7 +20,7 @@ import { AbstractLayout } from 'sprotty/lib/features/bounds/abstract-layout';
20
20
  import { AbstractLayoutOptions } from 'sprotty/lib/features/bounds/layout-options';
21
21
 
22
22
  /**
23
- * Layouts children of a container with explit X/Y positions
23
+ * Layouts children of a container with explicit X/Y positions
24
24
  */
25
25
  @injectable()
26
26
  export class FreeFormLayouter extends AbstractLayout<AbstractLayoutOptions> {
@@ -0,0 +1,85 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2022-2023 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, ComputedBoundsAction, Deferred, ElementAndRoutingPoints, RequestAction, ResponseAction } from '@eclipse-glsp/protocol';
18
+ import { inject, injectable, optional } from 'inversify';
19
+ import { VNode } from 'snabbdom';
20
+ import { EdgeRouterRegistry, HiddenBoundsUpdater, IActionDispatcher, SModelElement, SRoutableElement } from 'sprotty';
21
+ import { calcElementAndRoute, isRoutable } from '../../utils/smodel-util';
22
+
23
+ /**
24
+ * Grabs the bounds from hidden SVG DOM elements, applies layouts, collects routes and fires {@link ComputedBoundsAction}s.
25
+ *
26
+ * The actions will contain the bound, alignment, and routing points of elements.
27
+ */
28
+ @injectable()
29
+ export class GLSPHiddenBoundsUpdater extends HiddenBoundsUpdater {
30
+ @inject(EdgeRouterRegistry) @optional() protected readonly edgeRouterRegistry?: EdgeRouterRegistry;
31
+
32
+ protected element2route: ElementAndRoutingPoints[] = [];
33
+ protected edges: SRoutableElement[] = [];
34
+ protected nodes: VNode[] = [];
35
+
36
+ override decorate(vnode: VNode, element: SModelElement): VNode {
37
+ super.decorate(vnode, element);
38
+ if (isRoutable(element)) {
39
+ this.element2route.push(calcElementAndRoute(element, this.edgeRouterRegistry));
40
+ }
41
+ return vnode;
42
+ }
43
+
44
+ override postUpdate(cause?: Action): void {
45
+ const actions = this.captureActions(() => super.postUpdate(cause));
46
+ actions
47
+ .filter(action => ComputedBoundsAction.is(action))
48
+ .forEach(action => this.actionDispatcher.dispatch(this.enhanceAction(action as ComputedBoundsAction)));
49
+ this.element2route = [];
50
+ }
51
+
52
+ protected captureActions(call: () => void): Action[] {
53
+ const capturingActionDispatcher = new CapturingActionDispatcher();
54
+ const actualActionDispatcher = this.actionDispatcher;
55
+ this.actionDispatcher = capturingActionDispatcher;
56
+ try {
57
+ call();
58
+ return capturingActionDispatcher.actions;
59
+ } finally {
60
+ this.actionDispatcher = actualActionDispatcher;
61
+ }
62
+ }
63
+
64
+ protected enhanceAction(action: ComputedBoundsAction): ComputedBoundsAction {
65
+ action.routes = this.element2route.length === 0 ? undefined : this.element2route;
66
+ return action;
67
+ }
68
+ }
69
+
70
+ class CapturingActionDispatcher implements IActionDispatcher {
71
+ readonly actions: Action[] = [];
72
+
73
+ async dispatch(action: Action): Promise<void> {
74
+ this.actions.push(action);
75
+ }
76
+
77
+ async dispatchAll(actions: Action[]): Promise<void> {
78
+ this.actions.push(...actions);
79
+ }
80
+
81
+ async request<Res extends ResponseAction>(action: RequestAction<Res>): Promise<Res> {
82
+ // ignore, not needed for our purposes
83
+ return new Deferred<Res>().promise;
84
+ }
85
+ }
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2022 TypeFox, STMicroelectronics and others.
2
+ * Copyright (c) 2022-2023 TypeFox, STMicroelectronics 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
@@ -19,7 +19,7 @@ import { expect } from 'chai';
19
19
  import 'mocha';
20
20
  import 'reflect-metadata';
21
21
  import { BoundsData, ConsoleLogger, SModelElement, SNode } from 'sprotty';
22
- import { layout, setupLayoutRegistry, sLabel, sNode } from './layouter-test-util';
22
+ import { layout, setupLayoutRegistry, sLabel, sNode } from './layouter-test-util.spec';
23
23
 
24
24
  describe('HBoxLayouter', () => {
25
25
  const layoutRegistry = setupLayoutRegistry();
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2021-2022 EclipseSource and others.
2
+ * Copyright (c) 2021-2023 EclipseSource and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2022 STMicroelectronics and others.
2
+ * Copyright (c) 2022-2023 STMicroelectronics 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,8 +15,8 @@
15
15
  ********************************************************************************/
16
16
 
17
17
  import { Dimension, Point } from '@eclipse-glsp/protocol';
18
+ import { Container } from 'inversify';
18
19
  import 'mocha';
19
- import 'reflect-metadata';
20
20
  import {
21
21
  BoundsData,
22
22
  ConsoleLogger,
@@ -30,9 +30,9 @@ import {
30
30
  SParentElement,
31
31
  TYPES
32
32
  } from 'sprotty';
33
- import { createClientContainer } from '../../../base/container-modules';
34
- import { GLSPGraph } from '../../../lib/model';
35
- import { StatefulLayouterExt } from '../layouter';
33
+ import { initializeDiagramContainer } from '../../base/container-modules';
34
+ import { GLSPGraph } from '../../lib/model';
35
+ import { StatefulLayouterExt } from './layouter';
36
36
 
37
37
  export function gModel(): GLSPGraph {
38
38
  return new GLSPGraph();
@@ -117,6 +117,6 @@ export function layout(
117
117
  export function setupLayoutRegistry(): LayoutRegistry {
118
118
  // Generic Test setup
119
119
  // create client container that registers all default modules including the layoutModule
120
- const layoutContainer = createClientContainer();
120
+ const layoutContainer = initializeDiagramContainer(new Container());
121
121
  return layoutContainer.get<LayoutRegistry>(TYPES.LayoutRegistry);
122
122
  }
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2022 EclipseSource and others.
2
+ * Copyright (c) 2022-2023 EclipseSource and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2022 TypeFox, STMicroelectronics and others.
2
+ * Copyright (c) 2022-2023 TypeFox, STMicroelectronics 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
@@ -19,7 +19,7 @@ import { expect } from 'chai';
19
19
  import 'mocha';
20
20
  import 'reflect-metadata';
21
21
  import { BoundsData, ConsoleLogger, SModelElement, SNode } from 'sprotty';
22
- import { layout, setupLayoutRegistry, sLabel, sNode } from './layouter-test-util';
22
+ import { layout, setupLayoutRegistry, sLabel, sNode } from './layouter-test-util.spec';
23
23
 
24
24
  describe('VBoxLayouter', () => {
25
25
  const layoutRegistry = setupLayoutRegistry();
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2021-2022 EclipseSource and others.
2
+ * Copyright (c) 2021-2023 EclipseSource and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2020 EclipseSource and others.
2
+ * Copyright (c) 2019-2023 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
@@ -25,7 +25,7 @@ export class CommandPaletteTool implements Tool {
25
25
 
26
26
  @postConstruct()
27
27
  protected postConstruct(): void {
28
- this.commandPaletteKeyListener = this.createCommandPaleteKeyListener();
28
+ this.commandPaletteKeyListener = this.createCommandPaletteKeyListener();
29
29
  }
30
30
 
31
31
  get id(): string {
@@ -40,7 +40,7 @@ export class CommandPaletteTool implements Tool {
40
40
  this.keyTool.deregister(this.commandPaletteKeyListener);
41
41
  }
42
42
 
43
- protected createCommandPaleteKeyListener(): KeyListener {
43
+ protected createCommandPaletteKeyListener(): KeyListener {
44
44
  return new CommandPaletteKeyListener();
45
45
  }
46
46
  }