@tumaet/apollon 4.2.9 → 4.2.10

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/dist/typings.d.ts CHANGED
@@ -65,6 +65,7 @@ export declare enum ApollonView {
65
65
  Exporting = "Exporting",
66
66
  Highlight = "Highlight"
67
67
  }
68
+ export type SvgExportMode = "web" | "compat";
68
69
  export type ApollonOptions = {
69
70
  type?: UMLDiagramType;
70
71
  mode?: ApollonMode;
@@ -104,6 +105,12 @@ export type ExportOptions = {
104
105
  keepOriginalSize?: boolean;
105
106
  include?: string[];
106
107
  exclude?: string[];
108
+ /**
109
+ * Controls how SVG output is post-processed.
110
+ * - "web": keep CSS variables for theme-adaptive rendering in browsers
111
+ * - "compat": resolve CSS variables + inline attributes for PowerPoint/Inkscape
112
+ */
113
+ svgMode?: SvgExportMode;
107
114
  };
108
115
  export type SVG = {
109
116
  svg: string;
@@ -1,6 +1,9 @@
1
1
  import { ReactFlowInstance, Node, Edge, Rect } from '@xyflow/react';
2
2
  import { Point } from './pathParsing';
3
- export declare const getSVG: (container: HTMLElement, clip: Rect) => string;
3
+ type SvgExportMode = "web" | "compat";
4
+ export declare const getSVG: (container: HTMLElement, clip: Rect, options?: {
5
+ svgMode?: SvgExportMode;
6
+ }) => string;
4
7
  /**
5
8
  * Extract all coordinate points from an SVG path string.
6
9
  * This includes endpoints AND control points for bezier curves,
@@ -35,18 +38,19 @@ declare function extractStyles(styleString: string): {
35
38
  width: string | null;
36
39
  height: string | null;
37
40
  };
41
+ type CSSVariableMap = Readonly<Record<string, string>>;
38
42
  /**
39
43
  * Resolve a single CSS variable reference to its final value.
40
44
  * Handles recursive var() resolution and fallback values.
41
45
  */
42
- declare function resolveCSSVariable(value: string): string;
46
+ declare function resolveCSSVariable(value: string, cssVarMap?: CSSVariableMap): string;
43
47
  /**
44
48
  * Replace CSS variables and currentColor in all attributes of an element tree.
45
49
  *
46
50
  * @param node - The DOM node to process
47
51
  * @param inheritedColor - The inherited 'currentColor' value from parent elements
48
52
  */
49
- declare function replaceCSSVariables(node: Element | ChildNode, inheritedColor?: string): void;
53
+ declare function replaceCSSVariables(node: Element | ChildNode, inheritedColor?: string, cssVarMap?: CSSVariableMap): void;
50
54
  /**
51
55
  * Convert inline style properties to direct SVG attributes for better compatibility.
52
56
  * PowerPoint and some other applications don't properly parse CSS in style attributes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tumaet/apollon",
3
- "version": "4.2.9",
3
+ "version": "4.2.10",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",