@eclipse-glsp/client 1.1.0-next.383e4e9.264 → 1.1.0-next.3d1b3e6.280
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.
- package/css/decoration.css +0 -7
- package/css/glsp-sprotty.css +7 -0
- package/css/key-shortcut.css +5 -1
- package/{lib/base/source-uri-aware.js → css/navigation.css} +11 -9
- package/css/status-overlay.css +75 -0
- package/css/toast.css +45 -0
- package/lib/base/action-dispatcher.d.ts +8 -2
- package/lib/base/action-dispatcher.d.ts.map +1 -1
- package/lib/base/action-dispatcher.js +15 -7
- package/lib/base/action-dispatcher.js.map +1 -1
- package/lib/base/action-dispatcher.spec.d.ts +2 -0
- package/lib/base/action-dispatcher.spec.d.ts.map +1 -0
- package/lib/base/action-dispatcher.spec.js +78 -0
- package/lib/base/action-dispatcher.spec.js.map +1 -0
- package/lib/base/action-handler-registry.d.ts +25 -0
- package/lib/base/action-handler-registry.d.ts.map +1 -0
- package/lib/{features/tools/base-glsp-creation-tool.js → base/action-handler-registry.js} +20 -25
- package/lib/base/action-handler-registry.js.map +1 -0
- package/lib/base/default.module.d.ts +1 -10
- package/lib/base/default.module.d.ts.map +1 -1
- package/lib/base/default.module.js +20 -30
- package/lib/base/default.module.js.map +1 -1
- package/lib/base/editor-context-service.d.ts +17 -5
- package/lib/base/editor-context-service.d.ts.map +1 -1
- package/lib/base/editor-context-service.js +41 -14
- package/lib/base/editor-context-service.js.map +1 -1
- package/lib/base/feedback/feedback-action-dispatcher.d.ts.map +1 -1
- package/lib/base/feedback/feedback-action-dispatcher.js +5 -3
- package/lib/base/feedback/feedback-action-dispatcher.js.map +1 -1
- package/lib/base/focus/focus-tracker.d.ts +4 -0
- package/lib/base/focus/focus-tracker.d.ts.map +1 -1
- package/lib/base/focus/focus-tracker.js +12 -5
- package/lib/base/focus/focus-tracker.js.map +1 -1
- package/lib/base/model/diagram-loader.d.ts +116 -0
- package/lib/base/model/diagram-loader.d.ts.map +1 -0
- package/lib/base/model/diagram-loader.js +130 -0
- package/lib/base/model/diagram-loader.js.map +1 -0
- package/lib/base/model/glsp-model-source.d.ts +74 -0
- package/lib/base/model/glsp-model-source.d.ts.map +1 -0
- package/lib/base/model/glsp-model-source.js +178 -0
- package/lib/base/model/glsp-model-source.js.map +1 -0
- package/lib/base/{model-initialization-constraint.d.ts → model/model-initialization-constraint.d.ts} +24 -3
- package/lib/base/model/model-initialization-constraint.d.ts.map +1 -0
- package/lib/base/{model-initialization-constraint.js → model/model-initialization-constraint.js} +20 -10
- package/lib/base/model/model-initialization-constraint.js.map +1 -0
- package/lib/base/model/model-initialization-constraint.spec.d.ts +2 -0
- package/lib/base/model/model-initialization-constraint.spec.d.ts.map +1 -0
- package/lib/base/model/model-initialization-constraint.spec.js +97 -0
- package/lib/base/model/model-initialization-constraint.spec.js.map +1 -0
- package/lib/base/selection-service.spec.js +9 -8
- package/lib/base/selection-service.spec.js.map +1 -1
- package/lib/base/tool-manager/tool-manager.d.ts +82 -0
- package/lib/base/tool-manager/tool-manager.d.ts.map +1 -0
- package/lib/base/tool-manager/tool-manager.js +140 -0
- package/lib/base/tool-manager/tool-manager.js.map +1 -0
- package/lib/base/tool-manager/tool.d.ts +54 -0
- package/lib/base/tool-manager/tool.d.ts.map +1 -0
- package/lib/base/tool-manager/tool.js +60 -0
- package/lib/base/tool-manager/tool.js.map +1 -0
- package/lib/default-modules.d.ts +20 -26
- package/lib/default-modules.d.ts.map +1 -1
- package/lib/default-modules.js +31 -29
- package/lib/default-modules.js.map +1 -1
- package/lib/features/accessibility/accessibility-module.d.ts.map +1 -1
- package/lib/features/accessibility/accessibility-module.js +6 -0
- package/lib/features/accessibility/accessibility-module.js.map +1 -1
- package/lib/features/accessibility/element-navigation/diagram-navigation-tool.d.ts +65 -0
- package/lib/features/accessibility/element-navigation/diagram-navigation-tool.d.ts.map +1 -0
- package/lib/features/accessibility/element-navigation/diagram-navigation-tool.js +290 -0
- package/lib/features/accessibility/element-navigation/diagram-navigation-tool.js.map +1 -0
- package/lib/features/accessibility/element-navigation/element-navigation-module.d.ts +24 -0
- package/lib/features/accessibility/element-navigation/element-navigation-module.d.ts.map +1 -0
- package/lib/features/accessibility/element-navigation/element-navigation-module.js +38 -0
- package/lib/features/accessibility/element-navigation/element-navigation-module.js.map +1 -0
- package/lib/features/accessibility/element-navigation/element-navigator.d.ts +26 -0
- package/lib/features/accessibility/element-navigation/element-navigator.d.ts.map +1 -0
- package/{src/base/source-uri-aware.ts → lib/features/accessibility/element-navigation/element-navigator.js} +4 -9
- package/lib/features/accessibility/element-navigation/element-navigator.js.map +1 -0
- package/lib/features/accessibility/element-navigation/left-right-top-bottom-navigator.d.ts +28 -0
- package/lib/features/accessibility/element-navigation/left-right-top-bottom-navigator.d.ts.map +1 -0
- package/lib/features/accessibility/element-navigation/left-right-top-bottom-navigator.js +104 -0
- package/lib/features/accessibility/element-navigation/left-right-top-bottom-navigator.js.map +1 -0
- package/lib/features/accessibility/element-navigation/local-element-navigator.d.ts +35 -0
- package/lib/features/accessibility/element-navigation/local-element-navigator.d.ts.map +1 -0
- package/lib/features/accessibility/element-navigation/local-element-navigator.js +117 -0
- package/lib/features/accessibility/element-navigation/local-element-navigator.js.map +1 -0
- package/lib/features/accessibility/element-navigation/position-navigator.d.ts +32 -0
- package/lib/features/accessibility/element-navigation/position-navigator.d.ts.map +1 -0
- package/lib/features/accessibility/element-navigation/position-navigator.js +80 -0
- package/lib/features/accessibility/element-navigation/position-navigator.js.map +1 -0
- package/lib/features/accessibility/focus-tracker/focus-tracker-module.d.ts +23 -0
- package/lib/features/accessibility/focus-tracker/focus-tracker-module.d.ts.map +1 -0
- package/lib/features/accessibility/focus-tracker/focus-tracker-module.js +33 -0
- package/lib/features/accessibility/focus-tracker/focus-tracker-module.js.map +1 -0
- package/lib/features/accessibility/focus-tracker/focus-tracker-tool.d.ts +37 -0
- package/lib/features/accessibility/focus-tracker/focus-tracker-tool.d.ts.map +1 -0
- package/lib/features/accessibility/focus-tracker/focus-tracker-tool.js +133 -0
- package/lib/features/accessibility/focus-tracker/focus-tracker-tool.js.map +1 -0
- package/lib/features/accessibility/key-shortcut/accessible-key-shortcut-tool.d.ts +2 -2
- package/lib/features/accessibility/key-shortcut/accessible-key-shortcut-tool.d.ts.map +1 -1
- package/lib/features/accessibility/key-shortcut/accessible-key-shortcut-tool.js +2 -2
- package/lib/features/accessibility/key-shortcut/accessible-key-shortcut-tool.js.map +1 -1
- package/lib/features/accessibility/key-shortcut/accessible-key-shortcut.d.ts +1 -0
- package/lib/features/accessibility/key-shortcut/accessible-key-shortcut.d.ts.map +1 -1
- package/lib/features/accessibility/key-shortcut/accessible-key-shortcut.js +15 -3
- package/lib/features/accessibility/key-shortcut/accessible-key-shortcut.js.map +1 -1
- package/lib/features/accessibility/resize-key-tool/resize-key-tool.d.ts +2 -2
- package/lib/features/accessibility/resize-key-tool/resize-key-tool.d.ts.map +1 -1
- package/lib/features/accessibility/resize-key-tool/resize-key-tool.js +22 -15
- package/lib/features/accessibility/resize-key-tool/resize-key-tool.js.map +1 -1
- package/lib/features/accessibility/search/search-palette.d.ts.map +1 -1
- package/lib/features/accessibility/search/search-palette.js +3 -1
- package/lib/features/accessibility/search/search-palette.js.map +1 -1
- package/lib/features/accessibility/search/search-tool.d.ts +2 -1
- package/lib/features/accessibility/search/search-tool.d.ts.map +1 -1
- package/lib/features/accessibility/search/search-tool.js +4 -8
- package/lib/features/accessibility/search/search-tool.js.map +1 -1
- package/lib/features/accessibility/toast/messages.json +16 -0
- package/lib/features/accessibility/toast/toast-handler.d.ts +45 -0
- package/lib/features/accessibility/toast/toast-handler.d.ts.map +1 -0
- package/lib/features/accessibility/toast/toast-handler.js +54 -0
- package/lib/features/accessibility/toast/toast-handler.js.map +1 -0
- package/lib/features/accessibility/toast/toast-module.d.ts +24 -0
- package/lib/features/accessibility/toast/toast-module.d.ts.map +1 -0
- package/lib/features/accessibility/toast/toast-module.js +38 -0
- package/lib/features/accessibility/toast/toast-module.js.map +1 -0
- package/lib/features/accessibility/toast/toast-tool.d.ts +43 -0
- package/lib/features/accessibility/toast/toast-tool.d.ts.map +1 -0
- package/lib/features/accessibility/toast/toast-tool.js +115 -0
- package/lib/features/accessibility/toast/toast-tool.js.map +1 -0
- package/lib/features/accessibility/view-key-tools/deselect-key-tool.d.ts +2 -2
- package/lib/features/accessibility/view-key-tools/deselect-key-tool.d.ts.map +1 -1
- package/lib/features/accessibility/view-key-tools/movement-key-tool.d.ts +2 -2
- package/lib/features/accessibility/view-key-tools/movement-key-tool.d.ts.map +1 -1
- package/lib/features/accessibility/view-key-tools/movement-key-tool.js +4 -8
- package/lib/features/accessibility/view-key-tools/movement-key-tool.js.map +1 -1
- package/lib/features/accessibility/view-key-tools/zoom-key-tool.d.ts +2 -2
- package/lib/features/accessibility/view-key-tools/zoom-key-tool.d.ts.map +1 -1
- package/lib/features/accessibility/view-key-tools/zoom-key-tool.js +9 -13
- package/lib/features/accessibility/view-key-tools/zoom-key-tool.js.map +1 -1
- package/lib/features/bounds/bounds-module.d.ts.map +1 -1
- package/lib/features/bounds/bounds-module.js +2 -1
- package/lib/features/bounds/bounds-module.js.map +1 -1
- package/lib/features/command-palette/command-palette-tool.d.ts +2 -1
- package/lib/features/command-palette/command-palette-tool.d.ts.map +1 -1
- package/lib/features/command-palette/command-palette-tool.js.map +1 -1
- package/lib/features/command-palette/server-command-palette-provider.d.ts.map +1 -1
- package/lib/features/command-palette/server-command-palette-provider.js +3 -2
- package/lib/features/command-palette/server-command-palette-provider.js.map +1 -1
- package/lib/features/context-menu/context-menu-module.d.ts.map +1 -1
- package/lib/features/context-menu/context-menu-module.js +8 -8
- package/lib/features/context-menu/context-menu-module.js.map +1 -1
- package/lib/features/context-menu/{selection-service-aware-context-menu-mouse-listener.d.ts → glsp-context-menu-mouse-listener.d.ts} +2 -4
- package/lib/features/context-menu/glsp-context-menu-mouse-listener.d.ts.map +1 -0
- package/lib/features/context-menu/{selection-service-aware-context-menu-mouse-listener.js → glsp-context-menu-mouse-listener.js} +7 -12
- package/lib/features/context-menu/glsp-context-menu-mouse-listener.js.map +1 -0
- package/lib/features/context-menu/server-context-menu-provider.d.ts +1 -1
- package/lib/features/context-menu/server-context-menu-provider.d.ts.map +1 -1
- package/lib/features/context-menu/server-context-menu-provider.js +3 -2
- package/lib/features/context-menu/server-context-menu-provider.js.map +1 -1
- package/lib/features/copy-paste/copy-paste-context-menu.d.ts.map +1 -1
- package/lib/features/copy-paste/copy-paste-context-menu.js +1 -4
- package/lib/features/copy-paste/copy-paste-context-menu.js.map +1 -1
- package/lib/features/hints/type-hints-module.d.ts.map +1 -1
- package/lib/features/hints/type-hints-module.js +6 -5
- package/lib/features/hints/type-hints-module.js.map +1 -1
- package/lib/features/hints/type-hints.d.ts +6 -2
- package/lib/features/hints/type-hints.d.ts.map +1 -1
- package/lib/features/hints/type-hints.js +8 -0
- package/lib/features/hints/type-hints.js.map +1 -1
- package/lib/features/hover/hover-module.d.ts.map +1 -1
- package/lib/features/hover/hover-module.js +3 -2
- package/lib/features/hover/hover-module.js.map +1 -1
- package/lib/features/hover/hover.d.ts.map +1 -1
- package/lib/features/hover/hover.js +3 -2
- package/lib/features/hover/hover.js.map +1 -1
- package/lib/features/label-edit/edit-label-tool.d.ts +2 -2
- package/lib/features/label-edit/edit-label-tool.d.ts.map +1 -1
- package/lib/features/label-edit/edit-label-tool.js +2 -2
- package/lib/features/label-edit/edit-label-tool.js.map +1 -1
- package/lib/features/label-edit/edit-label-validator.d.ts.map +1 -1
- package/lib/features/label-edit/edit-label-validator.js +3 -2
- package/lib/features/label-edit/edit-label-validator.js.map +1 -1
- package/lib/features/navigation/navigation-action-handler.d.ts.map +1 -1
- package/lib/features/navigation/navigation-action-handler.js +1 -4
- package/lib/features/navigation/navigation-action-handler.js.map +1 -1
- package/lib/features/navigation/navigation-target-resolver.d.ts +3 -3
- package/lib/features/navigation/navigation-target-resolver.d.ts.map +1 -1
- package/lib/features/navigation/navigation-target-resolver.js +5 -7
- package/lib/features/navigation/navigation-target-resolver.js.map +1 -1
- package/lib/features/select/select-mouse-listener.d.ts +4 -2
- package/lib/features/select/select-mouse-listener.d.ts.map +1 -1
- package/lib/features/select/select-mouse-listener.js +17 -58
- package/lib/features/select/select-mouse-listener.js.map +1 -1
- package/lib/features/source-model-watcher/source-model-changed-action-handler.d.ts.map +1 -1
- package/lib/features/source-model-watcher/source-model-changed-action-handler.js +1 -4
- package/lib/features/source-model-watcher/source-model-changed-action-handler.js.map +1 -1
- package/lib/features/status/status-module.d.ts +19 -0
- package/lib/features/status/status-module.d.ts.map +1 -0
- package/lib/features/status/status-module.js +28 -0
- package/lib/features/status/status-module.js.map +1 -0
- package/lib/features/status/status-overlay.d.ts +25 -0
- package/lib/features/status/status-overlay.d.ts.map +1 -0
- package/lib/features/status/status-overlay.js +124 -0
- package/lib/features/status/status-overlay.js.map +1 -0
- package/lib/features/tool-palette/tool-palette-module.d.ts.map +1 -1
- package/lib/features/tool-palette/tool-palette-module.js +3 -2
- package/lib/features/tool-palette/tool-palette-module.js.map +1 -1
- package/lib/features/tool-palette/tool-palette.d.ts +10 -8
- package/lib/features/tool-palette/tool-palette.d.ts.map +1 -1
- package/lib/features/tool-palette/tool-palette.js +36 -29
- package/lib/features/tool-palette/tool-palette.js.map +1 -1
- package/lib/features/tools/{base-glsp-tool.d.ts → base-tools.d.ts} +14 -4
- package/lib/features/tools/base-tools.d.ts.map +1 -0
- package/lib/features/tools/{base-glsp-tool.js → base-tools.js} +31 -10
- package/lib/features/tools/base-tools.js.map +1 -0
- package/lib/features/tools/change-bounds/change-bounds-tool.d.ts +2 -2
- package/lib/features/tools/change-bounds/change-bounds-tool.d.ts.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool.js +2 -2
- package/lib/features/tools/change-bounds/change-bounds-tool.js.map +1 -1
- package/lib/features/tools/deletion/delete-tool.d.ts +4 -4
- package/lib/features/tools/deletion/delete-tool.d.ts.map +1 -1
- package/lib/features/tools/deletion/delete-tool.js +4 -3
- package/lib/features/tools/deletion/delete-tool.js.map +1 -1
- package/lib/features/tools/edge-creation/edge-creation-tool.d.ts +2 -2
- package/lib/features/tools/edge-creation/edge-creation-tool.d.ts.map +1 -1
- package/lib/features/tools/edge-creation/edge-creation-tool.js +5 -4
- package/lib/features/tools/edge-creation/edge-creation-tool.js.map +1 -1
- package/lib/features/tools/edge-edit/edge-edit-tool.d.ts +2 -2
- package/lib/features/tools/edge-edit/edge-edit-tool.d.ts.map +1 -1
- package/lib/features/tools/edge-edit/edge-edit-tool.js +2 -2
- package/lib/features/tools/edge-edit/edge-edit-tool.js.map +1 -1
- package/lib/features/tools/marquee-selection/marquee-mouse-tool.d.ts +2 -2
- package/lib/features/tools/marquee-selection/marquee-mouse-tool.d.ts.map +1 -1
- package/lib/features/tools/marquee-selection/marquee-mouse-tool.js +5 -4
- package/lib/features/tools/marquee-selection/marquee-mouse-tool.js.map +1 -1
- package/lib/features/tools/marquee-selection/marquee-tool.d.ts +2 -2
- package/lib/features/tools/marquee-selection/marquee-tool.d.ts.map +1 -1
- package/lib/features/tools/marquee-selection/marquee-tool.js +4 -3
- package/lib/features/tools/marquee-selection/marquee-tool.js.map +1 -1
- package/lib/features/tools/node-creation/node-creation-tool.d.ts +2 -2
- package/lib/features/tools/node-creation/node-creation-tool.d.ts.map +1 -1
- package/lib/features/tools/node-creation/node-creation-tool.js +4 -3
- package/lib/features/tools/node-creation/node-creation-tool.js.map +1 -1
- package/lib/features/tools/tool-focus-loss-module.d.ts.map +1 -1
- package/lib/features/tools/tool-focus-loss-module.js +2 -1
- package/lib/features/tools/tool-focus-loss-module.js.map +1 -1
- package/lib/features/validation/validate.js +1 -1
- package/lib/features/validation/validate.js.map +1 -1
- package/lib/features/viewport/glsp-scroll-mouse-listener.d.ts.map +1 -1
- package/lib/features/viewport/glsp-scroll-mouse-listener.js +3 -2
- package/lib/features/viewport/glsp-scroll-mouse-listener.js.map +1 -1
- package/lib/features/viewport/reposition.d.ts +38 -0
- package/lib/features/viewport/reposition.d.ts.map +1 -0
- package/lib/features/viewport/reposition.js +109 -0
- package/lib/features/viewport/reposition.js.map +1 -0
- package/lib/features/viewport/viewport-modules.d.ts.map +1 -1
- package/lib/features/viewport/viewport-modules.js +5 -2
- package/lib/features/viewport/viewport-modules.js.map +1 -1
- package/lib/glsp-sprotty/augmented-actions.d.ts +2 -10
- package/lib/glsp-sprotty/augmented-actions.d.ts.map +1 -1
- package/lib/glsp-sprotty/augmented-actions.js +2 -6
- package/lib/glsp-sprotty/augmented-actions.js.map +1 -1
- package/lib/glsp-sprotty/index.d.ts +3 -6
- package/lib/glsp-sprotty/index.d.ts.map +1 -1
- package/lib/glsp-sprotty/index.js +4 -7
- package/lib/glsp-sprotty/index.js.map +1 -1
- package/lib/glsp-sprotty/types.d.ts +5 -82
- package/lib/glsp-sprotty/types.d.ts.map +1 -1
- package/lib/glsp-sprotty/types.js +2 -8
- package/lib/glsp-sprotty/types.js.map +1 -1
- package/lib/index.d.ts +17 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +17 -7
- package/lib/index.js.map +1 -1
- package/lib/standalone-modules.d.ts +11 -2
- package/lib/standalone-modules.d.ts.map +1 -1
- package/lib/standalone-modules.js +37 -1
- package/lib/standalone-modules.js.map +1 -1
- package/lib/views/base-view-module.d.ts.map +1 -1
- package/lib/views/base-view-module.js +2 -1
- package/lib/views/base-view-module.js.map +1 -1
- package/lib/views/glsp-projection-view.d.ts +2 -1
- package/lib/views/glsp-projection-view.d.ts.map +1 -1
- package/lib/views/glsp-projection-view.js +11 -2
- package/lib/views/glsp-projection-view.js.map +1 -1
- package/package.json +4 -4
- package/src/base/action-dispatcher.spec.ts +87 -0
- package/src/base/action-dispatcher.ts +24 -10
- package/src/{features/tools/base-glsp-creation-tool.ts → base/action-handler-registry.ts} +10 -20
- package/src/base/default.module.ts +21 -34
- package/src/base/editor-context-service.ts +49 -16
- package/src/base/feedback/feedback-action-dispatcher.ts +5 -3
- package/src/base/focus/focus-tracker.ts +16 -5
- package/src/base/model/diagram-loader.ts +215 -0
- package/src/base/model/glsp-model-source.ts +199 -0
- package/src/base/model/model-initialization-constraint.spec.ts +95 -0
- package/src/base/{model-initialization-constraint.ts → model/model-initialization-constraint.ts} +43 -10
- package/src/base/selection-service.spec.ts +10 -9
- package/src/base/tool-manager/tool-manager.ts +183 -0
- package/src/base/tool-manager/tool.ts +85 -0
- package/src/default-modules.ts +37 -28
- package/src/features/accessibility/README.md +18 -0
- package/src/features/accessibility/accessibility-module.ts +6 -1
- package/src/features/accessibility/element-navigation/diagram-navigation-tool.ts +307 -0
- package/src/features/accessibility/element-navigation/element-navigation-module.ts +36 -0
- package/src/features/accessibility/element-navigation/element-navigator.ts +57 -0
- package/src/features/accessibility/element-navigation/left-right-top-bottom-navigator.ts +113 -0
- package/src/features/accessibility/element-navigation/local-element-navigator.ts +147 -0
- package/src/features/accessibility/element-navigation/position-navigator.ts +102 -0
- package/src/features/accessibility/focus-tracker/focus-tracker-module.ts +32 -0
- package/src/features/accessibility/focus-tracker/focus-tracker-tool.ts +129 -0
- package/src/features/accessibility/key-shortcut/accessible-key-shortcut-tool.ts +3 -3
- package/src/features/accessibility/key-shortcut/accessible-key-shortcut.ts +18 -3
- package/src/features/accessibility/resize-key-tool/resize-key-tool.ts +30 -16
- package/src/features/accessibility/search/search-palette.ts +4 -2
- package/src/features/accessibility/search/search-tool.ts +8 -9
- package/src/features/accessibility/toast/messages.json +16 -0
- package/src/features/accessibility/toast/toast-handler.ts +69 -0
- package/src/features/accessibility/toast/toast-module.ts +36 -0
- package/src/features/accessibility/toast/toast-tool.ts +108 -0
- package/src/features/accessibility/view-key-tools/deselect-key-tool.ts +2 -2
- package/src/features/accessibility/view-key-tools/movement-key-tool.ts +8 -10
- package/src/features/accessibility/view-key-tools/zoom-key-tool.ts +13 -15
- package/src/features/bounds/bounds-module.ts +2 -2
- package/src/features/command-palette/command-palette-tool.ts +2 -1
- package/src/features/command-palette/server-command-palette-provider.ts +3 -2
- package/src/features/context-menu/context-menu-module.ts +11 -12
- package/src/features/context-menu/{selection-service-aware-context-menu-mouse-listener.ts → glsp-context-menu-mouse-listener.ts} +1 -5
- package/src/features/context-menu/server-context-menu-provider.ts +3 -2
- package/src/features/copy-paste/copy-paste-context-menu.ts +3 -6
- package/src/features/hints/type-hints-module.ts +7 -6
- package/src/features/hints/type-hints.ts +12 -1
- package/src/features/hover/hover-module.ts +1 -2
- package/src/features/hover/hover.ts +2 -3
- package/src/features/label-edit/edit-label-tool.ts +2 -2
- package/src/features/label-edit/edit-label-validator.ts +7 -6
- package/src/features/navigation/navigation-action-handler.ts +5 -8
- package/src/features/navigation/navigation-target-resolver.ts +10 -7
- package/src/features/select/select-mouse-listener.ts +27 -79
- package/src/features/source-model-watcher/source-model-changed-action-handler.ts +3 -6
- package/src/features/status/status-module.ts +26 -0
- package/src/features/status/status-overlay.ts +121 -0
- package/src/features/tool-palette/tool-palette-module.ts +4 -3
- package/src/features/tool-palette/tool-palette.ts +44 -33
- package/src/features/tools/{base-glsp-tool.ts → base-tools.ts} +28 -3
- package/src/features/tools/change-bounds/change-bounds-tool.ts +2 -2
- package/src/features/tools/deletion/delete-tool.ts +4 -5
- package/src/features/tools/edge-creation/edge-creation-tool.ts +3 -3
- package/src/features/tools/edge-edit/edge-edit-tool.ts +2 -2
- package/src/features/tools/marquee-selection/marquee-mouse-tool.ts +3 -3
- package/src/features/tools/marquee-selection/marquee-tool.ts +4 -3
- package/src/features/tools/node-creation/node-creation-tool.ts +3 -3
- package/src/features/tools/tool-focus-loss-module.ts +2 -1
- package/src/features/validation/validate.ts +1 -1
- package/src/features/viewport/glsp-scroll-mouse-listener.ts +2 -9
- package/src/features/viewport/reposition.ts +119 -0
- package/src/features/viewport/viewport-modules.ts +3 -2
- package/src/glsp-sprotty/augmented-actions.ts +1 -16
- package/src/glsp-sprotty/index.ts +4 -7
- package/src/glsp-sprotty/types.ts +6 -8
- package/src/index.ts +17 -7
- package/src/standalone-modules.ts +40 -1
- package/src/views/base-view-module.ts +2 -2
- package/src/views/glsp-projection-view.tsx +18 -8
- package/lib/base/model-initialization-constraint.d.ts.map +0 -1
- package/lib/base/model-initialization-constraint.js.map +0 -1
- package/lib/base/source-uri-aware.d.ts +0 -5
- package/lib/base/source-uri-aware.d.ts.map +0 -1
- package/lib/base/source-uri-aware.js.map +0 -1
- package/lib/base/tool-manager/glsp-tool-manager.d.ts +0 -21
- package/lib/base/tool-manager/glsp-tool-manager.d.ts.map +0 -1
- package/lib/base/tool-manager/glsp-tool-manager.js +0 -113
- package/lib/base/tool-manager/glsp-tool-manager.js.map +0 -1
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.d.ts.map +0 -1
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.js.map +0 -1
- package/lib/features/tools/base-glsp-creation-tool.d.ts +0 -10
- package/lib/features/tools/base-glsp-creation-tool.d.ts.map +0 -1
- package/lib/features/tools/base-glsp-creation-tool.js.map +0 -1
- package/lib/features/tools/base-glsp-tool.d.ts.map +0 -1
- package/lib/features/tools/base-glsp-tool.js.map +0 -1
- package/lib/model-source/glsp-diagram-server.d.ts +0 -21
- package/lib/model-source/glsp-diagram-server.d.ts.map +0 -1
- package/lib/model-source/glsp-diagram-server.js +0 -107
- package/lib/model-source/glsp-diagram-server.js.map +0 -1
- package/src/base/tool-manager/glsp-tool-manager.ts +0 -96
- package/src/model-source/glsp-diagram-server.ts +0 -125
|
@@ -0,0 +1,113 @@
|
|
|
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 { EdgeRouterRegistry, findParentByFeature, SEdge, SModelElement, SModelRoot, Point } from '~glsp-sprotty';
|
|
18
|
+
import { toArray } from 'sprotty/lib/utils/iterable';
|
|
19
|
+
import { calcElementAndRoute, isRoutable, isSelectableAndBoundsAware, SelectableBoundsAware } from '../../../utils/smodel-util';
|
|
20
|
+
import { ElementNavigator } from './element-navigator';
|
|
21
|
+
import { inject, injectable, optional } from 'inversify';
|
|
22
|
+
|
|
23
|
+
@injectable()
|
|
24
|
+
export class LeftToRightTopToBottomElementNavigator implements ElementNavigator {
|
|
25
|
+
@inject(EdgeRouterRegistry) @optional() readonly edgeRouterRegistry?: EdgeRouterRegistry;
|
|
26
|
+
|
|
27
|
+
previous(
|
|
28
|
+
root: Readonly<SModelRoot>,
|
|
29
|
+
current?: SelectableBoundsAware,
|
|
30
|
+
previousCurrent?: SelectableBoundsAware,
|
|
31
|
+
predicate: (element: SModelElement) => boolean = () => true
|
|
32
|
+
): SModelElement | undefined {
|
|
33
|
+
const elements = this.getElements(root, predicate);
|
|
34
|
+
|
|
35
|
+
if (current === undefined) {
|
|
36
|
+
return elements.length > 0 ? elements[0] : undefined;
|
|
37
|
+
}
|
|
38
|
+
return elements[this.getPreviousIndex(current, elements) % elements.length];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
next(
|
|
42
|
+
root: Readonly<SModelRoot>,
|
|
43
|
+
current?: SelectableBoundsAware,
|
|
44
|
+
previousCurrent?: SelectableBoundsAware,
|
|
45
|
+
predicate: (element: SModelElement) => boolean = () => true
|
|
46
|
+
): SModelElement | undefined {
|
|
47
|
+
const elements = this.getElements(root, predicate);
|
|
48
|
+
if (current === undefined) {
|
|
49
|
+
return elements.length > 0 ? elements[0] : undefined;
|
|
50
|
+
}
|
|
51
|
+
return elements[this.getNextIndex(current, elements) % elements.length];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
protected getElements(root: Readonly<SModelRoot>, predicate: (element: SModelElement) => boolean): SModelElement[] {
|
|
55
|
+
const elements = toArray(root.index.all().filter(e => isSelectableAndBoundsAware(e))) as SelectableBoundsAware[];
|
|
56
|
+
return elements.sort((a, b) => this.compare(a, b)).filter(predicate);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
protected getNextIndex(current: SelectableBoundsAware, elements: SModelElement[]): number {
|
|
60
|
+
for (let index = 0; index < elements.length; index++) {
|
|
61
|
+
if (this.compare(elements[index], current) > 0) {
|
|
62
|
+
return index;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
protected getPreviousIndex(current: SelectableBoundsAware, elements: SModelElement[]): number {
|
|
70
|
+
for (let index = elements.length - 1; index >= 0; index--) {
|
|
71
|
+
if (this.compare(elements[index], current) < 0) {
|
|
72
|
+
return index;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return elements.length - 1;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
protected compare(one: SModelElement, other: SModelElement): number {
|
|
80
|
+
let positionOne: Point | undefined = undefined;
|
|
81
|
+
let positionOther: Point | undefined = undefined;
|
|
82
|
+
|
|
83
|
+
if (one instanceof SEdge && isRoutable(one)) {
|
|
84
|
+
positionOne = calcElementAndRoute(one, this.edgeRouterRegistry).newRoutingPoints?.[0];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (other instanceof SEdge && isRoutable(other)) {
|
|
88
|
+
positionOther = calcElementAndRoute(other, this.edgeRouterRegistry).newRoutingPoints?.[0];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const boundsOne = findParentByFeature(one, isSelectableAndBoundsAware);
|
|
92
|
+
const boundsOther = findParentByFeature(other, isSelectableAndBoundsAware);
|
|
93
|
+
|
|
94
|
+
if (positionOne === undefined && boundsOne) {
|
|
95
|
+
positionOne = boundsOne.bounds;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (positionOther === undefined && boundsOther) {
|
|
99
|
+
positionOther = boundsOther.bounds;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (positionOne && positionOther) {
|
|
103
|
+
if (positionOne.y !== positionOther.y) {
|
|
104
|
+
return positionOne.y - positionOther.y;
|
|
105
|
+
}
|
|
106
|
+
if (positionOne.x !== positionOther.x) {
|
|
107
|
+
return positionOne.x - positionOther.x;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return 0;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
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
|
+
import { BoundsAware, EdgeRouterRegistry, SConnectableElement, SEdge, SModelElement, SModelRoot, TYPES } from '~glsp-sprotty';
|
|
17
|
+
import { ElementNavigator } from './element-navigator';
|
|
18
|
+
import { inject, injectable, optional } from 'inversify';
|
|
19
|
+
import { GLSPActionDispatcher } from '../../../base/action-dispatcher';
|
|
20
|
+
import { applyCssClasses, deleteCssClasses } from '../../../base/feedback/css-feedback';
|
|
21
|
+
import { SelectableBoundsAware } from '../../../utils/smodel-util';
|
|
22
|
+
|
|
23
|
+
@injectable()
|
|
24
|
+
export class LocalElementNavigator implements ElementNavigator {
|
|
25
|
+
navigableElementCSS = 'navigable-element';
|
|
26
|
+
@inject(EdgeRouterRegistry) @optional() readonly edgeRouterRegistry?: EdgeRouterRegistry;
|
|
27
|
+
@inject(TYPES.IActionDispatcher) protected readonly actionDispatcher: GLSPActionDispatcher;
|
|
28
|
+
|
|
29
|
+
previous(
|
|
30
|
+
root: Readonly<SModelRoot>,
|
|
31
|
+
current: SelectableBoundsAware,
|
|
32
|
+
previousCurrent?: SelectableBoundsAware,
|
|
33
|
+
predicate?: (element: SModelElement) => boolean
|
|
34
|
+
): SModelElement | undefined {
|
|
35
|
+
return this.getPreviousElement(current, predicate);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
next(
|
|
39
|
+
root: Readonly<SModelRoot>,
|
|
40
|
+
current: SelectableBoundsAware,
|
|
41
|
+
previousCurrent?: SelectableBoundsAware,
|
|
42
|
+
predicate?: (element: SModelElement) => boolean
|
|
43
|
+
): SModelElement | undefined {
|
|
44
|
+
return this.getNextElement(current, predicate);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
up(
|
|
48
|
+
root: Readonly<SModelRoot>,
|
|
49
|
+
current: SelectableBoundsAware,
|
|
50
|
+
previousCurrent?: SelectableBoundsAware,
|
|
51
|
+
predicate?: (element: SModelElement) => boolean
|
|
52
|
+
): SModelElement | undefined {
|
|
53
|
+
return this.getIterable(current, previousCurrent, predicate);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
down(
|
|
57
|
+
root: Readonly<SModelRoot>,
|
|
58
|
+
current: SelectableBoundsAware,
|
|
59
|
+
previousCurrent?: SelectableBoundsAware,
|
|
60
|
+
predicate?: (element: SModelElement) => boolean
|
|
61
|
+
): SModelElement | undefined {
|
|
62
|
+
return this.getIterable(current, previousCurrent, predicate);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
process(
|
|
66
|
+
root: Readonly<SModelRoot>,
|
|
67
|
+
current: SelectableBoundsAware,
|
|
68
|
+
target: SelectableBoundsAware,
|
|
69
|
+
previousCurrent?: SelectableBoundsAware,
|
|
70
|
+
predicate?: (element: SModelElement) => boolean
|
|
71
|
+
): void {
|
|
72
|
+
let elements: SModelElement[] = [];
|
|
73
|
+
|
|
74
|
+
// Mark only edges
|
|
75
|
+
if (target instanceof SEdge) {
|
|
76
|
+
// If current is a edge, we have to check the source and target
|
|
77
|
+
if (current instanceof SEdge) {
|
|
78
|
+
elements = this.getIterables(target, current.source === target.source ? current.source : current.target, predicate);
|
|
79
|
+
} else {
|
|
80
|
+
// Otherwise take the current as it is
|
|
81
|
+
elements = this.getIterables(target, current, predicate);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
elements.filter(e => e.id !== target.id).forEach(e => this.actionDispatcher.dispatch(applyCssClasses(e, this.navigableElementCSS)));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
clean(root: Readonly<SModelRoot>, current?: SelectableBoundsAware, previousCurrent?: SelectableBoundsAware): void {
|
|
88
|
+
root.index.all().forEach(e => this.actionDispatcher.dispatch(deleteCssClasses(e, this.navigableElementCSS)));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
protected getIterables(
|
|
92
|
+
current: SelectableBoundsAware,
|
|
93
|
+
previousCurrent?: SModelElement & BoundsAware,
|
|
94
|
+
predicate: (element: SModelElement) => boolean = () => true
|
|
95
|
+
): SModelElement[] {
|
|
96
|
+
const elements: SModelElement[] = [];
|
|
97
|
+
|
|
98
|
+
if (current instanceof SEdge) {
|
|
99
|
+
if (current.target === previousCurrent) {
|
|
100
|
+
current.target?.incomingEdges.forEach(e => elements.push(e));
|
|
101
|
+
} else {
|
|
102
|
+
current.source?.outgoingEdges.forEach(e => elements.push(e));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return elements.filter(predicate);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
protected getIterable(
|
|
110
|
+
current: SelectableBoundsAware,
|
|
111
|
+
previousCurrent?: SelectableBoundsAware,
|
|
112
|
+
predicate: (element: SModelElement) => boolean = () => true
|
|
113
|
+
): SModelElement | undefined {
|
|
114
|
+
return this.getIterables(current, previousCurrent, predicate).filter(e => e.id !== current.id)[0];
|
|
115
|
+
}
|
|
116
|
+
protected getNextElement(
|
|
117
|
+
current: SelectableBoundsAware,
|
|
118
|
+
predicate: (element: SModelElement) => boolean = () => true
|
|
119
|
+
): SModelElement | undefined {
|
|
120
|
+
const elements: SModelElement[] = [];
|
|
121
|
+
|
|
122
|
+
if (current instanceof SConnectableElement) {
|
|
123
|
+
current.outgoingEdges.forEach(e => elements.push(e));
|
|
124
|
+
} else if (current instanceof SEdge) {
|
|
125
|
+
const target = current.target as SModelElement;
|
|
126
|
+
elements.push(target);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return elements.filter(predicate)[0];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
protected getPreviousElement(
|
|
133
|
+
current: SelectableBoundsAware,
|
|
134
|
+
predicate: (element: SModelElement) => boolean = () => true
|
|
135
|
+
): SModelElement | undefined {
|
|
136
|
+
const elements: SModelElement[] = [];
|
|
137
|
+
|
|
138
|
+
if (current instanceof SConnectableElement) {
|
|
139
|
+
current.incomingEdges.forEach(e => elements.push(e));
|
|
140
|
+
} else if (current instanceof SEdge) {
|
|
141
|
+
const source = current.source as SModelElement;
|
|
142
|
+
elements.push(source);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return elements.filter(predicate)[0];
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
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 { isBoundsAware, isSelectable, SChildElement, SModelElement, SModelRoot, SNode, TYPES, Bounds, Point } from '~glsp-sprotty';
|
|
18
|
+
import { ElementNavigator } from './element-navigator';
|
|
19
|
+
import { inject, injectable } from 'inversify';
|
|
20
|
+
import { GLSPActionDispatcher } from '../../../base/action-dispatcher';
|
|
21
|
+
import { toArray } from 'sprotty/lib/utils/iterable';
|
|
22
|
+
import { SelectableBoundsAware } from '../../../utils/smodel-util';
|
|
23
|
+
|
|
24
|
+
@injectable()
|
|
25
|
+
export class PositionNavigator implements ElementNavigator {
|
|
26
|
+
@inject(TYPES.IActionDispatcher) protected readonly actionDispatcher: GLSPActionDispatcher;
|
|
27
|
+
|
|
28
|
+
previous(
|
|
29
|
+
root: Readonly<SModelRoot>,
|
|
30
|
+
current: SelectableBoundsAware,
|
|
31
|
+
previousCurrent?: SelectableBoundsAware,
|
|
32
|
+
predicate?: (element: SModelElement) => boolean
|
|
33
|
+
): SModelElement | undefined {
|
|
34
|
+
return this.getNearestElement(root, current, e => this.bounds(root, e).x < this.bounds(root, current).x);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
next(
|
|
38
|
+
root: Readonly<SModelRoot>,
|
|
39
|
+
current: SelectableBoundsAware,
|
|
40
|
+
previousCurrent?: SelectableBoundsAware,
|
|
41
|
+
predicate?: (element: SModelElement) => boolean
|
|
42
|
+
): SModelElement | undefined {
|
|
43
|
+
return this.getNearestElement(root, current, e => this.bounds(root, e).x > this.bounds(root, current).x);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
up(
|
|
47
|
+
root: Readonly<SModelRoot>,
|
|
48
|
+
current: SelectableBoundsAware,
|
|
49
|
+
previousCurrent?: SelectableBoundsAware,
|
|
50
|
+
predicate?: (element: SModelElement) => boolean
|
|
51
|
+
): SModelElement | undefined {
|
|
52
|
+
return this.getNearestElement(root, current, e => this.bounds(root, e).y < this.bounds(root, current).y);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
down(
|
|
56
|
+
root: Readonly<SModelRoot>,
|
|
57
|
+
current: SelectableBoundsAware,
|
|
58
|
+
previousCurrent?: SelectableBoundsAware,
|
|
59
|
+
predicate?: (element: SModelElement) => boolean
|
|
60
|
+
): SModelElement | undefined {
|
|
61
|
+
return this.getNearestElement(root, current, e => this.bounds(root, e).y > this.bounds(root, current).y);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
protected getNearestElement(
|
|
65
|
+
root: Readonly<SModelRoot>,
|
|
66
|
+
current: SelectableBoundsAware,
|
|
67
|
+
filter: (e: SelectableBoundsAware) => boolean
|
|
68
|
+
): SModelElement | undefined {
|
|
69
|
+
const elements = this.boundElements(root).filter(filter);
|
|
70
|
+
return this.sortByDistance(root, current, elements)[0];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
protected sortByDistance(root: SModelRoot, current: SelectableBoundsAware, elements: SelectableBoundsAware[]): SelectableBoundsAware[] {
|
|
74
|
+
// https://www.tutorialspoint.com/sort-array-of-points-by-ascending-distance-from-a-given-point-javascript
|
|
75
|
+
const distance = (coor1: Point, coor2: Point): number => {
|
|
76
|
+
const x = coor2.x - coor1.x;
|
|
77
|
+
const y = coor2.y - coor1.y;
|
|
78
|
+
return Math.sqrt(x * x + y * y);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return elements.sort(
|
|
82
|
+
(a, b) =>
|
|
83
|
+
distance(this.bounds(root, a), this.bounds(root, current)) - distance(this.bounds(root, b), this.bounds(root, current))
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
protected boundElements(root: Readonly<SModelRoot>): SelectableBoundsAware[] {
|
|
88
|
+
return toArray(root.index.all().filter(e => e instanceof SNode && isSelectable(e) && isBoundsAware(e))) as SelectableBoundsAware[];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
protected bounds(root: Readonly<SModelRoot>, element: SelectableBoundsAware): Bounds {
|
|
92
|
+
return this.boundsInViewport(element, element.bounds, root);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
protected boundsInViewport(element: SModelElement, bounds: Bounds, viewport: SModelRoot): Bounds {
|
|
96
|
+
if (element instanceof SChildElement && element.parent !== viewport) {
|
|
97
|
+
return this.boundsInViewport(element.parent, element.parent.localToParent(bounds) as Bounds, viewport);
|
|
98
|
+
} else {
|
|
99
|
+
return bounds;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { ContainerModule } from 'inversify';
|
|
18
|
+
import { FocusTrackerTool } from './focus-tracker-tool';
|
|
19
|
+
import { BindingContext, TYPES, bindAsService } from '~glsp-sprotty';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Handles actions for tracking the focus of the cursor.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export const glspFocusTrackerModule = new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
26
|
+
const context = { bind, unbind, isBound, rebind };
|
|
27
|
+
configureFocusTrackerTool(context);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export function configureFocusTrackerTool(context: BindingContext): void {
|
|
31
|
+
bindAsService(context, TYPES.IDefaultTool, FocusTrackerTool);
|
|
32
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
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 { inject, injectable } from 'inversify';
|
|
18
|
+
import { TYPES, ViewerOptions } from '~glsp-sprotty';
|
|
19
|
+
import { GLSPActionDispatcher } from '../../../base/action-dispatcher';
|
|
20
|
+
import { Tool } from '../../../base/tool-manager/tool';
|
|
21
|
+
import * as messages from '../toast/messages.json';
|
|
22
|
+
import { ShowToastMessageAction } from '../toast/toast-handler';
|
|
23
|
+
|
|
24
|
+
@injectable()
|
|
25
|
+
export class FocusTrackerTool implements Tool {
|
|
26
|
+
static ID = 'glsp.focus-tracker';
|
|
27
|
+
|
|
28
|
+
isEditTool = false;
|
|
29
|
+
@inject(TYPES.IActionDispatcher)
|
|
30
|
+
protected actionDispatcher: GLSPActionDispatcher;
|
|
31
|
+
@inject(TYPES.ViewerOptions)
|
|
32
|
+
protected readonly viewerOptions: ViewerOptions;
|
|
33
|
+
|
|
34
|
+
protected readonly focusInFunction = (event: FocusEvent): Promise<void> => this.focusIn(event);
|
|
35
|
+
protected readonly focusOutFunction = (event: FocusEvent): Promise<void> => this.focusOut(event);
|
|
36
|
+
protected registered = false;
|
|
37
|
+
|
|
38
|
+
get id(): string {
|
|
39
|
+
return FocusTrackerTool.ID;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
enable(): void {
|
|
43
|
+
if (!this.registered) {
|
|
44
|
+
document.addEventListener('focusin', this.focusInFunction);
|
|
45
|
+
document.addEventListener('focusout', this.focusOutFunction);
|
|
46
|
+
}
|
|
47
|
+
this.registered = true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
disable(): void {
|
|
51
|
+
// the focus tracker cannot be disabled after enabling it
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
protected async focusOut(event: FocusEvent): Promise<void> {
|
|
55
|
+
await this.showToast('Focus not set');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
protected async focusIn(event: FocusEvent): Promise<void> {
|
|
59
|
+
let message: string | undefined;
|
|
60
|
+
const target = event.target;
|
|
61
|
+
|
|
62
|
+
if (target instanceof HTMLElement) {
|
|
63
|
+
const parent = this.parentWithAriaLabel(target);
|
|
64
|
+
const textMessage = this.handleTextNode(target);
|
|
65
|
+
// eslint-disable-next-line no-null/no-null
|
|
66
|
+
if (target.ariaLabel !== null) {
|
|
67
|
+
message = this.handleAriaLabel(target);
|
|
68
|
+
} else {
|
|
69
|
+
if (parent === undefined && textMessage !== undefined) {
|
|
70
|
+
message = textMessage;
|
|
71
|
+
} else if (parent !== undefined && textMessage === undefined) {
|
|
72
|
+
message = `Focus is in ${parent.ariaLabel}`;
|
|
73
|
+
} else if (parent !== undefined && textMessage !== undefined) {
|
|
74
|
+
message = `${parent.ariaLabel} -> ${textMessage}`;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
await this.showToast(message);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
protected handleTextNode(target: HTMLElement): string | undefined {
|
|
83
|
+
const textNode = Array.prototype.filter
|
|
84
|
+
.call(target.childNodes, element => element.nodeType === Node.TEXT_NODE)
|
|
85
|
+
.map(element => element.textContent)
|
|
86
|
+
.join('');
|
|
87
|
+
|
|
88
|
+
if (textNode.trim().length !== 0) {
|
|
89
|
+
return textNode;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
protected handleAriaLabel(target: HTMLElement): string | undefined {
|
|
96
|
+
// eslint-disable-next-line no-null/no-null
|
|
97
|
+
return target.ariaLabel === null ? undefined : target.ariaLabel;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
protected showToast(message?: string): Promise<void> {
|
|
101
|
+
return this.actionDispatcher.dispatchAll([
|
|
102
|
+
ShowToastMessageAction.create({
|
|
103
|
+
id: Symbol.for(FocusTrackerTool.ID),
|
|
104
|
+
message: `${messages.focus.focus_on} ${message ?? 'unknown'}`,
|
|
105
|
+
position: 'left'
|
|
106
|
+
})
|
|
107
|
+
]);
|
|
108
|
+
}
|
|
109
|
+
protected parentWithAriaLabel(target: HTMLElement): HTMLElement | undefined {
|
|
110
|
+
let current = target.parentElement;
|
|
111
|
+
|
|
112
|
+
while (
|
|
113
|
+
// eslint-disable-next-line no-null/no-null
|
|
114
|
+
current !== null &&
|
|
115
|
+
current !== document.body &&
|
|
116
|
+
current !== document.getElementById(this.viewerOptions.baseDiv) &&
|
|
117
|
+
// eslint-disable-next-line no-null/no-null
|
|
118
|
+
current.ariaLabel === null
|
|
119
|
+
) {
|
|
120
|
+
current = current.parentElement;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (current === document.getElementById(this.viewerOptions.baseDiv) || current === document.body) {
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return current ?? undefined;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
17
|
import { inject, injectable } from 'inversify';
|
|
18
|
-
import { Action, KeyListener, KeyTool,
|
|
19
|
-
import {
|
|
18
|
+
import { Action, KeyListener, KeyTool, SModelElement, SetUIExtensionVisibilityAction, matchesKeystroke } from '~glsp-sprotty';
|
|
19
|
+
import { BaseEditTool } from '../../tools/base-tools';
|
|
20
20
|
import { KeyShortcutUIExtension } from './accessible-key-shortcut';
|
|
21
21
|
|
|
22
22
|
@injectable()
|
|
23
|
-
export class AccessibleKeyShortcutTool extends
|
|
23
|
+
export class AccessibleKeyShortcutTool extends BaseEditTool {
|
|
24
24
|
static ID = 'accessible-key-shortcut-tool';
|
|
25
25
|
|
|
26
26
|
@inject(KeyTool) protected readonly keytool: KeyTool;
|
|
@@ -93,6 +93,7 @@ export class KeyShortcutUIExtension extends AbstractUIExtension implements IActi
|
|
|
93
93
|
const grouped = groupBy(registrations, k => k.group);
|
|
94
94
|
|
|
95
95
|
const groupTable = document.createElement('table');
|
|
96
|
+
groupTable.classList.add('shortcut-table');
|
|
96
97
|
const tableHead = document.createElement('thead');
|
|
97
98
|
const tableBody = document.createElement('tbody');
|
|
98
99
|
|
|
@@ -100,8 +101,7 @@ export class KeyShortcutUIExtension extends AbstractUIExtension implements IActi
|
|
|
100
101
|
const commandCell = document.createElement('th');
|
|
101
102
|
const keybindingCell = document.createElement('th');
|
|
102
103
|
|
|
103
|
-
commandCell.classList.add('
|
|
104
|
-
commandCell.classList.add('columnTitle');
|
|
104
|
+
commandCell.classList.add('column-title');
|
|
105
105
|
|
|
106
106
|
commandCell.innerText = 'Command';
|
|
107
107
|
keybindingCell.innerText = 'Keybinding';
|
|
@@ -110,7 +110,8 @@ export class KeyShortcutUIExtension extends AbstractUIExtension implements IActi
|
|
|
110
110
|
headerRow.appendChild(keybindingCell);
|
|
111
111
|
tableHead.appendChild(headerRow);
|
|
112
112
|
|
|
113
|
-
for (const [, shortcuts] of Object.entries(grouped)) {
|
|
113
|
+
for (const [group, shortcuts] of Object.entries(grouped)) {
|
|
114
|
+
tableBody.appendChild(this.createGroupHeader(group));
|
|
114
115
|
shortcuts.forEach(s => {
|
|
115
116
|
tableBody.appendChild(this.createEntry(s));
|
|
116
117
|
});
|
|
@@ -122,6 +123,20 @@ export class KeyShortcutUIExtension extends AbstractUIExtension implements IActi
|
|
|
122
123
|
this.shortcutsContainer.append(groupTable);
|
|
123
124
|
}
|
|
124
125
|
|
|
126
|
+
protected createGroupHeader(group: string): HTMLElement {
|
|
127
|
+
const entryRow = document.createElement('tr');
|
|
128
|
+
const groupElement = document.createElement('td');
|
|
129
|
+
const text = document.createElement('strong');
|
|
130
|
+
const emptyElement = document.createElement('td');
|
|
131
|
+
|
|
132
|
+
text.innerText = group;
|
|
133
|
+
groupElement.appendChild(text);
|
|
134
|
+
entryRow.appendChild(groupElement);
|
|
135
|
+
entryRow.appendChild(emptyElement);
|
|
136
|
+
|
|
137
|
+
return entryRow;
|
|
138
|
+
}
|
|
139
|
+
|
|
125
140
|
protected getShortcutHTML(shortcuts: string[]): HTMLElement {
|
|
126
141
|
const shortcutKeys = document.createElement('span');
|
|
127
142
|
shortcutKeys.innerHTML = shortcuts.map(key => `<kbd>${key}</kbd>`).join(' + ');
|
|
@@ -16,16 +16,18 @@
|
|
|
16
16
|
|
|
17
17
|
import { inject, injectable, optional } from 'inversify';
|
|
18
18
|
import { matchesKeystroke } from 'sprotty/lib/utils/keyboard';
|
|
19
|
-
import { Action,
|
|
19
|
+
import { Action, ISnapper, KeyListener, KeyTool, SModelElement, TYPES } from '~glsp-sprotty';
|
|
20
20
|
import { GLSPActionDispatcher } from '../../../base/action-dispatcher';
|
|
21
21
|
import { SelectionService } from '../../../base/selection-service';
|
|
22
|
-
import {
|
|
22
|
+
import { EnableDefaultToolsAction, EnableToolsAction, Tool } from '../../../base/tool-manager/tool';
|
|
23
23
|
import { IMovementRestrictor } from '../../change-bounds/movement-restrictor';
|
|
24
24
|
import { AccessibleKeyShortcutProvider, SetAccessibleKeyShortcutAction } from '../key-shortcut/accessible-key-shortcut';
|
|
25
|
+
import * as messages from '../toast/messages.json';
|
|
26
|
+
import { ShowToastMessageAction } from '../toast/toast-handler';
|
|
25
27
|
import { ResizeElementAction, ResizeType } from './resize-key-handler';
|
|
26
28
|
|
|
27
29
|
@injectable()
|
|
28
|
-
export class ResizeKeyTool implements
|
|
30
|
+
export class ResizeKeyTool implements Tool {
|
|
29
31
|
static ID = 'glsp.resize-key-tool';
|
|
30
32
|
|
|
31
33
|
isEditTool = true;
|
|
@@ -61,19 +63,17 @@ export class ResizeKeyListener extends KeyListener implements AccessibleKeyShort
|
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
registerShortcutKey(): void {
|
|
64
|
-
this.tool.actionDispatcher.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
]);
|
|
76
|
-
});
|
|
66
|
+
this.tool.actionDispatcher.dispatchOnceModelInitialized(
|
|
67
|
+
SetAccessibleKeyShortcutAction.create({
|
|
68
|
+
token: this.token,
|
|
69
|
+
keys: [
|
|
70
|
+
{ shortcuts: ['ALT', 'A'], description: 'Activate resize mode for selected element', group: 'Resize', position: 0 },
|
|
71
|
+
{ shortcuts: ['+'], description: 'Increase size of element', group: 'Resize', position: 1 },
|
|
72
|
+
{ shortcuts: ['-'], description: 'Increase size of element', group: 'Resize', position: 2 },
|
|
73
|
+
{ shortcuts: ['CTRL', '0'], description: 'Set element size to default', group: 'Resize', position: 3 }
|
|
74
|
+
]
|
|
75
|
+
})
|
|
76
|
+
);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
override keyDown(element: SModelElement, event: KeyboardEvent): Action[] {
|
|
@@ -82,12 +82,26 @@ export class ResizeKeyListener extends KeyListener implements AccessibleKeyShort
|
|
|
82
82
|
|
|
83
83
|
if (this.isEditMode && this.matchesDeactivateResizeModeKeystroke(event)) {
|
|
84
84
|
this.isEditMode = false;
|
|
85
|
+
|
|
86
|
+
this.tool.actionDispatcher.dispatch(
|
|
87
|
+
ShowToastMessageAction.createWithTimeout({
|
|
88
|
+
id: Symbol.for(ResizeKeyListener.name),
|
|
89
|
+
message: messages.resize.resize_mode_deactivated
|
|
90
|
+
})
|
|
91
|
+
);
|
|
92
|
+
|
|
85
93
|
actions.push(EnableDefaultToolsAction.create());
|
|
86
94
|
}
|
|
87
95
|
|
|
88
96
|
if (selectedElementsIds.length > 0) {
|
|
89
97
|
if (!this.isEditMode && this.matchesActivateResizeModeKeystroke(event)) {
|
|
90
98
|
this.isEditMode = true;
|
|
99
|
+
this.tool.actionDispatcher.dispatch(
|
|
100
|
+
ShowToastMessageAction.create({
|
|
101
|
+
id: Symbol.for(ResizeKeyListener.name),
|
|
102
|
+
message: messages.resize.resize_mode_activated
|
|
103
|
+
})
|
|
104
|
+
);
|
|
91
105
|
actions.push(EnableToolsAction.create([ResizeKeyTool.ID]));
|
|
92
106
|
}
|
|
93
107
|
|