@eclipse-glsp/client 2.7.0-next.24 → 2.7.0-next.26

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.
Files changed (74) hide show
  1. package/lib/base/action-dispatcher.d.ts.map +1 -1
  2. package/lib/base/action-dispatcher.js +2 -1
  3. package/lib/base/action-dispatcher.js.map +1 -1
  4. package/lib/base/model/diagram-loader.d.ts +8 -6
  5. package/lib/base/model/diagram-loader.d.ts.map +1 -1
  6. package/lib/base/model/diagram-loader.js +1 -1
  7. package/lib/base/model/diagram-loader.js.map +1 -1
  8. package/lib/features/export/default-png-diagram-exporter.d.ts +52 -0
  9. package/lib/features/export/default-png-diagram-exporter.d.ts.map +1 -0
  10. package/lib/features/export/default-png-diagram-exporter.js +157 -0
  11. package/lib/features/export/default-png-diagram-exporter.js.map +1 -0
  12. package/lib/features/export/default-svg-diagram-exporter.d.ts +32 -0
  13. package/lib/features/export/default-svg-diagram-exporter.d.ts.map +1 -0
  14. package/lib/features/export/default-svg-diagram-exporter.js +54 -0
  15. package/lib/features/export/default-svg-diagram-exporter.js.map +1 -0
  16. package/lib/features/export/diagram-export-postprocessor.d.ts +33 -0
  17. package/lib/features/export/diagram-export-postprocessor.d.ts.map +1 -0
  18. package/lib/features/export/diagram-export-postprocessor.js +84 -0
  19. package/lib/features/export/diagram-export-postprocessor.js.map +1 -0
  20. package/lib/features/export/diagram-exporter.d.ts +44 -0
  21. package/lib/features/export/diagram-exporter.d.ts.map +1 -0
  22. package/lib/features/export/diagram-exporter.js +18 -0
  23. package/lib/features/export/diagram-exporter.js.map +1 -0
  24. package/lib/features/export/export-modules.d.ts +1 -1
  25. package/lib/features/export/export-modules.d.ts.map +1 -1
  26. package/lib/features/export/export-modules.js +20 -3
  27. package/lib/features/export/export-modules.js.map +1 -1
  28. package/lib/features/export/export-result-action-handler.d.ts +28 -0
  29. package/lib/features/export/export-result-action-handler.d.ts.map +1 -0
  30. package/lib/features/export/export-result-action-handler.js +72 -0
  31. package/lib/features/export/export-result-action-handler.js.map +1 -0
  32. package/lib/features/export/export-svg-action-handler.d.ts +19 -0
  33. package/lib/features/export/export-svg-action-handler.d.ts.map +1 -1
  34. package/lib/features/export/export-svg-action-handler.js +4 -15
  35. package/lib/features/export/export-svg-action-handler.js.map +1 -1
  36. package/lib/features/export/glsp-svg-exporter.d.ts +18 -1
  37. package/lib/features/export/glsp-svg-exporter.d.ts.map +1 -1
  38. package/lib/features/export/glsp-svg-exporter.js +44 -11
  39. package/lib/features/export/glsp-svg-exporter.js.map +1 -1
  40. package/lib/features/export/request-export-command.d.ts +29 -0
  41. package/lib/features/export/request-export-command.d.ts.map +1 -0
  42. package/lib/features/export/request-export-command.js +73 -0
  43. package/lib/features/export/request-export-command.js.map +1 -0
  44. package/lib/features/export/request-export-key-listener.d.ts +21 -0
  45. package/lib/features/export/request-export-key-listener.d.ts.map +1 -0
  46. package/lib/features/export/request-export-key-listener.js +40 -0
  47. package/lib/features/export/request-export-key-listener.js.map +1 -0
  48. package/lib/features/tool-palette/tool-palette.d.ts.map +1 -1
  49. package/lib/features/tool-palette/tool-palette.js +1 -2
  50. package/lib/features/tool-palette/tool-palette.js.map +1 -1
  51. package/lib/features/viewport/origin-viewport.d.ts +2 -13
  52. package/lib/features/viewport/origin-viewport.d.ts.map +1 -1
  53. package/lib/features/viewport/origin-viewport.js +3 -19
  54. package/lib/features/viewport/origin-viewport.js.map +1 -1
  55. package/lib/index.d.ts +6 -0
  56. package/lib/index.d.ts.map +1 -1
  57. package/lib/index.js +6 -0
  58. package/lib/index.js.map +1 -1
  59. package/package.json +3 -3
  60. package/src/base/action-dispatcher.ts +3 -1
  61. package/src/base/model/diagram-loader.ts +8 -6
  62. package/src/features/export/default-png-diagram-exporter.ts +145 -0
  63. package/src/features/export/default-svg-diagram-exporter.ts +39 -0
  64. package/src/features/export/diagram-export-postprocessor.ts +82 -0
  65. package/src/features/export/diagram-exporter.ts +45 -0
  66. package/src/features/export/export-modules.ts +24 -4
  67. package/src/features/export/export-result-action-handler.ts +66 -0
  68. package/src/features/export/export-svg-action-handler.ts +7 -2
  69. package/src/features/export/glsp-svg-exporter.ts +48 -12
  70. package/src/features/export/request-export-command.ts +65 -0
  71. package/src/features/export/request-export-key-listener.ts +29 -0
  72. package/src/features/tool-palette/tool-palette.ts +1 -1
  73. package/src/features/viewport/origin-viewport.ts +10 -23
  74. package/src/index.ts +6 -0
