@zenuml/core 4.8.1 → 4.9.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenuml/core",
3
- "version": "4.8.1",
3
+ "version": "4.9.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "repository": {
package/types/index.d.ts CHANGED
@@ -10,12 +10,18 @@ export type SvgTheme =
10
10
  export interface RenderOptions {
11
11
  /** Theme name. Unknown names fall back to 'theme-default'. */
12
12
  theme?: SvgTheme;
13
+ /** Semantic document colours; supplied slots override the selected theme. */
14
+ palette?: DiagramPalette;
15
+ /** Optional opaque colour painted underneath the outer canvas once. */
16
+ backingColor?: string;
13
17
  /** Show sequence references and their badges; defaults to true. */
14
18
  enableNumbering?: boolean;
15
19
  }
16
20
 
17
21
  export interface RenderResult {
18
22
  svg: string;
23
+ /** Raw outer-canvas paint, excluding the optional export backing. */
24
+ surface: RenderSurface;
19
25
  /** Inner SVG content (defs + g) for embedding into an existing SVG container */
20
26
  innerSvg: string;
21
27
  width: number;
@@ -23,6 +29,48 @@ export interface RenderResult {
23
29
  viewBox: string;
24
30
  }
25
31
 
32
+ /** Raw outer-canvas paint; transparent unless the author paints it. */
33
+ export interface RenderSurface {
34
+ backgroundColor: string;
35
+ }
36
+
37
+ export interface ExportOptions {
38
+ /** Opaque colour painted behind the diagram once. Omit to preserve alpha. */
39
+ backingColor?: string;
40
+ }
41
+
42
+ /** Optional semantic colour overrides shared by HTML and native SVG. */
43
+ export interface DiagramPalette {
44
+ canvasBg?: string;
45
+ frameBg?: string;
46
+ frameBorder?: string;
47
+ titleText?: string;
48
+ participantBg?: string;
49
+ participantBorder?: string;
50
+ participantText?: string;
51
+ messageArrow?: string;
52
+ messageText?: string;
53
+ lifeline?: string;
54
+ occurrenceBg?: string;
55
+ occurrenceBorder?: string;
56
+ fragmentBorder?: string;
57
+ fragmentHeaderBg?: string;
58
+ fragmentHeaderText?: string;
59
+ fragmentText?: string;
60
+ fragmentSeparator?: string;
61
+ guardOpacity?: string;
62
+ guardText?: string;
63
+ commentText?: string;
64
+ commentOpacity?: string;
65
+ groupOutline?: string;
66
+ dividerLine?: string;
67
+ dividerBg?: string;
68
+ dividerText?: string;
69
+ numberText?: string;
70
+ fragmentNumberText?: string;
71
+ numberBg?: string;
72
+ }
73
+
26
74
  export declare function renderToSvg(
27
75
  code: string,
28
76
  options?: RenderOptions,
@@ -85,6 +133,7 @@ export interface ErrorDetail {
85
133
 
86
134
  export interface Config {
87
135
  theme?: string;
136
+ palette?: DiagramPalette;
88
137
  enableScopedTheming?: boolean;
89
138
  onThemeChange?: (data: { theme: string; scoped?: boolean }) => void;
90
139
  enableMultiTheme?: boolean;
@@ -103,6 +152,7 @@ interface IZenUml {
103
152
  code: string | undefined,
104
153
  config: Config | undefined,
105
154
  ): Promise<IZenUml>;
155
+ getSurface(): RenderSurface;
106
156
  }
107
157
 
108
158
  declare class ZenUml implements IZenUml {
@@ -110,7 +160,12 @@ declare class ZenUml implements IZenUml {
110
160
  static readonly default: typeof ZenUml;
111
161
  /** Same as the named export {@link setDiagramFontUrl}. */
112
162
  static readonly setDiagramFontUrl: typeof setDiagramFontUrl;
113
- constructor(el: HTMLElement | string, naked?: boolean);
163
+ /** Initial appearance is applied before the first committed frame. */
164
+ constructor(
165
+ el: HTMLElement | string,
166
+ naked?: boolean,
167
+ initial?: Pick<Config, "theme" | "palette">,
168
+ );
114
169
  get code(): string | undefined;
115
170
  get theme(): string | undefined;
116
171
  parse(text: string): Promise<ParseResult>;
@@ -118,8 +173,10 @@ declare class ZenUml implements IZenUml {
118
173
  code: string | undefined,
119
174
  config: Config | undefined,
120
175
  ): Promise<IZenUml>;
121
- getPng(): Promise<string>;
122
- getSvg(): Promise<string>;
176
+ /** Read the raw canvas paint after render, or again after author CSS changes. */
177
+ getSurface(): RenderSurface;
178
+ getPng(options?: ExportOptions): Promise<string>;
179
+ getSvg(options?: ExportOptions): Promise<string>;
123
180
  }
124
181
 
125
182
  export default ZenUml;