@eclipse-glsp/client 2.3.0-next.390 → 2.3.0-next.391
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/export/glsp-svg-exporter.d.ts +3 -3
- package/lib/features/export/glsp-svg-exporter.d.ts.map +1 -1
- package/lib/features/export/glsp-svg-exporter.js +6 -5
- package/lib/features/export/glsp-svg-exporter.js.map +1 -1
- package/package.json +3 -3
- package/src/features/export/glsp-svg-exporter.ts +17 -7
|
@@ -13,10 +13,10 @@
|
|
|
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
|
+
import { Action, ExportSvgAction, ExportSvgOptions, GModelRoot, RequestAction, RequestExportSvgAction, SvgExporter } from '@eclipse-glsp/sprotty';
|
|
17
17
|
export declare class GLSPSvgExporter extends SvgExporter {
|
|
18
|
-
export(root: GModelRoot, request?:
|
|
19
|
-
protected createSvg(svgElement: SVGSVGElement, root: GModelRoot): string;
|
|
18
|
+
export(root: GModelRoot, request?: RequestExportSvgAction): void;
|
|
19
|
+
protected createSvg(svgElement: SVGSVGElement, root: GModelRoot, options?: ExportSvgOptions, cause?: Action): string;
|
|
20
20
|
protected findSvgElement(): SVGSVGElement | null;
|
|
21
21
|
protected prepareSvgElement(svgElement: SVGSVGElement, root: GModelRoot, request?: RequestAction<ExportSvgAction>): SVGSVGElement;
|
|
22
22
|
protected copyStyles(source: Element, target: Element, skippedProperties: string[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-svg-exporter.d.ts","sourceRoot":"","sources":["../../../src/features/export/glsp-svg-exporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,
|
|
1
|
+
{"version":3,"file":"glsp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AAe,CAAC,GAAG,MAAM,GAAG,SAAS;CAUtI"}
|
|
@@ -27,23 +27,24 @@ const inversify_1 = require("inversify");
|
|
|
27
27
|
const uuid_1 = require("uuid");
|
|
28
28
|
let GLSPSvgExporter = class GLSPSvgExporter extends sprotty_1.SvgExporter {
|
|
29
29
|
export(root, request) {
|
|
30
|
+
var _a;
|
|
30
31
|
if (typeof document !== 'undefined') {
|
|
31
32
|
let svgElement = this.findSvgElement();
|
|
32
33
|
if (svgElement) {
|
|
33
34
|
svgElement = this.prepareSvgElement(svgElement, root, request);
|
|
34
|
-
const serializedSvg = this.createSvg(svgElement, root);
|
|
35
|
+
const serializedSvg = this.createSvg(svgElement, root, (_a = request === null || request === void 0 ? void 0 : request.options) !== null && _a !== void 0 ? _a : {}, request);
|
|
35
36
|
const svgExport = this.getSvgExport(serializedSvg, svgElement, root, request);
|
|
36
37
|
// 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));
|
|
38
|
+
this.actionDispatcher.dispatch(sprotty_1.ExportSvgAction.create(svgExport, { responseId: request === null || request === void 0 ? void 0 : request.requestId, options: request === null || request === void 0 ? void 0 : request.options }));
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
createSvg(svgElement, root) {
|
|
42
|
+
createSvg(svgElement, root, options, cause) {
|
|
42
43
|
// createSvg requires the svg to have a non-empty id, so we generate one if necessary
|
|
43
44
|
const originalId = svgElement.id;
|
|
44
45
|
try {
|
|
45
46
|
svgElement.id = originalId || (0, uuid_1.v4)();
|
|
46
|
-
return super.createSvg(svgElement, root);
|
|
47
|
+
return super.createSvg(svgElement, root, options, cause);
|
|
47
48
|
}
|
|
48
49
|
finally {
|
|
49
50
|
svgElement.id = originalId;
|
|
@@ -103,7 +104,7 @@ let GLSPSvgExporter = class GLSPSvgExporter extends sprotty_1.SvgExporter {
|
|
|
103
104
|
}
|
|
104
105
|
getSvgExportStyle(svgElement, root, request) {
|
|
105
106
|
// provide generated svg code with respective sizing for proper viewing in browser and remove undesired border
|
|
106
|
-
const bounds = this.getBounds(root);
|
|
107
|
+
const bounds = this.getBounds(root, document);
|
|
107
108
|
return (`width: ${bounds.width}px !important;` +
|
|
108
109
|
`height: ${bounds.height}px !important;` +
|
|
109
110
|
'border: none !important;' +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glsp-svg-exporter.js","sourceRoot":"","sources":["../../../src/features/export/glsp-svg-exporter.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"glsp-svg-exporter.js","sourceRoot":"","sources":["../../../src/features/export/glsp-svg-exporter.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,mDAQ+B;AAC/B,yCAAuC;AACvC,+BAAkC;AAG3B,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,qBAAW;IACnC,MAAM,CAAC,IAAgB,EAAE,OAAgC;;QAC9D,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;YAClC,IAAI,UAAU,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;YACvC,IAAI,UAAU,EAAE,CAAC;gBACb,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;gBAC/D,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,mCAAI,EAAE,EAAE,OAAO,CAAC,CAAC;gBACxF,MAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;gBAC9E,qGAAqG;gBACrG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAC1B,yBAAe,CAAC,MAA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AK,EAAE,EAAE,CAAC;YACf,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAC/C,CAAC;IACL,CAAC;IAES,iBAAiB,CAAC,OAAY;QACpC,4GAA4G;QAC5G,OAAO,SAAS,IAAI,OAAO,IAAI,OAAO,IAAI,OAAO,CAAC;IACtD,CAAC;IAES,YAAY,CAClB,oBAA4B,EAC5B,UAAsB,EACtB,IAAgB,EAChB,OAAwC;QAExC,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QACzE,OAAO,cAAc,CAAC,CAAC,CAAC,oBAAoB,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC;IACvH,CAAC;IAES,iBAAiB,CAAC,UAAsB,EAAE,IAAgB,EAAE,OAAwC;QAC1G,8GAA8G;QAC9G,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC9C,OAAO,CACH,UAAU,MAAM,CAAC,KAAK,gBAAgB;YACtC,WAAW,MAAM,CAAC,MAAM,gBAAgB;YACxC,0BAA0B;YAC1B,6BAA6B,CAChC,CAAC;IACN,CAAC;CACJ,CAAA;AArGY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,sBAAU,GAAE;GACA,eAAe,CAqG3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-glsp/client",
|
|
3
|
-
"version": "2.3.0-next.
|
|
3
|
+
"version": "2.3.0-next.391+dd011ea",
|
|
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.3.0-next.
|
|
49
|
+
"@eclipse-glsp/sprotty": "2.3.0-next.391+dd011ea",
|
|
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": "dd011eae4f7a629cc2431e5e6d832ddb9483554b"
|
|
67
67
|
}
|
|
@@ -13,31 +13,41 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
Action,
|
|
18
|
+
ExportSvgAction,
|
|
19
|
+
ExportSvgOptions,
|
|
20
|
+
GModelRoot,
|
|
21
|
+
RequestAction,
|
|
22
|
+
RequestExportSvgAction,
|
|
23
|
+
SvgExporter
|
|
24
|
+
} from '@eclipse-glsp/sprotty';
|
|
17
25
|
import { injectable } from 'inversify';
|
|
18
26
|
import { v4 as uuid } from 'uuid';
|
|
19
27
|
|
|
20
28
|
@injectable()
|
|
21
29
|
export class GLSPSvgExporter extends SvgExporter {
|
|
22
|
-
override export(root: GModelRoot, request?:
|
|
30
|
+
override export(root: GModelRoot, request?: RequestExportSvgAction): void {
|
|
23
31
|
if (typeof document !== 'undefined') {
|
|
24
32
|
let svgElement = this.findSvgElement();
|
|
25
33
|
if (svgElement) {
|
|
26
34
|
svgElement = this.prepareSvgElement(svgElement, root, request);
|
|
27
|
-
const serializedSvg = this.createSvg(svgElement, root);
|
|
35
|
+
const serializedSvg = this.createSvg(svgElement, root, request?.options ?? {}, request);
|
|
28
36
|
const svgExport = this.getSvgExport(serializedSvg, svgElement, root, request);
|
|
29
37
|
// do not give request/response id here as otherwise the action is treated as an unrequested response
|
|
30
|
-
this.actionDispatcher.dispatch(
|
|
38
|
+
this.actionDispatcher.dispatch(
|
|
39
|
+
ExportSvgAction.create(svgExport, { responseId: request?.requestId, options: request?.options })
|
|
40
|
+
);
|
|
31
41
|
}
|
|
32
42
|
}
|
|
33
43
|
}
|
|
34
44
|
|
|
35
|
-
protected override createSvg(svgElement: SVGSVGElement, root: GModelRoot): string {
|
|
45
|
+
protected override createSvg(svgElement: SVGSVGElement, root: GModelRoot, options?: ExportSvgOptions, cause?: Action): string {
|
|
36
46
|
// createSvg requires the svg to have a non-empty id, so we generate one if necessary
|
|
37
47
|
const originalId = svgElement.id;
|
|
38
48
|
try {
|
|
39
49
|
svgElement.id = originalId || uuid();
|
|
40
|
-
return super.createSvg(svgElement, root);
|
|
50
|
+
return super.createSvg(svgElement, root, options, cause);
|
|
41
51
|
} finally {
|
|
42
52
|
svgElement.id = originalId;
|
|
43
53
|
}
|
|
@@ -109,7 +119,7 @@ export class GLSPSvgExporter extends SvgExporter {
|
|
|
109
119
|
|
|
110
120
|
protected getSvgExportStyle(svgElement: SVGElement, root: GModelRoot, request?: RequestAction<ExportSvgAction>): string | undefined {
|
|
111
121
|
// provide generated svg code with respective sizing for proper viewing in browser and remove undesired border
|
|
112
|
-
const bounds = this.getBounds(root);
|
|
122
|
+
const bounds = this.getBounds(root, document);
|
|
113
123
|
return (
|
|
114
124
|
`width: ${bounds.width}px !important;` +
|
|
115
125
|
`height: ${bounds.height}px !important;` +
|