@eclipse-glsp/client 0.10.0-next.6bee8eb.163 → 0.10.0-next.82afe91.177
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/lib/base/action-dispatcher.d.ts +1 -0
- package/lib/base/action-dispatcher.d.ts.map +1 -1
- package/lib/base/action-dispatcher.js +11 -3
- package/lib/base/action-dispatcher.js.map +1 -1
- package/lib/base/actions/focus-change-action.d.ts +16 -7
- package/lib/base/actions/focus-change-action.d.ts.map +1 -1
- package/lib/base/actions/focus-change-action.js +31 -12
- package/lib/base/actions/focus-change-action.js.map +1 -1
- package/lib/base/actions/sprotty-actions.d.ts +7 -0
- package/lib/base/actions/sprotty-actions.d.ts.map +1 -0
- package/lib/{features/tool-palette/palette-item.js → base/actions/sprotty-actions.js} +4 -20
- package/lib/base/actions/sprotty-actions.js.map +1 -0
- package/lib/base/auto-complete/auto-complete-actions.d.ts +5 -3
- package/lib/base/auto-complete/auto-complete-actions.d.ts.map +1 -1
- package/lib/base/auto-complete/auto-complete-actions.js +24 -5
- package/lib/base/auto-complete/auto-complete-actions.js.map +1 -1
- package/lib/base/auto-complete/auto-complete-widget.d.ts +9 -2
- package/lib/base/auto-complete/auto-complete-widget.d.ts.map +1 -1
- package/lib/base/auto-complete/auto-complete-widget.js +11 -4
- package/lib/base/auto-complete/auto-complete-widget.js.map +1 -1
- package/lib/base/command-stack.d.ts.map +1 -1
- package/lib/base/command-stack.js +4 -3
- package/lib/base/command-stack.js.map +1 -1
- package/lib/base/container-modules.d.ts.map +1 -1
- package/lib/base/container-modules.js +2 -1
- package/lib/base/container-modules.js.map +1 -1
- package/lib/base/di.config.d.ts +1 -1
- package/lib/base/di.config.d.ts.map +1 -1
- package/lib/base/di.config.js +9 -10
- package/lib/base/di.config.js.map +1 -1
- package/lib/base/editor-context-service.d.ts +15 -4
- package/lib/base/editor-context-service.d.ts.map +1 -1
- package/lib/base/editor-context-service.js +27 -16
- package/lib/base/editor-context-service.js.map +1 -1
- package/lib/base/focus-tracker.d.ts +1 -1
- package/lib/base/focus-tracker.d.ts.map +1 -1
- package/lib/base/focus-tracker.js +3 -3
- package/lib/base/focus-tracker.js.map +1 -1
- package/lib/base/model/update-model-command.d.ts +14 -7
- package/lib/base/model/update-model-command.d.ts.map +1 -1
- package/lib/base/model/update-model-command.js +38 -48
- package/lib/base/model/update-model-command.js.map +1 -1
- package/lib/base/model-initialization-constraint.d.ts +2 -3
- package/lib/base/model-initialization-constraint.d.ts.map +1 -1
- package/lib/base/model-initialization-constraint.js +3 -4
- package/lib/base/model-initialization-constraint.js.map +1 -1
- package/lib/base/source-uri-aware.d.ts +2 -17
- package/lib/base/source-uri-aware.d.ts.map +1 -1
- package/lib/base/source-uri-aware.js +4 -6
- package/lib/base/source-uri-aware.js.map +1 -1
- package/lib/base/tool-manager/glsp-tool-manager.d.ts.map +1 -1
- package/lib/base/tool-manager/glsp-tool-manager.js +3 -3
- package/lib/base/tool-manager/glsp-tool-manager.js.map +1 -1
- package/lib/base/tool-manager/tool-actions.d.ts +14 -0
- package/lib/base/tool-manager/tool-actions.d.ts.map +1 -0
- package/lib/base/tool-manager/tool-actions.js +25 -0
- package/lib/base/tool-manager/tool-actions.js.map +1 -0
- package/lib/base/types.d.ts +144 -20
- package/lib/base/types.d.ts.map +1 -1
- package/lib/base/types.js +14 -26
- package/lib/base/types.js.map +1 -1
- package/lib/features/change-bounds/movement-restrictor.d.ts +37 -7
- package/lib/features/change-bounds/movement-restrictor.d.ts.map +1 -1
- package/lib/features/change-bounds/movement-restrictor.js +54 -39
- package/lib/features/change-bounds/movement-restrictor.js.map +1 -1
- package/lib/features/change-bounds/snap.d.ts +60 -4
- package/lib/features/change-bounds/snap.d.ts.map +1 -1
- package/lib/features/change-bounds/snap.js +96 -9
- package/lib/features/change-bounds/snap.js.map +1 -1
- package/lib/features/change-bounds/snap.spec.d.ts +17 -0
- package/lib/features/change-bounds/snap.spec.d.ts.map +1 -0
- package/lib/features/change-bounds/snap.spec.js +82 -0
- package/lib/features/change-bounds/snap.spec.js.map +1 -0
- package/lib/features/command-palette/di.config.d.ts +2 -2
- package/lib/features/command-palette/di.config.d.ts.map +1 -1
- package/lib/features/command-palette/di.config.js +6 -6
- package/lib/features/command-palette/di.config.js.map +1 -1
- package/lib/features/command-palette/server-command-palette-provider.d.ts +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 +11 -8
- package/lib/features/command-palette/server-command-palette-provider.js.map +1 -1
- package/lib/features/context-menu/delete-element-context-menu.d.ts +17 -1
- package/lib/features/context-menu/delete-element-context-menu.d.ts.map +1 -1
- package/lib/features/context-menu/delete-element-context-menu.js +3 -3
- package/lib/features/context-menu/delete-element-context-menu.js.map +1 -1
- package/lib/features/context-menu/di.config.d.ts +1 -1
- package/lib/features/context-menu/di.config.d.ts.map +1 -1
- package/lib/features/context-menu/di.config.js +8 -7
- package/lib/features/context-menu/di.config.js.map +1 -1
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.d.ts +22 -8
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.d.ts.map +1 -1
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.js +11 -33
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.js.map +1 -1
- 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 +6 -5
- package/lib/features/context-menu/server-context-menu-provider.js.map +1 -1
- package/lib/features/copy-paste/copy-paste-context-menu.d.ts +12 -15
- package/lib/features/copy-paste/copy-paste-context-menu.d.ts.map +1 -1
- package/lib/features/copy-paste/copy-paste-context-menu.js +24 -31
- package/lib/features/copy-paste/copy-paste-context-menu.js.map +1 -1
- package/lib/features/copy-paste/copy-paste-handler.d.ts +1 -1
- package/lib/features/copy-paste/copy-paste-handler.d.ts.map +1 -1
- package/lib/features/copy-paste/copy-paste-handler.js +6 -7
- package/lib/features/copy-paste/copy-paste-handler.js.map +1 -1
- package/lib/features/copy-paste/di.config.d.ts +1 -1
- package/lib/features/copy-paste/di.config.d.ts.map +1 -1
- package/lib/features/copy-paste/di.config.js +5 -7
- package/lib/features/copy-paste/di.config.js.map +1 -1
- package/lib/features/decoration/decoration-placer.d.ts.map +1 -1
- package/lib/features/decoration/decoration-placer.js +17 -1
- package/lib/features/decoration/decoration-placer.js.map +1 -1
- package/lib/features/decoration/di.config.d.ts +2 -2
- package/lib/features/decoration/di.config.d.ts.map +1 -1
- package/lib/features/decoration/di.config.js +4 -4
- package/lib/features/decoration/di.config.js.map +1 -1
- package/lib/features/edit-label/di.config.d.ts +1 -1
- package/lib/features/edit-label/di.config.d.ts.map +1 -1
- package/lib/features/edit-label/di.config.js +4 -4
- package/lib/features/edit-label/di.config.js.map +1 -1
- package/lib/features/edit-label/edit-label-tool.d.ts.map +1 -1
- package/lib/features/edit-label/edit-label-tool.js +1 -1
- package/lib/features/edit-label/edit-label-tool.js.map +1 -1
- package/lib/features/edit-label/edit-label-validator.d.ts +4 -6
- package/lib/features/edit-label/edit-label-validator.d.ts.map +1 -1
- package/lib/features/edit-label/edit-label-validator.js +8 -10
- package/lib/features/edit-label/edit-label-validator.js.map +1 -1
- package/lib/features/hints/di.config.js +2 -2
- package/lib/features/hints/di.config.js.map +1 -1
- package/lib/features/hints/type-hints.d.ts +14 -4
- package/lib/features/hints/type-hints.d.ts.map +1 -1
- package/lib/features/hints/type-hints.js +21 -18
- package/lib/features/hints/type-hints.js.map +1 -1
- package/lib/features/hover/di.config.d.ts.map +1 -1
- package/lib/features/hover/di.config.js +2 -0
- package/lib/features/hover/di.config.js.map +1 -1
- package/lib/features/hover/hover.d.ts +4 -2
- package/lib/features/hover/hover.d.ts.map +1 -1
- package/lib/features/hover/hover.js +22 -4
- package/lib/features/hover/hover.js.map +1 -1
- package/lib/features/layout/di.config.d.ts +3 -3
- package/lib/features/layout/di.config.d.ts.map +1 -1
- package/lib/features/layout/di.config.js +9 -6
- package/lib/features/layout/di.config.js.map +1 -1
- package/lib/features/layout/freeform-layout.d.ts +17 -1
- package/lib/features/layout/freeform-layout.d.ts.map +1 -1
- package/lib/features/layout/freeform-layout.js +2 -2
- package/lib/features/layout/freeform-layout.js.map +1 -1
- package/lib/features/layout/hbox-layout.d.ts +41 -0
- package/lib/features/layout/hbox-layout.d.ts.map +1 -0
- package/lib/features/layout/hbox-layout.js +189 -0
- package/lib/features/layout/hbox-layout.js.map +1 -0
- package/lib/features/layout/layout-elements-action.d.ts +198 -0
- package/lib/features/layout/layout-elements-action.d.ts.map +1 -0
- package/lib/features/layout/layout-elements-action.js +391 -0
- package/lib/features/layout/layout-elements-action.js.map +1 -0
- package/lib/features/layout/layout-elements-action.spec.d.ts +3 -0
- package/lib/features/layout/layout-elements-action.spec.d.ts.map +1 -0
- package/lib/features/layout/{layout-commands.spec.js → layout-elements-action.spec.js} +75 -56
- package/lib/features/layout/layout-elements-action.spec.js.map +1 -0
- package/lib/features/layout/vbox-layout.d.ts +17 -1
- package/lib/features/layout/vbox-layout.d.ts.map +1 -1
- package/lib/features/layout/vbox-layout.js +4 -3
- package/lib/features/layout/vbox-layout.js.map +1 -1
- package/lib/features/model-source-watcher/model-source-changed-action-handler.d.ts +1 -1
- package/lib/features/model-source-watcher/model-source-changed-action-handler.d.ts.map +1 -1
- package/lib/features/model-source-watcher/model-source-changed-action-handler.js +7 -7
- package/lib/features/model-source-watcher/model-source-changed-action-handler.js.map +1 -1
- package/lib/features/mouse-tool/di.config.d.ts +1 -1
- package/lib/features/mouse-tool/di.config.d.ts.map +1 -1
- package/lib/features/mouse-tool/di.config.js +2 -2
- package/lib/features/mouse-tool/di.config.js.map +1 -1
- package/lib/features/mouse-tool/mouse-tool.d.ts +0 -1
- package/lib/features/mouse-tool/mouse-tool.d.ts.map +1 -1
- package/lib/features/mouse-tool/mouse-tool.js +3 -5
- package/lib/features/mouse-tool/mouse-tool.js.map +1 -1
- package/lib/features/navigation/navigation-action-handler.d.ts +31 -16
- package/lib/features/navigation/navigation-action-handler.d.ts.map +1 -1
- package/lib/features/navigation/navigation-action-handler.js +50 -66
- 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 +7 -8
- package/lib/features/navigation/navigation-target-resolver.js.map +1 -1
- package/lib/features/navigation/navigation-target-resolver.spec.js +3 -3
- package/lib/features/navigation/navigation-target-resolver.spec.js.map +1 -1
- package/lib/features/save/di.config.d.ts +1 -1
- package/lib/features/save/di.config.d.ts.map +1 -1
- package/lib/features/save/di.config.js +3 -3
- package/lib/features/save/di.config.js.map +1 -1
- package/lib/features/save/save-keylistener.js +1 -1
- package/lib/features/save/save-keylistener.js.map +1 -1
- package/lib/features/select/di.config.d.ts +1 -1
- package/lib/features/select/di.config.d.ts.map +1 -1
- package/lib/features/select/di.config.js +4 -5
- package/lib/features/select/di.config.js.map +1 -1
- package/lib/features/select/select-feedback-action.d.ts +26 -22
- package/lib/features/select/select-feedback-action.d.ts.map +1 -1
- package/lib/features/select/select-feedback-action.js +18 -45
- package/lib/features/select/select-feedback-action.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 +63 -1
- package/lib/features/select/select-mouse-listener.js.map +1 -1
- package/lib/features/select/selection-service.d.ts +12 -3
- package/lib/features/select/selection-service.d.ts.map +1 -1
- package/lib/features/select/selection-service.js +47 -58
- package/lib/features/select/selection-service.js.map +1 -1
- package/lib/features/select/selection-service.spec.js +10 -7
- package/lib/features/select/selection-service.spec.js.map +1 -1
- package/lib/features/tool-feedback/change-bounds-tool-feedback.d.ts +16 -8
- package/lib/features/tool-feedback/change-bounds-tool-feedback.d.ts.map +1 -1
- package/lib/features/tool-feedback/change-bounds-tool-feedback.js +51 -21
- package/lib/features/tool-feedback/change-bounds-tool-feedback.js.map +1 -1
- package/lib/features/tool-feedback/creation-tool-feedback.d.ts +22 -10
- package/lib/features/tool-feedback/creation-tool-feedback.d.ts.map +1 -1
- package/lib/features/tool-feedback/creation-tool-feedback.js +46 -21
- package/lib/features/tool-feedback/creation-tool-feedback.js.map +1 -1
- package/lib/features/tool-feedback/css-feedback.d.ts +17 -10
- package/lib/features/tool-feedback/css-feedback.d.ts.map +1 -1
- package/lib/features/tool-feedback/css-feedback.js +41 -37
- package/lib/features/tool-feedback/css-feedback.js.map +1 -1
- package/lib/features/tool-feedback/di.config.d.ts +1 -1
- package/lib/features/tool-feedback/di.config.d.ts.map +1 -1
- package/lib/features/tool-feedback/di.config.js +4 -4
- package/lib/features/tool-feedback/di.config.js.map +1 -1
- package/lib/features/tool-feedback/edge-edit-tool-feedback.d.ts +44 -21
- package/lib/features/tool-feedback/edge-edit-tool-feedback.d.ts.map +1 -1
- package/lib/features/tool-feedback/edge-edit-tool-feedback.js +124 -91
- package/lib/features/tool-feedback/edge-edit-tool-feedback.js.map +1 -1
- package/lib/features/tool-feedback/feedback-action-dispatcher.d.ts.map +1 -1
- package/lib/features/tool-feedback/feedback-action-dispatcher.js +3 -3
- package/lib/features/tool-feedback/feedback-action-dispatcher.js.map +1 -1
- package/lib/features/tool-feedback/marquee-tool-feedback.d.ts +20 -9
- package/lib/features/tool-feedback/marquee-tool-feedback.d.ts.map +1 -1
- package/lib/features/tool-feedback/marquee-tool-feedback.js +41 -15
- package/lib/features/tool-feedback/marquee-tool-feedback.js.map +1 -1
- package/lib/features/tool-feedback/view.d.ts +1 -1
- package/lib/features/tool-feedback/view.d.ts.map +1 -1
- package/lib/features/tool-feedback/view.js +18 -1
- package/lib/features/tool-feedback/view.js.map +1 -1
- package/lib/features/tool-palette/di.config.d.ts +1 -1
- package/lib/features/tool-palette/di.config.d.ts.map +1 -1
- package/lib/features/tool-palette/di.config.js +3 -2
- package/lib/features/tool-palette/di.config.js.map +1 -1
- package/lib/features/tool-palette/tool-palette.d.ts +9 -6
- package/lib/features/tool-palette/tool-palette.d.ts.map +1 -1
- package/lib/features/tool-palette/tool-palette.js +25 -20
- package/lib/features/tool-palette/tool-palette.js.map +1 -1
- package/lib/features/tools/base-glsp-tool.d.ts.map +1 -1
- package/lib/features/tools/base-glsp-tool.js +3 -3
- package/lib/features/tools/base-glsp-tool.js.map +1 -1
- package/lib/features/tools/change-bounds-tool.d.ts +6 -8
- package/lib/features/tools/change-bounds-tool.d.ts.map +1 -1
- package/lib/features/tools/change-bounds-tool.js +22 -45
- package/lib/features/tools/change-bounds-tool.js.map +1 -1
- package/lib/features/tools/delete-tool.d.ts.map +1 -1
- package/lib/features/tools/delete-tool.js +5 -5
- package/lib/features/tools/delete-tool.js.map +1 -1
- package/lib/features/tools/di.config.d.ts +9 -2
- package/lib/features/tools/di.config.d.ts.map +1 -1
- package/lib/features/tools/di.config.js +23 -12
- package/lib/features/tools/di.config.js.map +1 -1
- package/lib/features/tools/edge-creation-tool.d.ts.map +1 -1
- package/lib/features/tools/edge-creation-tool.js +16 -9
- package/lib/features/tools/edge-creation-tool.js.map +1 -1
- package/lib/features/tools/edge-edit-tool.d.ts +2 -1
- package/lib/features/tools/edge-edit-tool.d.ts.map +1 -1
- package/lib/features/tools/edge-edit-tool.js +20 -15
- package/lib/features/tools/edge-edit-tool.js.map +1 -1
- package/lib/features/{tool-palette/palette-item.d.ts → tools/enable-default-tools-on-focus-loss.d.ts} +11 -11
- package/lib/features/tools/enable-default-tools-on-focus-loss.d.ts.map +1 -0
- package/lib/features/tools/enable-default-tools-on-focus-loss.js +29 -0
- package/lib/features/tools/enable-default-tools-on-focus-loss.js.map +1 -0
- package/lib/features/tools/marquee-behavior.d.ts +1 -1
- package/lib/features/tools/marquee-behavior.js +2 -2
- package/lib/features/tools/marquee-behavior.js.map +1 -1
- package/lib/features/tools/marquee-mouse-tool.d.ts.map +1 -1
- package/lib/features/tools/marquee-mouse-tool.js +7 -7
- package/lib/features/tools/marquee-mouse-tool.js.map +1 -1
- package/lib/features/tools/marquee-tool.js +1 -1
- package/lib/features/tools/marquee-tool.js.map +1 -1
- package/lib/features/tools/model.d.ts +2 -1
- package/lib/features/tools/model.d.ts.map +1 -1
- package/lib/features/tools/model.js +0 -15
- package/lib/features/tools/model.js.map +1 -1
- package/lib/features/tools/node-creation-tool.d.ts.map +1 -1
- package/lib/features/tools/node-creation-tool.js +5 -5
- package/lib/features/tools/node-creation-tool.js.map +1 -1
- package/lib/features/validation/di.config.d.ts +0 -15
- package/lib/features/validation/di.config.d.ts.map +1 -1
- package/lib/features/validation/di.config.js +9 -7
- package/lib/features/validation/di.config.js.map +1 -1
- package/lib/features/validation/marker-navigator.d.ts +26 -24
- package/lib/features/validation/marker-navigator.d.ts.map +1 -1
- package/lib/features/validation/marker-navigator.js +50 -77
- package/lib/features/validation/marker-navigator.js.map +1 -1
- package/lib/features/validation/marker-navigator.spec.d.ts.map +1 -1
- package/lib/features/validation/marker-navigator.spec.js +2 -16
- package/lib/features/validation/marker-navigator.spec.js.map +1 -1
- package/lib/features/validation/validate.d.ts +16 -29
- package/lib/features/validation/validate.d.ts.map +1 -1
- package/lib/features/validation/validate.js +48 -76
- package/lib/features/validation/validate.js.map +1 -1
- package/lib/features/viewport/di.config.d.ts +1 -1
- package/lib/features/viewport/di.config.d.ts.map +1 -1
- package/lib/features/viewport/di.config.js +1 -1
- package/lib/features/viewport/di.config.js.map +1 -1
- package/lib/features/viewport/glsp-scroll-mouse-listener.js +2 -2
- package/lib/features/viewport/glsp-scroll-mouse-listener.js.map +1 -1
- package/lib/index.d.ts +8 -9
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +9 -9
- package/lib/index.js.map +1 -1
- package/lib/lib/model.d.ts +2 -1
- package/lib/lib/model.d.ts.map +1 -1
- package/lib/lib/model.js +3 -18
- package/lib/lib/model.js.map +1 -1
- package/lib/model-source/glsp-diagram-server.d.ts +5 -5
- package/lib/model-source/glsp-diagram-server.d.ts.map +1 -1
- package/lib/model-source/glsp-diagram-server.js +6 -6
- package/lib/model-source/glsp-diagram-server.js.map +1 -1
- package/lib/sprotty-reexport.d.ts +174 -0
- package/lib/sprotty-reexport.d.ts.map +1 -0
- package/lib/sprotty-reexport.js +299 -0
- package/lib/sprotty-reexport.js.map +1 -0
- package/lib/utils/layout-utils.d.ts +6 -22
- package/lib/utils/layout-utils.d.ts.map +1 -1
- package/lib/utils/layout-utils.js +1 -1
- package/lib/utils/layout-utils.js.map +1 -1
- package/lib/utils/smodel-util.d.ts +27 -18
- package/lib/utils/smodel-util.d.ts.map +1 -1
- package/lib/utils/smodel-util.js +30 -11
- package/lib/utils/smodel-util.js.map +1 -1
- package/lib/utils/viewpoint-util.d.ts +3 -3
- package/lib/utils/viewpoint-util.d.ts.map +1 -1
- package/lib/utils/viewpoint-util.js +17 -1
- package/lib/utils/viewpoint-util.js.map +1 -1
- package/lib/views/base-view-module.d.ts.map +1 -1
- package/lib/views/base-view-module.js +3 -1
- package/lib/views/base-view-module.js.map +1 -1
- package/package.json +5 -4
- package/src/base/action-dispatcher.ts +13 -4
- package/src/base/actions/focus-change-action.ts +25 -8
- package/src/base/actions/sprotty-actions.ts +26 -0
- package/src/base/auto-complete/auto-complete-actions.ts +7 -5
- package/src/base/auto-complete/auto-complete-widget.ts +15 -13
- package/src/base/command-stack.ts +4 -3
- package/src/base/container-modules.ts +4 -3
- package/src/base/di.config.ts +4 -5
- package/src/base/editor-context-service.ts +32 -12
- package/src/base/focus-tracker.ts +5 -4
- package/src/base/model/update-model-command.ts +52 -39
- package/src/base/model-initialization-constraint.ts +3 -4
- package/src/base/source-uri-aware.ts +5 -4
- package/src/base/tool-manager/glsp-tool-manager.ts +4 -4
- package/src/base/tool-manager/tool-actions.ts +37 -0
- package/src/base/types.ts +31 -24
- package/src/features/change-bounds/movement-restrictor.ts +74 -44
- package/src/features/change-bounds/snap.spec.ts +89 -0
- package/src/features/change-bounds/snap.ts +99 -12
- package/src/features/command-palette/di.config.ts +5 -7
- package/src/features/command-palette/server-command-palette-provider.ts +9 -8
- package/src/features/context-menu/delete-element-context-menu.ts +6 -6
- package/src/features/context-menu/di.config.ts +3 -2
- package/src/features/context-menu/selection-service-aware-context-menu-mouse-listener.ts +22 -29
- package/src/features/context-menu/server-context-menu-provider.ts +7 -6
- package/src/features/copy-paste/copy-paste-context-menu.ts +30 -23
- package/src/features/copy-paste/copy-paste-handler.ts +6 -6
- package/src/features/copy-paste/di.config.ts +7 -15
- package/src/features/decoration/decoration-placer.ts +2 -2
- package/src/features/decoration/di.config.ts +3 -5
- package/src/features/edit-label/di.config.ts +4 -5
- package/src/features/edit-label/edit-label-tool.ts +1 -2
- package/src/features/edit-label/edit-label-validator.ts +6 -10
- package/src/features/hints/di.config.ts +3 -3
- package/src/features/hints/type-hints.ts +31 -16
- package/src/features/hover/di.config.ts +4 -0
- package/src/features/hover/hover.ts +29 -11
- package/src/features/layout/di.config.ts +15 -7
- package/src/features/layout/freeform-layout.ts +3 -12
- package/src/features/layout/hbox-layout.ts +256 -0
- package/src/features/layout/{layout-commands.spec.ts → layout-elements-action.spec.ts} +89 -65
- package/src/features/layout/layout-elements-action.ts +486 -0
- package/src/features/layout/vbox-layout.ts +4 -8
- package/src/features/model-source-watcher/model-source-changed-action-handler.ts +7 -12
- package/src/features/mouse-tool/di.config.ts +3 -4
- package/src/features/mouse-tool/mouse-tool.ts +4 -7
- package/src/features/navigation/navigation-action-handler.ts +76 -42
- package/src/features/navigation/navigation-target-resolver.spec.ts +3 -3
- package/src/features/navigation/navigation-target-resolver.ts +8 -13
- package/src/features/save/di.config.ts +2 -3
- package/src/features/save/save-keylistener.ts +1 -1
- package/src/features/select/di.config.ts +6 -8
- package/src/features/select/select-feedback-action.ts +18 -46
- package/src/features/select/select-mouse-listener.ts +82 -3
- package/src/features/select/selection-service.spec.ts +12 -9
- package/src/features/select/selection-service.ts +49 -58
- package/src/features/tool-feedback/change-bounds-tool-feedback.ts +43 -14
- package/src/features/tool-feedback/creation-tool-feedback.ts +42 -21
- package/src/features/tool-feedback/css-feedback.ts +40 -37
- package/src/features/tool-feedback/di.config.ts +4 -5
- package/src/features/tool-feedback/edge-edit-tool-feedback.ts +130 -78
- package/src/features/tool-feedback/feedback-action-dispatcher.ts +2 -1
- package/src/features/tool-feedback/marquee-tool-feedback.ts +36 -11
- package/src/features/tool-feedback/view.tsx +3 -3
- package/src/features/tool-palette/di.config.ts +3 -2
- package/src/features/tool-palette/tool-palette.ts +30 -16
- package/src/features/tools/base-glsp-tool.ts +4 -4
- package/src/features/tools/change-bounds-tool.ts +31 -61
- package/src/features/tools/delete-tool.ts +6 -6
- package/src/features/tools/di.config.ts +23 -12
- package/src/features/tools/edge-creation-tool.ts +18 -9
- package/src/features/tools/edge-edit-tool.ts +20 -16
- package/src/features/tools/enable-default-tools-on-focus-loss.ts +33 -0
- package/src/features/tools/marquee-behavior.ts +2 -2
- package/src/features/tools/marquee-mouse-tool.ts +8 -9
- package/src/features/tools/marquee-tool.ts +1 -1
- package/src/features/tools/model.ts +2 -1
- package/src/features/tools/node-creation-tool.ts +5 -5
- package/src/features/validation/di.config.ts +13 -11
- package/src/features/validation/marker-navigator.spec.ts +4 -2
- package/src/features/validation/marker-navigator.ts +65 -82
- package/src/features/validation/validate.ts +55 -85
- package/src/features/viewport/di.config.ts +1 -2
- package/src/features/viewport/glsp-scroll-mouse-listener.ts +3 -3
- package/src/index.ts +9 -9
- package/src/lib/model.ts +2 -1
- package/src/model-source/glsp-diagram-server.ts +9 -11
- package/src/sprotty-reexport.ts +283 -0
- package/src/utils/layout-utils.ts +9 -29
- package/src/utils/smodel-util.ts +36 -20
- package/src/utils/viewpoint-util.ts +5 -14
- package/src/views/base-view-module.ts +5 -1
- package/lib/features/layout/layout-commands.d.ts +0 -153
- package/lib/features/layout/layout-commands.d.ts.map +0 -1
- package/lib/features/layout/layout-commands.js +0 -415
- package/lib/features/layout/layout-commands.js.map +0 -1
- package/lib/features/layout/layout-commands.spec.d.ts +0 -3
- package/lib/features/layout/layout-commands.spec.d.ts.map +0 -1
- package/lib/features/layout/layout-commands.spec.js.map +0 -1
- package/lib/features/tool-palette/palette-item.d.ts.map +0 -1
- package/lib/features/tool-palette/palette-item.js.map +0 -1
- package/lib/protocol-reexport.d.ts +0 -45
- package/lib/protocol-reexport.d.ts.map +0 -1
- package/lib/protocol-reexport.js +0 -80
- package/lib/protocol-reexport.js.map +0 -1
- package/src/features/layout/layout-commands.ts +0 -424
- package/src/features/tool-palette/palette-item.ts +0 -38
- package/src/protocol-reexport.ts +0 -64
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2022 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,18 +13,9 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
Dimension,
|
|
20
|
-
findParentByFeature,
|
|
21
|
-
isAlignable,
|
|
22
|
-
isViewport,
|
|
23
|
-
ORIGIN_POINT,
|
|
24
|
-
SModelElement,
|
|
25
|
-
translateBounds,
|
|
26
|
-
Viewport
|
|
27
|
-
} from 'sprotty';
|
|
16
|
+
|
|
17
|
+
import { Bounds, Dimension, Point, Viewport } from '@eclipse-glsp/protocol';
|
|
18
|
+
import { BoundsAware, findParentByFeature, isAlignable, isViewport, SModelElement, translateBounds } from 'sprotty';
|
|
28
19
|
|
|
29
20
|
/**
|
|
30
21
|
* Return the position corresponding to this mouse event (Browser coordinates)
|
|
@@ -70,7 +61,7 @@ export function getAbsolutePosition(target: SModelElement, mouseEvent: MouseEven
|
|
|
70
61
|
* @param target A bounds-aware element from the diagram
|
|
71
62
|
*/
|
|
72
63
|
export function toAbsoluteBounds(element: SModelElement & BoundsAware): Bounds {
|
|
73
|
-
const location = isAlignable(element) ? element.alignment :
|
|
64
|
+
const location = isAlignable(element) ? element.alignment : Point.ORIGIN;
|
|
74
65
|
const x = location.x;
|
|
75
66
|
const y = location.y;
|
|
76
67
|
const width = element.bounds.width;
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
ForeignObjectView,
|
|
27
27
|
HtmlRoot,
|
|
28
28
|
HtmlRootView,
|
|
29
|
+
moveFeature,
|
|
29
30
|
PreRenderedElement,
|
|
30
31
|
PreRenderedView,
|
|
31
32
|
RectangularNode,
|
|
@@ -34,6 +35,7 @@ import {
|
|
|
34
35
|
SCompartment,
|
|
35
36
|
SCompartmentView,
|
|
36
37
|
SEdge,
|
|
38
|
+
selectFeature,
|
|
37
39
|
SGraphView,
|
|
38
40
|
ShapedPreRenderedElement,
|
|
39
41
|
SIssueMarker,
|
|
@@ -66,7 +68,9 @@ export function configureDefaultModelElements(context: ContainerContext): void {
|
|
|
66
68
|
configureModelElement(context, DefaultTypes.HTML, HtmlRoot, HtmlRootView);
|
|
67
69
|
|
|
68
70
|
// generic elements
|
|
69
|
-
configureModelElement(context, DefaultTypes.FOREIGN_OBJECT, ForeignObjectElement, ForeignObjectView
|
|
71
|
+
configureModelElement(context, DefaultTypes.FOREIGN_OBJECT, ForeignObjectElement, ForeignObjectView, {
|
|
72
|
+
disable: [selectFeature, moveFeature]
|
|
73
|
+
});
|
|
70
74
|
configureModelElement(context, DefaultTypes.PRE_RENDERED, PreRenderedElement, PreRenderedView);
|
|
71
75
|
configureModelElement(context, DefaultTypes.SHAPE_PRE_RENDERED, ShapedPreRenderedElement, PreRenderedView);
|
|
72
76
|
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-2022 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 { Action, ElementAndBounds } from '@eclipse-glsp/protocol';
|
|
17
|
-
import { Command, CommandExecutionContext, CommandReturn, ElementMove, IActionDispatcher, SModelElement } from 'sprotty';
|
|
18
|
-
import { WriteableElementAndBounds, WriteableElementMove } from '../../utils/layout-utils';
|
|
19
|
-
import { BoundsAwareModelElement } from '../../utils/smodel-util';
|
|
20
|
-
import { IMovementRestrictor } from '../change-bounds/movement-restrictor';
|
|
21
|
-
import { SelectionService } from '../select/selection-service';
|
|
22
|
-
export declare enum ResizeDimension {
|
|
23
|
-
Width = 0,
|
|
24
|
-
Height = 1,
|
|
25
|
-
Width_And_Height = 2
|
|
26
|
-
}
|
|
27
|
-
export declare namespace Reduce {
|
|
28
|
-
function min(...values: number[]): number;
|
|
29
|
-
function max(...values: number[]): number;
|
|
30
|
-
function avg(...values: number[]): number;
|
|
31
|
-
function first(...values: number[]): number;
|
|
32
|
-
function last(...values: number[]): number;
|
|
33
|
-
}
|
|
34
|
-
export declare class ResizeElementsAction implements Action {
|
|
35
|
-
/**
|
|
36
|
-
* IDs of the elements that should be resized. If no IDs are given, the selected elements will be resized.
|
|
37
|
-
*/
|
|
38
|
-
readonly elementIds: string[];
|
|
39
|
-
/**
|
|
40
|
-
* Resize dimension.
|
|
41
|
-
*/
|
|
42
|
-
readonly dimension: ResizeDimension;
|
|
43
|
-
/**
|
|
44
|
-
* Function to reduce the dimension to a target dimension value, see Reduce.* for potential functions.
|
|
45
|
-
*/
|
|
46
|
-
readonly reductionFunction: (...values: number[]) => number;
|
|
47
|
-
readonly kind: string;
|
|
48
|
-
constructor(
|
|
49
|
-
/**
|
|
50
|
-
* IDs of the elements that should be resized. If no IDs are given, the selected elements will be resized.
|
|
51
|
-
*/
|
|
52
|
-
elementIds: string[],
|
|
53
|
-
/**
|
|
54
|
-
* Resize dimension.
|
|
55
|
-
*/
|
|
56
|
-
dimension: ResizeDimension,
|
|
57
|
-
/**
|
|
58
|
-
* Function to reduce the dimension to a target dimension value, see Reduce.* for potential functions.
|
|
59
|
-
*/
|
|
60
|
-
reductionFunction: (...values: number[]) => number, kind?: string);
|
|
61
|
-
}
|
|
62
|
-
export declare enum Alignment {
|
|
63
|
-
Left = 0,
|
|
64
|
-
Center = 1,
|
|
65
|
-
Right = 2,
|
|
66
|
-
Top = 3,
|
|
67
|
-
Middle = 4,
|
|
68
|
-
Bottom = 5
|
|
69
|
-
}
|
|
70
|
-
export declare namespace Select {
|
|
71
|
-
function all(elements: BoundsAwareModelElement[]): BoundsAwareModelElement[];
|
|
72
|
-
function first(elements: BoundsAwareModelElement[]): BoundsAwareModelElement[];
|
|
73
|
-
function last(elements: BoundsAwareModelElement[]): BoundsAwareModelElement[];
|
|
74
|
-
}
|
|
75
|
-
export declare class AlignElementsAction implements Action {
|
|
76
|
-
/**
|
|
77
|
-
* IDs of the elements that should be aligned. If no IDs are given, the selected elements will be aligned.
|
|
78
|
-
*/
|
|
79
|
-
readonly elementIds: string[];
|
|
80
|
-
/**
|
|
81
|
-
* Alignment direction.
|
|
82
|
-
*/
|
|
83
|
-
readonly alignment: Alignment;
|
|
84
|
-
/**
|
|
85
|
-
* Function to selected elements that are considered during alignment calculation, see Select.* for potential functions.
|
|
86
|
-
*/
|
|
87
|
-
readonly selectionFunction: (elements: BoundsAwareModelElement[]) => BoundsAwareModelElement[];
|
|
88
|
-
readonly kind: string;
|
|
89
|
-
constructor(
|
|
90
|
-
/**
|
|
91
|
-
* IDs of the elements that should be aligned. If no IDs are given, the selected elements will be aligned.
|
|
92
|
-
*/
|
|
93
|
-
elementIds?: string[],
|
|
94
|
-
/**
|
|
95
|
-
* Alignment direction.
|
|
96
|
-
*/
|
|
97
|
-
alignment?: Alignment,
|
|
98
|
-
/**
|
|
99
|
-
* Function to selected elements that are considered during alignment calculation, see Select.* for potential functions.
|
|
100
|
-
*/
|
|
101
|
-
selectionFunction?: (elements: BoundsAwareModelElement[]) => BoundsAwareModelElement[], kind?: string);
|
|
102
|
-
}
|
|
103
|
-
declare abstract class LayoutElementsCommand extends Command {
|
|
104
|
-
protected action: ResizeElementsAction | AlignElementsAction;
|
|
105
|
-
protected actionDispatcher: IActionDispatcher;
|
|
106
|
-
protected selectionService: SelectionService;
|
|
107
|
-
readonly movementRestrictor?: IMovementRestrictor | undefined;
|
|
108
|
-
constructor(action: ResizeElementsAction | AlignElementsAction, actionDispatcher: IActionDispatcher, selectionService: SelectionService, movementRestrictor?: IMovementRestrictor | undefined);
|
|
109
|
-
getActionElements(context: CommandExecutionContext): BoundsAwareModelElement[];
|
|
110
|
-
protected abstract isActionElement(element: SModelElement): element is BoundsAwareModelElement;
|
|
111
|
-
dispatchAction(action: Action): void;
|
|
112
|
-
dispatchActions(actions: Action[]): void;
|
|
113
|
-
}
|
|
114
|
-
export declare class ResizeElementsCommand extends LayoutElementsCommand {
|
|
115
|
-
protected action: ResizeElementsAction;
|
|
116
|
-
protected actionDispatcher: IActionDispatcher;
|
|
117
|
-
protected selectionService: SelectionService;
|
|
118
|
-
readonly movementRestrictor?: IMovementRestrictor | undefined;
|
|
119
|
-
static readonly KIND = "layout:resize";
|
|
120
|
-
constructor(action: ResizeElementsAction, actionDispatcher: IActionDispatcher, selectionService: SelectionService, movementRestrictor?: IMovementRestrictor | undefined);
|
|
121
|
-
protected isActionElement(element: SModelElement): element is BoundsAwareModelElement;
|
|
122
|
-
execute(context: CommandExecutionContext): CommandReturn;
|
|
123
|
-
resizeWidth(elements: BoundsAwareModelElement[]): void;
|
|
124
|
-
resizeHeight(elements: BoundsAwareModelElement[]): void;
|
|
125
|
-
resizeWidthAndHeight(elements: BoundsAwareModelElement[]): void;
|
|
126
|
-
dispatchResizeActions(elements: BoundsAwareModelElement[], change: (element: BoundsAwareModelElement, bounds: WriteableElementAndBounds) => void): void;
|
|
127
|
-
createElementAndBounds(element: BoundsAwareModelElement, change: (_element: BoundsAwareModelElement, _bounds: WriteableElementAndBounds) => void): WriteableElementAndBounds | undefined;
|
|
128
|
-
undo(context: CommandExecutionContext): CommandReturn;
|
|
129
|
-
redo(context: CommandExecutionContext): CommandReturn;
|
|
130
|
-
}
|
|
131
|
-
export declare class AlignElementsCommand extends LayoutElementsCommand {
|
|
132
|
-
protected action: AlignElementsAction;
|
|
133
|
-
protected actionDispatcher: IActionDispatcher;
|
|
134
|
-
protected selectionService: SelectionService;
|
|
135
|
-
readonly movementRestrictor?: IMovementRestrictor | undefined;
|
|
136
|
-
static readonly KIND = "layout:align";
|
|
137
|
-
constructor(action: AlignElementsAction, actionDispatcher: IActionDispatcher, selectionService: SelectionService, movementRestrictor?: IMovementRestrictor | undefined);
|
|
138
|
-
protected isActionElement(element: SModelElement): element is BoundsAwareModelElement;
|
|
139
|
-
execute(context: CommandExecutionContext): CommandReturn;
|
|
140
|
-
alignLeft(elements: BoundsAwareModelElement[]): void;
|
|
141
|
-
alignCenter(elements: BoundsAwareModelElement[]): void;
|
|
142
|
-
alignRight(elements: BoundsAwareModelElement[]): void;
|
|
143
|
-
alignTop(elements: BoundsAwareModelElement[]): void;
|
|
144
|
-
alignMiddle(elements: BoundsAwareModelElement[]): void;
|
|
145
|
-
alignBottom(elements: BoundsAwareModelElement[]): void;
|
|
146
|
-
dispatchAlignActions(elements: BoundsAwareModelElement[], change: (element: BoundsAwareModelElement, move: WriteableElementMove) => void): void;
|
|
147
|
-
createElementMove(element: BoundsAwareModelElement, change: (_element: BoundsAwareModelElement, _move: WriteableElementMove) => void): WriteableElementMove | undefined;
|
|
148
|
-
createElementAndBounds(element: BoundsAwareModelElement, move: ElementMove): ElementAndBounds;
|
|
149
|
-
undo(context: CommandExecutionContext): CommandReturn;
|
|
150
|
-
redo(context: CommandExecutionContext): CommandReturn;
|
|
151
|
-
}
|
|
152
|
-
export {};
|
|
153
|
-
//# sourceMappingURL=layout-commands.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layout-commands.d.ts","sourceRoot":"","sources":["../../../src/features/layout/layout-commands.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,415 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.AlignElementsCommand = exports.ResizeElementsCommand = exports.AlignElementsAction = exports.Select = exports.Alignment = exports.ResizeElementsAction = exports.Reduce = exports.ResizeDimension = void 0;
|
|
16
|
-
/********************************************************************************
|
|
17
|
-
* Copyright (c) 2019-2022 EclipseSource and others.
|
|
18
|
-
*
|
|
19
|
-
* This program and the accompanying materials are made available under the
|
|
20
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
21
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
22
|
-
*
|
|
23
|
-
* This Source Code may also be made available under the following Secondary
|
|
24
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
25
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
26
|
-
* with the GNU Classpath Exception which is available at
|
|
27
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
28
|
-
*
|
|
29
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
30
|
-
********************************************************************************/
|
|
31
|
-
const protocol_1 = require("@eclipse-glsp/protocol");
|
|
32
|
-
const inversify_1 = require("inversify");
|
|
33
|
-
const sprotty_1 = require("sprotty");
|
|
34
|
-
const types_1 = require("../../base/types");
|
|
35
|
-
const layout_utils_1 = require("../../utils/layout-utils");
|
|
36
|
-
const model_1 = require("../change-bounds/model");
|
|
37
|
-
const selection_service_1 = require("../select/selection-service");
|
|
38
|
-
// eslint-disable-next-line no-shadow
|
|
39
|
-
var ResizeDimension;
|
|
40
|
-
(function (ResizeDimension) {
|
|
41
|
-
ResizeDimension[ResizeDimension["Width"] = 0] = "Width";
|
|
42
|
-
ResizeDimension[ResizeDimension["Height"] = 1] = "Height";
|
|
43
|
-
ResizeDimension[ResizeDimension["Width_And_Height"] = 2] = "Width_And_Height";
|
|
44
|
-
})(ResizeDimension = exports.ResizeDimension || (exports.ResizeDimension = {}));
|
|
45
|
-
var Reduce;
|
|
46
|
-
(function (Reduce) {
|
|
47
|
-
function min(...values) {
|
|
48
|
-
return Math.min(...values);
|
|
49
|
-
}
|
|
50
|
-
Reduce.min = min;
|
|
51
|
-
function max(...values) {
|
|
52
|
-
return Math.max(...values);
|
|
53
|
-
}
|
|
54
|
-
Reduce.max = max;
|
|
55
|
-
function avg(...values) {
|
|
56
|
-
return values.reduce((a, b) => a + b, 0) / values.length;
|
|
57
|
-
}
|
|
58
|
-
Reduce.avg = avg;
|
|
59
|
-
function first(...values) {
|
|
60
|
-
return values[0];
|
|
61
|
-
}
|
|
62
|
-
Reduce.first = first;
|
|
63
|
-
function last(...values) {
|
|
64
|
-
return values[values.length - 1];
|
|
65
|
-
}
|
|
66
|
-
Reduce.last = last;
|
|
67
|
-
})(Reduce = exports.Reduce || (exports.Reduce = {}));
|
|
68
|
-
class ResizeElementsAction {
|
|
69
|
-
constructor(
|
|
70
|
-
/**
|
|
71
|
-
* IDs of the elements that should be resized. If no IDs are given, the selected elements will be resized.
|
|
72
|
-
*/
|
|
73
|
-
elementIds = [],
|
|
74
|
-
/**
|
|
75
|
-
* Resize dimension.
|
|
76
|
-
*/
|
|
77
|
-
dimension = ResizeDimension.Width,
|
|
78
|
-
/**
|
|
79
|
-
* Function to reduce the dimension to a target dimension value, see Reduce.* for potential functions.
|
|
80
|
-
*/
|
|
81
|
-
reductionFunction, kind = ResizeElementsCommand.KIND) {
|
|
82
|
-
this.elementIds = elementIds;
|
|
83
|
-
this.dimension = dimension;
|
|
84
|
-
this.reductionFunction = reductionFunction;
|
|
85
|
-
this.kind = kind;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
exports.ResizeElementsAction = ResizeElementsAction;
|
|
89
|
-
// eslint-disable-next-line no-shadow
|
|
90
|
-
var Alignment;
|
|
91
|
-
(function (Alignment) {
|
|
92
|
-
Alignment[Alignment["Left"] = 0] = "Left";
|
|
93
|
-
Alignment[Alignment["Center"] = 1] = "Center";
|
|
94
|
-
Alignment[Alignment["Right"] = 2] = "Right";
|
|
95
|
-
Alignment[Alignment["Top"] = 3] = "Top";
|
|
96
|
-
Alignment[Alignment["Middle"] = 4] = "Middle";
|
|
97
|
-
Alignment[Alignment["Bottom"] = 5] = "Bottom";
|
|
98
|
-
})(Alignment = exports.Alignment || (exports.Alignment = {}));
|
|
99
|
-
var Select;
|
|
100
|
-
(function (Select) {
|
|
101
|
-
function all(elements) {
|
|
102
|
-
return elements;
|
|
103
|
-
}
|
|
104
|
-
Select.all = all;
|
|
105
|
-
function first(elements) {
|
|
106
|
-
return [elements[0]];
|
|
107
|
-
}
|
|
108
|
-
Select.first = first;
|
|
109
|
-
function last(elements) {
|
|
110
|
-
return [elements[elements.length - 1]];
|
|
111
|
-
}
|
|
112
|
-
Select.last = last;
|
|
113
|
-
})(Select = exports.Select || (exports.Select = {}));
|
|
114
|
-
class AlignElementsAction {
|
|
115
|
-
constructor(
|
|
116
|
-
/**
|
|
117
|
-
* IDs of the elements that should be aligned. If no IDs are given, the selected elements will be aligned.
|
|
118
|
-
*/
|
|
119
|
-
elementIds = [],
|
|
120
|
-
/**
|
|
121
|
-
* Alignment direction.
|
|
122
|
-
*/
|
|
123
|
-
alignment = Alignment.Left,
|
|
124
|
-
/**
|
|
125
|
-
* Function to selected elements that are considered during alignment calculation, see Select.* for potential functions.
|
|
126
|
-
*/
|
|
127
|
-
selectionFunction = Select.all, kind = AlignElementsCommand.KIND) {
|
|
128
|
-
this.elementIds = elementIds;
|
|
129
|
-
this.alignment = alignment;
|
|
130
|
-
this.selectionFunction = selectionFunction;
|
|
131
|
-
this.kind = kind;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
exports.AlignElementsAction = AlignElementsAction;
|
|
135
|
-
let LayoutElementsCommand = class LayoutElementsCommand extends sprotty_1.Command {
|
|
136
|
-
constructor(action, actionDispatcher, selectionService, movementRestrictor) {
|
|
137
|
-
super();
|
|
138
|
-
this.action = action;
|
|
139
|
-
this.actionDispatcher = actionDispatcher;
|
|
140
|
-
this.selectionService = selectionService;
|
|
141
|
-
this.movementRestrictor = movementRestrictor;
|
|
142
|
-
}
|
|
143
|
-
getActionElements(context) {
|
|
144
|
-
const model = context.root;
|
|
145
|
-
const elementIDs = this.action.elementIds;
|
|
146
|
-
if (elementIDs.length === 0) {
|
|
147
|
-
// collect the selected elements from the selection service (selection order is kept by service)
|
|
148
|
-
this.selectionService.getSelectedElementIDs().forEach(elementID => elementIDs.push(elementID));
|
|
149
|
-
}
|
|
150
|
-
const boundsAwareElements = [];
|
|
151
|
-
elementIDs.forEach(id => {
|
|
152
|
-
const element = model.index.getById(id);
|
|
153
|
-
if (element && this.isActionElement(element)) {
|
|
154
|
-
boundsAwareElements.push(element);
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
return boundsAwareElements;
|
|
158
|
-
}
|
|
159
|
-
dispatchAction(action) {
|
|
160
|
-
this.actionDispatcher.dispatch(action);
|
|
161
|
-
}
|
|
162
|
-
dispatchActions(actions) {
|
|
163
|
-
this.actionDispatcher.dispatchAll(actions);
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
LayoutElementsCommand = __decorate([
|
|
167
|
-
(0, inversify_1.injectable)(),
|
|
168
|
-
__param(0, (0, inversify_1.inject)(sprotty_1.TYPES.Action)),
|
|
169
|
-
__param(1, (0, inversify_1.inject)(sprotty_1.TYPES.IActionDispatcher)),
|
|
170
|
-
__param(2, (0, inversify_1.inject)(types_1.GLSP_TYPES.SelectionService)),
|
|
171
|
-
__param(3, (0, inversify_1.inject)(types_1.GLSP_TYPES.IMovementRestrictor)),
|
|
172
|
-
__param(3, (0, inversify_1.optional)()),
|
|
173
|
-
__metadata("design:paramtypes", [Object, Object, selection_service_1.SelectionService, Object])
|
|
174
|
-
], LayoutElementsCommand);
|
|
175
|
-
let ResizeElementsCommand = class ResizeElementsCommand extends LayoutElementsCommand {
|
|
176
|
-
constructor(action, actionDispatcher, selectionService, movementRestrictor) {
|
|
177
|
-
super(action, actionDispatcher, selectionService, movementRestrictor);
|
|
178
|
-
this.action = action;
|
|
179
|
-
this.actionDispatcher = actionDispatcher;
|
|
180
|
-
this.selectionService = selectionService;
|
|
181
|
-
this.movementRestrictor = movementRestrictor;
|
|
182
|
-
}
|
|
183
|
-
isActionElement(element) {
|
|
184
|
-
return (0, model_1.isResizable)(element);
|
|
185
|
-
}
|
|
186
|
-
execute(context) {
|
|
187
|
-
const elements = this.getActionElements(context);
|
|
188
|
-
if (elements.length > 1) {
|
|
189
|
-
switch (this.action.dimension) {
|
|
190
|
-
case ResizeDimension.Width:
|
|
191
|
-
this.resizeWidth(elements);
|
|
192
|
-
break;
|
|
193
|
-
case ResizeDimension.Height:
|
|
194
|
-
this.resizeHeight(elements);
|
|
195
|
-
break;
|
|
196
|
-
case ResizeDimension.Width_And_Height:
|
|
197
|
-
this.resizeWidthAndHeight(elements);
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
return context.root;
|
|
202
|
-
}
|
|
203
|
-
resizeWidth(elements) {
|
|
204
|
-
const targetWidth = this.action.reductionFunction(...elements.map(element => element.bounds.width));
|
|
205
|
-
this.dispatchResizeActions(elements, (element, bounds) => {
|
|
206
|
-
// resize around center
|
|
207
|
-
const halfDiffWidth = 0.5 * (targetWidth - element.bounds.width);
|
|
208
|
-
bounds.newPosition.x = element.bounds.x - halfDiffWidth;
|
|
209
|
-
bounds.newSize.width = targetWidth;
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
resizeHeight(elements) {
|
|
213
|
-
const targetHeight = this.action.reductionFunction(...elements.map(element => element.bounds.height));
|
|
214
|
-
this.dispatchResizeActions(elements, (element, bounds) => {
|
|
215
|
-
// resize around middle
|
|
216
|
-
const halfDiffHeight = 0.5 * (targetHeight - element.bounds.height);
|
|
217
|
-
bounds.newPosition.y = element.bounds.y - halfDiffHeight;
|
|
218
|
-
bounds.newSize.height = targetHeight;
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
resizeWidthAndHeight(elements) {
|
|
222
|
-
const targetWidth = this.action.reductionFunction(...elements.map(element => element.bounds.width));
|
|
223
|
-
const targetHeight = this.action.reductionFunction(...elements.map(element => element.bounds.height));
|
|
224
|
-
this.dispatchResizeActions(elements, (element, bounds) => {
|
|
225
|
-
// resize around center and middle
|
|
226
|
-
const halfDiffWidth = 0.5 * (targetWidth - element.bounds.width);
|
|
227
|
-
const halfDiffHeight = 0.5 * (targetHeight - element.bounds.height);
|
|
228
|
-
bounds.newPosition.x = element.bounds.x - halfDiffWidth;
|
|
229
|
-
bounds.newPosition.y = element.bounds.y - halfDiffHeight;
|
|
230
|
-
bounds.newSize.width = targetWidth;
|
|
231
|
-
bounds.newSize.height = targetHeight;
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
dispatchResizeActions(elements, change) {
|
|
235
|
-
const elementAndBounds = []; // client- and server-side resize
|
|
236
|
-
elements.forEach(element => {
|
|
237
|
-
const elementChange = this.createElementAndBounds(element, change);
|
|
238
|
-
if (elementChange) {
|
|
239
|
-
// simply skip invalid changes
|
|
240
|
-
elementAndBounds.push(elementChange);
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
this.dispatchActions([new sprotty_1.SetBoundsAction(elementAndBounds), new protocol_1.ChangeBoundsOperation(elementAndBounds)]);
|
|
244
|
-
}
|
|
245
|
-
createElementAndBounds(element, change) {
|
|
246
|
-
const bounds = {
|
|
247
|
-
elementId: element.id,
|
|
248
|
-
newPosition: {
|
|
249
|
-
x: element.bounds.x,
|
|
250
|
-
y: element.bounds.y
|
|
251
|
-
},
|
|
252
|
-
newSize: {
|
|
253
|
-
width: element.bounds.width,
|
|
254
|
-
height: element.bounds.height
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
change(element, bounds);
|
|
258
|
-
return (0, layout_utils_1.toValidElementAndBounds)(element, bounds, this.movementRestrictor);
|
|
259
|
-
}
|
|
260
|
-
undo(context) {
|
|
261
|
-
// we dispatch another action which can be undone, so no explicit implementation necessary
|
|
262
|
-
return context.root;
|
|
263
|
-
}
|
|
264
|
-
redo(context) {
|
|
265
|
-
// we dispatch another action which can be redone, so no explicit implementation necessary
|
|
266
|
-
return context.root;
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
ResizeElementsCommand.KIND = 'layout:resize';
|
|
270
|
-
ResizeElementsCommand = __decorate([
|
|
271
|
-
(0, inversify_1.injectable)(),
|
|
272
|
-
__param(0, (0, inversify_1.inject)(sprotty_1.TYPES.Action)),
|
|
273
|
-
__param(1, (0, inversify_1.inject)(sprotty_1.TYPES.IActionDispatcher)),
|
|
274
|
-
__param(2, (0, inversify_1.inject)(types_1.GLSP_TYPES.SelectionService)),
|
|
275
|
-
__param(3, (0, inversify_1.inject)(types_1.GLSP_TYPES.IMovementRestrictor)),
|
|
276
|
-
__param(3, (0, inversify_1.optional)()),
|
|
277
|
-
__metadata("design:paramtypes", [ResizeElementsAction, Object, selection_service_1.SelectionService, Object])
|
|
278
|
-
], ResizeElementsCommand);
|
|
279
|
-
exports.ResizeElementsCommand = ResizeElementsCommand;
|
|
280
|
-
let AlignElementsCommand = class AlignElementsCommand extends LayoutElementsCommand {
|
|
281
|
-
constructor(action, actionDispatcher, selectionService, movementRestrictor) {
|
|
282
|
-
super(action, actionDispatcher, selectionService, movementRestrictor);
|
|
283
|
-
this.action = action;
|
|
284
|
-
this.actionDispatcher = actionDispatcher;
|
|
285
|
-
this.selectionService = selectionService;
|
|
286
|
-
this.movementRestrictor = movementRestrictor;
|
|
287
|
-
}
|
|
288
|
-
isActionElement(element) {
|
|
289
|
-
return (0, model_1.isBoundsAwareMoveable)(element);
|
|
290
|
-
}
|
|
291
|
-
execute(context) {
|
|
292
|
-
const elements = this.getActionElements(context);
|
|
293
|
-
if (elements.length > 1) {
|
|
294
|
-
switch (this.action.alignment) {
|
|
295
|
-
case Alignment.Left:
|
|
296
|
-
this.alignLeft(elements);
|
|
297
|
-
break;
|
|
298
|
-
case Alignment.Center:
|
|
299
|
-
this.alignCenter(elements);
|
|
300
|
-
break;
|
|
301
|
-
case Alignment.Right:
|
|
302
|
-
this.alignRight(elements);
|
|
303
|
-
break;
|
|
304
|
-
case Alignment.Top:
|
|
305
|
-
this.alignTop(elements);
|
|
306
|
-
break;
|
|
307
|
-
case Alignment.Middle:
|
|
308
|
-
this.alignMiddle(elements);
|
|
309
|
-
break;
|
|
310
|
-
case Alignment.Bottom:
|
|
311
|
-
this.alignBottom(elements);
|
|
312
|
-
break;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
return context.root;
|
|
316
|
-
}
|
|
317
|
-
alignLeft(elements) {
|
|
318
|
-
const calculationElements = this.action.selectionFunction(elements);
|
|
319
|
-
const minX = calculationElements.map(element => element.bounds.x).reduce((a, b) => Math.min(a, b));
|
|
320
|
-
this.dispatchAlignActions(elements, (_, move) => (move.toPosition.x = minX));
|
|
321
|
-
}
|
|
322
|
-
alignCenter(elements) {
|
|
323
|
-
const calculationElements = this.action.selectionFunction(elements);
|
|
324
|
-
const minX = calculationElements.map(element => element.bounds.x).reduce((a, b) => Math.min(a, b));
|
|
325
|
-
const maxX = calculationElements.map(element => element.bounds.x + element.bounds.width).reduce((a, b) => Math.max(a, b));
|
|
326
|
-
const diffX = maxX - minX;
|
|
327
|
-
const centerX = minX + 0.5 * diffX;
|
|
328
|
-
this.dispatchAlignActions(elements, (element, move) => (move.toPosition.x = centerX - 0.5 * element.bounds.width));
|
|
329
|
-
}
|
|
330
|
-
alignRight(elements) {
|
|
331
|
-
const calculationElements = this.action.selectionFunction(elements);
|
|
332
|
-
const maxX = calculationElements.map(element => element.bounds.x + element.bounds.width).reduce((a, b) => Math.max(a, b));
|
|
333
|
-
this.dispatchAlignActions(elements, (element, move) => (move.toPosition.x = maxX - element.bounds.width));
|
|
334
|
-
}
|
|
335
|
-
alignTop(elements) {
|
|
336
|
-
const calculationElements = this.action.selectionFunction(elements);
|
|
337
|
-
const minY = calculationElements.map(element => element.bounds.y).reduce((a, b) => Math.min(a, b));
|
|
338
|
-
this.dispatchAlignActions(elements, (_, move) => (move.toPosition.y = minY));
|
|
339
|
-
}
|
|
340
|
-
alignMiddle(elements) {
|
|
341
|
-
const calculationElements = this.action.selectionFunction(elements);
|
|
342
|
-
const minY = calculationElements.map(element => element.bounds.y).reduce((a, b) => Math.min(a, b));
|
|
343
|
-
const maxY = calculationElements.map(element => element.bounds.y + element.bounds.height).reduce((a, b) => Math.max(a, b));
|
|
344
|
-
const diffY = maxY - minY;
|
|
345
|
-
const middleY = minY + 0.5 * diffY;
|
|
346
|
-
this.dispatchAlignActions(elements, (element, move) => (move.toPosition.y = middleY - 0.5 * element.bounds.height));
|
|
347
|
-
}
|
|
348
|
-
alignBottom(elements) {
|
|
349
|
-
const calculationElements = this.action.selectionFunction(elements);
|
|
350
|
-
const maxY = calculationElements.map(element => element.bounds.y + element.bounds.height).reduce((a, b) => Math.max(a, b));
|
|
351
|
-
this.dispatchAlignActions(elements, (element, move) => (move.toPosition.y = maxY - element.bounds.height));
|
|
352
|
-
}
|
|
353
|
-
dispatchAlignActions(elements, change) {
|
|
354
|
-
const moves = []; // client-side move
|
|
355
|
-
const elementAndBounds = []; // server-side move
|
|
356
|
-
elements.forEach(element => {
|
|
357
|
-
const move = this.createElementMove(element, change);
|
|
358
|
-
if (move) {
|
|
359
|
-
// simply skip invalid changes
|
|
360
|
-
moves.push(move);
|
|
361
|
-
const elementAndBound = this.createElementAndBounds(element, move);
|
|
362
|
-
elementAndBounds.push(elementAndBound);
|
|
363
|
-
}
|
|
364
|
-
});
|
|
365
|
-
this.dispatchActions([new sprotty_1.MoveAction(moves), new protocol_1.ChangeBoundsOperation(elementAndBounds)]);
|
|
366
|
-
}
|
|
367
|
-
createElementMove(element, change) {
|
|
368
|
-
const move = {
|
|
369
|
-
elementId: element.id,
|
|
370
|
-
fromPosition: {
|
|
371
|
-
x: element.bounds.x,
|
|
372
|
-
y: element.bounds.y
|
|
373
|
-
},
|
|
374
|
-
toPosition: {
|
|
375
|
-
x: element.bounds.x,
|
|
376
|
-
y: element.bounds.y
|
|
377
|
-
}
|
|
378
|
-
};
|
|
379
|
-
change(element, move);
|
|
380
|
-
return (0, layout_utils_1.toValidElementMove)(element, move, this.movementRestrictor);
|
|
381
|
-
}
|
|
382
|
-
createElementAndBounds(element, move) {
|
|
383
|
-
return {
|
|
384
|
-
elementId: element.id,
|
|
385
|
-
newPosition: {
|
|
386
|
-
x: move.toPosition.x,
|
|
387
|
-
y: move.toPosition.y
|
|
388
|
-
},
|
|
389
|
-
newSize: {
|
|
390
|
-
width: element.bounds.width,
|
|
391
|
-
height: element.bounds.height
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
undo(context) {
|
|
396
|
-
// we dispatch another action which can be undone, so no explicit implementation necessary
|
|
397
|
-
return context.root;
|
|
398
|
-
}
|
|
399
|
-
redo(context) {
|
|
400
|
-
// we dispatch another action which can be redone, so no explicit implementation necessary
|
|
401
|
-
return context.root;
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
AlignElementsCommand.KIND = 'layout:align';
|
|
405
|
-
AlignElementsCommand = __decorate([
|
|
406
|
-
(0, inversify_1.injectable)(),
|
|
407
|
-
__param(0, (0, inversify_1.inject)(sprotty_1.TYPES.Action)),
|
|
408
|
-
__param(1, (0, inversify_1.inject)(sprotty_1.TYPES.IActionDispatcher)),
|
|
409
|
-
__param(2, (0, inversify_1.inject)(types_1.GLSP_TYPES.SelectionService)),
|
|
410
|
-
__param(3, (0, inversify_1.inject)(types_1.GLSP_TYPES.IMovementRestrictor)),
|
|
411
|
-
__param(3, (0, inversify_1.optional)()),
|
|
412
|
-
__metadata("design:paramtypes", [AlignElementsAction, Object, selection_service_1.SelectionService, Object])
|
|
413
|
-
], AlignElementsCommand);
|
|
414
|
-
exports.AlignElementsCommand = AlignElementsCommand;
|
|
415
|
-
//# sourceMappingURL=layout-commands.js.map
|