@mermanjs/node-wasm 0.10.0 → 0.12.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/CHANGELOG.md +46 -1
- package/README.md +29 -42
- package/THIRD_PARTY_LICENSES/d3-hierarchy/LICENSE +13 -0
- package/THIRD_PARTY_LICENSES/d3-sankey/LICENSE +27 -0
- package/THIRD_PARTY_LICENSES/grok-build/LICENSE +204 -0
- package/THIRD_PARTY_LICENSES/krilla/LICENSE-APACHE +202 -0
- package/THIRD_PARTY_LICENSES/krilla/LICENSE-ICC +116 -0
- package/THIRD_PARTY_LICENSES/{roxmltree-dom → krilla}/LICENSE-MIT +3 -3
- package/THIRD_PARTY_LICENSES/resvg-iir-blur/LICENSE +24 -0
- package/THIRD_PARTY_LICENSES/rust-cargo-dependencies.json +444 -517
- package/THIRD_PARTY_LICENSES/usvg/LICENSE-APACHE +176 -0
- package/THIRD_PARTY_LICENSES/usvg/LICENSE-MIT +25 -0
- package/THIRD_PARTY_NOTICES.md +229 -67
- package/artifact/merman_node.cjs +26 -0
- package/artifact/merman_node_bg.wasm +0 -0
- package/dist/bounded-executor.mjs +11 -6
- package/dist/candidates/wasm.mjs +6 -9
- package/dist/candidates/wrap-engine.mjs +51 -3
- package/dist/engine.mjs +478 -123
- package/dist/errors.mjs +228 -90
- package/dist/generated/binding-contract.mjs +208 -113
- package/dist/generated/capability-surface.mjs +58 -56
- package/dist/generated/node-wire-contract.json +17 -4
- package/dist/index.d.ts +431 -129
- package/dist/index.mjs +11 -3
- package/dist/native-loader.mjs +152 -7
- package/dist/transport-contract.mjs +39 -1
- package/package.json +4 -2
- package/THIRD_PARTY_LICENSES/roxmltree-dom/LICENSE-APACHE +0 -201
- /package/THIRD_PARTY_LICENSES/{roxmltree-dom → roxmltree-ego-tree}/LICENSE-ISC +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference lib="esnext.disposable" />
|
|
2
|
+
|
|
1
3
|
export type MermanResourceProfile =
|
|
2
4
|
| "interactive"
|
|
3
5
|
| "constrained"
|
|
@@ -5,136 +7,389 @@ export type MermanResourceProfile =
|
|
|
5
7
|
| "unbounded-for-trusted-input";
|
|
6
8
|
|
|
7
9
|
export interface MermanBindingOptions {
|
|
8
|
-
version?:
|
|
10
|
+
version?: 4;
|
|
9
11
|
runtime_policy?: "deterministic";
|
|
12
|
+
fixed_today?: string | null;
|
|
13
|
+
/** Exact host-supplied Unix milliseconds; mutually exclusive with a non-null fixed_today. */
|
|
14
|
+
fixed_unix_millis?: number | null;
|
|
15
|
+
fixed_local_offset_minutes?: number | null;
|
|
16
|
+
site_config?: {
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
themeCSS?: never;
|
|
19
|
+
theme_css?: never;
|
|
20
|
+
secure?: never;
|
|
21
|
+
securityLevel?: never;
|
|
22
|
+
security_level?: never;
|
|
23
|
+
dompurifyConfig?: never;
|
|
24
|
+
dompurify_config?: never;
|
|
25
|
+
maxEdges?: never;
|
|
26
|
+
max_edges?: never;
|
|
27
|
+
maxTextSize?: never;
|
|
28
|
+
max_text_size?: never;
|
|
29
|
+
};
|
|
30
|
+
parse?: { suppress_errors?: boolean };
|
|
31
|
+
/** DrawList v1 projection options. */
|
|
32
|
+
draw_list?: {
|
|
33
|
+
/** Bake endpoint markers and surface-contrast edge overlays into plain paths. */
|
|
34
|
+
expand_markers?: boolean;
|
|
35
|
+
};
|
|
36
|
+
/** Layout viewport, responsive adaptation, and incremental Shoal frame options. */
|
|
37
|
+
layout?: {
|
|
38
|
+
/**
|
|
39
|
+
* Explicit width-fitting adaptation for Kanban and Shoal-backed families
|
|
40
|
+
* (`flowchart`, `agentflow`, `swimlane`, `class`, `state`, `er`, `requirement`,
|
|
41
|
+
* `usecase`, `architecture`, and `c4`).
|
|
42
|
+
*/
|
|
43
|
+
adaptation?: "none" | "fit-width";
|
|
44
|
+
container_width?: number;
|
|
45
|
+
container_height?: number;
|
|
46
|
+
screen_available_width?: number;
|
|
47
|
+
/** Allow Shoal fit-width to fold wide leaf ranks. Defaults to `false`. */
|
|
48
|
+
fold_wide_ranks?: boolean;
|
|
49
|
+
/** Include a `shoal_layout_frame` snapshot in render metadata when rendering with Shoal. */
|
|
50
|
+
capture_shoal_frame?: boolean;
|
|
51
|
+
/** Replay the previous successful Shoal frame for this document and capture a new one. */
|
|
52
|
+
previous_shoal_frame?: Readonly<Record<string, unknown>>;
|
|
53
|
+
};
|
|
10
54
|
environment?: {
|
|
11
|
-
theme_portability?: "best-effort" | "require-portable";
|
|
12
55
|
text_measurement?: "deterministic" | null;
|
|
13
|
-
|
|
56
|
+
math_renderer?: "none" | "ratex";
|
|
14
57
|
};
|
|
15
58
|
resources?: {
|
|
16
59
|
profile?: MermanResourceProfile;
|
|
17
60
|
limits?: Record<string, number>;
|
|
18
61
|
};
|
|
19
|
-
/** A supplied selection replaces the
|
|
62
|
+
/** A supplied selection replaces the constructor theme. Use `null` or `"none"` to clear it. */
|
|
20
63
|
theme?: DiagramThemeSelection | null;
|
|
21
|
-
|
|
64
|
+
/** Overrides the SVG canvas base with a solid CSS color or `"transparent"`. */
|
|
65
|
+
background?: string;
|
|
66
|
+
svg?: {
|
|
67
|
+
diagram_id?: string;
|
|
68
|
+
/** Outline SVG text for font-independent display. Requires the native outlined-svg capability. */
|
|
69
|
+
outlines?: boolean;
|
|
70
|
+
pipeline?: "parity" | "static" | "readable" | "resvg-safe";
|
|
71
|
+
root_background_color?: string;
|
|
72
|
+
drop_native_duplicate_fallbacks?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Policy for math expressions when native math rendering is unavailable:
|
|
75
|
+
* `"strict"` rejects the render, `"source-text"` keeps raw math text, and
|
|
76
|
+
* `"drop"` omits the unavailable math payload.
|
|
77
|
+
*/
|
|
78
|
+
native_math_fallback?: "strict" | "source-text" | "drop";
|
|
79
|
+
viewbox_padding?: number;
|
|
80
|
+
viewBoxPadding?: number;
|
|
81
|
+
};
|
|
22
82
|
}
|
|
23
83
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
| string | number | boolean | null
|
|
27
|
-
| ThemeJsonValue[]
|
|
28
|
-
| { [key: string]: ThemeJsonValue };
|
|
29
|
-
export type ThemeJsonObject = { [key: string]: ThemeJsonValue };
|
|
30
|
-
|
|
31
|
-
/** Editable JSON sections are validated by the shared Rust theme compiler. */
|
|
32
|
-
export interface ThemeDesignV1 {
|
|
33
|
-
tokens?: Record<string, ThemeJsonValue>;
|
|
34
|
-
styles?: Record<string, ThemeJsonValue>;
|
|
35
|
-
rules?: ThemeJsonObject[];
|
|
36
|
-
palettes?: Record<string, ThemeJsonValue>;
|
|
37
|
-
canvas?: ThemeJsonObject;
|
|
38
|
-
typography?: ThemeJsonObject;
|
|
39
|
-
mermaid?: ThemeJsonObject;
|
|
40
|
-
assets?: ThemeJsonObject;
|
|
41
|
-
requirements?: ThemeJsonObject;
|
|
42
|
-
appearances?: Partial<Record<ThemeAppearance, ThemeAppearanceOverridesV1>>;
|
|
43
|
-
default_appearance?: ThemeAppearance;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export type ThemeAppearanceOverridesV1 =
|
|
47
|
-
Omit<ThemeDesignV1, "appearances" | "default_appearance" | "assets" | "requirements">;
|
|
48
|
-
|
|
49
|
-
export type ThemeRecipeV1 = {
|
|
50
|
-
schema_version: 1;
|
|
51
|
-
preset?: never;
|
|
52
|
-
spec?: never;
|
|
53
|
-
recipe?: never;
|
|
54
|
-
appearance?: never;
|
|
55
|
-
} & (
|
|
56
|
-
| { kind: "design"; design: ThemeDesignV1; complete_spec?: never }
|
|
57
|
-
| { kind: "complete_spec"; complete_spec: ThemeJsonObject; design?: never }
|
|
58
|
-
);
|
|
84
|
+
// BEGIN Theme v2 declarations
|
|
85
|
+
// @generated from crates/xtask/src/cmd/theme_contract/types.ts by `cargo run --locked -p xtask -- gen-theme-contract`.
|
|
59
86
|
|
|
87
|
+
/** A concrete appearance selected by the host. */
|
|
88
|
+
export type ThemeAppearance = "light" | "dark";
|
|
89
|
+
/** High-level grouping category used by theme pickers and catalogs. */
|
|
90
|
+
export type ThemeCategory = "reading" | "editor" | "art" | "custom";
|
|
91
|
+
/** Precedence policy when both the host and Mermaid source declare a theme. */
|
|
92
|
+
export type ThemePrecedence = "host" | "source";
|
|
93
|
+
|
|
94
|
+
/** Complete built-in theme catalog and per-family native capability bitmasks. */
|
|
95
|
+
export interface ThemeCatalog {
|
|
96
|
+
readonly schema_version: 2;
|
|
97
|
+
readonly presets: readonly ThemePresetCatalogEntry[];
|
|
98
|
+
readonly mermaid_themes: readonly string[];
|
|
99
|
+
/** Native theme capability bit masks by logical diagram family. */
|
|
100
|
+
readonly families: readonly { id: string; capabilities: number }[];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** Metadata, supported appearances, and preview swatch for one built-in Theme v2 preset. */
|
|
104
|
+
export interface ThemePresetCatalogEntry {
|
|
105
|
+
readonly id: string;
|
|
106
|
+
readonly name: string;
|
|
107
|
+
readonly description: string;
|
|
108
|
+
readonly category: ThemeCategory;
|
|
109
|
+
readonly appearances: readonly ThemeAppearance[];
|
|
110
|
+
readonly default_appearance: ThemeAppearance;
|
|
111
|
+
/** Semantic colors for the preset's default appearance. */
|
|
112
|
+
readonly swatches: readonly [
|
|
113
|
+
canvas: string, node: string, container: string,
|
|
114
|
+
title: string, primaryText: string, firstDataFill: string,
|
|
115
|
+
];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** Authorable Theme v2 document (schema version `2`) supporting `extends`, seeds, roles, typography, form, appearances, and per-family overrides. */
|
|
119
|
+
export interface ThemeDocument {
|
|
120
|
+
readonly $schema?: string;
|
|
121
|
+
readonly schema_version: 2;
|
|
122
|
+
readonly id?: string;
|
|
123
|
+
readonly name?: string;
|
|
124
|
+
readonly description?: string;
|
|
125
|
+
readonly category?: ThemeCategory;
|
|
126
|
+
readonly extends?: string;
|
|
127
|
+
readonly default_appearance?: ThemeAppearance;
|
|
128
|
+
readonly seed?: ThemeSeed;
|
|
129
|
+
readonly roles?: Partial<ThemeRoles>;
|
|
130
|
+
readonly typography?: Partial<ThemeTypography>;
|
|
131
|
+
readonly form?: ThemeFormPatch;
|
|
132
|
+
readonly appearances?: Readonly<Partial<Record<ThemeAppearance, ThemeAppearanceLayer>>>;
|
|
133
|
+
readonly overrides?: readonly ThemeFamilyOverride[];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** A preset ID, `none` to clear the selection, or an editable v2 document. */
|
|
60
137
|
export type DiagramThemeSelection =
|
|
61
|
-
|
|
|
62
|
-
| (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
138
|
+
| string
|
|
139
|
+
| (ThemeDocument & {
|
|
140
|
+
readonly preset?: never;
|
|
141
|
+
readonly document?: never;
|
|
142
|
+
readonly appearance?: never;
|
|
143
|
+
readonly precedence?: never;
|
|
144
|
+
})
|
|
145
|
+
| ({
|
|
146
|
+
readonly schema_version?: never;
|
|
147
|
+
readonly appearance?: ThemeAppearance;
|
|
148
|
+
readonly precedence?: ThemePrecedence;
|
|
149
|
+
} & (
|
|
150
|
+
| { readonly preset: string; readonly document?: never }
|
|
151
|
+
| { readonly document: ThemeDocument; readonly preset?: never }
|
|
66
152
|
));
|
|
67
153
|
|
|
68
|
-
export type
|
|
69
|
-
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
export
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export interface
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
154
|
+
export type ThemeSeed = Readonly<Partial<Record<
|
|
155
|
+
"canvas" | "ink" | "accent" | "surface" | "callout" | "info" | "success" | "warn" | "danger",
|
|
156
|
+
string
|
|
157
|
+
>>>;
|
|
158
|
+
|
|
159
|
+
export type ThemePaint = string | {
|
|
160
|
+
readonly kind: "linear_gradient";
|
|
161
|
+
readonly angle_deg?: number;
|
|
162
|
+
readonly stops: readonly { offset: number; color: string; opacity?: number }[];
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export interface ThemeRoles {
|
|
166
|
+
readonly canvas: ThemePaint;
|
|
167
|
+
readonly "surface.node": string;
|
|
168
|
+
readonly "surface.container": string;
|
|
169
|
+
readonly "surface.callout": string;
|
|
170
|
+
readonly "surface.emphasis": string;
|
|
171
|
+
readonly "stroke.border": string;
|
|
172
|
+
readonly "stroke.connector": string;
|
|
173
|
+
readonly "stroke.guide": string;
|
|
174
|
+
readonly "text.primary": string;
|
|
175
|
+
readonly "text.muted": string;
|
|
176
|
+
readonly "text.title": string;
|
|
177
|
+
readonly "text.callout": string;
|
|
178
|
+
readonly "text.on_emphasis": string;
|
|
179
|
+
readonly "status.info": string;
|
|
180
|
+
readonly "status.success": string;
|
|
181
|
+
readonly "status.warn": string;
|
|
182
|
+
readonly "status.danger": string;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
type ThemeTextureColor = { readonly color?: string; readonly opacity?: number };
|
|
186
|
+
|
|
187
|
+
export type ThemeTexture =
|
|
188
|
+
| { readonly kind: "none" }
|
|
189
|
+
| (ThemeTextureColor & {
|
|
190
|
+
readonly kind: "grid";
|
|
191
|
+
readonly step_px: number;
|
|
192
|
+
readonly major_every?: number;
|
|
193
|
+
readonly major_opacity?: number;
|
|
194
|
+
})
|
|
195
|
+
| (ThemeTextureColor & { readonly kind: "dots"; readonly step_px: number; readonly radius_px?: number })
|
|
196
|
+
| (ThemeTextureColor & {
|
|
197
|
+
readonly kind: "ruled";
|
|
198
|
+
readonly line_height_px: number;
|
|
199
|
+
readonly margin_rule_color?: string;
|
|
200
|
+
readonly margin_rule_x_px?: number;
|
|
201
|
+
})
|
|
202
|
+
| (ThemeTextureColor & { readonly kind: "fibers"; readonly angle_deg?: number; readonly cross?: boolean })
|
|
203
|
+
| (ThemeTextureColor & { readonly kind: "scanlines"; readonly step_px: number })
|
|
204
|
+
| {
|
|
205
|
+
readonly kind: "radial_wash";
|
|
206
|
+
readonly color: string;
|
|
207
|
+
readonly opacity?: number;
|
|
208
|
+
readonly cx?: number;
|
|
209
|
+
readonly cy?: number;
|
|
210
|
+
readonly radius?: number;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
interface ThemeShadowLayer {
|
|
214
|
+
readonly dx: number;
|
|
215
|
+
readonly dy: number;
|
|
216
|
+
readonly blur?: number;
|
|
217
|
+
readonly color: string;
|
|
218
|
+
readonly opacity?: number;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
interface ThemeGlow {
|
|
222
|
+
readonly kind: "glow";
|
|
223
|
+
readonly color: string;
|
|
224
|
+
readonly blur: number;
|
|
225
|
+
readonly opacity?: number;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export type ThemeElevationSpec =
|
|
229
|
+
| "flat" | "soft" | "crisp"
|
|
230
|
+
| { readonly kind: "layered_stack"; readonly layers: readonly ThemeShadowLayer[] }
|
|
231
|
+
| ThemeGlow;
|
|
232
|
+
|
|
233
|
+
export type ThemeElevation =
|
|
234
|
+
| { readonly kind: "flat" }
|
|
235
|
+
| { readonly kind: "shadows"; readonly layers: readonly Required<ThemeShadowLayer>[] }
|
|
236
|
+
| Required<ThemeGlow>;
|
|
237
|
+
|
|
238
|
+
type ThemeFontRole = "sans" | "serif" | "mono";
|
|
239
|
+
|
|
240
|
+
export interface ThemeTypography {
|
|
241
|
+
readonly sans: readonly string[];
|
|
242
|
+
readonly mono: readonly string[];
|
|
243
|
+
readonly serif: readonly string[];
|
|
244
|
+
readonly body_family: ThemeFontRole;
|
|
245
|
+
readonly title_family: ThemeFontRole;
|
|
246
|
+
readonly code_family: "mono" | "sans";
|
|
247
|
+
readonly base_size_px: number;
|
|
248
|
+
readonly title_weight: number;
|
|
249
|
+
readonly label_weight: number;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface ThemeForm {
|
|
253
|
+
readonly density: "compact" | "balanced" | "airy";
|
|
254
|
+
readonly radius: number;
|
|
255
|
+
readonly container_radius: number;
|
|
256
|
+
readonly stroke_width: number;
|
|
257
|
+
readonly connector_width: number;
|
|
258
|
+
readonly edge_style: "curved" | "orthogonal" | "straight" | "sketch";
|
|
259
|
+
readonly marker_style: "stealth" | "filled" | "open" | "classic";
|
|
260
|
+
readonly edge_label_bg: "auto" | "canvas" | "pill" | "transparent";
|
|
261
|
+
readonly chart: {
|
|
262
|
+
readonly gridlines: boolean;
|
|
263
|
+
readonly bar_radius: number;
|
|
264
|
+
readonly bar_wireframe: boolean;
|
|
265
|
+
readonly line_markers: boolean;
|
|
266
|
+
readonly pie_gap_px: number;
|
|
267
|
+
readonly pie_opacity: number;
|
|
268
|
+
};
|
|
128
269
|
}
|
|
129
270
|
|
|
130
|
-
export interface
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
271
|
+
export interface ThemeFormPatch extends Partial<Omit<ThemeForm, "chart">> {
|
|
272
|
+
readonly elevation?: ThemeElevationSpec;
|
|
273
|
+
readonly chart?: Partial<ThemeForm["chart"]>;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
interface ThemeCanvas {
|
|
277
|
+
readonly textures: readonly ThemeTexture[];
|
|
278
|
+
readonly padding_px: number;
|
|
136
279
|
}
|
|
137
280
|
|
|
281
|
+
interface ThemeDataPalette {
|
|
282
|
+
readonly ink: readonly string[];
|
|
283
|
+
readonly fill: readonly string[];
|
|
284
|
+
readonly fill_ink: readonly string[];
|
|
285
|
+
readonly pattern_encoding: boolean;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
type ThemeDataPatch = Partial<Omit<ThemeDataPalette, "fill_ink">> & { readonly fill_ink?: string };
|
|
289
|
+
|
|
290
|
+
export interface ThemeAppearanceLayer {
|
|
291
|
+
readonly seed?: ThemeSeed;
|
|
292
|
+
readonly roles?: Partial<ThemeRoles>;
|
|
293
|
+
readonly data?: ThemeDataPatch;
|
|
294
|
+
readonly canvas?: Partial<ThemeCanvas>;
|
|
295
|
+
readonly elevation?: ThemeElevationSpec;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export interface ThemeFamilyOverride {
|
|
299
|
+
readonly families: readonly string[];
|
|
300
|
+
readonly appearance?: ThemeAppearance;
|
|
301
|
+
readonly roles?: Partial<ThemeRoles>;
|
|
302
|
+
readonly data?: ThemeDataPatch;
|
|
303
|
+
readonly form?: ThemeFormPatch;
|
|
304
|
+
readonly elevation?: ThemeElevationSpec;
|
|
305
|
+
readonly typography?: Partial<ThemeTypography>;
|
|
306
|
+
readonly node_ordinal_palette?: boolean;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
interface ResolvedFamilyTheme {
|
|
310
|
+
readonly roles: ThemeRoles;
|
|
311
|
+
readonly data: ThemeDataPalette;
|
|
312
|
+
readonly typography: ThemeTypography;
|
|
313
|
+
readonly form: ThemeForm;
|
|
314
|
+
readonly elevation: ThemeElevation;
|
|
315
|
+
readonly node_ordinal_palette: boolean;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/** Fully compiled Theme v2 token set for one concrete appearance, including resolved family overrides. */
|
|
319
|
+
export interface ResolvedTheme extends ResolvedFamilyTheme {
|
|
320
|
+
readonly id: string | null;
|
|
321
|
+
readonly appearance: ThemeAppearance;
|
|
322
|
+
readonly canvas: ThemeCanvas;
|
|
323
|
+
readonly family_overrides?: Readonly<Record<string, ResolvedFamilyTheme>>;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/** Structured diagnostic notice emitted while compiling or contrast-checking a Theme v2 document. */
|
|
327
|
+
export type ThemeNotice =
|
|
328
|
+
| {
|
|
329
|
+
readonly kind: "low_contrast";
|
|
330
|
+
readonly foreground: string;
|
|
331
|
+
readonly background: string;
|
|
332
|
+
readonly ratio: number;
|
|
333
|
+
readonly minimum: number;
|
|
334
|
+
}
|
|
335
|
+
| { readonly kind: "contrast_adjusted"; readonly foreground: string; readonly color: string }
|
|
336
|
+
| {
|
|
337
|
+
readonly kind: "appearance_polarity_mismatch";
|
|
338
|
+
readonly appearance: ThemeAppearance;
|
|
339
|
+
readonly family?: string;
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
/** Effective rendering theme mode, resolved preset/appearance, and notices recorded for a render operation. */
|
|
343
|
+
export interface ThemeOutcome {
|
|
344
|
+
readonly mode: "mermaid_parity" | "merman_native";
|
|
345
|
+
readonly preset_id?: string;
|
|
346
|
+
readonly appearance?: ThemeAppearance;
|
|
347
|
+
readonly notices: readonly (ThemeNotice | string)[];
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/** Aggregate WCAG contrast grade across checked foreground/background role pairs. */
|
|
351
|
+
export type ThemeContrastGrade = "warning" | "AA" | "AAA";
|
|
352
|
+
|
|
353
|
+
/** Measured WCAG contrast ratio for one semantic foreground/background pair. */
|
|
354
|
+
export interface ThemeContrastRow {
|
|
355
|
+
readonly foreground: string;
|
|
356
|
+
readonly background: string;
|
|
357
|
+
readonly ratio: number;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/** Options controlling `resolveTheme()` appearance selection, contrast auto-fix, and `extends` expansion. */
|
|
361
|
+
export interface ThemeResolveOptions extends Pick<RenderSvgOptions, "signal" | "timeoutMs"> {
|
|
362
|
+
readonly appearance?: ThemeAppearance;
|
|
363
|
+
/** Adjust foreground colors in the resolved preview and emit `fixed_document` when it fits. */
|
|
364
|
+
readonly auto_fix_contrast?: boolean;
|
|
365
|
+
/** Inline `extends` into a standalone authoring document in `expanded_document`. */
|
|
366
|
+
readonly expand?: boolean;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/** Structured syntax or validation failure returned when `resolveTheme()` rejects a document. */
|
|
370
|
+
export interface ThemeResolveError {
|
|
371
|
+
readonly ok: false;
|
|
372
|
+
/** One-based coordinates in the input document, when known. */
|
|
373
|
+
readonly line: number | null;
|
|
374
|
+
readonly column: number | null;
|
|
375
|
+
readonly path: string | null;
|
|
376
|
+
readonly message: string;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/** Result of compiling and validating a Theme v2 document via `resolveTheme()`. */
|
|
380
|
+
export type ThemeResolution =
|
|
381
|
+
| {
|
|
382
|
+
readonly ok: true;
|
|
383
|
+
readonly resolved: ResolvedTheme;
|
|
384
|
+
readonly notices: readonly ThemeNotice[];
|
|
385
|
+
readonly contrast_grade?: ThemeContrastGrade;
|
|
386
|
+
readonly contrast_rows?: readonly ThemeContrastRow[];
|
|
387
|
+
readonly expanded_document?: ThemeDocument;
|
|
388
|
+
readonly fixed_document?: ThemeDocument;
|
|
389
|
+
}
|
|
390
|
+
| ThemeResolveError;
|
|
391
|
+
// END Theme v2 declarations
|
|
392
|
+
|
|
138
393
|
/** One host-loaded Iconify pack, admitted once into an immutable engine-local registry. */
|
|
139
394
|
export interface MermanIconPack {
|
|
140
395
|
json: string;
|
|
@@ -155,21 +410,29 @@ export interface RenderSvgOptions {
|
|
|
155
410
|
* carrying canonical cancellation details once transport admission or a renderer checkpoint
|
|
156
411
|
* observes the request.
|
|
157
412
|
*/
|
|
158
|
-
signal?: AbortSignal;
|
|
413
|
+
signal?: AbortSignal | null;
|
|
159
414
|
/**
|
|
160
415
|
* Relative monotonic deadline in milliseconds, starting when the Rust transport admits the
|
|
161
416
|
* operation. Values must be integers from 0 through 4,294,967,295.
|
|
162
417
|
*/
|
|
163
418
|
timeoutMs?: number;
|
|
164
|
-
/**
|
|
419
|
+
/** Request-local SVG ID. When supplying request options, set `svg.diagram_id` there. */
|
|
420
|
+
diagramId?: string;
|
|
421
|
+
/** Per-request options merged over the engine baseline. Supply either `options` or `optionsJson`. */
|
|
422
|
+
options?: MermanBindingOptions;
|
|
423
|
+
/** Raw per-request Options JSON. Supply either `optionsJson` or `options`. */
|
|
165
424
|
optionsJson?: string;
|
|
166
425
|
}
|
|
167
426
|
|
|
427
|
+
type DiagramOperationOptions = Omit<RenderSvgOptions, "diagramId"> & { diagramId?: never };
|
|
428
|
+
|
|
168
429
|
export interface MermanOperationRequest {
|
|
169
430
|
operationId: string;
|
|
170
431
|
source: string;
|
|
171
432
|
uri?: string | null;
|
|
172
|
-
/**
|
|
433
|
+
/** Per-request options merged over the engine baseline. Supply either `options` or `optionsJson`. */
|
|
434
|
+
options?: MermanBindingOptions;
|
|
435
|
+
/** Raw per-request Options JSON. Supply either `optionsJson` or `options`. */
|
|
173
436
|
optionsJson?: string;
|
|
174
437
|
}
|
|
175
438
|
|
|
@@ -177,9 +440,26 @@ export interface MermanOperationResult {
|
|
|
177
440
|
operation_id: string;
|
|
178
441
|
media_type: string;
|
|
179
442
|
data: string;
|
|
443
|
+
/** Canonical JSON for `MermanOperationMetadata`. */
|
|
180
444
|
metadata_json: string;
|
|
181
445
|
}
|
|
182
446
|
|
|
447
|
+
export interface NativeMathFallbackObservation {
|
|
448
|
+
readonly policy: "source-text" | "drop";
|
|
449
|
+
readonly fallback_count: number;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
export interface MermanOperationMetadata {
|
|
453
|
+
readonly version: 1;
|
|
454
|
+
readonly operation_id: string;
|
|
455
|
+
readonly media_type: string;
|
|
456
|
+
readonly runtime_policy: "deterministic";
|
|
457
|
+
readonly byte_length: number;
|
|
458
|
+
readonly native_math_fallback?: NativeMathFallbackObservation;
|
|
459
|
+
readonly theme_outcome?: ThemeOutcome;
|
|
460
|
+
readonly [key: string]: unknown;
|
|
461
|
+
}
|
|
462
|
+
|
|
183
463
|
export interface MermanTextMeasurementCatalog {
|
|
184
464
|
protocol_version: number;
|
|
185
465
|
provider_ids: string[];
|
|
@@ -265,7 +545,7 @@ export interface MermanRuntimeConstructorServiceContract {
|
|
|
265
545
|
|
|
266
546
|
export interface MermanRuntimeCatalog {
|
|
267
547
|
schema_version: 1;
|
|
268
|
-
transport_api_version:
|
|
548
|
+
transport_api_version: 3;
|
|
269
549
|
package_version: string;
|
|
270
550
|
options_schema_versions: number[];
|
|
271
551
|
payload_schemas: MermanRuntimePayloadSchema[];
|
|
@@ -305,41 +585,61 @@ export interface MermanQueueState {
|
|
|
305
585
|
readonly state: "open" | "disposing" | "disposed";
|
|
306
586
|
}
|
|
307
587
|
|
|
588
|
+
/** Managed Node.js native rendering engine with bounded concurrency and cooperative cancellation. */
|
|
308
589
|
export declare class MermanEngine {
|
|
309
590
|
private constructor();
|
|
591
|
+
/** Snapshot of active, queued, and lifecycle state for this engine's worker queue. */
|
|
310
592
|
readonly queueState: MermanQueueState;
|
|
593
|
+
/** Immutable capability, output, registry, and resource catalog exposed by the loaded native addon. */
|
|
311
594
|
readonly runtimeCatalog: MermanRuntimeCatalog;
|
|
595
|
+
/** Renders Mermaid source to SVG asynchronously on the engine worker pool. */
|
|
312
596
|
renderSvg(source: string, options?: RenderSvgOptions): Promise<string>;
|
|
313
597
|
/** Synchronous rendering is intended only for explicit SSG build paths. */
|
|
314
598
|
renderSvgSync(source: string, options?: Omit<RenderSvgOptions, "signal">): string;
|
|
315
|
-
|
|
599
|
+
/** Computes the SVG capability plan JSON asynchronously without rendering. */
|
|
600
|
+
svgPlanJson(source: string, options?: DiagramOperationOptions): Promise<string>;
|
|
601
|
+
/** Computes the SVG capability plan JSON synchronously. */
|
|
316
602
|
svgPlanJsonSync(
|
|
317
603
|
source: string,
|
|
318
|
-
options?: Omit<
|
|
604
|
+
options?: Omit<DiagramOperationOptions, "signal">,
|
|
319
605
|
): string;
|
|
320
|
-
/**
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
606
|
+
/** Emits DrawList v1 JSON asynchronously for admitted compact diagrams (`flowchart`, `sequence`, `class`, `state`, `er`). */
|
|
607
|
+
drawListJson(source: string, options?: DiagramOperationOptions): Promise<string>;
|
|
608
|
+
/** Emits DrawList v1 JSON synchronously for admitted compact diagrams (`flowchart`, `sequence`, `class`, `state`, `er`). */
|
|
609
|
+
drawListJsonSync(source: string, options?: Omit<DiagramOperationOptions, "signal">): string;
|
|
610
|
+
/** Returns the compiled Theme v2 built-in preset and family capability catalog. */
|
|
611
|
+
themeCatalog(): ThemeCatalog;
|
|
612
|
+
/** Exports the editable v2 document, including every declared appearance. */
|
|
613
|
+
exportThemePreset(
|
|
614
|
+
presetId: string,
|
|
615
|
+
options?: Pick<RenderSvgOptions, "signal" | "timeoutMs">,
|
|
616
|
+
): Promise<ThemeDocument>;
|
|
617
|
+
/** Pass raw JSON text to preserve document-relative syntax and duplicate-key diagnostics. */
|
|
618
|
+
resolveTheme(
|
|
619
|
+
document: ThemeDocument | string,
|
|
620
|
+
options?: ThemeResolveOptions,
|
|
621
|
+
): Promise<ThemeResolution>;
|
|
622
|
+
/** Returns static JSON metadata for the requested contract metadata identifier. */
|
|
331
623
|
metadataJson(id: string): string;
|
|
624
|
+
/** Executes a generic binding operation asynchronously (for example `svg`, `png`, `pdf`, `ascii`, `draw-list`). */
|
|
332
625
|
executeOperation(
|
|
333
626
|
request: MermanOperationRequest,
|
|
334
627
|
options?: Pick<RenderSvgOptions, "signal" | "timeoutMs">,
|
|
335
628
|
): Promise<MermanOperationResult>;
|
|
629
|
+
/** Executes a generic binding operation synchronously. */
|
|
336
630
|
executeOperationSync(
|
|
337
631
|
request: MermanOperationRequest,
|
|
338
632
|
options?: Pick<RenderSvgOptions, "timeoutMs">,
|
|
339
633
|
): MermanOperationResult;
|
|
634
|
+
/** Drains in-flight operations and releases native resources. Idempotent. */
|
|
340
635
|
dispose(): Promise<void>;
|
|
636
|
+
/** Starts disposal immediately. Use async disposal to await in-flight operations and cleanup. */
|
|
637
|
+
[Symbol.dispose](): void;
|
|
638
|
+
/** Awaits in-flight operations and releases native resources (`await using engine = ...`). */
|
|
639
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
341
640
|
}
|
|
342
641
|
|
|
642
|
+
/** Creates and initializes a managed native {@link MermanEngine} for Node.js. */
|
|
343
643
|
export declare function createNodeEngine(
|
|
344
644
|
options?: CreateNodeEngineOptions,
|
|
345
645
|
): Promise<MermanEngine>;
|
|
@@ -364,7 +664,9 @@ export interface MermanResourceErrorDetails {
|
|
|
364
664
|
}
|
|
365
665
|
|
|
366
666
|
export interface MermanDiagnosticSpan {
|
|
667
|
+
/** Inclusive start, in UTF-8 bytes from the start of the diagnosed input. */
|
|
367
668
|
readonly start: number;
|
|
669
|
+
/** Exclusive end, in UTF-8 bytes from the start of the diagnosed input. */
|
|
368
670
|
readonly end: number;
|
|
369
671
|
readonly kind: "exact" | "insertion-point" | "fallback" | string;
|
|
370
672
|
}
|
|
@@ -398,7 +700,7 @@ export declare class MermanOperationError extends MermanError {
|
|
|
398
700
|
readonly codeName: string | null;
|
|
399
701
|
readonly kind: "generic" | "unknown-operation" | "missing-capability" | string;
|
|
400
702
|
readonly capabilityId: string | null;
|
|
401
|
-
/** Complete core-owned details
|
|
703
|
+
/** Complete core-owned details. */
|
|
402
704
|
readonly details: Readonly<Record<string, unknown>> | null;
|
|
403
705
|
readonly resourceDetails: MermanResourceErrorDetails | null;
|
|
404
706
|
readonly iconRegistryDetails: MermanIconRegistryErrorDetails | null;
|