@@ -0,0 +1,44 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { Action, ExportEncoding, ExportFormat, ExportMimeType, GModelRoot } from '@eclipse-glsp/sprotty';
17
+ /**
18
+ * A pluggable strategy that turns the rendered diagram into the bytes of a specific export
19
+ * format. GLSP ships strategies for `'svg'` and `'png'` (both rendered client-side via the
20
+ * existing SVG export pipeline + `OffscreenCanvas` for PNG). Adopters add formats — PPTX,
21
+ * PDF, server-rendered PNG, … — by registering additional contributions.
22
+ *
23
+ * Implementations choose how the bytes are produced (DOM serialisation, canvas
24
+ * rasterisation, delegation to a backend service via Theia/Electron RPC, …) — the registry
25
+ * is runtime-agnostic. The generic `O` is the strategy-specific options shape (e.g.
26
+ * `PngExportOptions`) carried inside `RequestExportAction.formatOptions`; the postprocessor
27
+ * forwards the bag to the strategy, so each implementation reads its typed options directly
28
+ * without an in-method cast.
29
+ */
30
+ export interface DiagramExporter<O = unknown> {
31
+ /** Format identifier matched against `RequestExportAction.format` (lower-case). */
32
+ readonly format: ExportFormat;
33
+ /** MIME type written into the resulting `ExportResultAction.mimeType`. */
34
+ readonly mimeType: ExportMimeType;
35
+ /** Encoding of the produced `data` field — `'text'` for SVG markup, `'base64'` for binary formats, or any adopter-defined tag. */
36
+ readonly encoding: ExportEncoding;
37
+ /**
38
+ * Produce the export payload. `formatOptions` is the strategy-typed slice of
39
+ * `RequestExportAction.formatOptions`; `cause` carries the originating action so
40
+ * adopters can inspect request metadata beyond the per-format options.
41
+ */
42
+ export(root: GModelRoot, formatOptions: O, cause?: Action): Promise<string>;
43
+ }
44
+ //# sourceMappingURL=diagram-exporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagram-exporter.d.ts","sourceRoot":"","sources":["../../../src/features/export/diagram-exporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEzG;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,OAAO;IACxC,mFAAmF;IACnF,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,kIAAkI;IAClI,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC/E"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ //# sourceMappingURL=diagram-exporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagram-exporter.js","sourceRoot":"","sources":["../../../src/features/export/diagram-exporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF"}
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2019-2024 EclipseSource and others.
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
@@ -1 +1 @@
1
- {"version":3,"file":"export-modules.d.ts","sourceRoot":"","sources":["../../../src/features/export/export-modules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAQH,aAAa,EAEhB,MAAM,uBAAuB,CAAC;AAI/B,eAAO,MAAM,YAAY,eAQxB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,eAQlC,CAAC"}
1
+ {"version":3,"file":"export-modules.d.ts","sourceRoot":"","sources":["../../../src/features/export/export-modules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAQH,aAAa,EAEhB,MAAM,uBAAuB,CAAC;AAU/B,eAAO,MAAM,YAAY,eAiBxB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,eAYlC,CAAC"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.standaloneExportModule = exports.exportModule = void 0;
4
4
  /********************************************************************************
5
- * Copyright (c) 2019-2024 EclipseSource and others.
5
+ * Copyright (c) 2019-2026 EclipseSource and others.
6
6
  *
7
7
  * This program and the accompanying materials are made available under the
8
8
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -16,14 +16,28 @@ exports.standaloneExportModule = exports.exportModule = void 0;
16
16
  *
17
17
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
18
18
  ********************************************************************************/
19
+ /* eslint-disable @typescript-eslint/no-deprecated */
19
20
  const sprotty_1 = require("@eclipse-glsp/sprotty");
21
+ const default_png_diagram_exporter_1 = require("./default-png-diagram-exporter");
22
+ const default_svg_diagram_exporter_1 = require("./default-svg-diagram-exporter");
23
+ const diagram_export_postprocessor_1 = require("./diagram-export-postprocessor");
24
+ const export_result_action_handler_1 = require("./export-result-action-handler");
20
25
  const export_svg_action_handler_1 = require("./export-svg-action-handler");
21
26
  const glsp_svg_exporter_1 = require("./glsp-svg-exporter");
27
+ const request_export_command_1 = require("./request-export-command");
28
+ const request_export_key_listener_1 = require("./request-export-key-listener");
22
29
  exports.exportModule = new sprotty_1.FeatureModule((bind, _unbind, isBound) => {
23
30
  const context = { bind, isBound };
31
+ (0, sprotty_1.bindAsService)(context, sprotty_1.TYPES.SvgExporter, glsp_svg_exporter_1.GLSPSvgExporter);
32
+ // Unified export pipeline.
33
+ (0, sprotty_1.bindAsService)(context, sprotty_1.TYPES.HiddenVNodePostprocessor, diagram_export_postprocessor_1.DiagramExportPostprocessor);
34
+ (0, sprotty_1.configureCommand)(context, request_export_command_1.RequestExportCommand);
35
+ (0, sprotty_1.bindAsService)(context, sprotty_1.TYPES.IDiagramExporter, default_svg_diagram_exporter_1.DefaultSvgDiagramExporter);
36
+ (0, sprotty_1.bindAsService)(context, sprotty_1.TYPES.IDiagramExporter, default_png_diagram_exporter_1.DefaultPngDiagramExporter);
37
+ // Legacy SVG-only pipeline kept functional for adopters still dispatching the
38
+ // deprecated `RequestExportSvgAction` / `ExportSvgAction`.
24
39
  (0, sprotty_1.bindAsService)(context, sprotty_1.TYPES.HiddenVNodePostprocessor, sprotty_1.ExportSvgPostprocessor);
25
40
  (0, sprotty_1.configureCommand)(context, sprotty_1.ExportSvgCommand);
26
- bind(sprotty_1.TYPES.SvgExporter).to(glsp_svg_exporter_1.GLSPSvgExporter).inSingletonScope();
27
41
  }, { featureId: Symbol('export') });
28
42
  /**
29
43
  * Feature module that is intended for the standalone deployment of GLSP (i.e. plain webapp)
@@ -32,7 +46,10 @@ exports.exportModule = new sprotty_1.FeatureModule((bind, _unbind, isBound) => {
32
46
  */
33
47
  exports.standaloneExportModule = new sprotty_1.FeatureModule((bind, _unbind, isBound) => {
34
48
  const context = { bind, isBound };
35
- (0, sprotty_1.bindAsService)(context, sprotty_1.TYPES.KeyListener, sprotty_1.ExportSvgKeyListener);
49
+ (0, sprotty_1.bindAsService)(context, sprotty_1.TYPES.KeyListener, request_export_key_listener_1.RequestExportKeyListener);
50
+ bind(export_result_action_handler_1.ExportResultActionHandler).toSelf().inSingletonScope();
51
+ (0, sprotty_1.configureActionHandler)(context, sprotty_1.ExportResultAction.KIND, export_result_action_handler_1.ExportResultActionHandler);
52
+ // Legacy download path: bound so adopters dispatching `ExportSvgAction` still get a download.
36
53
  bind(export_svg_action_handler_1.ExportSvgActionHandler).toSelf().inSingletonScope();
37
54
  (0, sprotty_1.configureActionHandler)(context, sprotty_1.ExportSvgAction.KIND, export_svg_action_handler_1.ExportSvgActionHandler);
38
55
  }, { featureId: Symbol('standaloneExport'), requires: exports.exportModule });
@@ -1 +1 @@
1
- {"version":3,"file":"export-modules.js","sourceRoot":"","sources":["../../../src/features/export/export-modules.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,mDAU+B;AAC/B,2EAAqE;AACrE,2DAAsD;AAEzC,QAAA,YAAY,GAAG,IAAI,uBAAa,CACzC,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE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AC,gBAAgB,EAAE,CAAC;IACzD,IAAA,gCAAsB,EAAC,OAAO,EAAE,yBAAe,CAAC,IAAI,EAAE,kDAAsB,CAAC,CAAC;AAClF,CAAC,EACD,EAAE,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC,EAAE,QAAQ,EAAE,oBAAY,EAAE,CACpE,CAAC"}
@@ -0,0 +1,28 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 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 { ExportResultAction, IActionHandler } from '@eclipse-glsp/sprotty';
17
+ /**
18
+ * Default handler for the unified {@link ExportResultAction} — triggers a browser file
19
+ * download for UI-driven flows. Bound by `standaloneExportModule`; integrations that
20
+ * provide their own download UX omit it.
21
+ */
22
+ export declare class ExportResultActionHandler implements IActionHandler {
23
+ handle(action: ExportResultAction): void;
24
+ protected toBlob(action: ExportResultAction): Blob;
25
+ protected extensionFor(format: string): string;
26
+ protected decodeBase64(data: string): ArrayBuffer;
27
+ }
28
+ //# sourceMappingURL=export-result-action-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export-result-action-handler.d.ts","sourceRoot":"","sources":["../../../src/features/export/export-result-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAI3E;;;;GAIG;AACH,qBACa,yBAA0B,YAAW,cAAc;IAC5D,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI;IAQxC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI;IAiBlD,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAI9C,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW;CASpD"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.ExportResultActionHandler = void 0;
25
+ const sprotty_1 = require("@eclipse-glsp/sprotty");
26
+ const file_saver_1 = require("file-saver");
27
+ const inversify_1 = require("inversify");
28
+ /**
29
+ * Default handler for the unified {@link ExportResultAction} — triggers a browser file
30
+ * download for UI-driven flows. Bound by `standaloneExportModule`; integrations that
31
+ * provide their own download UX omit it.
32
+ */
33
+ let ExportResultActionHandler = class ExportResultActionHandler {
34
+ handle(action) {
35
+ if (!sprotty_1.ExportResultAction.is(action)) {
36
+ return;
37
+ }
38
+ const blob = this.toBlob(action);
39
+ (0, file_saver_1.saveAs)(blob, `diagram.${this.extensionFor(action.format)}`);
40
+ }
41
+ toBlob(action) {
42
+ // `encoding` is `ProposalString<'text' | 'base64'>` — an open union. Reject unknown
43
+ // tags explicitly: silently treating an arbitrary value as text would mojibake binary
44
+ // payloads, while treating it as base64 would corrupt text payloads.
45
+ switch (action.encoding) {
46
+ case 'text':
47
+ return new Blob([action.data], { type: `${action.mimeType};charset=utf-8` });
48
+ case 'base64':
49
+ return new Blob([this.decodeBase64(action.data)], { type: action.mimeType });
50
+ default:
51
+ throw new Error(`ExportResultActionHandler: unsupported encoding '${action.encoding}' for format '${action.format}'. ` +
52
+ 'Adopters that ship a custom encoding must also subclass this handler to decode it.');
53
+ }
54
+ }
55
+ extensionFor(format) {
56
+ return format.toLowerCase();
57
+ }
58
+ decodeBase64(data) {
59
+ const binary = atob(data);
60
+ const buffer = new ArrayBuffer(binary.length);
61
+ const view = new Uint8Array(buffer);
62
+ for (let i = 0; i < binary.length; ++i) {
63
+ view[i] = binary.charCodeAt(i);
64
+ }
65
+ return buffer;
66
+ }
67
+ };
68
+ exports.ExportResultActionHandler = ExportResultActionHandler;
69
+ exports.ExportResultActionHandler = ExportResultActionHandler = __decorate([
70
+ (0, inversify_1.injectable)()
71
+ ], ExportResultActionHandler);
72
+ //# sourceMappingURL=export-result-action-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export-result-action-handler.js","sourceRoot":"","sources":["../../../src/features/export/export-result-action-handler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;AAElF,mDAA2E;AAC3E,2CAAoC;AACpC,yCAAuC;AAEvC;;;;GAIG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBA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AG,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;YACrC,IAAI,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ,CAAA;AAvCY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,sBAAU,GAAE;GACA,yBAAyB,CAuCrC"}
@@ -1,9 +1,28 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023-2026 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
+ ********************************************************************************/
1
16
  import { ExportSvgAction, IActionHandler } from '@eclipse-glsp/sprotty';
2
17
  /**
3
18
  * The default handler for {@link ExportSvgAction}s. This generic handler can be used in
4
19
  * any GLSP project independent of the target platform. However, platform integration modules typically
5
20
  * * this handler is rebound to an application specific handler in platform integration modules
6
21
  * (e.g. the Theia integration)
22
+ *
23
+ * @deprecated Use the unified export pipeline ({@link RequestExportAction} +
24
+ * {@link DiagramExporter}) and bind your own {@link IActionHandler} for
25
+ * {@link ExportResultAction} instead.
7
26
  */
8
27
  export declare class ExportSvgActionHandler implements IActionHandler {
9
28
  handle(action: ExportSvgAction): void;
@@ -1 +1 @@
1
- {"version":3,"file":"export-svg-action-handler.d.ts","sourceRoot":"","sources":["../../../src/features/export/export-svg-action-handler.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAExE;;;;;GAKG;AACH,qBACa,sBAAuB,YAAW,cAAc;IACzD,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;CAIxC"}
1
+ {"version":3,"file":"export-svg-action-handler.d.ts","sourceRoot":"","sources":["../../../src/features/export/export-svg-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIxE;;;;;;;;;GASG;AACH,qBACa,sBAAuB,YAAW,cAAc;IACzD,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;CAIxC"}
@@ -7,21 +7,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.ExportSvgActionHandler = void 0;
10
- /********************************************************************************
11
- * Copyright (c) 2023 EclipseSource and others.
12
- *
13
- * This program and the accompanying materials are made available under the
14
- * terms of the Eclipse Public License v. 2.0 which is available at
15
- * http://www.eclipse.org/legal/epl-2.0.
16
- *
17
- * This Source Code may also be made available under the following Secondary
18
- * Licenses when the conditions for such availability set forth in the Eclipse
19
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
20
- * with the GNU Classpath Exception which is available at
21
- * https://www.gnu.org/software/classpath/license.html.
22
- *
23
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
24
- ********************************************************************************/
25
10
  const file_saver_1 = require("file-saver");
26
11
  const inversify_1 = require("inversify");
27
12
  /**
@@ -29,6 +14,10 @@ const inversify_1 = require("inversify");
29
14
  * any GLSP project independent of the target platform. However, platform integration modules typically
30
15
  * * this handler is rebound to an application specific handler in platform integration modules
31
16
  * (e.g. the Theia integration)
17
+ *
18
+ * @deprecated Use the unified export pipeline ({@link RequestExportAction} +
19
+ * {@link DiagramExporter}) and bind your own {@link IActionHandler} for
20
+ * {@link ExportResultAction} instead.
32
21
  */
33
22
  let ExportSvgActionHandler = class ExportSvgActionHandler {
34
23
  handle(action) {
@@ -1 +1 @@
1
- {"version":3,"file":"export-svg-action-handler.js","sourceRoot":"","sources":["../../../src/features/export/export-svg-action-handler.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,2CAAoC;AACpC,yCAAuC;AAGvC;;;;;GAKG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAC/B,MAAM,CAAC,MAAuB;QAC1B,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC,CAAC;QAC1E,IAAA,mBAAM,EAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAChC,CAAC;CACJ,CAAA;AALY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,sBAAU,GAAE;GACA,sBAAsB,CAKlC"}
1
+ {"version":3,"file":"export-svg-action-handler.js","sourceRoot":"","sources":["../../../src/features/export/export-svg-action-handler.ts"],"names":[],"mappings":";;;;;;;;;AAiBA,2CAAoC;AACpC,yCAAuC;AAEvC;;;;;;;;;GASG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAC/B,MAAM,CAAC,MAAuB;QAC1B,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC,CAAC;QAC1E,IAAA,mBAAM,EAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAChC,CAAC;CACJ,CAAA;AALY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,sBAAU,GAAE;GACA,sBAAsB,CAKlC"}
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2022-2024 EclipseSource and others.
2
+ * Copyright (c) 2022-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
@@ -15,7 +15,24 @@
15
15
  ********************************************************************************/
16
16
  import { Action, ExportSvgAction, ExportSvgOptions, GModelRoot, RequestAction, RequestExportSvgAction, SvgExporter } from '@eclipse-glsp/sprotty';
17
17
  export declare class GLSPSvgExporter extends SvgExporter {
18
+ /**
19
+ * Legacy entry point for the SVG-only export flow. New code should use the unified
20
+ * `RequestExportAction` flow (registered via the `DiagramExporter` registry);
21
+ * adopters that previously bound {@link RequestExportSvgAction} should migrate to
22
+ * `RequestExportAction` with `format: 'svg'`.
23
+ *
24
+ * @deprecated Use the unified export pipeline. Retained for backward compatibility
25
+ * with the legacy {@link RequestExportSvgAction} / {@link ExportSvgAction} flow.
26
+ */
18
27
  export(root: GModelRoot, request?: RequestExportSvgAction): void;
28
+ /**
29
+ * Produce the serialised SVG string without dispatching any action. Throws on
30
+ * failure (no document, no SVG element). Used by the legacy `export()` path and
31
+ * by unified-export strategies (`DefaultSvgDiagramExporter`, `DefaultPngDiagramExporter`)
32
+ * that need the SVG bytes without the action-dispatch side effect.
33
+ */
34
+ exportToString(root: GModelRoot, options?: ExportSvgOptions, cause?: Action): string;
35
+ protected dispatchRejectionIfRequested(request: RequestExportSvgAction | undefined, message: string): void;
19
36
  protected createSvg(svgElement: SVGSVGElement, root: GModelRoot, options?: ExportSvgOptions, cause?: Action): string;
20
37
  protected findSvgElement(): SVGSVGElement | null;
21
38
  protected prepareSvgElement(svgElement: SVGSVGElement, root: GModelRoot, request?: RequestAction<ExportSvgAction>): SVGSVGElement;
@@ -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,EACH,MAAM,EACN,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,sBAAsB,EACtB,WAAW,EACd,MAAM,uBAAuB,CAAC;AAI/B,qBACa,e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C,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,GAAG,MAAM,GAAG,SAAS;CAUtI"}
@@ -8,7 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.GLSPSvgExporter = void 0;
10
10
  /********************************************************************************
11
- * Copyright (c) 2022-2024 EclipseSource and others.
11
+ * Copyright (c) 2022-2026 EclipseSource and others.
12
12
  *
13
13
  * This program and the accompanying materials are made available under the
14
14
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -22,21 +22,54 @@ 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
+ /* eslint-disable @typescript-eslint/no-deprecated */
25
26
  const sprotty_1 = require("@eclipse-glsp/sprotty");
26
27
  const inversify_1 = require("inversify");
27
28
  const uuid_1 = require("uuid");
28
29
  let GLSPSvgExporter = class GLSPSvgExporter extends sprotty_1.SvgExporter {
30
+ /**
31
+ * Legacy entry point for the SVG-only export flow. New code should use the unified
32
+ * `RequestExportAction` flow (registered via the `DiagramExporter` registry);
33
+ * adopters that previously bound {@link RequestExportSvgAction} should migrate to
34
+ * `RequestExportAction` with `format: 'svg'`.
35
+ *
36
+ * @deprecated Use the unified export pipeline. Retained for backward compatibility
37
+ * with the legacy {@link RequestExportSvgAction} / {@link ExportSvgAction} flow.
38
+ */
29
39
  export(root, request) {
30
- var _a;
31
- if (typeof document !== 'undefined') {
32
- let svgElement = this.findSvgElement();
33
- if (svgElement) {
34
- svgElement = this.prepareSvgElement(svgElement, root, request);
35
- const serializedSvg = this.createSvg(svgElement, root, (_a = request === null || request === void 0 ? void 0 : request.options) !== null && _a !== void 0 ? _a : {}, request);
36
- const svgExport = this.getSvgExport(serializedSvg, svgElement, root, request);
37
- // do not give request/response id here as otherwise the action is treated as an unrequested response
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 }));
39
- }
40
+ try {
41
+ const svgExport = this.exportToString(root, request === null || request === void 0 ? void 0 : request.options, request);
42
+ 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 }));
43
+ }
44
+ catch (err) {
45
+ this.dispatchRejectionIfRequested(request, err instanceof Error ? err.message : String(err));
46
+ }
47
+ }
48
+ /**
49
+ * Produce the serialised SVG string without dispatching any action. Throws on
50
+ * failure (no document, no SVG element). Used by the legacy `export()` path and
51
+ * by unified-export strategies (`DefaultSvgDiagramExporter`, `DefaultPngDiagramExporter`)
52
+ * that need the SVG bytes without the action-dispatch side effect.
53
+ */
54
+ exportToString(root, options, cause) {
55
+ if (typeof document === 'undefined') {
56
+ throw new Error('SVG export failed: document is not available');
57
+ }
58
+ let svgElement = this.findSvgElement();
59
+ if (!svgElement) {
60
+ throw new Error('SVG export failed: SVG element not found');
61
+ }
62
+ // Only the legacy SVG-only flow carries a `RequestExportSvgAction`; under the unified
63
+ // export flow `cause` is a `RequestExportAction` and the legacy override hooks are
64
+ // intentionally invoked with `undefined`.
65
+ const request = sprotty_1.RequestExportSvgAction.is(cause) ? cause : undefined;
66
+ svgElement = this.prepareSvgElement(svgElement, root, request);
67
+ const serializedSvg = this.createSvg(svgElement, root, options !== null && options !== void 0 ? options : {}, cause);
68
+ return this.getSvgExport(serializedSvg, svgElement, root, request);
69
+ }
70
+ dispatchRejectionIfRequested(request, message) {
71
+ if (request === null || request === void 0 ? void 0 : request.requestId) {
72
+ this.actionDispatcher.dispatch(sprotty_1.RejectAction.create(message, { responseId: request.requestId }));
40
73
  }
41
74
  }
42
75
  createSvg(svgElement, root, options, cause) {
@@ -1 +1 @@
1
- {"version":3,"file":"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S,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;AAvIY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,sBAAU,GAAE;GACA,eAAe,CAuI3B"}
@@ -0,0 +1,29 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 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 { CommandExecutionContext, CommandResult, HiddenCommand, RequestExportAction } from '@eclipse-glsp/sprotty';
17
+ /**
18
+ * {@link HiddenCommand} for the unified {@link RequestExportAction} kind. Performs the same
19
+ * pre-render preparation as sprotty's `ExportSvgCommand` (clone the root, reset
20
+ * viewport, drop selection/hover) so the rendered SVG used by every
21
+ * `DiagramExporter` strategy is independent of UI state.
22
+ */
23
+ export declare class RequestExportCommand extends HiddenCommand {
24
+ protected action: RequestExportAction;
25
+ static readonly KIND = "requestExport";
26
+ constructor(action: RequestExportAction);
27
+ execute(context: CommandExecutionContext): CommandResult;
28
+ }
29
+ //# sourceMappingURL=request-export-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-export-command.d.ts","sourceRoot":"","sources":["../../../src/features/export/request-export-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EACH,uBAAuB,EACvB,aAAa,EACb,aAAa,EAKb,mBAAmB,EAEtB,MAAM,uBAAuB,CAAC;AAG/B;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;IAGjB,SAAS,CAAC,MAAM,EAAE,mBAAmB;IAFvE,MAAM,CAAC,QAAQ,CAAC,IAAI,mBAA4B;gBAEJ,MAAM,EAAE,mBAAmB;IAIvE,OAAO,CAAC,OAAO,EAAE,uBAAuB,GAAG,aAAa;CAsB3D"}
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ /********************************************************************************
3
+ * Copyright (c) 2026 EclipseSource and others.
4
+ *
5
+ * This program and the accompanying materials are made available under the
6
+ * terms of the Eclipse Public License v. 2.0 which is available at
7
+ * http://www.eclipse.org/legal/epl-2.0.
8
+ *
9
+ * This Source Code may also be made available under the following Secondary
10
+ * Licenses when the conditions for such availability set forth in the Eclipse
11
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ * with the GNU Classpath Exception which is available at
13
+ * https://www.gnu.org/software/classpath/license.html.
14
+ *
15
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ ********************************************************************************/
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
27
+ return function (target, key) { decorator(target, key, paramIndex); }
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.RequestExportCommand = void 0;
31
+ const sprotty_1 = require("@eclipse-glsp/sprotty");
32
+ const inversify_1 = require("inversify");
33
+ /**
34
+ * {@link HiddenCommand} for the unified {@link RequestExportAction} kind. Performs the same
35
+ * pre-render preparation as sprotty's `ExportSvgCommand` (clone the root, reset
36
+ * viewport, drop selection/hover) so the rendered SVG used by every
37
+ * `DiagramExporter` strategy is independent of UI state.
38
+ */
39
+ let RequestExportCommand = class RequestExportCommand extends sprotty_1.HiddenCommand {
40
+ constructor(action) {
41
+ super();
42
+ this.action = action;
43
+ }
44
+ execute(context) {
45
+ if (!(0, sprotty_1.isExportable)(context.root)) {
46
+ return { model: context.root, modelChanged: false };
47
+ }
48
+ const root = context.modelFactory.createRoot(context.root);
49
+ if (!(0, sprotty_1.isExportable)(root)) {
50
+ return { model: context.root, modelChanged: false };
51
+ }
52
+ if ((0, sprotty_1.isViewport)(root)) {
53
+ root.zoom = 1;
54
+ root.scroll = { x: 0, y: 0 };
55
+ }
56
+ root.index.all().forEach(element => {
57
+ if ((0, sprotty_1.isSelectable)(element) && element.selected) {
58
+ element.selected = false;
59
+ }
60
+ if ((0, sprotty_1.isHoverable)(element) && element.hoverFeedback) {
61
+ element.hoverFeedback = false;
62
+ }
63
+ });
64
+ return { model: root, modelChanged: true, cause: this.action };
65
+ }
66
+ };
67
+ exports.RequestExportCommand = RequestExportCommand;
68
+ RequestExportCommand.KIND = sprotty_1.RequestExportAction.KIND;
69
+ exports.RequestExportCommand = RequestExportCommand = __decorate([
70
+ __param(0, (0, inversify_1.inject)(sprotty_1.TYPES.Action)),
71
+ __metadata("design:paramtypes", [Object])
72
+ ], RequestExportCommand);
73
+ //# sourceMappingURL=request-export-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-export-command.js","sourceRoot":"","sources":["../../../src/features/export/request-export-command.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;;;;AAElF,mDAU+B;AAC/B,yCAAmC;AAEnC;;;;;GAKG;AACH,IAAa,oBAAoB,GAAjC,MAAa,oBAAqB,SAAQ,uBAAa;IAGnD,YAA4C,MAA2B;QACnE,KAAK,EAAE,CAAC;QADgC,WAAM,GAAN,MAAM,CAAqB;IAEvE,CAAC;IAED,OAAO,CAAC,OAAgC;QACpC,IAAI,CAAC,IAAA,sBAAY,EAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;QACxD,CAAC;QACD,MAAM,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3D,IAAI,CAAC,IAAA,sBAAY,EAAC,IAAI,CAAC,EAAE,CAAC;YACtB,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;QACxD,CAAC;QACD,IAAI,IAAA,oBAAU,EAAC,IAAI,CAAC,EAAE,CAAC;YACnB,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;YACd,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QACjC,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YAC/B,IAAI,IAAA,sBAAY,EAAC,OAAO,CAAC,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;gBAC5C,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;YAC7B,CAAC;YACD,IAAI,IAAA,qBAAW,EAAC,OAAO,CAAC,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;gBAChD,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC;YAClC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IACnE,CAAC;;AA5BQ,oDAAoB;AACb,yBAAI,GAAG,6BAAmB,CAAC,IAAI,AAA3B,CAA4B;+BADvC,oBAAoB;IAGhB,WAAA,IAAA,kBAAM,EAAC,eAAK,CAAC,MAAM,CAAC,CAAA;;GAHxB,oBAAoB,CA6BhC"}
@@ -0,0 +1,21 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ import { Action, GModelElement, KeyListener } from '@eclipse-glsp/sprotty';
17
+ /** Dispatches a {@link RequestExportAction} (format `'svg'`) on `Ctrl+Shift+E`. */
18
+ export declare class RequestExportKeyListener extends KeyListener {
19
+ keyDown(_element: GModelElement, event: KeyboardEvent): Action[];
20
+ }
21
+ //# sourceMappingURL=request-export-key-listener.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-export-key-listener.d.ts","sourceRoot":"","sources":["../../../src/features/export/request-export-key-listener.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAyC,MAAM,uBAAuB,CAAC;AAGlH,mFAAmF;AACnF,qBACa,wBAAyB,SAAQ,WAAW;IAC5C,OAAO,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,GAAG,MAAM,EAAE;CAM5E"}