@eclipse-glsp/client 2.2.0-next.351 → 2.2.0-next.354
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/glsp-sprotty.css +0 -9
- package/css/grid.css +8 -6
- package/lib/base/action-dispatcher.d.ts +13 -2
- package/lib/base/action-dispatcher.d.ts.map +1 -1
- package/lib/base/action-dispatcher.js +19 -0
- package/lib/base/action-dispatcher.js.map +1 -1
- package/lib/base/command-stack.d.ts.map +1 -1
- package/lib/base/command-stack.js +5 -4
- package/lib/base/command-stack.js.map +1 -1
- package/lib/base/default.module.d.ts.map +1 -1
- package/lib/base/default.module.js +1 -0
- package/lib/base/default.module.js.map +1 -1
- package/lib/features/debug/debug-bounds-decorator.d.ts +1 -0
- package/lib/features/debug/debug-bounds-decorator.d.ts.map +1 -1
- package/lib/features/debug/debug-bounds-decorator.js +26 -27
- package/lib/features/debug/debug-bounds-decorator.js.map +1 -1
- package/lib/features/helper-lines/view.d.ts +1 -0
- package/lib/features/helper-lines/view.d.ts.map +1 -1
- package/lib/features/helper-lines/view.js +5 -6
- package/lib/features/helper-lines/view.js.map +1 -1
- package/lib/features/tools/change-bounds/view.d.ts +1 -0
- package/lib/features/tools/change-bounds/view.d.ts.map +1 -1
- package/lib/features/tools/change-bounds/view.js +3 -4
- package/lib/features/tools/change-bounds/view.js.map +1 -1
- package/lib/features/tools/edge-creation/view.d.ts +17 -1
- package/lib/features/tools/edge-creation/view.d.ts.map +1 -1
- package/lib/features/tools/edge-creation/view.js +3 -4
- package/lib/features/tools/edge-creation/view.js.map +1 -1
- package/lib/features/tools/marquee-selection/view.d.ts +17 -1
- package/lib/features/tools/marquee-selection/view.d.ts.map +1 -1
- package/lib/features/tools/marquee-selection/view.js +4 -5
- package/lib/features/tools/marquee-selection/view.js.map +1 -1
- package/lib/features/tools/node-creation/node-creation-views.d.ts +1 -0
- package/lib/features/tools/node-creation/node-creation-views.d.ts.map +1 -1
- package/lib/features/tools/node-creation/node-creation-views.js +15 -16
- package/lib/features/tools/node-creation/node-creation-views.js.map +1 -1
- package/lib/views/compartments.d.ts +17 -1
- package/lib/views/compartments.d.ts.map +1 -1
- package/lib/views/compartments.js +4 -5
- package/lib/views/compartments.js.map +1 -1
- package/lib/views/gedge-view.d.ts +1 -0
- package/lib/views/gedge-view.d.ts.map +1 -1
- package/lib/views/gedge-view.js +4 -5
- package/lib/views/gedge-view.js.map +1 -1
- package/lib/views/ggraph-view.d.ts +0 -1
- package/lib/views/ggraph-view.d.ts.map +1 -1
- package/lib/views/ggraph-view.js +2 -12
- package/lib/views/ggraph-view.js.map +1 -1
- package/lib/views/glsp-projection-view.d.ts +1 -1
- package/lib/views/glsp-projection-view.d.ts.map +1 -1
- package/lib/views/glsp-projection-view.js +26 -73
- package/lib/views/glsp-projection-view.js.map +1 -1
- package/lib/views/issue-marker-view.d.ts +1 -0
- package/lib/views/issue-marker-view.d.ts.map +1 -1
- package/lib/views/issue-marker-view.js +6 -7
- package/lib/views/issue-marker-view.js.map +1 -1
- package/lib/views/rounded-corner-view.d.ts +17 -1
- package/lib/views/rounded-corner-view.d.ts.map +1 -1
- package/lib/views/rounded-corner-view.js +7 -8
- package/lib/views/rounded-corner-view.js.map +1 -1
- package/package.json +3 -3
- package/src/base/action-dispatcher.ts +26 -2
- package/src/base/command-stack.ts +6 -4
- package/src/base/default.module.ts +1 -0
- package/src/default-modules.spec.ts +56 -0
- package/src/features/debug/debug-bounds-decorator.tsx +1 -4
- package/src/features/helper-lines/view.tsx +1 -3
- package/src/features/tools/change-bounds/view.tsx +1 -3
- package/src/features/tools/edge-creation/view.tsx +2 -4
- package/src/features/tools/marquee-selection/view.tsx +2 -4
- package/src/features/tools/node-creation/node-creation-views.tsx +1 -4
- package/src/views/compartments.tsx +2 -4
- package/src/views/gedge-view.tsx +2 -4
- package/src/views/ggraph-view.tsx +2 -12
- package/src/views/glsp-projection-view.tsx +13 -76
- package/src/views/issue-marker-view.tsx +1 -3
- package/src/views/rounded-corner-view.tsx +2 -4
|
@@ -22,12 +22,11 @@ exports.toClipPathId = exports.RoundedCornerNodeView = void 0;
|
|
|
22
22
|
*
|
|
23
23
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
24
24
|
********************************************************************************/
|
|
25
|
-
|
|
25
|
+
/** @jsx svg */
|
|
26
26
|
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
27
|
+
const inversify_1 = require("inversify");
|
|
27
28
|
const argument_utils_1 = require("../utils/argument-utils");
|
|
28
29
|
const rounded_corner_1 = require("./rounded-corner");
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
30
|
-
const JSX = { createElement: sprotty_1.svg };
|
|
31
30
|
let RoundedCornerNodeView = class RoundedCornerNodeView extends sprotty_1.RectangularNodeView {
|
|
32
31
|
render(node, context) {
|
|
33
32
|
const cornerRadius = argument_utils_1.CornerRadius.from(node);
|
|
@@ -35,10 +34,10 @@ let RoundedCornerNodeView = class RoundedCornerNodeView extends sprotty_1.Rectan
|
|
|
35
34
|
return this.renderWithoutRadius(node, context);
|
|
36
35
|
}
|
|
37
36
|
const wrapper = new rounded_corner_1.RoundedCornerWrapper(node, cornerRadius);
|
|
38
|
-
return (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
return ((0, sprotty_1.svg)("g", { "class-node": true },
|
|
38
|
+
(0, sprotty_1.svg)("defs", null,
|
|
39
|
+
(0, sprotty_1.svg)("clipPath", { id: toClipPathId(node) },
|
|
40
|
+
(0, sprotty_1.svg)("path", { d: this.renderPath(wrapper, context, this.getClipPathInsets() || 0) }))),
|
|
42
41
|
this.renderPathNode(wrapper, context),
|
|
43
42
|
context.renderChildren(node)));
|
|
44
43
|
}
|
|
@@ -49,7 +48,7 @@ let RoundedCornerNodeView = class RoundedCornerNodeView extends sprotty_1.Rectan
|
|
|
49
48
|
return 2;
|
|
50
49
|
}
|
|
51
50
|
renderPathNode(wrapper, context) {
|
|
52
|
-
return (
|
|
51
|
+
return ((0, sprotty_1.svg)("path", Object.assign({ d: this.renderPath(wrapper, context, 0), "class-sprotty-node": wrapper.element instanceof sprotty_1.GNode, "class-sprotty-port": wrapper.element instanceof sprotty_1.GPort, "class-mouseover": wrapper.element.hoverFeedback, "class-selected": wrapper.element.selected }, this.additionalClasses(wrapper.element, context))));
|
|
53
52
|
}
|
|
54
53
|
additionalClasses(_node, _context) {
|
|
55
54
|
return {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rounded-corner-view.js","sourceRoot":"","sources":["../../src/views/rounded-corner-view.tsx"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"rounded-corner-view.js","sourceRoot":"","sources":["../../src/views/rounded-corner-view.tsx"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,eAAe;AACf,mDAAuI;AACvI,yCAAuC;AAEvC,4DAAuD;AACvD,qDAAwD;AAGjD,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,6BAAmB;IACjD,MAAM,CAAC,IAA8C,EAAE,OAAyB;QACrF,MAAM,YAAY,GAAG,6BAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,YAAY,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACnD,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,qCAAoB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC7D,OAAO,CACH,wCAAe,IAAI;YACf;gBACI,iCAAU,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC;oBAC5B,6BAAM,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC,GAAS,CAC3E,C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C/E,OAAO,GAAG,IAAI,CAAC,EAAE,YAAY,CAAC;AAClC,CAAC;AAFD,oCAEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp/client",
|
|
3
|
-
"version": "2.2.0-next.
|
|
3
|
+
"version": "2.2.0-next.354+cb93d58",
|
|
4
4
|
"description": "A sprotty-based client for GLSP",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eclipse",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"watch": "tsc -w"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@eclipse-glsp/sprotty": "2.2.0-next.
|
|
49
|
+
"@eclipse-glsp/sprotty": "2.2.0-next.354+cb93d58",
|
|
50
50
|
"autocompleter": "^9.1.2",
|
|
51
51
|
"file-saver": "^2.0.5",
|
|
52
52
|
"lodash": "4.17.21",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "cb93d584a5e1822702c6320b36be7e608bcdbd5b"
|
|
67
67
|
}
|
|
@@ -13,20 +13,23 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { Action, ActionDispatcher, EMPTY_ROOT, RequestAction, ResponseAction, SetModelAction } from '@eclipse-glsp/sprotty';
|
|
16
|
+
import { Action, ActionDispatcher, EMPTY_ROOT, GModelRoot, RequestAction, ResponseAction, SetModelAction } from '@eclipse-glsp/sprotty';
|
|
17
17
|
import { inject, injectable } from 'inversify';
|
|
18
18
|
import { GLSPActionHandlerRegistry } from './action-handler-registry';
|
|
19
|
+
import { IGModelRootListener } from './editor-context-service';
|
|
19
20
|
import { OptionalAction } from './model/glsp-model-source';
|
|
20
21
|
import { ModelInitializationConstraint } from './model/model-initialization-constraint';
|
|
21
22
|
|
|
22
23
|
@injectable()
|
|
23
|
-
export class GLSPActionDispatcher extends ActionDispatcher {
|
|
24
|
+
export class GLSPActionDispatcher extends ActionDispatcher implements IGModelRootListener {
|
|
24
25
|
protected readonly timeouts: Map<string, NodeJS.Timeout> = new Map();
|
|
25
26
|
protected initializedConstraint = false;
|
|
26
27
|
|
|
27
28
|
@inject(ModelInitializationConstraint)
|
|
28
29
|
protected initializationConstraint: ModelInitializationConstraint;
|
|
29
30
|
|
|
31
|
+
protected postUpdateQueue: Action[] = [];
|
|
32
|
+
|
|
30
33
|
override initialize(): Promise<void> {
|
|
31
34
|
if (!this.initialized) {
|
|
32
35
|
this.initialized = this.doInitialize();
|
|
@@ -71,6 +74,27 @@ export class GLSPActionDispatcher extends ActionDispatcher {
|
|
|
71
74
|
this.initializationConstraint.onInitialized(() => this.dispatchAll(actions));
|
|
72
75
|
}
|
|
73
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Processes all given actions, by dispatching them to the corresponding handlers, after the next model update.
|
|
79
|
+
* The given actions are queued until the next model update cycle has been completed i.e.
|
|
80
|
+
* the `EditorContextService.onModelRootChanged` event is triggered.
|
|
81
|
+
*
|
|
82
|
+
* @param actions The actions that should be dispatched after the next model update
|
|
83
|
+
*/
|
|
84
|
+
dispatchAfterNextUpdate(...actions: Action[]): void {
|
|
85
|
+
this.postUpdateQueue.push(...actions);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
modelRootChanged(_root: Readonly<GModelRoot>): void {
|
|
89
|
+
if (this.postUpdateQueue.length === 0) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const toDispatch = [...this.postUpdateQueue];
|
|
94
|
+
this.postUpdateQueue = [];
|
|
95
|
+
this.dispatchAll(toDispatch);
|
|
96
|
+
}
|
|
97
|
+
|
|
74
98
|
override async dispatch(action: Action): Promise<void> {
|
|
75
99
|
const result = await super.dispatch(action);
|
|
76
100
|
this.initializationConstraint.notifyDispatched(action);
|
|
@@ -67,12 +67,14 @@ export class GLSPCommandStack extends CommandStack implements Disposable {
|
|
|
67
67
|
return this.currentModel;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
override execute(command: ICommand): Promise<GModelRoot> {
|
|
71
|
-
const result = super.execute(command);
|
|
70
|
+
override async execute(command: ICommand): Promise<GModelRoot> {
|
|
72
71
|
if (command instanceof SetModelCommand || command instanceof UpdateModelCommand) {
|
|
73
|
-
result
|
|
72
|
+
const result = await super.execute(command);
|
|
73
|
+
this.notifyListeners(result);
|
|
74
|
+
return result;
|
|
74
75
|
}
|
|
75
|
-
|
|
76
|
+
|
|
77
|
+
return super.execute(command);
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
protected notifyListeners(root: Readonly<GModelRoot>): void {
|
|
@@ -99,6 +99,7 @@ export const defaultModule = new FeatureModule(
|
|
|
99
99
|
bindAsService(context, TYPES.MouseListener, SelectionClearingMouseListener);
|
|
100
100
|
bindOrRebind(context, TYPES.ICommandStack).to(GLSPCommandStack).inSingletonScope();
|
|
101
101
|
bind(GLSPActionDispatcher).toSelf().inSingletonScope();
|
|
102
|
+
bind(TYPES.IGModelRootListener).toService(GLSPActionDispatcher);
|
|
102
103
|
bindOrRebind(context, TYPES.IActionDispatcher).toService(GLSPActionDispatcher);
|
|
103
104
|
|
|
104
105
|
bindOrRebind(context, ActionHandlerRegistry).to(GLSPActionHandlerRegistry).inSingletonScope();
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2024 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 { FeatureModule } from '@eclipse-glsp/sprotty';
|
|
17
|
+
import { expect } from 'chai';
|
|
18
|
+
import { Container } from 'inversify';
|
|
19
|
+
import * as sinon from 'sinon';
|
|
20
|
+
import { defaultModule } from './base/default.module';
|
|
21
|
+
import { DEFAULT_MODULES, initializeDiagramContainer } from './default-modules';
|
|
22
|
+
|
|
23
|
+
describe('default-modules', () => {
|
|
24
|
+
// InitializeDiagramContainer internally uses `resolveContainerConfiguration` so we only test functionality
|
|
25
|
+
// that is not covered by the tests of `resolveContainerConfiguration`.
|
|
26
|
+
describe('initializeDiagramContainer', () => {
|
|
27
|
+
const sandbox = sinon.createSandbox();
|
|
28
|
+
const container = new Container();
|
|
29
|
+
const loadSpy = sandbox.spy(container, 'load');
|
|
30
|
+
container.snapshot();
|
|
31
|
+
|
|
32
|
+
beforeEach(() => {
|
|
33
|
+
sandbox.reset();
|
|
34
|
+
container.restore();
|
|
35
|
+
container.snapshot();
|
|
36
|
+
});
|
|
37
|
+
it('should initialize the diagram container with the default modules in addition to the given config and load them first', () => {
|
|
38
|
+
const extraModule = new FeatureModule(() => {});
|
|
39
|
+
initializeDiagramContainer(container, { add: extraModule });
|
|
40
|
+
expect(loadSpy.calledOnce).to.be.true;
|
|
41
|
+
const callArgs = loadSpy.firstCall.args;
|
|
42
|
+
const lastModule = callArgs.pop();
|
|
43
|
+
expect(callArgs).to.be.deep.equal(DEFAULT_MODULES).ordered;
|
|
44
|
+
expect(lastModule).to.be.equal(extraModule);
|
|
45
|
+
});
|
|
46
|
+
it('should throw an error if the base (default) module is removed via configuration', () => {
|
|
47
|
+
expect(() => initializeDiagramContainer(container, { remove: defaultModule })).to.throw(/Invalid module configuration/);
|
|
48
|
+
});
|
|
49
|
+
// eslint-disable-next-line max-len
|
|
50
|
+
it('should throw an error if the base (default) module is not the first module of the resolved configured (removed and added again)', () => {
|
|
51
|
+
expect(() => initializeDiagramContainer(container, { remove: defaultModule, add: defaultModule })).to.throw(
|
|
52
|
+
/Invalid module configuration/
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
/* eslint-disable max-len */
|
|
17
|
-
|
|
17
|
+
/** @jsx svg */
|
|
18
18
|
import { Bounds, GModelElement, IVNodePostprocessor, Point, isDecoration, isSizeable, setClass, svg } from '@eclipse-glsp/sprotty';
|
|
19
19
|
import { inject, injectable, optional } from 'inversify';
|
|
20
20
|
import { VNode } from 'snabbdom';
|
|
@@ -22,9 +22,6 @@ import { GGraph } from '../../model';
|
|
|
22
22
|
import { BoundsAwareModelElement } from '../../utils/gmodel-util';
|
|
23
23
|
import { DebugManager } from './debug-manager';
|
|
24
24
|
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
26
|
-
const JSX = { createElement: svg };
|
|
27
|
-
|
|
28
25
|
export const CSS_DEBUG_BOUNDS = 'debug-bounds';
|
|
29
26
|
|
|
30
27
|
@injectable()
|
|
@@ -13,14 +13,12 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
/** @jsx svg */
|
|
16
17
|
import { IViewArgs, RenderingContext, ShapeView, svg } from '@eclipse-glsp/sprotty';
|
|
17
18
|
import { injectable } from 'inversify';
|
|
18
19
|
import { VNode } from 'snabbdom';
|
|
19
20
|
import { HelperLine, SelectionBounds } from './model';
|
|
20
21
|
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
22
|
-
const JSX = { createElement: svg };
|
|
23
|
-
|
|
24
22
|
@injectable()
|
|
25
23
|
export class HelperLineView extends ShapeView {
|
|
26
24
|
override render(model: HelperLine, _context: RenderingContext): VNode | undefined {
|
|
@@ -13,14 +13,12 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
/** @jsx svg */
|
|
16
17
|
import { IView, Point, RenderingContext, setAttr, svg } from '@eclipse-glsp/sprotty';
|
|
17
18
|
import { injectable } from 'inversify';
|
|
18
19
|
import { VNode } from 'snabbdom';
|
|
19
20
|
import { GResizeHandle } from '../../change-bounds/model';
|
|
20
21
|
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
22
|
-
const JSX = { createElement: svg };
|
|
23
|
-
|
|
24
22
|
@injectable()
|
|
25
23
|
export class GResizeHandleView implements IView {
|
|
26
24
|
render(handle: GResizeHandle, context: RenderingContext): VNode | undefined {
|
|
@@ -13,12 +13,10 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
/** @jsx svg */
|
|
17
|
+
import { GModelElement, IView, Point, RenderingContext, svg } from '@eclipse-glsp/sprotty';
|
|
16
18
|
import { injectable } from 'inversify';
|
|
17
19
|
import { VNode } from 'snabbdom';
|
|
18
|
-
import { IView, Point, RenderingContext, GModelElement, svg } from '@eclipse-glsp/sprotty';
|
|
19
|
-
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
21
|
-
const JSX = { createElement: svg };
|
|
22
20
|
|
|
23
21
|
/**
|
|
24
22
|
* This view is used for the invisible end of the feedback edge.
|
|
@@ -13,14 +13,12 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
/** @jsx svg */
|
|
17
|
+
import { RectangularNodeView, RenderingContext, svg } from '@eclipse-glsp/sprotty';
|
|
16
18
|
import { injectable } from 'inversify';
|
|
17
19
|
import { VNode } from 'snabbdom';
|
|
18
|
-
import { RectangularNodeView, RenderingContext, svg } from '@eclipse-glsp/sprotty';
|
|
19
20
|
import { MarqueeNode } from './model';
|
|
20
21
|
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
22
|
-
const JSX = { createElement: svg };
|
|
23
|
-
|
|
24
22
|
@injectable()
|
|
25
23
|
export class MarqueeView extends RectangularNodeView {
|
|
26
24
|
override render(node: MarqueeNode, context: RenderingContext): VNode {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
|
|
16
|
+
/** @jsx svg */
|
|
17
17
|
import { IView, RenderingContext, TYPES, setClass, svg } from '@eclipse-glsp/sprotty';
|
|
18
18
|
import { inject, injectable, optional } from 'inversify';
|
|
19
19
|
import { VNode } from 'snabbdom';
|
|
@@ -21,9 +21,6 @@ import { GArgument } from '../../../utils/argument-utils';
|
|
|
21
21
|
import { Grid } from '../../grid/grid';
|
|
22
22
|
import { ARG_LENGTH, InsertIndicator } from './insert-indicator';
|
|
23
23
|
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
25
|
-
const JSX = { createElement: svg };
|
|
26
|
-
|
|
27
24
|
@injectable()
|
|
28
25
|
export class InsertIndicatorView implements IView {
|
|
29
26
|
@optional() @inject(TYPES.Grid) protected grid?: Grid;
|
|
@@ -13,12 +13,10 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
/** @jsx svg */
|
|
17
|
+
import { GCompartment, RenderingContext, ShapeView, svg } from '@eclipse-glsp/sprotty';
|
|
16
18
|
import { injectable } from 'inversify';
|
|
17
19
|
import { VNode } from 'snabbdom';
|
|
18
|
-
import { GCompartment, RenderingContext, ShapeView, svg } from '@eclipse-glsp/sprotty';
|
|
19
|
-
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
21
|
-
const JSX = { createElement: svg };
|
|
22
20
|
|
|
23
21
|
@injectable()
|
|
24
22
|
export class StructureCompartmentView extends ShapeView {
|
package/src/views/gedge-view.tsx
CHANGED
|
@@ -13,14 +13,12 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
/** @jsx svg */
|
|
16
17
|
import { Point, PolylineEdgeView, RenderingContext, svg } from '@eclipse-glsp/sprotty';
|
|
17
18
|
import { injectable } from 'inversify';
|
|
18
19
|
import { Classes, VNode } from 'snabbdom';
|
|
19
|
-
import { EdgePadding } from '../utils/argument-utils';
|
|
20
20
|
import { GEdge } from '../model';
|
|
21
|
-
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
23
|
-
const JSX = { createElement: svg };
|
|
21
|
+
import { EdgePadding } from '../utils/argument-utils';
|
|
24
22
|
|
|
25
23
|
@injectable()
|
|
26
24
|
export class GEdgeView extends PolylineEdgeView {
|
|
@@ -32,7 +32,7 @@ export class GGraphView extends SGraphView {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
protected getGridStyle(viewport: Readonly<SGraphImpl>, context: RenderingContext): GridStyle {
|
|
35
|
-
if (context.targetKind === 'hidden' || !this.gridManager
|
|
35
|
+
if (context.targetKind === 'hidden' || !this.gridManager) {
|
|
36
36
|
return {};
|
|
37
37
|
}
|
|
38
38
|
const bounds = this.getBackgroundBounds(viewport, context, this.gridManager);
|
|
@@ -41,11 +41,7 @@ export class GGraphView extends SGraphView {
|
|
|
41
41
|
[GridProperty.GRID_BACKGROUND_Y]: bounds.y + 'px',
|
|
42
42
|
[GridProperty.GRID_BACKGROUND_WIDTH]: bounds.width + 'px',
|
|
43
43
|
[GridProperty.GRID_BACKGROUND_HEIGHT]: bounds.height + 'px',
|
|
44
|
-
[GridProperty.GRID_BACKGROUND_ZOOM]: viewport.zoom + ''
|
|
45
|
-
[GridProperty.GRID_BACKGROUND_IMAGE]: this.getBackgroundImage(viewport, context, this.gridManager),
|
|
46
|
-
backgroundPosition: `${bounds.x}px ${bounds.y}px`,
|
|
47
|
-
backgroundSize: `${bounds.width}px ${bounds.height}px`
|
|
48
|
-
// we do not set the background-image directly in the style object, because we want to toggle it on and off via CSS
|
|
44
|
+
[GridProperty.GRID_BACKGROUND_ZOOM]: viewport.zoom + ''
|
|
49
45
|
};
|
|
50
46
|
}
|
|
51
47
|
|
|
@@ -54,10 +50,4 @@ export class GGraphView extends SGraphView {
|
|
|
54
50
|
const size = Dimension.fromPoint(Point.multiplyScalar(gridManager.grid, viewport.zoom));
|
|
55
51
|
return { ...position, ...size };
|
|
56
52
|
}
|
|
57
|
-
|
|
58
|
-
protected getBackgroundImage(viewport: Readonly<SGraphImpl>, context: RenderingContext, gridManager: GridManager): string {
|
|
59
|
-
const color = getComputedStyle(document.documentElement).getPropertyValue(GridProperty.GRID_COLOR).trim().replace(/#/g, '%23');
|
|
60
|
-
// eslint-disable-next-line max-len
|
|
61
|
-
return `url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${gridManager.grid.x} ${gridManager.grid.y}"><rect width="${gridManager.grid.x}" height="${gridManager.grid.y}" x="0" y="0" fill="none" stroke="${color}" stroke-width="1" /></svg>')`;
|
|
62
|
-
}
|
|
63
53
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
|
|
16
|
+
/** @jsx html */
|
|
17
17
|
import {
|
|
18
18
|
Bounds,
|
|
19
19
|
Dimension,
|
|
@@ -36,9 +36,6 @@ import { VNode, VNodeStyle, h } from 'snabbdom';
|
|
|
36
36
|
import { GridManager, GridStyle } from '../features/grid/grid-manager';
|
|
37
37
|
import { GridProperty } from '../features/grid/grid-style';
|
|
38
38
|
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
40
|
-
const JSX = { createElement: html };
|
|
41
|
-
|
|
42
39
|
/**
|
|
43
40
|
* Special viewport root view that renders horizontal and vertical projection bars for quick navigation.
|
|
44
41
|
*/
|
|
@@ -73,7 +70,7 @@ export class GLSPProjectionView extends ProjectedViewportView {
|
|
|
73
70
|
}
|
|
74
71
|
|
|
75
72
|
protected getGridStyle(viewport: Readonly<SGraphImpl>, context: RenderingContext): GridStyle {
|
|
76
|
-
if (context.targetKind === 'hidden' || !this.gridManager
|
|
73
|
+
if (context.targetKind === 'hidden' || !this.gridManager) {
|
|
77
74
|
return {};
|
|
78
75
|
}
|
|
79
76
|
const bounds = this.getBackgroundBounds(viewport, context, this.gridManager);
|
|
@@ -82,11 +79,7 @@ export class GLSPProjectionView extends ProjectedViewportView {
|
|
|
82
79
|
[GridProperty.GRID_BACKGROUND_Y]: bounds.y + 'px',
|
|
83
80
|
[GridProperty.GRID_BACKGROUND_WIDTH]: bounds.width + 'px',
|
|
84
81
|
[GridProperty.GRID_BACKGROUND_HEIGHT]: bounds.height + 'px',
|
|
85
|
-
[GridProperty.GRID_BACKGROUND_ZOOM]: viewport.zoom + ''
|
|
86
|
-
[GridProperty.GRID_BACKGROUND_IMAGE]: this.getBackgroundImage(viewport, context, this.gridManager),
|
|
87
|
-
backgroundPosition: `${bounds.x}px ${bounds.y}px`,
|
|
88
|
-
backgroundSize: `${bounds.width}px ${bounds.height}px`
|
|
89
|
-
// we do not set the background-image directly in the style object, because we want to toggle it on and off via CSS
|
|
82
|
+
[GridProperty.GRID_BACKGROUND_ZOOM]: viewport.zoom + ''
|
|
90
83
|
};
|
|
91
84
|
}
|
|
92
85
|
|
|
@@ -96,35 +89,15 @@ export class GLSPProjectionView extends ProjectedViewportView {
|
|
|
96
89
|
return { ...position, ...size };
|
|
97
90
|
}
|
|
98
91
|
|
|
99
|
-
protected getBackgroundImage(viewport: Readonly<SGraphImpl>, context: RenderingContext, gridManager: GridManager): string {
|
|
100
|
-
const color = getComputedStyle(document.documentElement).getPropertyValue(GridProperty.GRID_COLOR).trim().replace(/#/g, '%23');
|
|
101
|
-
// eslint-disable-next-line max-len
|
|
102
|
-
return `url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${gridManager.grid.x} ${gridManager.grid.y}"><rect width="${gridManager.grid.x}" height="${gridManager.grid.y}" x="0" y="0" fill="none" stroke="${color}" stroke-width="1" /></svg>')`;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
92
|
protected override renderProjectionBar(
|
|
106
93
|
projections: ViewProjection[],
|
|
107
94
|
model: Readonly<GViewportRootElement>,
|
|
108
95
|
modelBounds: Bounds,
|
|
109
96
|
orientation: 'horizontal' | 'vertical'
|
|
110
97
|
): VNode {
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
params.factor =
|
|
115
|
-
orientation === 'horizontal' ? model.canvasBounds.width / modelBounds.width : model.canvasBounds.height / modelBounds.height;
|
|
116
|
-
params.zoomedFactor = params.factor / model.zoom;
|
|
117
|
-
return (
|
|
118
|
-
<div
|
|
119
|
-
class-sprotty-projection-bar={true}
|
|
120
|
-
class-horizontal={orientation === 'horizontal'}
|
|
121
|
-
class-vertical={orientation === 'vertical'}
|
|
122
|
-
class-bordered-projection-bar={true}
|
|
123
|
-
>
|
|
124
|
-
{this.renderViewport(model, params)}
|
|
125
|
-
{projections.map(p => this.renderProjection(p, model, params))}
|
|
126
|
-
</div>
|
|
127
|
-
);
|
|
98
|
+
const vnode = super.renderProjectionBar(projections, model, modelBounds, orientation);
|
|
99
|
+
setClass(vnode, 'bordered-projection-bar', true);
|
|
100
|
+
return vnode;
|
|
128
101
|
}
|
|
129
102
|
|
|
130
103
|
protected override renderViewport(model: Readonly<GViewportRootElement>, params: ProjectionParams): VNode {
|
|
@@ -170,50 +143,14 @@ export class GLSPProjectionView extends ProjectedViewportView {
|
|
|
170
143
|
model: Readonly<GViewportRootElement>,
|
|
171
144
|
params: ProjectionParams
|
|
172
145
|
): VNode {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if (
|
|
177
|
-
|
|
178
|
-
projPos = (projection.projectedBounds.x - params.modelBounds.x) * params.factor;
|
|
179
|
-
projSize = projection.projectedBounds.width * params.factor;
|
|
146
|
+
const vnode = super.renderProjection(projection, model, params);
|
|
147
|
+
setClass(vnode, 'glsp-projection', true);
|
|
148
|
+
const style = vnode.data!.style!;
|
|
149
|
+
if (style.left) {
|
|
150
|
+
style.height = '60%';
|
|
180
151
|
} else {
|
|
181
|
-
|
|
182
|
-
projPos = (projection.projectedBounds.y - params.modelBounds.y) * params.factor;
|
|
183
|
-
projSize = projection.projectedBounds.height * params.factor;
|
|
152
|
+
style.width = '60%';
|
|
184
153
|
}
|
|
185
|
-
|
|
186
|
-
projSize += projPos;
|
|
187
|
-
projPos = 0;
|
|
188
|
-
} else if (projPos > canvasSize) {
|
|
189
|
-
projPos = canvasSize;
|
|
190
|
-
}
|
|
191
|
-
if (projSize < 0) {
|
|
192
|
-
projSize = 0;
|
|
193
|
-
} else if (projPos + projSize > canvasSize) {
|
|
194
|
-
projSize = canvasSize - projPos;
|
|
195
|
-
}
|
|
196
|
-
const style: VNodeStyle =
|
|
197
|
-
params.orientation === 'horizontal'
|
|
198
|
-
? {
|
|
199
|
-
left: `${projPos}px`,
|
|
200
|
-
width: `${projSize}px`,
|
|
201
|
-
height: '60%'
|
|
202
|
-
}
|
|
203
|
-
: {
|
|
204
|
-
top: `${projPos}px`,
|
|
205
|
-
height: `${projSize}px`,
|
|
206
|
-
width: '60%'
|
|
207
|
-
};
|
|
208
|
-
const result = (
|
|
209
|
-
<div
|
|
210
|
-
id={`${params.orientation}-projection:${projection.elementId}`}
|
|
211
|
-
class-sprotty-projection={true}
|
|
212
|
-
class-glsp-projection={true}
|
|
213
|
-
style={style}
|
|
214
|
-
/>
|
|
215
|
-
);
|
|
216
|
-
projection.cssClasses.forEach(cl => setClass(result, cl, true));
|
|
217
|
-
return result;
|
|
154
|
+
return vnode;
|
|
218
155
|
}
|
|
219
156
|
}
|
|
@@ -14,14 +14,12 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
/* eslint-disable max-len */
|
|
17
|
+
/** @jsx svg */
|
|
17
18
|
import { GIssueSeverity, IssueMarkerView, RenderingContext, setClass, svg } from '@eclipse-glsp/sprotty';
|
|
18
19
|
import { injectable } from 'inversify';
|
|
19
20
|
import { VNode } from 'snabbdom';
|
|
20
21
|
import { GIssueMarker } from '../features/validation/issue-marker';
|
|
21
22
|
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
23
|
-
const JSX = { createElement: svg };
|
|
24
|
-
|
|
25
23
|
@injectable()
|
|
26
24
|
export class GIssueMarkerView extends IssueMarkerView {
|
|
27
25
|
override render(marker: GIssueMarker, _context: RenderingContext): VNode {
|
|
@@ -13,15 +13,13 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
/** @jsx svg */
|
|
17
|
+
import { GNode, GPort, GShapeElement, Hoverable, RectangularNodeView, RenderingContext, Selectable, svg } from '@eclipse-glsp/sprotty';
|
|
16
18
|
import { injectable } from 'inversify';
|
|
17
19
|
import { Classes, VNode } from 'snabbdom';
|
|
18
|
-
import { Hoverable, RectangularNodeView, RenderingContext, GNode, GPort, GShapeElement, Selectable, svg } from '@eclipse-glsp/sprotty';
|
|
19
20
|
import { CornerRadius } from '../utils/argument-utils';
|
|
20
21
|
import { RoundedCornerWrapper } from './rounded-corner';
|
|
21
22
|
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
23
|
-
const JSX = { createElement: svg };
|
|
24
|
-
|
|
25
23
|
@injectable()
|
|
26
24
|
export class RoundedCornerNodeView extends RectangularNodeView {
|
|
27
25
|
override render(node: Readonly<GNode & Hoverable & Selectable>, context: RenderingContext): VNode | undefined {
|