@eclipse-glsp/client 2.8.0-next.0 → 2.8.0-next.12
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/README.md +1 -1
- package/css/grid.css +2 -1
- package/lib/base/action-dispatcher.js +1 -4
- package/lib/base/action-dispatcher.js.map +1 -1
- package/lib/base/auto-complete/auto-complete-widget.js +4 -8
- package/lib/base/auto-complete/auto-complete-widget.js.map +1 -1
- package/lib/base/auto-complete/base-autocomplete-palette.js +1 -2
- package/lib/base/auto-complete/base-autocomplete-palette.js.map +1 -1
- package/lib/base/editor-context-service.js +4 -7
- package/lib/base/editor-context-service.js.map +1 -1
- package/lib/base/feedback/css-feedback.js +1 -1
- package/lib/base/feedback/css-feedback.js.map +1 -1
- package/lib/base/feedback/feedback-action-dispatcher.js +4 -6
- package/lib/base/feedback/feedback-action-dispatcher.js.map +1 -1
- package/lib/base/feedback/feedback-command.js +1 -2
- package/lib/base/feedback/feedback-command.js.map +1 -1
- package/lib/base/feedback/feedback-emitter.js +1 -2
- package/lib/base/feedback/feedback-emitter.js.map +1 -1
- package/lib/base/feedback/set-model-command.js +1 -2
- package/lib/base/feedback/set-model-command.js.map +1 -1
- package/lib/base/feedback/update-model-command.js +1 -2
- package/lib/base/feedback/update-model-command.js.map +1 -1
- package/lib/base/model/diagram-loader.js +4 -6
- package/lib/base/model/diagram-loader.js.map +1 -1
- package/lib/base/model/glsp-model-source.js +3 -5
- package/lib/base/model/glsp-model-source.js.map +1 -1
- package/lib/base/model/model-registry.js +1 -2
- package/lib/base/model/model-registry.js.map +1 -1
- package/lib/base/selection-service.js +3 -3
- package/lib/base/selection-service.js.map +1 -1
- package/lib/base/shortcuts/available-shortcuts-extension.js +3 -2
- package/lib/base/shortcuts/available-shortcuts-extension.js.map +1 -1
- package/lib/base/shortcuts/available-shortcuts-tool.js +3 -2
- package/lib/base/shortcuts/available-shortcuts-tool.js.map +1 -1
- package/lib/base/tool-manager/tool-manager.js +1 -1
- package/lib/base/tool-manager/tool-manager.js.map +1 -1
- package/lib/base/ui-extension/ui-extension.js +4 -6
- package/lib/base/ui-extension/ui-extension.js.map +1 -1
- package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-palette.js +12 -17
- package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-palette.js.map +1 -1
- package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-tool.js +3 -2
- package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-tool.js.map +1 -1
- package/lib/features/accessibility/element-navigation/diagram-navigation-tool.js +11 -15
- package/lib/features/accessibility/element-navigation/diagram-navigation-tool.js.map +1 -1
- package/lib/features/accessibility/element-navigation/left-right-top-bottom-navigator.js +2 -3
- package/lib/features/accessibility/element-navigation/left-right-top-bottom-navigator.js.map +1 -1
- package/lib/features/accessibility/element-navigation/local-element-navigator.js +2 -3
- package/lib/features/accessibility/element-navigation/local-element-navigator.js.map +1 -1
- package/lib/features/accessibility/focus-tracker/focus-tracker-tool.js +5 -4
- package/lib/features/accessibility/focus-tracker/focus-tracker-tool.js.map +1 -1
- package/lib/features/accessibility/global-keylistener-tool.js +4 -3
- package/lib/features/accessibility/global-keylistener-tool.js.map +1 -1
- package/lib/features/accessibility/keyboard-grid/keyboard-grid-search-palette.js +3 -2
- package/lib/features/accessibility/keyboard-grid/keyboard-grid-search-palette.js.map +1 -1
- package/lib/features/accessibility/keyboard-pointer/keyboard-pointer.d.ts +9 -1
- package/lib/features/accessibility/keyboard-pointer/keyboard-pointer.d.ts.map +1 -1
- package/lib/features/accessibility/keyboard-pointer/keyboard-pointer.js +12 -4
- package/lib/features/accessibility/keyboard-pointer/keyboard-pointer.js.map +1 -1
- package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.js +5 -7
- package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.js.map +1 -1
- package/lib/features/accessibility/toast/toast-handler.js +2 -4
- package/lib/features/accessibility/toast/toast-handler.js.map +1 -1
- package/lib/features/accessibility/toast/toast-tool.js +3 -2
- package/lib/features/accessibility/toast/toast-tool.js.map +1 -1
- package/lib/features/accessibility/view-key-tools/deselect-key-tool.js +3 -2
- package/lib/features/accessibility/view-key-tools/deselect-key-tool.js.map +1 -1
- package/lib/features/accessibility/view-key-tools/grid-cell-zoom-key-tool.js +4 -3
- package/lib/features/accessibility/view-key-tools/grid-cell-zoom-key-tool.js.map +1 -1
- package/lib/features/bounds/freeform-layout.js +1 -1
- package/lib/features/bounds/freeform-layout.js.map +1 -1
- package/lib/features/bounds/hbox-layout.js +7 -10
- package/lib/features/bounds/hbox-layout.js.map +1 -1
- package/lib/features/bounds/layout-data.js +2 -4
- package/lib/features/bounds/layout-data.js.map +1 -1
- package/lib/features/bounds/local-bounds.js +3 -4
- package/lib/features/bounds/local-bounds.js.map +1 -1
- package/lib/features/bounds/set-bounds-feedback-command.js +2 -3
- package/lib/features/bounds/set-bounds-feedback-command.js.map +1 -1
- package/lib/features/bounds/vbox-layout.js +7 -10
- package/lib/features/bounds/vbox-layout.js.map +1 -1
- package/lib/features/change-bounds/model.js +1 -1
- package/lib/features/change-bounds/model.js.map +1 -1
- package/lib/features/change-bounds/move-element-handler.js +1 -2
- package/lib/features/change-bounds/move-element-handler.js.map +1 -1
- package/lib/features/change-bounds/movement-restrictor.js +1 -2
- package/lib/features/change-bounds/movement-restrictor.js.map +1 -1
- package/lib/features/change-bounds/point-position-updater.js +1 -1
- package/lib/features/change-bounds/point-position-updater.js.map +1 -1
- package/lib/features/change-bounds/resize/resize-default-tool.js +4 -3
- package/lib/features/change-bounds/resize/resize-default-tool.js.map +1 -1
- package/lib/features/change-bounds/resize/resize-handler.js +1 -2
- package/lib/features/change-bounds/resize/resize-handler.js.map +1 -1
- package/lib/features/change-bounds/resize/resize-tool.js +4 -3
- package/lib/features/change-bounds/resize/resize-tool.js.map +1 -1
- package/lib/features/change-bounds/tracker.js +1 -2
- package/lib/features/change-bounds/tracker.js.map +1 -1
- package/lib/features/command-palette/command-palette-tool.js +3 -2
- package/lib/features/command-palette/command-palette-tool.js.map +1 -1
- package/lib/features/command-palette/command-palette.d.ts.map +1 -1
- package/lib/features/command-palette/command-palette.js +6 -5
- package/lib/features/command-palette/command-palette.js.map +1 -1
- package/lib/features/context-menu/glsp-context-menu-mouse-listener.js +2 -3
- package/lib/features/context-menu/glsp-context-menu-mouse-listener.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 +3 -5
- package/lib/features/copy-paste/copy-paste-handler.js.map +1 -1
- package/lib/features/copy-paste/copy-paste-standalone.js +6 -9
- package/lib/features/copy-paste/copy-paste-standalone.js.map +1 -1
- package/lib/features/debug/debug-bounds-decorator.js +9 -12
- package/lib/features/debug/debug-bounds-decorator.js.map +1 -1
- package/lib/features/debug/debug-model.js +1 -1
- package/lib/features/debug/debug-model.js.map +1 -1
- package/lib/features/decoration/decoration-placer.js +3 -2
- package/lib/features/decoration/decoration-placer.js.map +1 -1
- package/lib/features/element-template/add-template-element.js +3 -4
- package/lib/features/element-template/add-template-element.js.map +1 -1
- package/lib/features/element-template/mouse-tracking-element-position-listener.js +1 -1
- package/lib/features/element-template/mouse-tracking-element-position-listener.js.map +1 -1
- package/lib/features/element-template/remove-template-element.js +1 -1
- package/lib/features/element-template/remove-template-element.js.map +1 -1
- package/lib/features/export/default-png-diagram-exporter.js +4 -7
- package/lib/features/export/default-png-diagram-exporter.js.map +1 -1
- package/lib/features/export/diagram-export-postprocessor.js +1 -2
- package/lib/features/export/diagram-export-postprocessor.js.map +1 -1
- package/lib/features/export/glsp-svg-exporter.d.ts.map +1 -1
- package/lib/features/export/glsp-svg-exporter.js +5 -6
- package/lib/features/export/glsp-svg-exporter.js.map +1 -1
- package/lib/features/export/request-export-command.js +1 -1
- package/lib/features/export/request-export-command.js.map +1 -1
- package/lib/features/grid/grid-model.js +1 -1
- package/lib/features/grid/grid-model.js.map +1 -1
- package/lib/features/helper-lines/helper-line-feedback.js +7 -8
- package/lib/features/helper-lines/helper-line-feedback.js.map +1 -1
- package/lib/features/helper-lines/model.d.ts +1 -1
- package/lib/features/helper-lines/model.d.ts.map +1 -1
- package/lib/features/helper-lines/model.js +3 -4
- package/lib/features/helper-lines/model.js.map +1 -1
- package/lib/features/hints/type-hint-provider.js +3 -5
- package/lib/features/hints/type-hint-provider.js.map +1 -1
- package/lib/features/label-edit/edit-label-tool.js +3 -2
- package/lib/features/label-edit/edit-label-tool.js.map +1 -1
- package/lib/features/label-edit-ui/label-edit-ui.js +2 -3
- package/lib/features/label-edit-ui/label-edit-ui.js.map +1 -1
- package/lib/features/navigation/navigation-target-resolver.js +1 -1
- package/lib/features/navigation/navigation-target-resolver.js.map +1 -1
- package/lib/features/routing/sticky-manhattan-anchors.js +9 -6
- package/lib/features/routing/sticky-manhattan-anchors.js.map +1 -1
- package/lib/features/routing/sticky-manhattan-edge-router.js +10 -12
- package/lib/features/routing/sticky-manhattan-edge-router.js.map +1 -1
- package/lib/features/search-palette/search-palette.js +3 -2
- package/lib/features/search-palette/search-palette.js.map +1 -1
- package/lib/features/search-palette/suggestions/edge-element-suggestions.js +2 -3
- package/lib/features/search-palette/suggestions/edge-element-suggestions.js.map +1 -1
- package/lib/features/search-palette/suggestions/named-element-suggestions.js +8 -11
- package/lib/features/search-palette/suggestions/named-element-suggestions.js.map +1 -1
- package/lib/features/select/select-feedback-command.js +1 -1
- package/lib/features/select/select-feedback-command.js.map +1 -1
- package/lib/features/select/select-mouse-listener.js +1 -2
- package/lib/features/select/select-mouse-listener.js.map +1 -1
- package/lib/features/status/status-overlay.js +4 -4
- package/lib/features/status/status-overlay.js.map +1 -1
- package/lib/features/tool-palette/tool-palette.js +14 -19
- package/lib/features/tool-palette/tool-palette.js.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-manager.js +4 -6
- package/lib/features/tools/change-bounds/change-bounds-manager.js.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool-feedback.js +3 -4
- package/lib/features/tools/change-bounds/change-bounds-tool-feedback.js.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool-move-feedback.js +4 -8
- package/lib/features/tools/change-bounds/change-bounds-tool-move-feedback.js.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool.js +6 -6
- package/lib/features/tools/change-bounds/change-bounds-tool.js.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tracker.js +7 -10
- package/lib/features/tools/change-bounds/change-bounds-tracker.js.map +1 -1
- package/lib/features/tools/deletion/delete-tool.js +6 -4
- package/lib/features/tools/deletion/delete-tool.js.map +1 -1
- package/lib/features/tools/edge-creation/dangling-edge-feedback.js +4 -4
- package/lib/features/tools/edge-creation/dangling-edge-feedback.js.map +1 -1
- package/lib/features/tools/edge-creation/edge-creation-tool.js +5 -6
- package/lib/features/tools/edge-creation/edge-creation-tool.js.map +1 -1
- package/lib/features/tools/edge-creation/view.js +1 -2
- package/lib/features/tools/edge-creation/view.js.map +1 -1
- package/lib/features/tools/edge-edit/edge-edit-tool-feedback.js +4 -4
- package/lib/features/tools/edge-edit/edge-edit-tool-feedback.js.map +1 -1
- package/lib/features/tools/edge-edit/edge-edit-tool.js +3 -2
- package/lib/features/tools/edge-edit/edge-edit-tool.js.map +1 -1
- package/lib/features/tools/marquee-selection/marquee-mouse-tool.js +3 -2
- package/lib/features/tools/marquee-selection/marquee-mouse-tool.js.map +1 -1
- package/lib/features/tools/marquee-selection/marquee-tool-feedback.js +2 -2
- package/lib/features/tools/marquee-selection/marquee-tool-feedback.js.map +1 -1
- package/lib/features/tools/marquee-selection/marquee-tool.js +3 -2
- package/lib/features/tools/marquee-selection/marquee-tool.js.map +1 -1
- package/lib/features/tools/marquee-selection/model.js +1 -1
- package/lib/features/tools/marquee-selection/model.js.map +1 -1
- package/lib/features/tools/node-creation/container-manager.js +3 -4
- package/lib/features/tools/node-creation/container-manager.js.map +1 -1
- package/lib/features/tools/node-creation/insert-indicator.d.ts +1 -1
- package/lib/features/tools/node-creation/insert-indicator.d.ts.map +1 -1
- package/lib/features/tools/node-creation/insert-indicator.js +4 -5
- package/lib/features/tools/node-creation/insert-indicator.js.map +1 -1
- package/lib/features/tools/node-creation/node-creation-tool.js +5 -6
- package/lib/features/tools/node-creation/node-creation-tool.js.map +1 -1
- package/lib/features/tools/node-creation/node-creation-views.js +1 -2
- package/lib/features/tools/node-creation/node-creation-views.js.map +1 -1
- package/lib/features/validation/marker-navigator.js +1 -1
- package/lib/features/validation/marker-navigator.js.map +1 -1
- package/lib/features/validation/validate.js +4 -6
- package/lib/features/validation/validate.js.map +1 -1
- package/lib/features/viewport/origin-viewport.js +1 -1
- package/lib/features/viewport/origin-viewport.js.map +1 -1
- package/lib/features/viewport/reposition.js +2 -3
- package/lib/features/viewport/reposition.js.map +1 -1
- package/lib/features/viewport/viewport-handler.js +2 -3
- package/lib/features/viewport/viewport-handler.js.map +1 -1
- package/lib/features/viewport/viewport-tool.js +4 -3
- package/lib/features/viewport/viewport-tool.js.map +1 -1
- package/lib/features/zorder/bring-to-front-command.js +1 -2
- package/lib/features/zorder/bring-to-front-command.js.map +1 -1
- package/lib/model.js +2 -2
- package/lib/model.js.map +1 -1
- package/lib/utils/argument-utils.js +5 -5
- package/lib/utils/argument-utils.js.map +1 -1
- package/lib/utils/gmodel-util.js +4 -6
- package/lib/utils/gmodel-util.js.map +1 -1
- package/lib/utils/layout-utils.js +1 -2
- package/lib/utils/layout-utils.js.map +1 -1
- package/lib/utils/viewpoint-util.d.ts +13 -1
- package/lib/utils/viewpoint-util.d.ts.map +1 -1
- package/lib/utils/viewpoint-util.js +22 -1
- package/lib/utils/viewpoint-util.js.map +1 -1
- package/lib/views/glsp-projection-view.d.ts +12 -1
- package/lib/views/glsp-projection-view.d.ts.map +1 -1
- package/lib/views/glsp-projection-view.js +51 -1
- package/lib/views/glsp-projection-view.js.map +1 -1
- package/package.json +17 -16
- package/src/base/feedback/feedback-command.ts +1 -1
- package/src/features/accessibility/README.md +5 -5
- package/src/features/accessibility/keyboard-pointer/keyboard-pointer.ts +12 -3
- package/src/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.ts +1 -1
- package/src/features/command-palette/command-palette.ts +4 -2
- package/src/features/copy-paste/copy-paste-handler.ts +3 -3
- package/src/features/export/glsp-svg-exporter.ts +2 -2
- package/src/features/helper-lines/model.ts +4 -5
- package/src/features/tools/node-creation/insert-indicator.ts +3 -4
- package/src/utils/viewpoint-util.ts +23 -1
- package/src/views/glsp-projection-view.tsx +58 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2023-
|
|
2
|
+
* Copyright (c) 2023-2026 Business Informatics Group (TU Wien) 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
|
|
@@ -18,6 +18,7 @@ import { inject, injectable } from 'inversify';
|
|
|
18
18
|
import { EditorContextService } from '../../../base/editor-context-service';
|
|
19
19
|
import { CursorCSS } from '../../../base/feedback/css-feedback';
|
|
20
20
|
import { GLSPAbstractUIExtension } from '../../../base/ui-extension/ui-extension';
|
|
21
|
+
import { pageToCssPosition } from '../../../utils/viewpoint-util';
|
|
21
22
|
import { ContainerManager } from '../../tools/node-creation/container-manager';
|
|
22
23
|
import { KeyboardGridCellSelectedAction } from '../keyboard-grid/action';
|
|
23
24
|
import { SetKeyboardPointerRenderPositionAction } from './actions';
|
|
@@ -50,8 +51,12 @@ export class KeyboardPointer extends GLSPAbstractUIExtension implements IActionH
|
|
|
50
51
|
return this._triggerAction;
|
|
51
52
|
}
|
|
52
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Whether the pointer is currently shown. Reflects the `hidden` css class toggled by
|
|
56
|
+
* {@link GLSPAbstractUIExtension}, not the inline `visibility` style.
|
|
57
|
+
*/
|
|
53
58
|
get isVisible(): boolean {
|
|
54
|
-
return this.containerElement
|
|
59
|
+
return !!this.containerElement && this.isContainerVisible();
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
get getPosition(): KeyboardPointerPosition {
|
|
@@ -92,9 +97,13 @@ export class KeyboardPointer extends GLSPAbstractUIExtension implements IActionH
|
|
|
92
97
|
}
|
|
93
98
|
}
|
|
94
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Positions the pointer on the selected grid cell and colors it to indicate whether node creation
|
|
102
|
+
* is allowed at that location.
|
|
103
|
+
*/
|
|
95
104
|
render(): void {
|
|
96
105
|
if (this.containerElement !== undefined) {
|
|
97
|
-
const { x, y } = this.position.renderPosition;
|
|
106
|
+
const { x, y } = pageToCssPosition(this.containerElement, this.position.renderPosition);
|
|
98
107
|
this.containerElement.style.left = `${x}px`;
|
|
99
108
|
this.containerElement.style.top = `${y}px`;
|
|
100
109
|
|
|
@@ -218,7 +218,7 @@ export class KeyboardToolPalette extends ToolPalette {
|
|
|
218
218
|
|
|
219
219
|
// Create button for Search
|
|
220
220
|
this.searchToolButton = this.createSearchButton();
|
|
221
|
-
this.headerToolsButtonMapping.set(mappingIndex
|
|
221
|
+
this.headerToolsButtonMapping.set(mappingIndex, this.searchToolButton);
|
|
222
222
|
headerTools.appendChild(this.searchToolButton);
|
|
223
223
|
|
|
224
224
|
return headerTools;
|
|
@@ -18,6 +18,7 @@ import { Bounds, CommandPalette, getWindowScroll, GModelElement, GModelRoot } fr
|
|
|
18
18
|
import { injectable } from 'inversify';
|
|
19
19
|
import { CSS_HIDDEN_EXTENSION_CLASS, CSS_UI_EXTENSION_CLASS } from '../../base/ui-extension/ui-extension';
|
|
20
20
|
import { getElements, isSelectableAndBoundsAware } from '../../utils/gmodel-util';
|
|
21
|
+
import { pageToCssPosition } from '../../utils/viewpoint-util';
|
|
21
22
|
|
|
22
23
|
@injectable()
|
|
23
24
|
export class GlspCommandPalette extends CommandPalette {
|
|
@@ -49,8 +50,9 @@ export class GlspCommandPalette extends CommandPalette {
|
|
|
49
50
|
x += bounds.x;
|
|
50
51
|
y += bounds.y;
|
|
51
52
|
}
|
|
52
|
-
|
|
53
|
-
containerElement.style.
|
|
53
|
+
const { x: cssX, y: cssY } = pageToCssPosition(containerElement, { x, y });
|
|
54
|
+
containerElement.style.left = `${cssX}px`;
|
|
55
|
+
containerElement.style.top = `${cssY}px`;
|
|
54
56
|
containerElement.style.width = `${this.defaultWidth}px`;
|
|
55
57
|
}
|
|
56
58
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2026 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import {
|
|
17
17
|
ClipboardData,
|
|
18
18
|
CutOperation,
|
|
19
|
+
generateUuid,
|
|
19
20
|
IActionDispatcher,
|
|
20
21
|
PasteOperation,
|
|
21
22
|
RequestClipboardDataAction,
|
|
@@ -24,7 +25,6 @@ import {
|
|
|
24
25
|
ViewerOptions
|
|
25
26
|
} from '@eclipse-glsp/sprotty';
|
|
26
27
|
import { inject, injectable } from 'inversify';
|
|
27
|
-
import { v4 as uuid } from 'uuid';
|
|
28
28
|
import { EditorContextService } from '../../base/editor-context-service';
|
|
29
29
|
|
|
30
30
|
export interface ICopyPasteHandler {
|
|
@@ -107,7 +107,7 @@ export class ServerCopyPasteHandler implements ICopyPasteHandler {
|
|
|
107
107
|
|
|
108
108
|
handleCopy(event: ClipboardEvent): void {
|
|
109
109
|
if (event.clipboardData && this.shouldCopy(event)) {
|
|
110
|
-
const clipboardId =
|
|
110
|
+
const clipboardId = generateUuid();
|
|
111
111
|
event.clipboardData.setData(CLIPBOARD_DATA_FORMAT, toClipboardId(clipboardId));
|
|
112
112
|
this.actionDispatcher
|
|
113
113
|
.request<SetClipboardDataAction>(RequestClipboardDataAction.create(this.editorContext.get()))
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
Action,
|
|
19
19
|
ExportSvgAction,
|
|
20
20
|
ExportSvgOptions,
|
|
21
|
+
generateUuid,
|
|
21
22
|
GModelRoot,
|
|
22
23
|
RejectAction,
|
|
23
24
|
RequestAction,
|
|
@@ -25,7 +26,6 @@ import {
|
|
|
25
26
|
SvgExporter
|
|
26
27
|
} from '@eclipse-glsp/sprotty';
|
|
27
28
|
import { injectable } from 'inversify';
|
|
28
|
-
import { v4 as uuid } from 'uuid';
|
|
29
29
|
|
|
30
30
|
@injectable()
|
|
31
31
|
export class GLSPSvgExporter extends SvgExporter {
|
|
@@ -82,7 +82,7 @@ export class GLSPSvgExporter extends SvgExporter {
|
|
|
82
82
|
// createSvg requires the svg to have a non-empty id, so we generate one if necessary
|
|
83
83
|
const originalId = svgElement.id;
|
|
84
84
|
try {
|
|
85
|
-
svgElement.id = originalId ||
|
|
85
|
+
svgElement.id = originalId || generateUuid();
|
|
86
86
|
return super.createSvg(svgElement, root, options, cause);
|
|
87
87
|
} finally {
|
|
88
88
|
svgElement.id = originalId;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2023-
|
|
2
|
+
* Copyright (c) 2023-2026 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
-
import { Args, Bounds, Direction, GChildElement, GModelElement, GShapeElement, Point, Vector } from '@eclipse-glsp/sprotty';
|
|
18
|
-
import { v4 as uuid } from 'uuid';
|
|
17
|
+
import { Args, Bounds, Direction, GChildElement, GModelElement, GShapeElement, Point, Vector, generateUuid } from '@eclipse-glsp/sprotty';
|
|
19
18
|
import { ArgsAware } from '../../base/args-feature';
|
|
20
19
|
import { ResizeHandleLocation } from '../change-bounds/model';
|
|
21
20
|
|
|
@@ -46,7 +45,7 @@ export class HelperLine extends GChildElement implements ArgsAware {
|
|
|
46
45
|
readonly lineType: HelperLineType = HelperLineType.Left
|
|
47
46
|
) {
|
|
48
47
|
super();
|
|
49
|
-
this.id =
|
|
48
|
+
this.id = generateUuid();
|
|
50
49
|
this.type = HELPER_LINE;
|
|
51
50
|
}
|
|
52
51
|
|
|
@@ -86,7 +85,7 @@ export class SelectionBounds extends GShapeElement implements ArgsAware {
|
|
|
86
85
|
|
|
87
86
|
constructor(bounds?: Bounds) {
|
|
88
87
|
super();
|
|
89
|
-
this.id =
|
|
88
|
+
this.id = generateUuid();
|
|
90
89
|
this.type = SELECTION_BOUNDS;
|
|
91
90
|
if (bounds) {
|
|
92
91
|
this.bounds = bounds;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2024 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2024-2026 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
-
import { Args, Dimension, FeatureSet, GNode, boundsFeature, createFeatureSet, moveFeature } from '@eclipse-glsp/sprotty';
|
|
18
|
-
import { v4 as uuid } from 'uuid';
|
|
17
|
+
import { Args, Dimension, FeatureSet, GNode, boundsFeature, createFeatureSet, generateUuid, moveFeature } from '@eclipse-glsp/sprotty';
|
|
19
18
|
import { ArgsAware, argsFeature } from '../../../base/args-feature';
|
|
20
19
|
|
|
21
20
|
export const ARG_LENGTH = 'length';
|
|
@@ -25,7 +24,7 @@ export class InsertIndicator extends GNode implements ArgsAware {
|
|
|
25
24
|
|
|
26
25
|
static TYPE = 'node:insert-indicator';
|
|
27
26
|
|
|
28
|
-
override id: string =
|
|
27
|
+
override id: string = generateUuid();
|
|
29
28
|
override type: string = InsertIndicator.TYPE;
|
|
30
29
|
override features?: FeatureSet = createFeatureSet(InsertIndicator.DEFAULT_FEATURES);
|
|
31
30
|
override cssClasses: string[] = ['insert-indicator', 'sprotty-node'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2026 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
Point,
|
|
24
24
|
Viewport,
|
|
25
25
|
findParentByFeature,
|
|
26
|
+
getWindowScroll,
|
|
26
27
|
isAlignable,
|
|
27
28
|
isBoundsAware,
|
|
28
29
|
isViewport,
|
|
@@ -61,6 +62,27 @@ export function getAbsolutePositionByPoint(target: GModelElement, point: Point):
|
|
|
61
62
|
return position;
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Computes the CSS `left`/`top` (in pixels) for placing {@link element} at the given point in page
|
|
67
|
+
* coordinates, accounting for its positioning context: relative to its `offsetParent` (the diagram
|
|
68
|
+
* container for absolutely positioned overlays) or, when there is none, relative to the viewport for
|
|
69
|
+
* fixed elements. This lets UI extensions be placed on the diagram canvas independently of where the
|
|
70
|
+
* diagram container sits within the page (e.g. below an application header).
|
|
71
|
+
*
|
|
72
|
+
* @param element the DOM-attached element to position
|
|
73
|
+
* @param pagePoint the target location in page coordinates
|
|
74
|
+
* @returns the `left`/`top` offset to assign to {@link element}'s style
|
|
75
|
+
*/
|
|
76
|
+
export function pageToCssPosition(element: HTMLElement, pagePoint: Point): Point {
|
|
77
|
+
const scroll = getWindowScroll();
|
|
78
|
+
const offsetParent = element.offsetParent as HTMLElement | null;
|
|
79
|
+
if (offsetParent) {
|
|
80
|
+
const bounds = offsetParent.getBoundingClientRect();
|
|
81
|
+
return { x: pagePoint.x - bounds.left - scroll.x, y: pagePoint.y - bounds.top - scroll.y };
|
|
82
|
+
}
|
|
83
|
+
return { x: pagePoint.x - scroll.x, y: pagePoint.y - scroll.y };
|
|
84
|
+
}
|
|
85
|
+
|
|
64
86
|
export function getViewportBounds(target: GModelElement, bounds: Bounds): Bounds {
|
|
65
87
|
const topLeft = getAbsolutePositionByPoint(target, Bounds.topLeft(bounds));
|
|
66
88
|
const bottomRight = getAbsolutePositionByPoint(target, Bounds.bottomRight(bounds));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2017-
|
|
2
|
+
* Copyright (c) 2017-2026 TypeFox 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
|
|
@@ -28,7 +28,9 @@ import {
|
|
|
28
28
|
TYPES,
|
|
29
29
|
ViewProjection,
|
|
30
30
|
Writable,
|
|
31
|
+
getProjections,
|
|
31
32
|
html,
|
|
33
|
+
isBoundsAware,
|
|
32
34
|
setAttr,
|
|
33
35
|
setClass
|
|
34
36
|
} from '@eclipse-glsp/sprotty';
|
|
@@ -91,6 +93,61 @@ export class GLSPProjectionView extends ProjectedViewportView {
|
|
|
91
93
|
return { ...position, ...size };
|
|
92
94
|
}
|
|
93
95
|
|
|
96
|
+
protected override renderProjections(model: Readonly<GViewportRootElement>, context: RenderingContext, args?: IViewArgs): VNode[] {
|
|
97
|
+
if (model.zoom <= 0) {
|
|
98
|
+
return [];
|
|
99
|
+
}
|
|
100
|
+
const modelBounds = this.getModelBounds(model);
|
|
101
|
+
if (!modelBounds) {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
const projections = getProjections(model) ?? [];
|
|
105
|
+
return [
|
|
106
|
+
this.renderProjectionBar(projections, model, modelBounds, 'vertical'),
|
|
107
|
+
this.renderProjectionBar(projections, model, modelBounds, 'horizontal')
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Computes the total bounds that the projection bars map to, i.e. the union of the actual
|
|
113
|
+
* content bounds and the current viewport.
|
|
114
|
+
*
|
|
115
|
+
* This is a reimplementation of sprotty's `getModelBounds`, with two minor fixes
|
|
116
|
+
* - this intentionally derives the content bounds from the
|
|
117
|
+
* root's children instead of using {@link GViewportRootElement.bounds} directly.
|
|
118
|
+
* - We ignore bounds with invalid dimensions (e.g. from routable edges without bend points) to avoid pulling the
|
|
119
|
+
*/
|
|
120
|
+
protected getModelBounds(model: Readonly<GViewportRootElement>): Bounds | undefined {
|
|
121
|
+
let minX = Number.POSITIVE_INFINITY;
|
|
122
|
+
let minY = Number.POSITIVE_INFINITY;
|
|
123
|
+
let maxX = Number.NEGATIVE_INFINITY;
|
|
124
|
+
let maxY = Number.NEGATIVE_INFINITY;
|
|
125
|
+
|
|
126
|
+
for (const element of model.children) {
|
|
127
|
+
if (isBoundsAware(element)) {
|
|
128
|
+
const b = element.bounds;
|
|
129
|
+
if (!Dimension.isValid(b)) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
minX = Math.min(minX, b.x);
|
|
133
|
+
minY = Math.min(minY, b.y);
|
|
134
|
+
maxX = Math.max(maxX, b.x + b.width);
|
|
135
|
+
maxY = Math.max(maxY, b.y + b.height);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// enlarge the bounds by the current viewport to ensure it always fits into the projection
|
|
140
|
+
minX = Math.min(minX, model.scroll.x);
|
|
141
|
+
minY = Math.min(minY, model.scroll.y);
|
|
142
|
+
maxX = Math.max(maxX, model.scroll.x + model.canvasBounds.width / model.zoom);
|
|
143
|
+
maxY = Math.max(maxY, model.scroll.y + model.canvasBounds.height / model.zoom);
|
|
144
|
+
|
|
145
|
+
if (minX < maxX && minY < maxY) {
|
|
146
|
+
return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };
|
|
147
|
+
}
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
150
|
+
|
|
94
151
|
protected override renderProjectionBar(
|
|
95
152
|
projections: ViewProjection[],
|
|
96
153
|
model: Readonly<GViewportRootElement>,
|