@eclipse-glsp/client 2.2.0-next.341 → 2.2.0-next.343
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/features/element-template/mouse-tracking-element-position-listener.d.ts.map +1 -1
- package/lib/features/element-template/mouse-tracking-element-position-listener.js +3 -2
- package/lib/features/element-template/mouse-tracking-element-position-listener.js.map +1 -1
- package/lib/features/export/glsp-svg-exporter.d.ts +24 -2
- package/lib/features/export/glsp-svg-exporter.d.ts.map +1 -1
- package/lib/features/export/glsp-svg-exporter.js +74 -16
- package/lib/features/export/glsp-svg-exporter.js.map +1 -1
- package/lib/features/tools/node-creation/container-manager.d.ts +7 -6
- package/lib/features/tools/node-creation/container-manager.d.ts.map +1 -1
- package/lib/features/tools/node-creation/container-manager.js +1 -1
- package/lib/features/tools/node-creation/container-manager.js.map +1 -1
- package/lib/features/tools/node-creation/insert-indicator.d.ts.map +1 -1
- package/lib/features/tools/node-creation/insert-indicator.js +1 -1
- package/lib/features/tools/node-creation/insert-indicator.js.map +1 -1
- package/lib/features/tools/node-creation/node-creation-tool.d.ts +3 -2
- package/lib/features/tools/node-creation/node-creation-tool.d.ts.map +1 -1
- package/lib/features/tools/node-creation/node-creation-tool.js +13 -4
- package/lib/features/tools/node-creation/node-creation-tool.js.map +1 -1
- package/package.json +3 -3
- package/src/features/element-template/mouse-tracking-element-position-listener.ts +3 -2
- package/src/features/export/glsp-svg-exporter.ts +88 -18
- package/src/features/tools/node-creation/container-manager.ts +9 -7
- package/src/features/tools/node-creation/insert-indicator.ts +1 -1
- package/src/features/tools/node-creation/node-creation-tool.ts +24 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mouse-tracking-element-position-listener.d.ts","sourceRoot":"","sources":["../../../src/features/element-template/mouse-tracking-element-position-listener.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,MAAM,EAAa,aAAa,EAAc,KAAK,EAA6B,MAAM,uBAAuB,CAAC;AACvH,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAE9E,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEnF,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAEhG,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACtD,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;CACrD;AAED,qBAAa,oCAAqC,SAAQ,sBAAsB;IAKxE,SAAS,CAAC,SAAS,EAAE,MAAM;IAC3B,SAAS,CAAC,IAAI,EAAE,eAAe;IAC/B,SAAS,CAAC,cAAc,EAAE,UAAU,GAAG,QAAQ;IANnD,SAAS,CAAC,iBAAiB,EAAE,eAAe,CAAC;IAC7C,SAAS,CAAC,OAAO,EAAE,mBAAmB,CAAC;gBAGzB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,eAAe,EACrB,cAAc,GAAE,UAAU,GAAG,QAAqB;IAOhE,SAAS,CAAC,iBAAiB,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,eAAe,GAAG,SAAS;IAKzF,SAAS,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,EAAE;
|
|
1
|
+
{"version":3,"file":"mouse-tracking-element-position-listener.d.ts","sourceRoot":"","sources":["../../../src/features/element-template/mouse-tracking-element-position-listener.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,MAAM,EAAa,aAAa,EAAc,KAAK,EAA6B,MAAM,uBAAuB,CAAC;AACvH,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCA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;IAKhF,OAAO,IAAI,IAAI;CAI3B"}
|
|
@@ -40,10 +40,11 @@ class MouseTrackingElementPositionListener extends drag_aware_mouse_listener_1.D
|
|
|
40
40
|
if (!element) {
|
|
41
41
|
return [];
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
const isInitializing = !this.tracker.isTracking();
|
|
44
|
+
if (isInitializing) {
|
|
44
45
|
this.initialize(element, ctx, event);
|
|
45
46
|
}
|
|
46
|
-
const move = this.tracker.moveElements([element], { snap: event, restrict: event });
|
|
47
|
+
const move = this.tracker.moveElements([element], { snap: event, restrict: event, skipStatic: !isInitializing });
|
|
47
48
|
const elementMove = move.elementMoves[0];
|
|
48
49
|
if (!elementMove) {
|
|
49
50
|
return [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mouse-tracking-element-position-listener.js","sourceRoot":"","sources":["../../../src/features/element-template/mouse-tracking-element-position-listener.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,mDAAuH;AACvH,oFAA8E;AAC9E,mEAAuF;AAGvF,+DAAiE;AAGjE,oGAA6F;AAO7F,MAAa,oCAAqC,SAAQ,kDAAsB;IAI5E,YACc,SAAiB,EACjB,IAAqB,EACrB,iBAAwC,UAAU;QAE5D,KAAK,EAAE,CAAC;QAJE,cAAS,GAAT,SAAS,CAAQ;QACjB,SAAI,GAAJ,IAAI,CAAiB;QACrB,mBAAc,GAAd,cAAc,CAAoC;QAG5D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,aAAa,EAAE,CAAC;QAC7D,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC;IAC/D,CAAC;IAES,iBAAiB,CAAC,MAAqB,EAAE,KAAiB;QAChE,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1D,OAAO,CAAC,OAAO,IAAI,CAAC,IAAA,oBAAU,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;IAClE,CAAC;IAEQ,SAAS,CAAC,GAAkB,EAAE,KAAiB;QACpD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACnD,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,OAAO,EAAE,CAAC;QACd,CAAC;QACD,
|
|
1
|
+
{"version":3,"file":"mouse-tracking-element-position-listener.js","sourceRoot":"","sources":["../../../src/features/element-template/mouse-tracking-element-position-listener.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,mDAAuH;AACvH,oFAA8E;AAC9E,mEAAuF;AAGvF,+DAAiE;AAGjE,oGAA6F;AAO7F,MAAa,oCAAqC,SAAQ,kDAAsB;IAI5E,YACc,SAAiB,EACjB,IAAqB,EACrB,iBAAwC,UAAU;QAE5D,KAAK,EAAE,CAAC;QAJE,cAAS,GAAT,SAAS,CAAQ;QACjB,SAAI,GAAJ,IAAI,CAAiB;QACrB,mBAAc,GAAd,cAAc,CAAoC;QAG5D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,aAAa,EAAE,CAAC;QAC7D,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC;IAC/D,CAAC;IAES,iBAAiB,CAAC,MAAqB,EAAE,KAAiB;QAChE,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC1D,OAAO,CAAC,OAAO,IAAI,CAAC,IAAA,oBAAU,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAA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) 2022-2023 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
import { ExportSvgAction, GModelRoot, RequestAction, SvgExporter } from '@eclipse-glsp/sprotty';
|
|
2
17
|
export declare class GLSPSvgExporter extends SvgExporter {
|
|
3
|
-
export(root: GModelRoot,
|
|
18
|
+
export(root: GModelRoot, request?: RequestAction<ExportSvgAction>): void;
|
|
19
|
+
protected createSvg(svgElement: SVGSVGElement, root: GModelRoot): string;
|
|
4
20
|
protected findSvgElement(): SVGSVGElement | null;
|
|
21
|
+
protected prepareSvgElement(svgElement: SVGSVGElement, root: GModelRoot, request?: RequestAction<ExportSvgAction>): SVGSVGElement;
|
|
22
|
+
protected copyStyles(source: Element, target: Element, skippedProperties: string[]): void;
|
|
23
|
+
protected copyStyle(source: Element, target: Element, skippedProperties: string[]): void;
|
|
24
|
+
protected shouldUpdateStyle(element: any): element is ElementCSSInlineStyle;
|
|
25
|
+
protected getSvgExport(serializedSvgElement: string, svgElement: SVGElement, root: GModelRoot, request?: RequestAction<ExportSvgAction>): string;
|
|
26
|
+
protected getSvgExportStyle(svgElement: SVGElement, root: GModelRoot, request?: RequestAction<ExportSvgAction>): string | undefined;
|
|
5
27
|
}
|
|
6
28
|
//# sourceMappingURL=glsp-svg-exporter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-svg-exporter.d.ts","sourceRoot":"","sources":["../../../src/features/export/glsp-svg-exporter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"glsp-svg-exporter.d.ts","sourceRoot":"","sources":["../../../src/features/export/glsp-svg-exporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAIhG,qBACa,eAAgB,SAAQ,WAAW;IACnC,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,GAAG,IAAI;cAa9D,SAAS,CAAC,UAAU,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM;IAWjF,SAAS,CAAC,cAAc,IAAI,aAAa,GAAG,IAAI;IAMhD,SAAS,CAAC,iBAAiB,CAAC,UAAU,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,GAAG,aAAa;cAI9G,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,GAAG,IAAI;IAalG,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,GAAG,IAAI;IA0BxF,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,IAAI,qBAAqB;IAK3E,SAAS,CAAC,YAAY,CAClB,oBAAoB,EAAE,MAAM,EAC5B,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,UAAU,EAChB,OAAO,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,GACzC,MAAM;IAKT,SAAS,CAAC,iBAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,GAAG,MAAM,GAAG,SAAS;CAUtI"}
|
|
@@ -22,35 +22,93 @@ exports.GLSPSvgExporter = void 0;
|
|
|
22
22
|
*
|
|
23
23
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
24
24
|
********************************************************************************/
|
|
25
|
+
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
25
26
|
const inversify_1 = require("inversify");
|
|
26
27
|
const uuid_1 = require("uuid");
|
|
27
|
-
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
28
28
|
let GLSPSvgExporter = class GLSPSvgExporter extends sprotty_1.SvgExporter {
|
|
29
|
-
export(root,
|
|
29
|
+
export(root, request) {
|
|
30
30
|
if (typeof document !== 'undefined') {
|
|
31
|
-
|
|
31
|
+
let svgElement = this.findSvgElement();
|
|
32
32
|
if (svgElement) {
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const bounds = this.getBounds(root);
|
|
39
|
-
const svg = this.createSvg(svgElement, root).replace('style="', `style="width: ${bounds.width}px !important;height: ${bounds.height}px !important;border: none !important;`);
|
|
40
|
-
// do not give request/response id here as otherwise the action is treated as an unrequested response
|
|
41
|
-
this.actionDispatcher.dispatch(sprotty_1.ExportSvgAction.create(svg));
|
|
42
|
-
}
|
|
43
|
-
finally {
|
|
44
|
-
svgElement.id = originalId;
|
|
45
|
-
}
|
|
33
|
+
svgElement = this.prepareSvgElement(svgElement, root, request);
|
|
34
|
+
const serializedSvg = this.createSvg(svgElement, root);
|
|
35
|
+
const svgExport = this.getSvgExport(serializedSvg, svgElement, root, request);
|
|
36
|
+
// do not give request/response id here as otherwise the action is treated as an unrequested response
|
|
37
|
+
this.actionDispatcher.dispatch(sprotty_1.ExportSvgAction.create(svgExport));
|
|
46
38
|
}
|
|
47
39
|
}
|
|
48
40
|
}
|
|
41
|
+
createSvg(svgElement, root) {
|
|
42
|
+
// createSvg requires the svg to have a non-empty id, so we generate one if necessary
|
|
43
|
+
const originalId = svgElement.id;
|
|
44
|
+
try {
|
|
45
|
+
svgElement.id = originalId || (0, uuid_1.v4)();
|
|
46
|
+
return super.createSvg(svgElement, root);
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
svgElement.id = originalId;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
49
52
|
findSvgElement() {
|
|
50
53
|
const div = document.getElementById(this.options.hiddenDiv);
|
|
51
54
|
// search for first svg element as hierarchy within Sprotty might change
|
|
52
55
|
return div && div.querySelector('svg');
|
|
53
56
|
}
|
|
57
|
+
prepareSvgElement(svgElement, root, request) {
|
|
58
|
+
return svgElement;
|
|
59
|
+
}
|
|
60
|
+
copyStyles(source, target, skippedProperties) {
|
|
61
|
+
this.copyStyle(source, target, skippedProperties);
|
|
62
|
+
// IE doesn't retrun anything on source.children
|
|
63
|
+
for (let i = 0; i < source.childNodes.length; ++i) {
|
|
64
|
+
const sourceChild = source.childNodes[i];
|
|
65
|
+
const targetChild = target.childNodes[i];
|
|
66
|
+
if (sourceChild instanceof Element) {
|
|
67
|
+
this.copyStyles(sourceChild, targetChild, []);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
copyStyle(source, target, skippedProperties) {
|
|
72
|
+
const sourceStyle = getComputedStyle(source);
|
|
73
|
+
const targetStyle = getComputedStyle(target);
|
|
74
|
+
let style = '';
|
|
75
|
+
for (let i = 0; i < sourceStyle.length; i++) {
|
|
76
|
+
const propertyName = sourceStyle[i];
|
|
77
|
+
if (!skippedProperties.includes(propertyName)) {
|
|
78
|
+
const propertyValue = sourceStyle.getPropertyValue(propertyName);
|
|
79
|
+
const propertyPriority = sourceStyle.getPropertyPriority(propertyName);
|
|
80
|
+
if (targetStyle.getPropertyValue(propertyName) !== propertyValue) {
|
|
81
|
+
if (this.shouldUpdateStyle(target)) {
|
|
82
|
+
// rather set the property directly on the element to keep other values intact
|
|
83
|
+
target.style.setProperty(propertyName, propertyValue);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
// collect all properties to set them at once
|
|
87
|
+
style += `${propertyName}: ${propertyValue}${propertyPriority ? ' !' + propertyPriority : ''}; `;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (style !== '') {
|
|
93
|
+
target.setAttribute('style', style.trim());
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
shouldUpdateStyle(element) {
|
|
97
|
+
// we want to simply update the style of elements and keep other values intact if they have a style property
|
|
98
|
+
return 'tagName' in element && 'style' in element;
|
|
99
|
+
}
|
|
100
|
+
getSvgExport(serializedSvgElement, svgElement, root, request) {
|
|
101
|
+
const svgExportStyle = this.getSvgExportStyle(svgElement, root, request);
|
|
102
|
+
return svgExportStyle ? serializedSvgElement.replace('style="', `style="${svgExportStyle}`) : serializedSvgElement;
|
|
103
|
+
}
|
|
104
|
+
getSvgExportStyle(svgElement, root, request) {
|
|
105
|
+
// provide generated svg code with respective sizing for proper viewing in browser and remove undesired border
|
|
106
|
+
const bounds = this.getBounds(root);
|
|
107
|
+
return (`width: ${bounds.width}px !important;` +
|
|
108
|
+
`height: ${bounds.height}px !important;` +
|
|
109
|
+
'border: none !important;' +
|
|
110
|
+
'cursor: default !important;');
|
|
111
|
+
}
|
|
54
112
|
};
|
|
55
113
|
exports.GLSPSvgExporter = GLSPSvgExporter;
|
|
56
114
|
exports.GLSPSvgExporter = GLSPSvgExporter = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-svg-exporter.js","sourceRoot":"","sources":["../../../src/features/export/glsp-svg-exporter.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,yCAAuC;AACvC,+BAAkC;
|
|
1
|
+
{"version":3,"file":"glsp-svg-exporter.js","sourceRoot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C,KAAK,gBAAgB;YACtC,WAAW,MAAM,CAAC,MAAM,gBAAgB;YACxC,0BAA0B;YAC1B,6BAA6B,CAChC,CAAC;IACN,CAAC;CACJ,CAAA;AAnGY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,sBAAU,GAAE;GACA,eAAe,CAmG3B"}
|
|
@@ -17,12 +17,6 @@ import { GModelElement, Point } from '@eclipse-glsp/sprotty';
|
|
|
17
17
|
import { FeedbackEmitter } from '../../../base/feedback/feedback-emitter';
|
|
18
18
|
import { ContainerElement } from '../../hints/model';
|
|
19
19
|
import { ChangeBoundsManager } from '../change-bounds/change-bounds-manager';
|
|
20
|
-
export interface TrackedInsert {
|
|
21
|
-
elementTypeId: string;
|
|
22
|
-
location: Point;
|
|
23
|
-
container?: GModelElement;
|
|
24
|
-
valid: boolean;
|
|
25
|
-
}
|
|
26
20
|
export interface InsertOptions extends Record<string, unknown> {
|
|
27
21
|
/** Flag to indicate whether the location within a container needs to be valid. Default: false */
|
|
28
22
|
validateLocationInContainer?: boolean;
|
|
@@ -32,6 +26,13 @@ export interface InsertOptions extends Record<string, unknown> {
|
|
|
32
26
|
evt?: MouseEvent;
|
|
33
27
|
}
|
|
34
28
|
export declare const DEFAULT_INSERT_OPTIONS: InsertOptions;
|
|
29
|
+
export interface TrackedInsert {
|
|
30
|
+
elementTypeId: string;
|
|
31
|
+
location: Point;
|
|
32
|
+
container?: GModelElement;
|
|
33
|
+
valid: boolean;
|
|
34
|
+
options: InsertOptions;
|
|
35
|
+
}
|
|
35
36
|
export declare class ContainerManager {
|
|
36
37
|
protected readonly changeBoundsManager: ChangeBoundsManager;
|
|
37
38
|
insert(proxy: GModelElement, location: Point, elementTypeId: string, opts?: Partial<InsertOptions>): TrackedInsert;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container-manager.d.ts","sourceRoot":"","sources":["../../../../src/features/tools/node-creation/container-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,aAAa,EAAE,KAAK,EAA0B,MAAM,uBAAuB,CAAC;AAGrF,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAiB,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"container-manager.d.ts","sourceRoot":"","sources":["../../../../src/features/tools/node-creation/container-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,aAAa,EAAE,KAAK,EAA0B,MAAM,uBAAuB,CAAC;AAGrF,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAiB,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAE7E,MAAM,WAAW,aAAc,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC1D,iGAAiG;IACjG,2BAA2B,CAAC,EAAE,OAAO,CAAC;IAEtC,kGAAkG;IAClG,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC,2EAA2E;IAC3E,GAAG,CAAC,EAAE,UAAU,CAAC;CACpB;AAED,eAAO,MAAM,sBAAsB,EAAE,aAEpC,CAAC;AAEF,MAAM,WAAW,aAAa;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,KAAK,CAAC;IAChB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,aAAa,CAAC;CAC1B;AAED,qBACa,gBAAgB;IACI,SAAS,CAAC,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAEzF,MAAM,CAAC,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa;IAWlH,aAAa,CAAC,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,UAAU,GAAG,gBAAgB,GAAG,SAAS;IAOlG,iBAAiB,CAAC,QAAQ,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,UAAU,GAAG,eAAe;CASvI"}
|
|
@@ -43,7 +43,7 @@ let ContainerManager = class ContainerManager {
|
|
|
43
43
|
// we need to check whether the location is valid either because we do not have a container or the option is set
|
|
44
44
|
valid = (_a = opts === null || opts === void 0 ? void 0 : opts.validLocationOverwrite) !== null && _a !== void 0 ? _a : this.changeBoundsManager.hasValidPosition(proxy, location);
|
|
45
45
|
}
|
|
46
|
-
return { elementTypeId, container, location, valid };
|
|
46
|
+
return { elementTypeId, container, location, valid, options };
|
|
47
47
|
}
|
|
48
48
|
findContainer(location, ctx, evt) {
|
|
49
49
|
// reverse order of children to find the innermost, top-rendered containers first
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container-manager.js","sourceRoot":"","sources":["../../../../src/features/tools/node-creation/container-manager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,mDAAqF;AACrF,yCAA+C;AAC/C,sEAAyG;AAEzG,6CAAoE;AACpE,kFAA6E;
|
|
1
|
+
{"version":3,"file":"container-manager.js","sourceRoot":"","sources":["../../../../src/features/tools/node-creation/container-manager.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,mDAAqF;AACrF,yCAA+C;AAC/C,sEAAyG;AAEzG,6CAAoE;AACpE,kFAA6E;AAahE,QAAA,sBAAsB,GAAkB;IACjD,2BAA2B,EAAE,KAAK;CACrC,CAAC;AAWK,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAGzB,MAAM,CAAC,K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,qBAAqB,CAAC,EAAE,IAAA,mCAAoB,EAAC,wBAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QACjH,CAAC;aAAM,CAAC;YACJ,QAAQ,CAAC,GAAG,CAAC,IAAA,mCAAoB,EAAC,wBAAS,CAAC,aAAa,CAAC,EAAE,IAAA,mCAAoB,GAAE,CAAC,CAAC;QACxF,CAAC;QACD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ,CAAA;AA9BY,4CAAgB;AACuB;IAA/C,IAAA,kBAAM,EAAC,2CAAmB,CAAC;8BAAyC,2CAAmB;6DAAC;2BADhF,gBAAgB;IAD5B,IAAA,sBAAU,GAAE;GACA,gBAAgB,CA8B5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insert-indicator.d.ts","sourceRoot":"","sources":["../../../../src/features/tools/node-creation/insert-indicator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAgD,MAAM,uBAAuB,CAAC;AAEzH,OAAO,EAAE,SAAS,EAAe,MAAM,4BAA4B,CAAC;AAEpE,eAAO,MAAM,UAAU,WAAW,CAAC;AAEnC,qBAAa,eAAgB,SAAQ,KAAM,YAAW,SAAS;IAC3D,gBAAyB,gBAAgB,WAA6C;IAEtF,MAAM,CAAC,IAAI,SAA2B;IAE7B,EAAE,EAAE,MAAM,CAAU;IACpB,IAAI,EAAE,MAAM,CAAwB;IACpC,QAAQ,CAAC,EAAE,UAAU,CAAsD;IAC3E,UAAU,EAAE,MAAM,EAAE,CAAwC;IAC5D,IAAI,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"insert-indicator.d.ts","sourceRoot":"","sources":["../../../../src/features/tools/node-creation/insert-indicator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAgD,MAAM,uBAAuB,CAAC;AAEzH,OAAO,EAAE,SAAS,EAAe,MAAM,4BAA4B,CAAC;AAEpE,eAAO,MAAM,UAAU,WAAW,CAAC;AAEnC,qBAAa,eAAgB,SAAQ,KAAM,YAAW,SAAS;IAC3D,gBAAyB,gBAAgB,WAA6C;IAEtF,MAAM,CAAC,IAAI,SAA2B;IAE7B,EAAE,EAAE,MAAM,CAAU;IACpB,IAAI,EAAE,MAAM,CAAwB;IACpC,QAAQ,CAAC,EAAE,UAAU,CAAsD;IAC3E,UAAU,EAAE,MAAM,EAAE,CAAwC;IAC5D,IAAI,EAAE,SAAS,CAAkB;IAC1C,IAAI,EAAE,IAAI,CAAM;gBAEJ,MAAM,CAAC,EAAE,MAAM;CAM9B"}
|
|
@@ -27,7 +27,7 @@ class InsertIndicator extends sprotty_1.GNode {
|
|
|
27
27
|
this.type = InsertIndicator.TYPE;
|
|
28
28
|
this.features = (0, sprotty_1.createFeatureSet)(InsertIndicator.DEFAULT_FEATURES);
|
|
29
29
|
this.cssClasses = ['insert-indicator', 'sprotty-node'];
|
|
30
|
-
this.size =
|
|
30
|
+
this.size = sprotty_1.Dimension.ZERO;
|
|
31
31
|
this.args = {};
|
|
32
32
|
if (length) {
|
|
33
33
|
this.args = { [exports.ARG_LENGTH]: length };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insert-indicator.js","sourceRoot":"","sources":["../../../../src/features/tools/node-creation/insert-indicator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,mDAAyH;AACzH,+BAAkC;AAClC,6DAAoE;AAEvD,QAAA,UAAU,GAAG,QAAQ,CAAC;AAEnC,MAAa,eAAgB,SAAQ,eAAK;IAYtC,YAAY,MAAe;QACvB,KAAK,EAAE,CAAC;QARH,OAAE,GAAW,IAAA,SAAI,GAAE,CAAC;QACpB,SAAI,GAAW,eAAe,CAAC,IAAI,CAAC;QACpC,aAAQ,GAAgB,IAAA,0BAAgB,EAAC,eAAe,CAAC,gBAAgB,CAAC,CAAC;QAC3E,eAAU,GAAa,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC;QAC5D,SAAI,GAAc,
|
|
1
|
+
{"version":3,"file":"insert-indicator.js","sourceRoot":"","sources":["../../../../src/features/tools/node-creation/insert-indicator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;AAElF,mDAAyH;AACzH,+BAAkC;AAClC,6DAAoE;AAEvD,QAAA,UAAU,GAAG,QAAQ,CAAC;AAEnC,MAAa,eAAgB,SAAQ,eAAK;IAYtC,YAAY,MAAe;QACvB,KAAK,EAAE,CAAC;QARH,OAAE,GAAW,IAAA,SAAI,GAAE,CAAC;QACpB,SAAI,GAAW,eAAe,CAAC,IAAI,CAAC;QACpC,aAAQ,GAAgB,IAAA,0BAAgB,EAAC,eAAe,CAAC,gBAAgB,CAAC,CAAC;QAC3E,eAAU,GAAa,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC;QAC5D,SAAI,GAAc,mBAAS,CAAC,IAAI,CAAC;QAC1C,SAAI,GAAS,EAAE,CAAC;QAIZ,IAAI,MAAM,EAAE,CAAC;YACT,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,kBAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACzC,CAAC;IACL,CAAC;;AAjBL,0CAkBC;AAjB4B,gCAAgB,GAAG,CAAC,uBAAa,EAAE,qBAAW,EAAE,0BAAW,CAAC,AAA5C,CAA6C;AAE/E,oBAAI,GAAG,uBAAuB,AAA1B,CAA2B"}
|
|
@@ -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
|
-
import { Action, Disposable, GModelElement, GhostElement, IModelFactory, TriggerNodeCreationAction } from '@eclipse-glsp/sprotty';
|
|
16
|
+
import { Action, Args, Disposable, GModelElement, GhostElement, IModelFactory, TriggerNodeCreationAction } from '@eclipse-glsp/sprotty';
|
|
17
17
|
import '../../../../css/ghost-element.css';
|
|
18
18
|
import { DragAwareMouseListener } from '../../../base/drag-aware-mouse-listener';
|
|
19
19
|
import { FeedbackEmitter } from '../../../base/feedback/feedback-emitter';
|
|
@@ -51,7 +51,8 @@ export declare class NodeCreationToolMouseListener extends DragAwareMouseListene
|
|
|
51
51
|
protected ghostElementId: string;
|
|
52
52
|
constructor(triggerAction: TriggerNodeCreationAction, tool: NodeCreationTool, ghostElement: GhostElement);
|
|
53
53
|
get elementTypeId(): string;
|
|
54
|
-
nonDraggingMouseUp(
|
|
54
|
+
nonDraggingMouseUp(ctx: GModelElement, event: MouseEvent): Action[];
|
|
55
|
+
protected getCreateNodeOperationArgs(insert: TrackedInsert, ctx: GModelElement, event: MouseEvent): Args | undefined;
|
|
55
56
|
protected createGhostElement(ghostElement: GhostElement): string;
|
|
56
57
|
protected getGhostElement(ctx: GModelElement, event: MouseEvent): MoveableElement | undefined;
|
|
57
58
|
protected getTrackedInsert(ctx: GModelElement, event: MouseEvent): TrackedInsert;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-creation-tool.d.ts","sourceRoot":"","sources":["../../../../src/features/tools/node-creation/node-creation-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACH,MAAM,
|
|
1
|
+
{"version":3,"file":"node-creation-tool.d.ts","sourceRoot":"","sources":["../../../../src/features/tools/node-creation/node-creation-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACH,MAAM,EACN,IAAI,EAIJ,UAAU,EAEV,aAAa,EACb,YAAY,EACZ,aAAa,EAGb,yBAAyB,EAI5B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,mCAAmC,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAEjF,OAAO,EAAE,eAAe,EAAE,MAAM,yCA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AI;CAQrG;AAED,qBAAa,6BAA8B,SAAQ,sBAAsB;IAMjE,SAAS,CAAC,aAAa,EAAE,yBAAyB;IAClD,SAAS,CAAC,IAAI,EAAE,gBAAgB;IAChC,SAAS,CAAC,YAAY,EAAE,YAAY;IAPxC,SAAS,CAAC,cAAc,EAAE,eAAe,CAAC;IAC1C,SAAS,CAAC,oBAAoB,EAAE,eAAe,CAAC;IAChD,SAAS,CAAC,cAAc,EAAE,MAAM,CAAC;gBAGnB,aAAa,EAAE,yBAAyB,EACxC,IAAI,EAAE,gBAAgB,EACtB,YAAY,EAAE,YAAY;IASxC,IAAI,aAAa,IAAI,MAAM,CAE1B;IAEQ,kBAAkB,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,EAAE;IA6B5E,SAAS,CAAC,0BAA0B,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS;IAgBpH,SAAS,CAAC,kBAAkB,CAAC,YAAY,EAAE,YAAY,GAAG,MAAM;IAUhE,SAAS,CAAC,eAAe,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,eAAe,GAAG,SAAS;IAK7F,SAAS,CAAC,gBAAgB,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,aAAa;IAQhF,SAAS,CAAC,yBAAyB,IAAI,IAAI;IAIlC,OAAO,IAAI,IAAI;CAI3B"}
|
|
@@ -115,15 +115,15 @@ class NodeCreationToolMouseListener extends drag_aware_mouse_listener_1.DragAwar
|
|
|
115
115
|
get elementTypeId() {
|
|
116
116
|
return this.triggerAction.elementTypeId;
|
|
117
117
|
}
|
|
118
|
-
nonDraggingMouseUp(
|
|
118
|
+
nonDraggingMouseUp(ctx, event) {
|
|
119
119
|
var _a;
|
|
120
120
|
const result = [];
|
|
121
|
-
const insert = this.getTrackedInsert(
|
|
121
|
+
const insert = this.getTrackedInsert(ctx, event);
|
|
122
122
|
if (insert.valid) {
|
|
123
123
|
result.push(sprotty_1.CreateNodeOperation.create(this.elementTypeId, {
|
|
124
124
|
location: insert.location,
|
|
125
125
|
containerId: (_a = insert.container) === null || _a === void 0 ? void 0 : _a.id,
|
|
126
|
-
args: this.
|
|
126
|
+
args: this.getCreateNodeOperationArgs(insert, ctx, event)
|
|
127
127
|
}));
|
|
128
128
|
}
|
|
129
129
|
if ((0, sprotty_1.isCtrlOrCmd)(event)) {
|
|
@@ -141,6 +141,15 @@ class NodeCreationToolMouseListener extends drag_aware_mouse_listener_1.DragAwar
|
|
|
141
141
|
result.push(tool_1.EnableDefaultToolsAction.create());
|
|
142
142
|
return result;
|
|
143
143
|
}
|
|
144
|
+
getCreateNodeOperationArgs(insert, ctx, event) {
|
|
145
|
+
let args = Object.assign({}, this.triggerAction.args);
|
|
146
|
+
const ghostElement = this.getGhostElement(ctx, event);
|
|
147
|
+
if (ghostElement) {
|
|
148
|
+
const ghostDimensions = (0, sprotty_1.isBoundsAware)(ghostElement) ? sprotty_1.Bounds.dimension(ghostElement.bounds) : sprotty_1.Dimension.ZERO;
|
|
149
|
+
args = Object.assign(Object.assign({}, args), { 'ghost-x': ghostElement.position.x, 'ghost-y': ghostElement.position.y, 'ghost-width': ghostDimensions.width, 'ghost-height': ghostDimensions.height });
|
|
150
|
+
}
|
|
151
|
+
return args;
|
|
152
|
+
}
|
|
144
153
|
createGhostElement(ghostElement) {
|
|
145
154
|
const templates = [ghostElement.template];
|
|
146
155
|
this.ghostElementFeedback.add(add_template_element_1.AddTemplateElementsAction.create({ templates, addClasses: [css_feedback_1.CSS_HIDDEN, css_feedback_1.CSS_GHOST_ELEMENT] }), remove_template_element_1.RemoveTemplateElementsAction.create({ templates }));
|
|
@@ -154,7 +163,7 @@ class NodeCreationToolMouseListener extends drag_aware_mouse_listener_1.DragAwar
|
|
|
154
163
|
getTrackedInsert(ctx, event) {
|
|
155
164
|
const ghostElement = this.getGhostElement(ctx, event);
|
|
156
165
|
if (!ghostElement) {
|
|
157
|
-
return { elementTypeId: this.elementTypeId, location: sprotty_1.Point.ORIGIN, valid: false };
|
|
166
|
+
return { elementTypeId: this.elementTypeId, location: sprotty_1.Point.ORIGIN, valid: false, options: { evt: event } };
|
|
158
167
|
}
|
|
159
168
|
return this.tool.containerManager.insert(ghostElement, ghostElement.position, this.elementTypeId, { evt: event });
|
|
160
169
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-creation-tool.js","sourceRoot":"","sources":["../../../../src/features/tools/node-creation/node-creation-tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"node-creation-tool.js","sourceRoot":"","sources":["../../../../src/features/tools/node-creation/node-creation-tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,mDAiB+B;AAC/B,yCAA+C;AAC/C,6CAA2C;AAC3C,uFAAiF;AACjF,sEAAqH;AAErH,0DAA2E;AAE3E,sFAA8G;AAC9G,8HAAwI;AACxI,4FAA8F;AAC9F,8CAAiD;AACjD,kFAA6E;AAE7E,2DAAsE;AACtE,yDAAqD;AAG9C,IAAM,gBAAgB,wBAAtB,MAAM,gBAAiB,SAAQ,6BAA2C;IAA1E;;QAGO,oBAAe,GAAG,mCAAyB,CAAC,EAAE,CAAC;IAuC7D,CAAC;IAjCG,IAAI,EAAE;QACF,OAAO,kBAAgB,CAAC,EAAE,CAAC;IAC/B,CAAC;IAED,QAAQ;;QACJ,MAAM,YAAY,GAAG,MAAA,IAAI,CAAC,aAAa,CAAC,YAAY,mCAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,EAAE,CAAC;QACnI,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,yBAAyB,CAAC,YA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OAAO,YAAY,IAAI,IAAA,oBAAU,EAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/E,CAAC;IAES,gBAAgB,CAAC,GAAkB,EAAE,KAAiB;QAC5D,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACtD,IAAI,CAAC,YAAY,EAAE,CAAC;YAChB,OAAO,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,EAAE,eAAK,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC;QAChH,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,YAAY,EAAE,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;IACtH,CAAC;IAES,yBAAyB;QAC/B,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;IAEQ,OAAO;QACZ,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC;QACpC,IAAI,CAAC,yBAAyB,EAAE,CAAC;IACrC,CAAC;CACJ;AAjGD,sEAiGC"}
|
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.343+fce3a6a",
|
|
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.343+fce3a6a",
|
|
50
50
|
"autocompleter": "^9.1.0",
|
|
51
51
|
"file-saver": "^2.0.5",
|
|
52
52
|
"lodash": "4.17.21"
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "fce3a6a6ce57c215d995e40c1d5eaebdc3c36b08"
|
|
65
65
|
}
|
|
@@ -54,10 +54,11 @@ export class MouseTrackingElementPositionListener extends DragAwareMouseListener
|
|
|
54
54
|
if (!element) {
|
|
55
55
|
return [];
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
const isInitializing = !this.tracker.isTracking();
|
|
58
|
+
if (isInitializing) {
|
|
58
59
|
this.initialize(element, ctx, event);
|
|
59
60
|
}
|
|
60
|
-
const move = this.tracker.moveElements([element], { snap: event, restrict: event });
|
|
61
|
+
const move = this.tracker.moveElements([element], { snap: event, restrict: event, skipStatic: !isInitializing });
|
|
61
62
|
const elementMove = move.elementMoves[0];
|
|
62
63
|
if (!elementMove) {
|
|
63
64
|
return [];
|
|
@@ -13,38 +13,108 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
import { ExportSvgAction, GModelRoot, RequestAction, SvgExporter } from '@eclipse-glsp/sprotty';
|
|
16
17
|
import { injectable } from 'inversify';
|
|
17
18
|
import { v4 as uuid } from 'uuid';
|
|
18
|
-
import { ExportSvgAction, RequestAction, GModelRoot, SvgExporter } from '@eclipse-glsp/sprotty';
|
|
19
19
|
|
|
20
20
|
@injectable()
|
|
21
21
|
export class GLSPSvgExporter extends SvgExporter {
|
|
22
|
-
override export(root: GModelRoot,
|
|
22
|
+
override export(root: GModelRoot, request?: RequestAction<ExportSvgAction>): void {
|
|
23
23
|
if (typeof document !== 'undefined') {
|
|
24
|
-
|
|
24
|
+
let svgElement = this.findSvgElement();
|
|
25
25
|
if (svgElement) {
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const bounds = this.getBounds(root);
|
|
32
|
-
const svg = this.createSvg(svgElement, root).replace(
|
|
33
|
-
'style="',
|
|
34
|
-
`style="width: ${bounds.width}px !important;height: ${bounds.height}px !important;border: none !important;`
|
|
35
|
-
);
|
|
36
|
-
// do not give request/response id here as otherwise the action is treated as an unrequested response
|
|
37
|
-
this.actionDispatcher.dispatch(ExportSvgAction.create(svg));
|
|
38
|
-
} finally {
|
|
39
|
-
svgElement.id = originalId;
|
|
40
|
-
}
|
|
26
|
+
svgElement = this.prepareSvgElement(svgElement, root, request);
|
|
27
|
+
const serializedSvg = this.createSvg(svgElement, root);
|
|
28
|
+
const svgExport = this.getSvgExport(serializedSvg, svgElement, root, request);
|
|
29
|
+
// do not give request/response id here as otherwise the action is treated as an unrequested response
|
|
30
|
+
this.actionDispatcher.dispatch(ExportSvgAction.create(svgExport));
|
|
41
31
|
}
|
|
42
32
|
}
|
|
43
33
|
}
|
|
44
34
|
|
|
35
|
+
protected override createSvg(svgElement: SVGSVGElement, root: GModelRoot): string {
|
|
36
|
+
// createSvg requires the svg to have a non-empty id, so we generate one if necessary
|
|
37
|
+
const originalId = svgElement.id;
|
|
38
|
+
try {
|
|
39
|
+
svgElement.id = originalId || uuid();
|
|
40
|
+
return super.createSvg(svgElement, root);
|
|
41
|
+
} finally {
|
|
42
|
+
svgElement.id = originalId;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
45
46
|
protected findSvgElement(): SVGSVGElement | null {
|
|
46
47
|
const div = document.getElementById(this.options.hiddenDiv);
|
|
47
48
|
// search for first svg element as hierarchy within Sprotty might change
|
|
48
49
|
return div && div.querySelector('svg');
|
|
49
50
|
}
|
|
51
|
+
|
|
52
|
+
protected prepareSvgElement(svgElement: SVGSVGElement, root: GModelRoot, request?: RequestAction<ExportSvgAction>): SVGSVGElement {
|
|
53
|
+
return svgElement;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
protected override copyStyles(source: Element, target: Element, skippedProperties: string[]): void {
|
|
57
|
+
this.copyStyle(source, target, skippedProperties);
|
|
58
|
+
|
|
59
|
+
// IE doesn't retrun anything on source.children
|
|
60
|
+
for (let i = 0; i < source.childNodes.length; ++i) {
|
|
61
|
+
const sourceChild = source.childNodes[i];
|
|
62
|
+
const targetChild = target.childNodes[i];
|
|
63
|
+
if (sourceChild instanceof Element) {
|
|
64
|
+
this.copyStyles(sourceChild, targetChild as Element, []);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
protected copyStyle(source: Element, target: Element, skippedProperties: string[]): void {
|
|
70
|
+
const sourceStyle = getComputedStyle(source);
|
|
71
|
+
const targetStyle = getComputedStyle(target);
|
|
72
|
+
|
|
73
|
+
let style = '';
|
|
74
|
+
for (let i = 0; i < sourceStyle.length; i++) {
|
|
75
|
+
const propertyName = sourceStyle[i];
|
|
76
|
+
if (!skippedProperties.includes(propertyName)) {
|
|
77
|
+
const propertyValue = sourceStyle.getPropertyValue(propertyName);
|
|
78
|
+
const propertyPriority = sourceStyle.getPropertyPriority(propertyName);
|
|
79
|
+
if (targetStyle.getPropertyValue(propertyName) !== propertyValue) {
|
|
80
|
+
if (this.shouldUpdateStyle(target)) {
|
|
81
|
+
// rather set the property directly on the element to keep other values intact
|
|
82
|
+
target.style.setProperty(propertyName, propertyValue);
|
|
83
|
+
} else {
|
|
84
|
+
// collect all properties to set them at once
|
|
85
|
+
style += `${propertyName}: ${propertyValue}${propertyPriority ? ' !' + propertyPriority : ''}; `;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (style !== '') {
|
|
91
|
+
target.setAttribute('style', style.trim());
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
protected shouldUpdateStyle(element: any): element is ElementCSSInlineStyle {
|
|
96
|
+
// we want to simply update the style of elements and keep other values intact if they have a style property
|
|
97
|
+
return 'tagName' in element && 'style' in element;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
protected getSvgExport(
|
|
101
|
+
serializedSvgElement: string,
|
|
102
|
+
svgElement: SVGElement,
|
|
103
|
+
root: GModelRoot,
|
|
104
|
+
request?: RequestAction<ExportSvgAction>
|
|
105
|
+
): string {
|
|
106
|
+
const svgExportStyle = this.getSvgExportStyle(svgElement, root, request);
|
|
107
|
+
return svgExportStyle ? serializedSvgElement.replace('style="', `style="${svgExportStyle}`) : serializedSvgElement;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
protected getSvgExportStyle(svgElement: SVGElement, root: GModelRoot, request?: RequestAction<ExportSvgAction>): string | undefined {
|
|
111
|
+
// provide generated svg code with respective sizing for proper viewing in browser and remove undesired border
|
|
112
|
+
const bounds = this.getBounds(root);
|
|
113
|
+
return (
|
|
114
|
+
`width: ${bounds.width}px !important;` +
|
|
115
|
+
`height: ${bounds.height}px !important;` +
|
|
116
|
+
'border: none !important;' +
|
|
117
|
+
'cursor: default !important;'
|
|
118
|
+
);
|
|
119
|
+
}
|
|
50
120
|
}
|
|
@@ -20,12 +20,6 @@ import { CSS_GHOST_ELEMENT, CursorCSS, cursorFeedbackAction } from '../../../bas
|
|
|
20
20
|
import { FeedbackEmitter } from '../../../base/feedback/feedback-emitter';
|
|
21
21
|
import { ContainerElement, isContainable } from '../../hints/model';
|
|
22
22
|
import { ChangeBoundsManager } from '../change-bounds/change-bounds-manager';
|
|
23
|
-
export interface TrackedInsert {
|
|
24
|
-
elementTypeId: string;
|
|
25
|
-
location: Point;
|
|
26
|
-
container?: GModelElement;
|
|
27
|
-
valid: boolean;
|
|
28
|
-
}
|
|
29
23
|
|
|
30
24
|
export interface InsertOptions extends Record<string, unknown> {
|
|
31
25
|
/** Flag to indicate whether the location within a container needs to be valid. Default: false */
|
|
@@ -42,6 +36,14 @@ export const DEFAULT_INSERT_OPTIONS: InsertOptions = {
|
|
|
42
36
|
validateLocationInContainer: false
|
|
43
37
|
};
|
|
44
38
|
|
|
39
|
+
export interface TrackedInsert {
|
|
40
|
+
elementTypeId: string;
|
|
41
|
+
location: Point;
|
|
42
|
+
container?: GModelElement;
|
|
43
|
+
valid: boolean;
|
|
44
|
+
options: InsertOptions;
|
|
45
|
+
}
|
|
46
|
+
|
|
45
47
|
@injectable()
|
|
46
48
|
export class ContainerManager {
|
|
47
49
|
@inject(ChangeBoundsManager) protected readonly changeBoundsManager: ChangeBoundsManager;
|
|
@@ -54,7 +56,7 @@ export class ContainerManager {
|
|
|
54
56
|
// we need to check whether the location is valid either because we do not have a container or the option is set
|
|
55
57
|
valid = opts?.validLocationOverwrite ?? this.changeBoundsManager.hasValidPosition(proxy, location);
|
|
56
58
|
}
|
|
57
|
-
return { elementTypeId, container, location, valid };
|
|
59
|
+
return { elementTypeId, container, location, valid, options };
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
findContainer(location: Point, ctx: GModelElement, evt?: MouseEvent): ContainerElement | undefined {
|
|
@@ -29,7 +29,7 @@ export class InsertIndicator extends GNode implements ArgsAware {
|
|
|
29
29
|
override type: string = InsertIndicator.TYPE;
|
|
30
30
|
override features?: FeatureSet = createFeatureSet(InsertIndicator.DEFAULT_FEATURES);
|
|
31
31
|
override cssClasses: string[] = ['insert-indicator', 'sprotty-node'];
|
|
32
|
-
override size: Dimension =
|
|
32
|
+
override size: Dimension = Dimension.ZERO;
|
|
33
33
|
args: Args = {};
|
|
34
34
|
|
|
35
35
|
constructor(length?: number) {
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import {
|
|
17
17
|
Action,
|
|
18
|
+
Args,
|
|
19
|
+
Bounds,
|
|
18
20
|
CreateNodeOperation,
|
|
21
|
+
Dimension,
|
|
19
22
|
Disposable,
|
|
20
23
|
DisposableCollection,
|
|
21
24
|
GModelElement,
|
|
@@ -24,6 +27,7 @@ import {
|
|
|
24
27
|
Point,
|
|
25
28
|
TYPES,
|
|
26
29
|
TriggerNodeCreationAction,
|
|
30
|
+
isBoundsAware,
|
|
27
31
|
isCtrlOrCmd,
|
|
28
32
|
isMoveable
|
|
29
33
|
} from '@eclipse-glsp/sprotty';
|
|
@@ -129,16 +133,16 @@ export class NodeCreationToolMouseListener extends DragAwareMouseListener {
|
|
|
129
133
|
return this.triggerAction.elementTypeId;
|
|
130
134
|
}
|
|
131
135
|
|
|
132
|
-
override nonDraggingMouseUp(
|
|
136
|
+
override nonDraggingMouseUp(ctx: GModelElement, event: MouseEvent): Action[] {
|
|
133
137
|
const result: Action[] = [];
|
|
134
138
|
|
|
135
|
-
const insert = this.getTrackedInsert(
|
|
139
|
+
const insert = this.getTrackedInsert(ctx, event);
|
|
136
140
|
if (insert.valid) {
|
|
137
141
|
result.push(
|
|
138
142
|
CreateNodeOperation.create(this.elementTypeId, {
|
|
139
143
|
location: insert.location,
|
|
140
144
|
containerId: insert.container?.id,
|
|
141
|
-
args: this.
|
|
145
|
+
args: this.getCreateNodeOperationArgs(insert, ctx, event)
|
|
142
146
|
})
|
|
143
147
|
);
|
|
144
148
|
}
|
|
@@ -158,6 +162,22 @@ export class NodeCreationToolMouseListener extends DragAwareMouseListener {
|
|
|
158
162
|
return result;
|
|
159
163
|
}
|
|
160
164
|
|
|
165
|
+
protected getCreateNodeOperationArgs(insert: TrackedInsert, ctx: GModelElement, event: MouseEvent): Args | undefined {
|
|
166
|
+
let args = { ...this.triggerAction.args };
|
|
167
|
+
const ghostElement = this.getGhostElement(ctx, event);
|
|
168
|
+
if (ghostElement) {
|
|
169
|
+
const ghostDimensions = isBoundsAware(ghostElement) ? Bounds.dimension(ghostElement.bounds) : Dimension.ZERO;
|
|
170
|
+
args = {
|
|
171
|
+
...args,
|
|
172
|
+
'ghost-x': ghostElement.position.x,
|
|
173
|
+
'ghost-y': ghostElement.position.y,
|
|
174
|
+
'ghost-width': ghostDimensions.width,
|
|
175
|
+
'ghost-height': ghostDimensions.height
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
return args;
|
|
179
|
+
}
|
|
180
|
+
|
|
161
181
|
protected createGhostElement(ghostElement: GhostElement): string {
|
|
162
182
|
const templates = [ghostElement.template];
|
|
163
183
|
this.ghostElementFeedback.add(
|
|
@@ -176,7 +196,7 @@ export class NodeCreationToolMouseListener extends DragAwareMouseListener {
|
|
|
176
196
|
protected getTrackedInsert(ctx: GModelElement, event: MouseEvent): TrackedInsert {
|
|
177
197
|
const ghostElement = this.getGhostElement(ctx, event);
|
|
178
198
|
if (!ghostElement) {
|
|
179
|
-
return { elementTypeId: this.elementTypeId, location: Point.ORIGIN, valid: false };
|
|
199
|
+
return { elementTypeId: this.elementTypeId, location: Point.ORIGIN, valid: false, options: { evt: event } };
|
|
180
200
|
}
|
|
181
201
|
return this.tool.containerManager.insert(ghostElement, ghostElement.position, this.elementTypeId, { evt: event });
|
|
182
202
|
}
|