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

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 (70) hide show
  1. package/lib/base/model/diagram-loader.d.ts +8 -6
  2. package/lib/base/model/diagram-loader.d.ts.map +1 -1
  3. package/lib/base/model/diagram-loader.js +1 -1
  4. package/lib/base/model/diagram-loader.js.map +1 -1
  5. package/lib/features/export/default-png-diagram-exporter.d.ts +52 -0
  6. package/lib/features/export/default-png-diagram-exporter.d.ts.map +1 -0
  7. package/lib/features/export/default-png-diagram-exporter.js +157 -0
  8. package/lib/features/export/default-png-diagram-exporter.js.map +1 -0
  9. package/lib/features/export/default-svg-diagram-exporter.d.ts +32 -0
  10. package/lib/features/export/default-svg-diagram-exporter.d.ts.map +1 -0
  11. package/lib/features/export/default-svg-diagram-exporter.js +54 -0
  12. package/lib/features/export/default-svg-diagram-exporter.js.map +1 -0
  13. package/lib/features/export/diagram-export-postprocessor.d.ts +33 -0
  14. package/lib/features/export/diagram-export-postprocessor.d.ts.map +1 -0
  15. package/lib/features/export/diagram-export-postprocessor.js +84 -0
  16. package/lib/features/export/diagram-export-postprocessor.js.map +1 -0
  17. package/lib/features/export/diagram-exporter.d.ts +44 -0
  18. package/lib/features/export/diagram-exporter.d.ts.map +1 -0
  19. package/lib/features/export/diagram-exporter.js +18 -0
  20. package/lib/features/export/diagram-exporter.js.map +1 -0
  21. package/lib/features/export/export-modules.d.ts +1 -1
  22. package/lib/features/export/export-modules.d.ts.map +1 -1
  23. package/lib/features/export/export-modules.js +19 -3
  24. package/lib/features/export/export-modules.js.map +1 -1
  25. package/lib/features/export/export-result-action-handler.d.ts +28 -0
  26. package/lib/features/export/export-result-action-handler.d.ts.map +1 -0
  27. package/lib/features/export/export-result-action-handler.js +72 -0
  28. package/lib/features/export/export-result-action-handler.js.map +1 -0
  29. package/lib/features/export/export-svg-action-handler.d.ts +4 -0
  30. package/lib/features/export/export-svg-action-handler.d.ts.map +1 -1
  31. package/lib/features/export/export-svg-action-handler.js +5 -1
  32. package/lib/features/export/export-svg-action-handler.js.map +1 -1
  33. package/lib/features/export/glsp-svg-exporter.d.ts +18 -1
  34. package/lib/features/export/glsp-svg-exporter.d.ts.map +1 -1
  35. package/lib/features/export/glsp-svg-exporter.js +43 -11
  36. package/lib/features/export/glsp-svg-exporter.js.map +1 -1
  37. package/lib/features/export/request-export-command.d.ts +29 -0
  38. package/lib/features/export/request-export-command.d.ts.map +1 -0
  39. package/lib/features/export/request-export-command.js +73 -0
  40. package/lib/features/export/request-export-command.js.map +1 -0
  41. package/lib/features/export/request-export-key-listener.d.ts +21 -0
  42. package/lib/features/export/request-export-key-listener.d.ts.map +1 -0
  43. package/lib/features/export/request-export-key-listener.js +40 -0
  44. package/lib/features/export/request-export-key-listener.js.map +1 -0
  45. package/lib/features/tool-palette/tool-palette.d.ts.map +1 -1
  46. package/lib/features/tool-palette/tool-palette.js +1 -2
  47. package/lib/features/tool-palette/tool-palette.js.map +1 -1
  48. package/lib/features/viewport/origin-viewport.d.ts +2 -13
  49. package/lib/features/viewport/origin-viewport.d.ts.map +1 -1
  50. package/lib/features/viewport/origin-viewport.js +3 -19
  51. package/lib/features/viewport/origin-viewport.js.map +1 -1
  52. package/lib/index.d.ts +6 -0
  53. package/lib/index.d.ts.map +1 -1
  54. package/lib/index.js +6 -0
  55. package/lib/index.js.map +1 -1
  56. package/package.json +3 -3
  57. package/src/base/model/diagram-loader.ts +8 -6
  58. package/src/features/export/default-png-diagram-exporter.ts +145 -0
  59. package/src/features/export/default-svg-diagram-exporter.ts +39 -0
  60. package/src/features/export/diagram-export-postprocessor.ts +82 -0
  61. package/src/features/export/diagram-exporter.ts +45 -0
  62. package/src/features/export/export-modules.ts +23 -4
  63. package/src/features/export/export-result-action-handler.ts +66 -0
  64. package/src/features/export/export-svg-action-handler.ts +5 -1
  65. package/src/features/export/glsp-svg-exporter.ts +47 -12
  66. package/src/features/export/request-export-command.ts +65 -0
  67. package/src/features/export/request-export-key-listener.ts +29 -0
  68. package/src/features/tool-palette/tool-palette.ts +1 -1
  69. package/src/features/viewport/origin-viewport.ts +10 -23
  70. package/src/index.ts +6 -0
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2023-2024 EclipseSource and others.
2
+ * Copyright (c) 2023-2026 EclipseSource and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -79,7 +79,7 @@ export interface IDiagramStartup extends Partial<Ranked> {
79
79
  export declare namespace IDiagramStartup {
80
80
  function is(object: unknown): object is IDiagramStartup;
81
81
  }
82
- export interface DiagramLoadingOptions {
82
+ export interface DiagramLoadingOptions<P extends InitializeParameters = InitializeParameters> {
83
83
  /**
84
84
  * Optional custom options that should be used the initial {@link RequestModelAction}.
85
85
  * These options will be merged with the default options (`diagramType` and `sourceUri`).
@@ -87,10 +87,12 @@ export interface DiagramLoadingOptions {
87
87
  */
88
88
  requestModelOptions?: Args;
89
89
  /**
90
- * Optional partial {@link InitializeParameters} that should be used for {@link GLSPClient.initializeServer} request if the underlying
91
- * {@link GLSPClient} has not been initialized yet.
90
+ * Optional partial {@link InitializeParameters} that should be used for {@link GLSPClient.initializeServer}
91
+ * request if the underlying {@link GLSPClient} has not been initialized yet. The generic type parameter
92
+ * `P` lets callers narrow this to a more specific extension type (e.g., `McpInitializeParameters`)
93
+ * without leaking that extension into the base loader API.
92
94
  */
93
- initializeParameters?: Partial<InitializeParameters>;
95
+ initializeParameters?: Partial<P>;
94
96
  /**
95
97
  * Flag to enable/disable client side notifications during the loading process.
96
98
  * Defaults to `true` if not defined
@@ -115,7 +117,7 @@ export declare class DiagramLoader {
115
117
  protected modelInitializationConstraint: ModelInitializationConstraint;
116
118
  protected lazyInjector: LazyInjector;
117
119
  get diagramStartups(): IDiagramStartup[];
118
- load(options?: DiagramLoadingOptions): Promise<void>;
120
+ load<P extends InitializeParameters = InitializeParameters>(options?: DiagramLoadingOptions<P>): Promise<void>;
119
121
  protected invokeStartupHook(hook: keyof Omit<IDiagramStartup, 'rank'>): Promise<void>;
120
122
  protected requestModel(options: ResolvedDiagramLoadingOptions): Promise<void>;
121
123
  protected initialize(options: ResolvedDiagramLoadingOptions): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"diagram-loader.d.ts","sourceRoot":"","sources":["../../../src/base/model/diagram-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAGH,IAAI,EACJ,UAAU,EACV,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACZ,YAAY,EAMf,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAElF;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,kBAAkB,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;IAE9C;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAgB,SAAQ,OAAO,CAAC,MAAM,CAAC;IACpD;;;OAGG;IACH,cAAc,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IAEtC;;OAEG;IACH,aAAa,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IAErC;;;OAGG;IACH,eAAe,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IAEvC;;;;;OAKG;IAEH,gBAAgB,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,CA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AAC,EAAE,IAAI,CAAC;IAE3B;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAElC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,6BAA6B;IAC1C,mBAAmB,EAAE,IAAI,CAAC;IAC1B,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,mBAAmB,EAAE,OAAO,CAAC;CAChC;AAED;;;;;GAKG;AACH,qBACa,aAAa;IAEtB,SAAS,CAAC,OAAO,EAAE,eAAe,CAAC;IAGnC,SAAS,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;IAG9C,SAAS,CAAC,WAAW,EAAE,eAAe,CAAC;IAGvC,SAAS,CAAC,6BAA6B,EAAE,6BAA6B,CAAC;IAGvE,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IAErC,IAAI,eAAe,IAAI,eAAe,EAAE,CAEvC;IAEK,IAAI,CAAC,CAAC,SAAS,oBAAoB,GAAG,oBAAoB,EAAE,OAAO,GAAE,qBAAqB,CAAC,CAAC,CAAM,GAAG,OAAO,CAAC,IAAI,CAAC;cA2BxG,iBAAiB,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;cAU3E,YAAY,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC;cAMnE,UAAU,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC;CAgBpF"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /********************************************************************************
3
- * Copyright (c) 2023-2024 EclipseSource and others.
3
+ * Copyright (c) 2023-2026 EclipseSource and others.
4
4
  *
5
5
  * This program and the accompanying materials are made available under the
6
6
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -1 +1 @@
1
- {"version":3,"file":"diagram-loader.js","sourceRoot":"","sources":["../../../src/base/model/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EAAE,CAAC;YAC9B,MAAM,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,sBAAY,CAAC,MAAM,CAAC,iBAAiB,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;QACvG,CAAC;QAED,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;QAC3D,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC;YAC/B,MAAM,UAAU,CAAC,gBAAgB,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;QACpE,CAAC;QACD,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAEvC,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;YAC9B,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,sBAAY,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;QAClF,CAAC;IACL,CAAC;CACJ,CAAA;AA/EY,sCAAa;AAEZ;IADT,IAAA,kBAAM,EAAC,eAAK,CAAC,eAAe,CAAC;;8CACK;AAGzB;IADT,IAAA,kBAAM,EAAC,eAAK,CAAC,iBAAiB,CAAC;;uDACc;AAGpC;IADT,IAAA,kBAAM,EAAC,mCAAe,CAAC;8BACD,mCAAe;kDAAC;AAG7B;IADT,IAAA,kBAAM,EAAC,+DAA6B,CAAC;8BACG,+DAA6B;oEAAC;AAG7D;IADT,IAAA,kBAAM,EAAC,sBAAY,CAAC;;mDACgB;wBAd5B,aAAa;IADzB,IAAA,sBAAU,GAAE;GACA,aAAa,CA+EzB"}
@@ -0,0 +1,52 @@
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, ExportFormat, ExportMimeType, GModelRoot, PngExportOptions } from '@eclipse-glsp/sprotty';
17
+ import { DiagramExporter } from './diagram-exporter';
18
+ import { GLSPSvgExporter } from './glsp-svg-exporter';
19
+ /**
20
+ * Default PNG strategy for the unified export registry. Reuses {@link GLSPSvgExporter}'s
21
+ * SVG-rendering pipeline and rasterises the result client-side via `OffscreenCanvas`.
22
+ * Adopters that need server-side rendering replace this binding with their own strategy.
23
+ */
24
+ export declare class DefaultPngDiagramExporter implements DiagramExporter<PngExportOptions> {
25
+ readonly format: ExportFormat;
26
+ readonly mimeType: ExportMimeType;
27
+ readonly encoding: "base64";
28
+ protected svgExporter: GLSPSvgExporter;
29
+ export(root: GModelRoot, options?: PngExportOptions, cause?: Action): Promise<string>;
30
+ /**
31
+ * Rewrite the root `<svg>` tag so its rendered size matches the target raster dimensions.
32
+ * Replaces `width`/`height` attributes and strips conflicting `style` declarations
33
+ * (the SVG exporter emits `width: …px !important` on the inline style for viewer-friendly
34
+ * display, which would otherwise win over the attributes). The existing `viewBox`
35
+ * preserves the vector coordinate system so the content scales without distortion.
36
+ */
37
+ protected applyRasterSize(svgString: string, width: number, height: number): string;
38
+ protected computeDimensions(svgString: string, options: PngExportOptions): {
39
+ width: number;
40
+ height: number;
41
+ };
42
+ /**
43
+ * Read the aspect ratio from the root `<svg>` tag's `viewBox`, falling back to the
44
+ * `width`/`height` attributes. GLSP-emitted SVGs always carry a `viewBox` (set by the
45
+ * underlying sprotty exporter), so the fallback is a defensive safeguard.
46
+ */
47
+ protected parseAspectRatio(svgString: string): number;
48
+ protected rasterise(svgString: string, width: number, height: number, background: string): Promise<Blob>;
49
+ protected bitmapFromSvgUrl(url: string): Promise<ImageBitmap>;
50
+ protected blobToBase64(blob: Blob): Promise<string>;
51
+ }
52
+ //# sourceMappingURL=default-png-diagram-exporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-png-diagram-exporter.d.ts","sourceRoot":"","sources":["../../../src/features/export/default-png-diagram-exporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE3G,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAMtD;;;;GAIG;AACH,qBACa,yBAA0B,YAAW,eAAe,CAAC,gBAAgB,CAAC;IAC/E,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAS;IACtC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAe;IAChD,QAAQ,CAAC,QAAQ,EAAG,QAAQ,CAAU;IAEb,SAAS,CAAC,WAAW,EAAE,eAAe,CAAC;IAE1D,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,GAAE,gBAAqB,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAa/F;;;;;;OAMG;IACH,SAAS,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAiBnF,SAAS,CAAC,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAW5G;;;;OAIG;IACH,SAAS,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;cAerC,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB9G,SAAS,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAS7D,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;CAWtD"}
@@ -0,0 +1,157 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.DefaultPngDiagramExporter = void 0;
28
+ const inversify_1 = require("inversify");
29
+ const glsp_svg_exporter_1 = require("./glsp-svg-exporter");
30
+ /** Default raster width (in CSS px) when neither `width` nor `height` is specified. */
31
+ const DEFAULT_PNG_WIDTH = 1024;
32
+ const DEFAULT_PNG_BACKGROUND = 'white';
33
+ /**
34
+ * Default PNG strategy for the unified export registry. Reuses {@link GLSPSvgExporter}'s
35
+ * SVG-rendering pipeline and rasterises the result client-side via `OffscreenCanvas`.
36
+ * Adopters that need server-side rendering replace this binding with their own strategy.
37
+ */
38
+ let DefaultPngDiagramExporter = class DefaultPngDiagramExporter {
39
+ constructor() {
40
+ this.format = 'png';
41
+ this.mimeType = 'image/png';
42
+ this.encoding = 'base64';
43
+ }
44
+ async export(root, options = {}, cause) {
45
+ var _a;
46
+ if (typeof document === 'undefined' || typeof OffscreenCanvas === 'undefined') {
47
+ throw new Error('PNG export failed: requires a DOM environment with OffscreenCanvas support');
48
+ }
49
+ const svgString = this.svgExporter.exportToString(root, options, cause);
50
+ const { width, height } = this.computeDimensions(svgString, options);
51
+ // Pin the SVG root to the target raster size BEFORE loading into `<img>` so the browser
52
+ // rasterises the vector content at full resolution.
53
+ const sizedSvg = this.applyRasterSize(svgString, width, height);
54
+ const blob = await this.rasterise(sizedSvg, width, height, (_a = options.background) !== null && _a !== void 0 ? _a : DEFAULT_PNG_BACKGROUND);
55
+ return this.blobToBase64(blob);
56
+ }
57
+ /**
58
+ * Rewrite the root `<svg>` tag so its rendered size matches the target raster dimensions.
59
+ * Replaces `width`/`height` attributes and strips conflicting `style` declarations
60
+ * (the SVG exporter emits `width: …px !important` on the inline style for viewer-friendly
61
+ * display, which would otherwise win over the attributes). The existing `viewBox`
62
+ * preserves the vector coordinate system so the content scales without distortion.
63
+ */
64
+ applyRasterSize(svgString, width, height) {
65
+ return svgString.replace(/<svg\b([^>]*)>/, (_, attrs) => {
66
+ const cleaned = attrs
67
+ .replace(/\swidth="[^"]*"/, '')
68
+ .replace(/\sheight="[^"]*"/, '')
69
+ .replace(/style="([^"]*)"/, (_match, styleBody) => {
70
+ const stripped = styleBody
71
+ .replace(/(?:^|;)\s*width\s*:[^;]*/gi, '')
72
+ .replace(/(?:^|;)\s*height\s*:[^;]*/gi, '')
73
+ .replace(/^\s*;+/, '')
74
+ .trim();
75
+ return stripped ? `style="${stripped}"` : '';
76
+ });
77
+ return `<svg${cleaned} width="${width}" height="${height}">`;
78
+ });
79
+ }
80
+ computeDimensions(svgString, options) {
81
+ var _a;
82
+ const requestedWidth = (_a = options.width) !== null && _a !== void 0 ? _a : DEFAULT_PNG_WIDTH;
83
+ const requestedHeight = options.height;
84
+ if (requestedHeight !== undefined) {
85
+ return { width: requestedWidth, height: requestedHeight };
86
+ }
87
+ // Read the aspect from the SVG attributes directly to avoid a redundant bitmap decode.
88
+ const aspect = this.parseAspectRatio(svgString);
89
+ return { width: requestedWidth, height: requestedWidth / aspect };
90
+ }
91
+ /**
92
+ * Read the aspect ratio from the root `<svg>` tag's `viewBox`, falling back to the
93
+ * `width`/`height` attributes. GLSP-emitted SVGs always carry a `viewBox` (set by the
94
+ * underlying sprotty exporter), so the fallback is a defensive safeguard.
95
+ */
96
+ parseAspectRatio(svgString) {
97
+ var _a;
98
+ const root = svgString.match(/<svg\b([^>]*)>/);
99
+ const attrs = (_a = root === null || root === void 0 ? void 0 : root[1]) !== null && _a !== void 0 ? _a : '';
100
+ const viewBox = attrs.match(/viewBox\s*=\s*"\s*[\d.eE+-]+\s+[\d.eE+-]+\s+([\d.eE+-]+)\s+([\d.eE+-]+)\s*"/);
101
+ if (viewBox) {
102
+ return parseFloat(viewBox[1]) / parseFloat(viewBox[2]);
103
+ }
104
+ const widthAttr = attrs.match(/\swidth\s*=\s*"([\d.eE+-]+)/);
105
+ const heightAttr = attrs.match(/\sheight\s*=\s*"([\d.eE+-]+)/);
106
+ if (widthAttr && heightAttr) {
107
+ return parseFloat(widthAttr[1]) / parseFloat(heightAttr[1]);
108
+ }
109
+ throw new Error('PNG export failed: SVG missing viewBox/width/height — cannot determine aspect ratio');
110
+ }
111
+ async rasterise(svgString, width, height, background) {
112
+ const url = URL.createObjectURL(new Blob([svgString], { type: 'image/svg+xml;charset=utf-8' }));
113
+ try {
114
+ const bitmap = await this.bitmapFromSvgUrl(url);
115
+ const offscreen = new OffscreenCanvas(width, height);
116
+ const ctx = offscreen.getContext('2d');
117
+ if (!ctx) {
118
+ throw new Error('PNG export failed: 2D context unavailable on OffscreenCanvas');
119
+ }
120
+ ctx.fillStyle = background;
121
+ ctx.fillRect(0, 0, width, height);
122
+ ctx.drawImage(bitmap, 0, 0, width, height);
123
+ return offscreen.convertToBlob({ type: 'image/png' });
124
+ }
125
+ finally {
126
+ URL.revokeObjectURL(url);
127
+ }
128
+ }
129
+ bitmapFromSvgUrl(url) {
130
+ return new Promise((resolve, reject) => {
131
+ const img = new Image();
132
+ img.onload = () => createImageBitmap(img).then(resolve, reject);
133
+ img.onerror = () => reject(new Error('PNG export failed: SVG could not be loaded into Image'));
134
+ img.src = url;
135
+ });
136
+ }
137
+ blobToBase64(blob) {
138
+ return new Promise((resolve, reject) => {
139
+ const reader = new FileReader();
140
+ reader.onloadend = () => {
141
+ const result = reader.result;
142
+ resolve(result.replace(/^data:[^;]+;base64,/, ''));
143
+ };
144
+ reader.onerror = () => { var _a; return reject((_a = reader.error) !== null && _a !== void 0 ? _a : new Error('PNG export failed: FileReader error')); };
145
+ reader.readAsDataURL(blob);
146
+ });
147
+ }
148
+ };
149
+ exports.DefaultPngDiagramExporter = DefaultPngDiagramExporter;
150
+ __decorate([
151
+ (0, inversify_1.inject)(glsp_svg_exporter_1.GLSPSvgExporter),
152
+ __metadata("design:type", glsp_svg_exporter_1.GLSPSvgExporter)
153
+ ], DefaultPngDiagramExporter.prototype, "svgExporter", void 0);
154
+ exports.DefaultPngDiagramExporter = DefaultPngDiagramExporter = __decorate([
155
+ (0, inversify_1.injectable)()
156
+ ], DefaultPngDiagramExporter);
157
+ //# sourceMappingURL=default-png-diagram-exporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-png-diagram-exporter.js","sourceRoot":"","sources":["../../../src/features/export/default-png-diagram-exporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAGlF,yCAA+C;AAE/C,2DAAsD;AAEtD,uFAAuF;AACvF,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAC/B,MAAM,sBAAsB,GAAG,OAAO,CAAC;AAEvC;;;;GAIG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAA/B;QACM,WAAM,GAAiB,KAAK,CAAC;QAC7B,aAAQ,GAAmB,WAAW,CAAC;QACvC,aAAQ,GAAG,QAAiB,CAAC;IA8G1C,CAAC;IA1GG,KAAK,CAAC,MAAM,CAAC,IAAgB,EAAE,UAA4B,EAAE,EAAE,KAAc;;QACzE,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,eAAe,KAAK,WAAW,EAAE,CAAC;YAC5E,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAC;QAClG,CAAC;QACD,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACxE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACrE,wFAAwF;QACxF,oDAAoD;QACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QAChE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAA,OAAO,CAAC,UAAU,mCAAI,sBAAsB,CAAC,CAAC;QACzG,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED;;;;;;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C,CAAC;YACvD,CAAC,CAAC;YACF,MAAM,CAAC,OAAO,GAAG,GAAG,EAAE,WAAC,OAAA,MAAM,CAAC,MAAA,MAAM,CAAC,KAAK,mCAAI,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC,CAAA,EAAA,CAAC;YAChG,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AAjHY,8DAAyB;AAKC;IAAlC,IAAA,kBAAM,EAAC,mCAAe,CAAC;8BAAwB,mCAAe;8DAAC;oCALvD,yBAAyB;IADrC,IAAA,sBAAU,GAAE;GACA,yBAAyB,CAiHrC"}
@@ -0,0 +1,32 @@
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, ExportFormat, ExportMimeType, GModelRoot, SvgExportOptions } from '@eclipse-glsp/sprotty';
17
+ import { DiagramExporter } from './diagram-exporter';
18
+ import { GLSPSvgExporter } from './glsp-svg-exporter';
19
+ /**
20
+ * Default SVG strategy for the unified export registry. Wraps {@link GLSPSvgExporter} —
21
+ * the same exporter that powers the legacy `RequestExportSvgAction` path — so adopter
22
+ * overrides on the SVG renderer (extending {@link GLSPSvgExporter}) participate in unified
23
+ * exports for free.
24
+ */
25
+ export declare class DefaultSvgDiagramExporter implements DiagramExporter<SvgExportOptions> {
26
+ readonly format: ExportFormat;
27
+ readonly mimeType: ExportMimeType;
28
+ readonly encoding: "text";
29
+ protected svgExporter: GLSPSvgExporter;
30
+ export(root: GModelRoot, options?: SvgExportOptions, cause?: Action): Promise<string>;
31
+ }
32
+ //# sourceMappingURL=default-svg-diagram-exporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-svg-diagram-exporter.d.ts","sourceRoot":"","sources":["../../../src/features/export/default-svg-diagram-exporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE3G,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;;;;GAKG;AACH,qBACa,yBAA0B,YAAW,eAAe,CAAC,gBAAgB,CAAC;IAC/E,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAS;IACtC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAmB;IACpD,QAAQ,CAAC,QAAQ,EAAG,MAAM,CAAU;IAEX,SAAS,CAAC,WAAW,EAAE,eAAe,CAAC;IAE1D,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,GAAE,gBAAqB,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAGlG"}
@@ -0,0 +1,54 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.DefaultSvgDiagramExporter = void 0;
28
+ const inversify_1 = require("inversify");
29
+ const glsp_svg_exporter_1 = require("./glsp-svg-exporter");
30
+ /**
31
+ * Default SVG strategy for the unified export registry. Wraps {@link GLSPSvgExporter} —
32
+ * the same exporter that powers the legacy `RequestExportSvgAction` path — so adopter
33
+ * overrides on the SVG renderer (extending {@link GLSPSvgExporter}) participate in unified
34
+ * exports for free.
35
+ */
36
+ let DefaultSvgDiagramExporter = class DefaultSvgDiagramExporter {
37
+ constructor() {
38
+ this.format = 'svg';
39
+ this.mimeType = 'image/svg+xml';
40
+ this.encoding = 'text';
41
+ }
42
+ async export(root, options = {}, cause) {
43
+ return this.svgExporter.exportToString(root, options, cause);
44
+ }
45
+ };
46
+ exports.DefaultSvgDiagramExporter = DefaultSvgDiagramExporter;
47
+ __decorate([
48
+ (0, inversify_1.inject)(glsp_svg_exporter_1.GLSPSvgExporter),
49
+ __metadata("design:type", glsp_svg_exporter_1.GLSPSvgExporter)
50
+ ], DefaultSvgDiagramExporter.prototype, "svgExporter", void 0);
51
+ exports.DefaultSvgDiagramExporter = DefaultSvgDiagramExporter = __decorate([
52
+ (0, inversify_1.injectable)()
53
+ ], DefaultSvgDiagramExporter);
54
+ //# sourceMappingURL=default-svg-diagram-exporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-svg-diagram-exporter.js","sourceRoot":"","sources":["../../../src/features/export/default-svg-diagram-exporter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAGlF,yCAA+C;AAE/C,2DAAsD;AAEtD;;;;;GAKG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAA/B;QACM,WAAM,GAAiB,KAAK,CAAC;QAC7B,aAAQ,GAAmB,eAAe,CAAC;QAC3C,aAAQ,GAAG,MAAe,CAAC;IAOxC,CAAC;IAHG,KAAK,CAAC,MAAM,CAAC,IAAgB,EAAE,UAA4B,EAAE,EAAE,KAAc;QACzE,OAAO,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IACjE,CAAC;CACJ,CAAA;AAVY,8DAAyB;AAKC;IAAlC,IAAA,kBAAM,EAAC,mCAAe,CAAC;8BAAwB,mCAAe;8DAAC;oCALvD,yBAAyB;IADrC,IAAA,sBAAU,GAAE;GACA,yBAAyB,CAUrC"}
@@ -0,0 +1,33 @@
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, GModelRoot, IActionDispatcher, IVNodePostprocessor, RequestExportAction } from '@eclipse-glsp/sprotty';
17
+ import { VNode } from 'snabbdom';
18
+ import { DiagramExporter } from './diagram-exporter';
19
+ /**
20
+ * Postprocessor for the unified {@link RequestExportAction} flow. Captures the rendered model
21
+ * root from the `decorate` pass, then on `postUpdate` looks up the matching
22
+ * {@link DiagramExporter} by `format` and dispatches an {@link ExportResultAction} with the
23
+ * produced bytes.
24
+ */
25
+ export declare class DiagramExportPostprocessor implements IVNodePostprocessor {
26
+ protected exporters: DiagramExporter[];
27
+ protected actionDispatcher: IActionDispatcher;
28
+ protected root: GModelRoot;
29
+ decorate(vnode: VNode, element: GModelElement): VNode;
30
+ postUpdate(cause?: Action): void;
31
+ protected runExport(request: RequestExportAction): Promise<void>;
32
+ }
33
+ //# sourceMappingURL=diagram-export-postprocessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagram-export-postprocessor.d.ts","sourceRoot":"","sources":["../../../src/features/export/diagram-export-postprocessor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EACH,MAAM,EAEN,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EAEnB,mBAAmB,EAEtB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;GAKG;AACH,qBACa,0BAA2B,YAAW,mBAAmB;IAC7B,SAAS,CAAC,SAAS,EAAE,eAAe,EAAE,CAAC;IAC3C,SAAS,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;IAE/E,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC;IAE3B,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,GAAG,KAAK;IAOrD,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;cAWhB,SAAS,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;CAmBzE"}
@@ -0,0 +1,84 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.DiagramExportPostprocessor = void 0;
28
+ const sprotty_1 = require("@eclipse-glsp/sprotty");
29
+ const inversify_1 = require("inversify");
30
+ /**
31
+ * Postprocessor for the unified {@link RequestExportAction} flow. Captures the rendered model
32
+ * root from the `decorate` pass, then on `postUpdate` looks up the matching
33
+ * {@link DiagramExporter} by `format` and dispatches an {@link ExportResultAction} with the
34
+ * produced bytes.
35
+ */
36
+ let DiagramExportPostprocessor = class DiagramExportPostprocessor {
37
+ decorate(vnode, element) {
38
+ if (element instanceof sprotty_1.GModelRoot) {
39
+ this.root = element;
40
+ }
41
+ return vnode;
42
+ }
43
+ postUpdate(cause) {
44
+ if (!this.root || !sprotty_1.RequestExportAction.is(cause)) {
45
+ return;
46
+ }
47
+ const request = cause;
48
+ this.runExport(request).catch(err => {
49
+ const message = err instanceof Error ? err.message : String(err);
50
+ this.actionDispatcher.dispatch(sprotty_1.RejectAction.create(message, { responseId: request.requestId }));
51
+ });
52
+ }
53
+ async runExport(request) {
54
+ var _a;
55
+ // First-bound-wins on duplicate formats: an adopter who registers a custom
56
+ // PNG exporter without `unbind`-ing the default will pick up the default. To
57
+ // override, rebind via `binding.rebind(DefaultPngDiagramExporter, MyPngExporter)`
58
+ // in your `DiagramExportModule` extension.
59
+ const exporter = this.exporters.find(candidate => candidate.format === request.format);
60
+ if (!exporter) {
61
+ throw new Error(`No DiagramExporter registered for format '${request.format}'`);
62
+ }
63
+ const data = await exporter.export(this.root, (_a = request.formatOptions) !== null && _a !== void 0 ? _a : {}, request);
64
+ this.actionDispatcher.dispatch(sprotty_1.ExportResultAction.create(exporter.format, data, {
65
+ mimeType: exporter.mimeType,
66
+ encoding: exporter.encoding,
67
+ responseId: request.requestId,
68
+ formatOptions: request.formatOptions
69
+ }));
70
+ }
71
+ };
72
+ exports.DiagramExportPostprocessor = DiagramExportPostprocessor;
73
+ __decorate([
74
+ (0, inversify_1.multiInject)(sprotty_1.TYPES.IDiagramExporter),
75
+ __metadata("design:type", Array)
76
+ ], DiagramExportPostprocessor.prototype, "exporters", void 0);
77
+ __decorate([
78
+ (0, inversify_1.inject)(sprotty_1.TYPES.IActionDispatcher),
79
+ __metadata("design:type", Object)
80
+ ], DiagramExportPostprocessor.prototype, "actionDispatcher", void 0);
81
+ exports.DiagramExportPostprocessor = DiagramExportPostprocessor = __decorate([
82
+ (0, inversify_1.injectable)()
83
+ ], DiagramExportPostprocessor);
84
+ //# sourceMappingURL=diagram-export-postprocessor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagram-export-postprocessor.js","sourceRoot":"","sources":["../../../src/features/export/diagram-export-postprocessor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,mDAU+B;AAC/B,yCAA4D;AAI5D;;;;;GAKG;AAEI,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAMnC,QAAQ,CAAC,KAAY,EAAE,OAAsB;QACzC,IAAI,OAAO,YAAY,oBAAU,EAAE,CAAC;YAChC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;QACxB,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,UAAU,CAAC,KAAc;QACrB,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,6BAAmB,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/C,OAAO;QACX,CAAC;QACD,MAAM,OAAO,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;YAChC,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,sBAAY,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QACpG,CAAC,CAAC,CAAC;IACP,CAAC;IAES,KAAK,CAAC,SAAS,CAAC,OAA4B;;QAClD,2EAA2E;QAC3E,6EAA6E;QAC7E,kFAAkF;QAClF,2CAA2C;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;QACvF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,6CAA6C,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;QACpF,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAA,OAAO,CAAC,aAAa,mCAAI,EAAE,EAAE,OAAO,CAAC,CAAC;QACpF,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAC1B,4BAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,EAAE;YAC7C,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,QAAQ,EAAE,QAAQ,CAAC,QAAQ;YAC3B,UAAU,EAAE,OAAO,CAAC,SAAS;YAC7B,aAAa,EAAE,OAAO,CAAC,aAAa;SACvC,CAAC,CACL,CAAC;IACN,CAAC;CACJ,CAAA;AA3CY,gEAA0B;AACY;IAA9C,IAAA,uBAAW,EAAC,eAAK,CAAC,gBAAgB,CAAC;;6DAAwC;AACjC;IAA1C,IAAA,kBAAM,EAAC,eAAK,CAAC,iBAAiB,CAAC;;oEAA+C;qCAFtE,0BAA0B;IADtC,IAAA,sBAAU,GAAE;GACA,0BAA0B,CA2CtC"}
@@ -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;AAClF,OAAO,EAQH,aAAa,EAEhB,MAAM,uBAAuB,CAAC;AAU/B,eAAO,MAAM,YAAY,eAiBxB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,eAYlC,CAAC"}