@mermanjs/web-render 0.9.3 → 0.10.0-alpha.2

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 (71) hide show
  1. package/README.md +16 -4
  2. package/THIRD_PARTY_LICENSES/d3-path/LICENSE +13 -0
  3. package/THIRD_PARTY_LICENSES/eclipse-elk/LICENSE.md +1 -2
  4. package/THIRD_PARTY_LICENSES/elkjs/LICENSE.md +1 -2
  5. package/THIRD_PARTY_LICENSES/roxmltree-dom/LICENSE-APACHE +201 -0
  6. package/THIRD_PARTY_LICENSES/roxmltree-dom/LICENSE-ISC +13 -0
  7. package/THIRD_PARTY_LICENSES/roxmltree-dom/LICENSE-MIT +21 -0
  8. package/THIRD_PARTY_LICENSES/rust-cargo-dependencies.json +60 -38
  9. package/THIRD_PARTY_NOTICES.md +55 -23
  10. package/artifacts/provenance.json +156 -106
  11. package/artifacts/wasm/merman_wasm.d.ts +50 -4
  12. package/artifacts/wasm/merman_wasm.js +764 -230
  13. package/artifacts/wasm/merman_wasm_bg.wasm +0 -0
  14. package/artifacts/wasm/merman_wasm_bg.wasm.d.ts +19 -2
  15. package/dist/generated/binding-contract.d.ts +384 -0
  16. package/dist/generated/binding-contract.d.ts.map +1 -0
  17. package/dist/generated/binding-contract.js +18 -12
  18. package/dist/generated/binding-contract.js.map +1 -1
  19. package/dist/generated/capability-surface.d.ts +56 -3
  20. package/dist/generated/capability-surface.d.ts.map +1 -1
  21. package/dist/generated/capability-surface.js +64 -1
  22. package/dist/generated/capability-surface.js.map +1 -1
  23. package/dist/generated/resource-contract.d.ts +3 -3
  24. package/dist/generated/resource-contract.d.ts.map +1 -1
  25. package/dist/generated/resource-contract.js +36 -10
  26. package/dist/generated/resource-contract.js.map +1 -1
  27. package/dist/generated/text-measurement-abi.d.ts +5 -0
  28. package/dist/generated/text-measurement-abi.d.ts.map +1 -1
  29. package/dist/generated/text-measurement-abi.js +1 -0
  30. package/dist/generated/text-measurement-abi.js.map +1 -1
  31. package/dist/index.d.ts +5 -4
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/json-input.js +13 -0
  34. package/dist/json-input.js.map +1 -0
  35. package/dist/package-entries/render.d.ts +15 -7
  36. package/dist/package-entries/render.d.ts.map +1 -1
  37. package/dist/package-entries/render.js +22 -7
  38. package/dist/package-entries/render.js.map +1 -1
  39. package/dist/public-catalog.d.ts +7 -7
  40. package/dist/public-catalog.d.ts.map +1 -1
  41. package/dist/public-catalog.js +6 -15
  42. package/dist/public-catalog.js.map +1 -1
  43. package/dist/public-types.d.ts +736 -59
  44. package/dist/public-types.d.ts.map +1 -1
  45. package/dist/runtime-analysis.d.ts.map +1 -1
  46. package/dist/runtime-core.d.ts +5 -3
  47. package/dist/runtime-core.d.ts.map +1 -1
  48. package/dist/runtime-core.js +222 -75
  49. package/dist/runtime-core.js.map +1 -1
  50. package/dist/runtime-mount.d.ts +4 -0
  51. package/dist/runtime-mount.d.ts.map +1 -0
  52. package/dist/runtime-mount.js +276 -0
  53. package/dist/runtime-mount.js.map +1 -0
  54. package/dist/runtime-render-session.d.ts.map +1 -1
  55. package/dist/runtime-render-session.js +8 -1
  56. package/dist/runtime-render-session.js.map +1 -1
  57. package/dist/runtime-render.d.ts +12 -10
  58. package/dist/runtime-render.d.ts.map +1 -1
  59. package/dist/runtime-render.js +118 -32
  60. package/dist/runtime-render.js.map +1 -1
  61. package/dist/runtime-state.d.ts +4 -3
  62. package/dist/runtime-state.d.ts.map +1 -1
  63. package/dist/runtime-state.js +3 -2
  64. package/dist/runtime-state.js.map +1 -1
  65. package/dist/surface-runtime.js +2 -2
  66. package/dist/surface-runtime.js.map +1 -1
  67. package/dist/svg-dom.js +24 -0
  68. package/dist/svg-dom.js.map +1 -0
  69. package/dist/svg-safety-policy.js +210 -2
  70. package/dist/svg-safety-policy.js.map +1 -1
  71. package/package.json +4 -3
@@ -1,19 +1,23 @@
1
- import type { AsciiCapability, BindingStatusCodeName, DiagramFamilyCapability, DiagramType, LintBindingOptions, LintRuleCatalogResponse, LintRuleCategory, LintRuleSeverity, LintRuleTag, RuntimeCapabilities } from "./public-catalog.js";
1
+ import type { AsciiCapability, BindingStatusCodeName, DiagramFamilyCapability, DiagramType, LintBindingOptions, LintRuleCatalogResponse, LintRuleCategory, LintRuleSeverity, LintRuleTag, RuntimeCapabilities, ThemeName } from "./public-catalog.js";
2
2
  import type { HostTextDirection, HostTextMeasurementOperation, HostTextMeasurementPhase, HostTextWhiteSpace, HostTextWrapMode } from "./generated/text-measurement-abi.js";
3
3
  import type { EditorRenamePolicy } from "./generated/editor-rename-policy.js";
4
- import type { ResourceOverrideId, ResourceLimitId, ResourceOptions, ResourceProfile } from "./generated/resource-contract.js";
4
+ import type { BINDING_OPTIONS_SCHEMA_VERSION, ResourceOverrideId, ResourceLimitId, ResourceOptions, ResourceProfile } from "./generated/resource-contract.js";
5
5
  export type { HostTextDirection, HostTextMeasurementOperation, HostTextMeasurementPhase, HostTextMeasurementResultKind, HostTextWhiteSpace, HostTextWrapMode, } from "./generated/text-measurement-abi.js";
6
6
  export type { ResourceOptions } from "./generated/resource-contract.js";
7
7
  export interface ParseOptions {
8
8
  suppress_errors?: boolean;
9
9
  }
10
10
  export interface LayoutOptions {
11
+ /** Explicit whole-column packing, currently supported by Kanban only. */
12
+ adaptation?: "none" | "fit-width";
11
13
  container_width?: number;
12
14
  container_height?: number;
13
15
  screen_available_width?: number;
14
16
  }
15
17
  export interface RenderEnvironmentOptions {
16
- text_measurement?: "deterministic";
18
+ /** Require the renderer's native portability admission; pipeline selection alone is not strict. */
19
+ theme_portability?: "best-effort" | "require-portable";
20
+ text_measurement?: "deterministic" | null;
17
21
  math_renderer?: "none" | "ratex";
18
22
  }
19
23
  /**
@@ -38,33 +42,66 @@ export interface RuntimeCatalog {
38
42
  registry: RuntimeRegistryContract;
39
43
  resources: RuntimeResourceContract;
40
44
  }
41
- export interface PresentationCatalog {
45
+ export interface ThemeCatalog {
42
46
  schema_version: 1;
43
- theme_presets: PresentationThemePresetCatalogEntry[];
44
- profiles: PresentationProfileCatalogEntry[];
45
- }
46
- export interface PresentationThemePresetCatalogEntry {
47
+ structured_spec_available: boolean;
48
+ supported_output_ids: string[];
49
+ presets: ThemePresetCatalogEntry[];
50
+ known_capability_ids: string[];
51
+ known_text_capability_ids: string[];
52
+ known_font_container_ids: string[];
53
+ known_font_source_ids: string[];
54
+ known_semantic_target_ids: string[];
55
+ known_variant_ids: string[];
56
+ resource_limits: ThemeResourceLimitCatalogEntry[];
57
+ }
58
+ export interface ThemePresetCatalogEntry {
47
59
  id: string;
60
+ display_name: string;
48
61
  appearance: string;
49
- fully_available: boolean;
50
- missing_capability_ids: string[];
51
- }
52
- export interface PresentationProfileCatalogEntry {
62
+ maturity: string;
63
+ available: boolean;
64
+ availability_reason_ids: string[];
65
+ /** Ordered color swatches for discovery, not a rendered palette or support claim. */
66
+ preview_colors: string[];
67
+ /** Curated design scope, independent of technical support or qualification. */
68
+ family_designs: ThemePresetFamilyDesign[];
69
+ /** Curated visual guidance; recommendations require an explicit host/user decision. */
70
+ application_notes: ThemePresetApplicationNote[];
71
+ qualified_cells: ThemePresetQualifiedCell[];
72
+ license_expression: string;
73
+ required_attribution: string | null;
74
+ export_kind: "design" | "complete_spec";
75
+ }
76
+ /** Missing families and unknown treatments are unreviewed; preserve unknown IDs. */
77
+ export interface ThemePresetFamilyDesign {
78
+ family_id: string;
79
+ /** Open string: dedicated, base_only, or unreviewed. None grants portability. */
80
+ treatment: string;
81
+ }
82
+ /** Open discovery guidance for a family; presence grants no support or qualification. */
83
+ export interface ThemePresetApplicationNote {
53
84
  id: string;
54
- fully_available: boolean;
55
- missing_capability_ids: string[];
56
- aspects: PresentationAspectCatalogEntry[];
57
- }
58
- export interface PresentationAspectCatalogEntry {
85
+ family_id: string;
86
+ message: string;
87
+ /** Suggested Mermaid site configuration. Never applied by preset selection itself. */
88
+ recommended_config: Record<string, unknown> | null;
89
+ }
90
+ /** Scoped metadata backed by catalog qualification, not an unconditional portability claim. */
91
+ export interface ThemePresetQualifiedCell {
92
+ family_id: string;
93
+ output_id: string;
94
+ /** Scenario and resource conditions. Unknown profiles do not grant usable support. */
95
+ profile_id: string;
96
+ /** Open target admission ID; for example `portable` or `host_dependent`. */
97
+ admission_status: string;
98
+ }
99
+ export interface ThemeResourceLimitCatalogEntry {
59
100
  id: string;
60
- applicability: PresentationAspectApplicability;
61
- required_capability_id: string | null;
62
- available: boolean;
63
- missing_capability_ids: string[];
64
- }
65
- export interface PresentationAspectApplicability {
66
- kind: string;
67
- family_id: string | null;
101
+ phase: string;
102
+ description: string;
103
+ effective_value: number | null;
104
+ hard_cap: boolean;
68
105
  }
69
106
  export interface RuntimePayloadSchema {
70
107
  [key: string]: unknown;
@@ -149,27 +186,500 @@ export interface RuntimeResourceProfile {
149
186
  export interface SvgOptions {
150
187
  diagram_id?: string;
151
188
  pipeline?: "parity" | "readable" | "resvg-safe";
152
- scoped_css?: string;
153
- css_override_policy?: "preserve" | "strip-existing-important";
154
189
  root_background_color?: string;
155
190
  drop_native_duplicate_fallbacks?: boolean;
156
191
  viewbox_padding?: number;
157
192
  viewBoxPadding?: number;
158
193
  }
159
- export type PresentationThemeAppearance = "light" | "dark";
160
- export interface PresentationThemeOptions {
161
- preset?: string;
162
- appearance?: PresentationThemeAppearance;
163
- font_family?: string;
164
- font_size?: string;
165
- roles?: Record<string, string>;
166
- series_palette?: string[];
194
+ /** A named preset, direct specification, or shareable recipe. Select exactly one form. */
195
+ export type DiagramThemeSelection = ({
196
+ kind?: never;
197
+ schema_version?: never;
198
+ design?: never;
199
+ complete_spec?: never;
200
+ } & ({
201
+ preset: string;
202
+ spec?: never;
203
+ } | {
204
+ preset?: never;
205
+ spec: DiagramThemeSpec;
206
+ })) | ThemeRecipeV1;
207
+ /** A literal or an exact document-local token reference; dots have no traversal meaning. */
208
+ export type ThemeValueV1<T> = T | ThemeReferenceV1;
209
+ export interface ThemeReferenceV1 {
210
+ ref: string;
211
+ }
212
+ /** An editable design. Only clearable style fields accept explicit null. */
213
+ export interface ThemeDesignV1 {
214
+ tokens?: Record<string, ThemeDesignTokenV1>;
215
+ styles?: Record<string, ThemeDesignStyleV1>;
216
+ rules?: ThemeDesignRuleV1[];
217
+ palettes?: Record<string, ThemeValueV1<ThemeValueV1<string>[]>>;
218
+ canvas?: ThemeDesignCanvasV1;
219
+ typography?: ThemeDesignTypographyV1;
220
+ mermaid?: MermaidThemeCompatibility;
221
+ assets?: ThemeAssetsSpec;
222
+ requirements?: ThemeRequirementsSpec;
223
+ }
224
+ export type ThemeDesignTokenV1 = {
225
+ label?: string;
226
+ description?: string;
227
+ group?: string;
228
+ } & ({
229
+ type: "color";
230
+ value: ThemeValueV1<string>;
231
+ } | {
232
+ type: "number";
233
+ value: ThemeValueV1<number>;
234
+ } | {
235
+ type: "string";
236
+ value: ThemeValueV1<string>;
237
+ } | {
238
+ type: "length";
239
+ value: ThemeValueV1<ThemeLength>;
240
+ } | {
241
+ type: "insets";
242
+ value: ThemeValueV1<ThemeInsets>;
243
+ } | {
244
+ type: "line-height";
245
+ value: ThemeValueV1<ThemeLineHeight>;
246
+ } | {
247
+ type: "font-stack";
248
+ value: ThemeValueV1<string[]>;
249
+ } | {
250
+ type: "palette";
251
+ value: ThemeValueV1<ThemeValueV1<string>[]>;
252
+ } | {
253
+ type: "paint";
254
+ value: ThemeValueV1<ThemeDesignPaintV1>;
255
+ } | {
256
+ type: "stroke";
257
+ value: ThemeValueV1<ThemeDesignStrokeV1>;
258
+ } | {
259
+ type: "text-style";
260
+ value: ThemeValueV1<ThemeDesignTextStyleV1>;
261
+ } | {
262
+ type: "effect";
263
+ value: ThemeValueV1<ThemeDesignEffectV1>;
264
+ });
265
+ export interface ThemeDesignRuleV1 {
266
+ target: string;
267
+ family?: string;
268
+ variant?: string;
269
+ ordinal?: ThemeRuleEntry["ordinal"];
270
+ style: ThemeDesignStyleV1;
271
+ }
272
+ export interface ThemeDesignStyleV1 {
273
+ fill?: ThemePatch<ThemeValueV1<ThemeDesignPaintV1>>;
274
+ opacity?: ThemePatch<ThemeValueV1<number>>;
275
+ fill_opacity?: ThemePatch<ThemeValueV1<number>>;
276
+ stroke?: ThemeValueV1<ThemeDesignStrokeV1>;
277
+ radius?: ThemePatch<ThemeValueV1<ThemeLength>>;
278
+ padding?: ThemePatch<ThemeValueV1<ThemeInsets>>;
279
+ typography?: ThemeValueV1<ThemeDesignTextStyleV1>;
280
+ effect?: ThemePatch<ThemeValueV1<ThemeDesignEffectV1>>;
281
+ }
282
+ export interface ThemeDesignStrokeV1 {
283
+ paint?: ThemePatch<ThemeValueV1<ThemeDesignPaintV1>>;
284
+ width?: ThemePatch<ThemeValueV1<ThemeLength>>;
285
+ dasharray?: ThemePatch<ThemeValueV1<number>[]>;
286
+ linecap?: ThemePatch<ThemeValueV1<"butt" | "round" | "square">>;
287
+ linejoin?: ThemePatch<ThemeValueV1<"miter" | "round" | "bevel">>;
288
+ opacity?: ThemePatch<ThemeValueV1<number>>;
289
+ }
290
+ export interface ThemeDesignTextStyleV1 {
291
+ font_stack?: ThemePatch<ThemeValueV1<string[]>>;
292
+ font_size_px?: ThemePatch<ThemeValueV1<ThemeLength>>;
293
+ font_weight?: ThemePatch<ThemeValueV1<number>>;
294
+ font_style?: ThemePatch<ThemeValueV1<"normal" | "italic" | "oblique">>;
295
+ line_height?: ThemePatch<ThemeValueV1<ThemeLineHeight>>;
296
+ letter_spacing_px?: ThemePatch<ThemeValueV1<ThemeLength>>;
297
+ word_spacing_px?: ThemePatch<ThemeValueV1<ThemeLength>>;
298
+ transform?: ThemePatch<ThemeValueV1<"none" | "uppercase" | "lowercase" | "capitalize">>;
299
+ decoration?: ThemePatch<ThemeValueV1<"none" | "underline" | "overline" | "line-through">>;
300
+ text_align?: ThemePatch<ThemeValueV1<"start" | "center" | "end">>;
301
+ white_space?: ThemePatch<ThemeValueV1<"normal" | "pre" | "no-wrap" | "pre-wrap" | "pre-line">>;
302
+ wrap?: ThemePatch<ThemeValueV1<"normal" | "break-word" | "anywhere">>;
303
+ }
304
+ export interface ThemeDesignTypographyV1 {
305
+ default?: ThemeValueV1<ThemeDesignTextStyleV1>;
306
+ families?: Record<string, ThemeValueV1<ThemeDesignTextStyleV1>>;
307
+ }
308
+ export type ThemeDesignPaintV1 = string | {
309
+ kind: "transparent";
310
+ } | {
311
+ kind: "solid";
312
+ color: ThemeValueV1<string>;
313
+ } | {
314
+ kind: "linear-gradient";
315
+ angle_degrees: ThemeValueV1<number>;
316
+ stops: ThemeDesignGradientStopV1[];
317
+ repetition?: ThemeLinearGradientRepetition;
318
+ } | {
319
+ kind: "radial-gradient";
320
+ center_x: ThemeValueV1<ThemeLength>;
321
+ center_y: ThemeValueV1<ThemeLength>;
322
+ radius: ThemeValueV1<ThemeLength>;
323
+ stops: ThemeDesignGradientStopV1[];
324
+ repetition?: ThemeRadialGradientRepetition;
325
+ } | {
326
+ /** Acceptance preserves the request; it does not establish pattern renderer support. */
327
+ kind: "pattern";
328
+ pattern: "dots" | "grid" | "stripes";
329
+ cell_width: ThemeValueV1<ThemeLength>;
330
+ cell_height: ThemeValueV1<ThemeLength>;
331
+ foreground: ThemeValueV1<string>;
332
+ background?: ThemeValueV1<string>;
333
+ angle_degrees?: ThemeValueV1<number>;
334
+ };
335
+ export interface ThemeDesignGradientStopV1 {
336
+ offset: ThemeValueV1<number>;
337
+ color: ThemeValueV1<string>;
338
+ opacity?: ThemeValueV1<number>;
339
+ }
340
+ export interface ThemeDesignCanvasV1 {
341
+ base?: ThemeValueV1<ThemeDesignPaintV1>;
342
+ layers?: ThemeDesignCanvasLayerV1[];
343
+ bleed?: ThemeValueV1<ThemeInsets>;
344
+ }
345
+ export interface ThemeDesignCanvasLayerV1 {
346
+ paint: ThemeValueV1<ThemeDesignPaintV1>;
347
+ opacity?: ThemeValueV1<number>;
348
+ blend_mode?: ThemeCanvasLayer["blend_mode"];
349
+ offset_x?: ThemeValueV1<ThemeLength>;
350
+ offset_y?: ThemeValueV1<ThemeLength>;
351
+ }
352
+ export type ThemeShadowCompositionV1 = "independent" | "cascade";
353
+ export type ThemeDesignEffectV1 = {
354
+ kind: "shadow-stack";
355
+ composition: ThemeShadowCompositionV1;
356
+ color_space?: "linear-rgb" | "srgb";
357
+ shadows: ThemeDesignShadowV1[];
358
+ } | {
359
+ kind: "graph";
360
+ color_space?: "linear-rgb" | "srgb";
361
+ primitives: ThemeEffectPrimitive[];
362
+ };
363
+ export interface ThemeDesignShadowV1 {
364
+ offset_x: ThemeValueV1<ThemeLength>;
365
+ offset_y: ThemeValueV1<ThemeLength>;
366
+ /** Gaussian standard deviation in pixels; zero produces a hard shadow. */
367
+ std_deviation: ThemeValueV1<ThemeLength>;
368
+ color: ThemeValueV1<string>;
369
+ opacity?: ThemeValueV1<number>;
370
+ }
371
+ export interface MaterializedThemeWireV1 {
372
+ schema_version: 1;
373
+ authoring_schema_version: 1;
374
+ expansion_version: 1;
375
+ spec_schema_version: 1;
376
+ spec: DiagramThemeSpec;
377
+ /** Declared authoring references and consumer constraints; this is not a winning-rule trace. */
378
+ references?: ThemeDesignReferenceUse[];
379
+ }
380
+ export interface ThemeDesignValueDomain {
381
+ value_type: ThemeDesignTokenV1["type"];
382
+ choices?: string[];
383
+ units?: string[];
384
+ min?: number;
385
+ max?: number;
386
+ }
387
+ export interface ThemeDesignReferenceUse {
388
+ token: string;
389
+ /** JSON Pointer to the authored consumer. */
390
+ path: string;
391
+ domain: ThemeDesignValueDomain;
392
+ }
393
+ export interface ThemeDesignInspection {
394
+ references: ThemeDesignReferenceUse[];
395
+ }
396
+ export type ThemeSupportOutputId = "standalone-svg" | "browser-svg" | "png" | "jpeg" | "pdf" | "ascii" | (string & {});
397
+ declare const themeSupportUnknownSubjectKind: unique symbol;
398
+ /**
399
+ * A subject kind not understood by this Web contract revision.
400
+ *
401
+ * The brand prevents an incomplete known subject such as `{ kind: "rule" }` from falling through
402
+ * to the forward-compatible branch. Values decoded from a newer runtime can retain their unknown
403
+ * kind, while authored known subjects remain checked against their exact required fields.
404
+ */
405
+ export type ThemeSupportUnknownSubjectKindV1 = string & {
406
+ readonly [themeSupportUnknownSubjectKind]: "unknown-theme-support-subject";
407
+ };
408
+ export type ThemeSupportUnknownSubjectV1 = {
409
+ kind: ThemeSupportUnknownSubjectKindV1;
410
+ } & Record<string, unknown>;
411
+ export type ThemeSupportSubjectV1 = {
412
+ kind: "rule";
413
+ target: string;
414
+ facet: string;
415
+ } | {
416
+ kind: "ordinal-palette";
417
+ target: string;
418
+ } | {
419
+ kind: "base-typography";
420
+ property: string;
421
+ } | ThemeSupportUnknownSubjectV1;
422
+ export interface ThemeSupportQueryV1 {
423
+ schema_version: 1;
424
+ family: string;
425
+ output: ThemeSupportOutputId;
426
+ subject: ThemeSupportSubjectV1;
427
+ }
428
+ export type ThemeSupportState = "unconditional" | "conditional" | "not-applicable" | "unsupported" | "unverified";
429
+ export interface ThemeCapabilityDescriptorV1 {
430
+ schema_version: 1;
431
+ claim_revision: number;
432
+ query: ThemeSupportQueryV1;
433
+ state: ThemeSupportState;
434
+ reason_ids: string[];
435
+ }
436
+ export type ThemeCapabilityDescriptor = ThemeCapabilityDescriptorV1;
437
+ /**
438
+ * A versioned theme document that can be saved as JSON and passed directly as options.theme.
439
+ * A recipe describes authored styles; it does not certify every family or output target.
440
+ */
441
+ export type ThemeRecipeV1 = {
442
+ schema_version: 1;
443
+ preset?: never;
444
+ spec?: never;
445
+ } & ({
446
+ kind: "design";
447
+ design: ThemeDesignV1;
448
+ complete_spec?: never;
449
+ } | {
450
+ kind: "complete_spec";
451
+ complete_spec: DiagramThemeSpec;
452
+ design?: never;
453
+ });
454
+ export interface DiagramThemeSpec {
455
+ mermaid?: MermaidThemeCompatibility;
456
+ typography?: ThemeTypographySpec;
457
+ styles?: ThemeStyleEntry[];
458
+ canvas?: ThemeCanvasSpec;
459
+ effects?: ThemeEffectEntry[];
460
+ requirements?: ThemeRequirementsSpec;
461
+ assets?: ThemeAssetsSpec;
462
+ }
463
+ export interface MermaidThemeCompatibility {
464
+ theme?: ThemeName;
465
+ dark_mode?: boolean;
466
+ variables?: Record<string, string | number | boolean>;
467
+ }
468
+ export interface ThemeTypographySpec {
469
+ default?: ThemeTextStyle;
470
+ families?: Record<string, ThemeTextStyle>;
471
+ }
472
+ export interface ThemeTextStyle {
473
+ font_stack?: string[];
474
+ font_size_px?: number;
475
+ font_weight?: number;
476
+ font_style?: "normal" | "italic" | "oblique";
477
+ line_height?: ThemeLineHeight;
478
+ letter_spacing_px?: number;
479
+ word_spacing_px?: number;
480
+ transform?: "none" | "uppercase" | "lowercase" | "capitalize";
481
+ decoration?: "none" | "underline" | "overline" | "line-through";
482
+ text_align?: "start" | "center" | "end";
483
+ white_space?: "normal" | "pre" | "no-wrap" | "pre-wrap" | "pre-line";
484
+ wrap?: "normal" | "break-word" | "anywhere";
485
+ }
486
+ export type ThemeLineHeight = "normal" | number | {
487
+ px: number;
488
+ };
489
+ export type ThemePatch<T> = T | null;
490
+ export type ThemeLength = number | {
491
+ px: number;
492
+ } | {
493
+ percent: number;
494
+ };
495
+ export type ThemeInsets = number | {
496
+ top: number;
497
+ right: number;
498
+ bottom: number;
499
+ left: number;
500
+ };
501
+ export type ThemePaint = string | {
502
+ kind: "transparent";
503
+ } | {
504
+ kind: "solid";
505
+ color: string;
506
+ } | {
507
+ kind: "linear-gradient";
508
+ angle_degrees: number;
509
+ stops: ThemeGradientStop[];
510
+ repetition?: ThemeLinearGradientRepetition;
511
+ } | {
512
+ kind: "radial-gradient";
513
+ center_x: ThemeLength;
514
+ center_y: ThemeLength;
515
+ radius: ThemeLength;
516
+ stops: ThemeGradientStop[];
517
+ repetition?: ThemeRadialGradientRepetition;
518
+ } | {
519
+ kind: "pattern";
520
+ pattern: "dots" | "grid" | "stripes";
521
+ cell_width: number;
522
+ cell_height: number;
523
+ foreground: string;
524
+ background?: string;
525
+ angle_degrees?: number;
526
+ };
527
+ export type ThemeLinearGradientRepetition = {
528
+ kind: "repeating";
529
+ period_px: number;
530
+ } | {
531
+ kind: "tiled";
532
+ width_px: number;
533
+ height_px: number;
534
+ };
535
+ export type ThemeRadialGradientRepetition = {
536
+ kind: "repeating";
537
+ } | {
538
+ kind: "tiled";
539
+ width_px: number;
540
+ height_px: number;
541
+ };
542
+ export interface ThemeGradientStop {
543
+ offset: number;
544
+ color: string;
545
+ }
546
+ export type ThemeStyleEntry = ThemeRuleEntry | ThemeOrdinalPaletteEntry;
547
+ export interface ThemeRuleEntry {
548
+ kind: "rule";
549
+ target: string;
550
+ family?: string;
551
+ variant?: string;
552
+ ordinal?: {
553
+ exact: number;
554
+ } | {
555
+ cycle: {
556
+ period: number;
557
+ offset: number;
558
+ };
559
+ };
560
+ style: ThemeStylePatch;
561
+ }
562
+ export interface ThemeOrdinalPaletteEntry {
563
+ kind: "ordinal-palette";
564
+ target: string;
565
+ colors: string[];
566
+ }
567
+ export interface ThemeStylePatch {
568
+ fill?: ThemePatch<ThemePaint>;
569
+ opacity?: ThemePatch<number>;
570
+ fill_opacity?: ThemePatch<number>;
571
+ stroke?: ThemeStrokePatch;
572
+ radius?: ThemePatch<number>;
573
+ padding?: ThemePatch<ThemeInsets>;
574
+ typography?: ThemeTextStylePatch;
575
+ effect?: ThemePatch<string>;
576
+ }
577
+ export interface ThemeStrokePatch {
578
+ paint?: ThemePatch<ThemePaint>;
579
+ width?: ThemePatch<number>;
580
+ dasharray?: ThemePatch<number[]>;
581
+ linecap?: ThemePatch<"butt" | "round" | "square">;
582
+ linejoin?: ThemePatch<"miter" | "round" | "bevel">;
583
+ opacity?: ThemePatch<number>;
584
+ }
585
+ export interface ThemeTextStylePatch {
586
+ font_stack?: ThemePatch<string[]>;
587
+ font_size_px?: ThemePatch<number>;
588
+ font_weight?: ThemePatch<number>;
589
+ font_style?: ThemePatch<"normal" | "italic" | "oblique">;
590
+ line_height?: ThemePatch<ThemeLineHeight>;
591
+ letter_spacing_px?: ThemePatch<number>;
592
+ word_spacing_px?: ThemePatch<number>;
593
+ transform?: ThemePatch<"none" | "uppercase" | "lowercase" | "capitalize">;
594
+ decoration?: ThemePatch<"none" | "underline" | "overline" | "line-through">;
595
+ text_align?: ThemePatch<"start" | "center" | "end">;
596
+ white_space?: ThemePatch<"normal" | "pre" | "no-wrap" | "pre-wrap" | "pre-line">;
597
+ wrap?: ThemePatch<"normal" | "break-word" | "anywhere">;
598
+ }
599
+ export interface ThemeCanvasSpec {
600
+ base?: ThemePaint;
601
+ layers?: ThemeCanvasLayer[];
602
+ bleed?: ThemeInsets;
603
+ }
604
+ export interface ThemeCanvasLayer {
605
+ paint: ThemePaint;
606
+ opacity?: number;
607
+ blend_mode?: "normal" | "multiply" | "screen" | "overlay" | "darken" | "lighten" | "difference";
608
+ offset_x?: number;
609
+ offset_y?: number;
610
+ }
611
+ export type ThemeEffectEntry = ThemeEffectGraph | ThemeEffectBinding;
612
+ export interface ThemeEffectGraph {
613
+ kind: "graph";
614
+ id: string;
615
+ /** Color interpolation for all primitives; defaults to linear-rgb when omitted. */
616
+ color_space?: "linear-rgb" | "srgb";
617
+ /** Independent composition accepts only drop-shadow primitives reading source-graphic. */
618
+ composition?: ThemeShadowCompositionV1;
619
+ primitives: ThemeEffectPrimitive[];
620
+ }
621
+ export interface ThemeEffectBinding {
622
+ kind: "binding";
623
+ target: string;
624
+ effect_id: string;
625
+ }
626
+ export type ThemeEffectInput = "source-graphic" | "previous";
627
+ export type ThemeEffectPrimitive = {
628
+ kind: "drop-shadow";
629
+ input?: ThemeEffectInput;
630
+ offset_x: number;
631
+ offset_y: number;
632
+ blur_radius: number;
633
+ spread: number;
634
+ color: string;
635
+ } | {
636
+ kind: "gaussian-blur";
637
+ input?: ThemeEffectInput;
638
+ std_deviation: number;
639
+ } | {
640
+ kind: "color-matrix";
641
+ input?: ThemeEffectInput;
642
+ values: number[];
643
+ } | {
644
+ kind: "turbulence";
645
+ input?: ThemeEffectInput;
646
+ base_frequency_x: number;
647
+ base_frequency_y: number;
648
+ octaves: number;
649
+ seed: number;
650
+ } | {
651
+ kind: "displacement";
652
+ input?: ThemeEffectInput;
653
+ map_input: ThemeEffectInput;
654
+ scale: number;
655
+ };
656
+ export interface ThemeRequirementsSpec {
657
+ capabilities?: string[];
658
+ text_capabilities?: string[];
659
+ }
660
+ export interface ThemeAssetsSpec {
661
+ fonts?: ThemeFontAsset[];
662
+ aliases?: Array<{
663
+ alias: string;
664
+ target: string;
665
+ }>;
666
+ generic_families?: Array<{
667
+ generic: string;
668
+ target: string;
669
+ }>;
670
+ available_sources?: Array<"embedded" | "system">;
671
+ embedding?: "none" | "full-font" | "subset";
672
+ }
673
+ export interface ThemeFontAsset {
674
+ id: string;
675
+ format: "truetype" | "opentype" | "collection" | "woff2";
676
+ data_base64: string;
167
677
  }
168
- export interface PresentationOptions {
169
- profile?: string;
170
- theme?: PresentationThemeOptions;
678
+ export interface MermaidSiteConfig {
679
+ [key: string]: unknown;
680
+ themeCSS?: never;
681
+ secure?: never;
171
682
  }
172
- export type MermaidSiteConfig = Record<string, unknown>;
173
683
  export interface AnalysisBindingOptions {
174
684
  fixed_today?: string;
175
685
  fixed_local_offset_minutes?: number;
@@ -188,24 +698,24 @@ export type EditorAnalysisBindingOptions = Omit<AnalysisBindingOptions, "resourc
188
698
  resources?: EditorResourceOptions;
189
699
  };
190
700
  interface BindingVersionOptions {
191
- version?: 2;
701
+ version?: typeof BINDING_OPTIONS_SCHEMA_VERSION;
192
702
  }
193
- type NoDirectAnalysisBindingOptions<Options extends AnalysisBindingOptions> = {
703
+ type NoDirectAnalysisBindingOptions<Options extends Omit<AnalysisBindingOptions, "resources">> = {
194
704
  [Property in keyof Options]?: never;
195
705
  };
196
- type DirectAnalysisBindingRoot<Options extends AnalysisBindingOptions> = Options & {
706
+ type DirectAnalysisBindingRoot<Options extends Omit<AnalysisBindingOptions, "resources">> = Options & {
197
707
  analysis?: never;
198
708
  merman?: never;
199
709
  };
200
- type AnalysisWrappedBindingRoot<Options extends AnalysisBindingOptions> = NoDirectAnalysisBindingOptions<Options> & {
710
+ type AnalysisWrappedBindingRoot<Options extends Omit<AnalysisBindingOptions, "resources">> = NoDirectAnalysisBindingOptions<Options> & {
201
711
  analysis: Options;
202
712
  merman?: never;
203
713
  };
204
- type MermanWrappedBindingRoot<Options extends AnalysisBindingOptions> = NoDirectAnalysisBindingOptions<Options> & {
714
+ type MermanWrappedBindingRoot<Options extends Omit<AnalysisBindingOptions, "resources">> = NoDirectAnalysisBindingOptions<Options> & {
205
715
  analysis?: never;
206
716
  merman: Options;
207
717
  };
208
- type AnalysisBindingRoot<Options extends AnalysisBindingOptions> = (DirectAnalysisBindingRoot<Options> | AnalysisWrappedBindingRoot<Options> | MermanWrappedBindingRoot<Options>);
718
+ type AnalysisBindingRoot<Options extends Omit<AnalysisBindingOptions, "resources">> = (DirectAnalysisBindingRoot<Options> | AnalysisWrappedBindingRoot<Options> | MermanWrappedBindingRoot<Options>);
209
719
  export type EditorBindingOptions = BindingVersionOptions & AnalysisBindingRoot<EditorAnalysisBindingOptions>;
210
720
  interface CommonBindingFields {
211
721
  parse?: ParseOptions;
@@ -284,7 +794,9 @@ interface AsciiBindingFields {
284
794
  }
285
795
  export type AsciiBindingOptions = CommonBindingOptions & AsciiBindingFields;
286
796
  interface SvgBindingFields {
287
- presentation?: PresentationOptions;
797
+ /** Relative deadline for this Web/WASM operation, in milliseconds. */
798
+ timeout_ms?: number;
799
+ theme?: DiagramThemeSelection | null;
288
800
  environment?: RenderEnvironmentOptions;
289
801
  layout?: LayoutOptions;
290
802
  svg?: SvgOptions;
@@ -301,18 +813,22 @@ export interface RenderSessionOptions {
301
813
  /** Immutable constructor services, scoped to this session and its creating package runtime. */
302
814
  export interface BrowserRenderSession {
303
815
  renderSvg(source: string, options?: SvgBindingOptions | string): string;
816
+ renderSvgResult(source: string, options?: SvgBindingOptions | string): SvgRenderResult;
304
817
  layoutJson(source: string, options?: SvgBindingOptions | string): string;
305
818
  edgeGeometryJson(source: string, options?: SvgBindingOptions | string): string;
306
- renderSvgWithTextMeasurer(source: string, measurer: HostTextMeasurer, options?: SvgBindingOptions | string): string;
307
- layoutJsonWithTextMeasurer(source: string, measurer: HostTextMeasurer, options?: SvgBindingOptions | string): string;
308
- edgeGeometryJsonWithTextMeasurer(source: string, measurer: HostTextMeasurer, options?: SvgBindingOptions | string): string;
819
+ renderSvgWithTextMeasurer(source: string, measurer: HostTextMeasurer, options?: HostTextMeasurerSvgBindingOptions | string): string;
820
+ renderSvgResultWithTextMeasurer(source: string, measurer: HostTextMeasurer, options?: HostTextMeasurerSvgBindingOptions | string): SvgRenderResult;
821
+ layoutJsonWithTextMeasurer(source: string, measurer: HostTextMeasurer, options?: HostTextMeasurerSvgBindingOptions | string): string;
822
+ edgeGeometryJsonWithTextMeasurer(source: string, measurer: HostTextMeasurer, options?: HostTextMeasurerSvgBindingOptions | string): string;
309
823
  dispose(): void;
310
824
  }
311
825
  export interface WasmRenderSessionBinding {
312
826
  renderSvg(source: string, optionsJson?: string | null): string;
827
+ renderSvgResult(source: string, optionsJson?: string | null): SvgRenderResult;
313
828
  layoutJson(source: string, optionsJson?: string | null): string;
314
829
  edgeGeometryJson(source: string, optionsJson?: string | null): string;
315
830
  renderSvgWithTextMeasurer(source: string, optionsJson: string | null | undefined, measurer: HostTextMeasurer): string;
831
+ renderSvgResultWithTextMeasurer(source: string, optionsJson: string | null | undefined, measurer: HostTextMeasurer): SvgRenderResult;
316
832
  layoutJsonWithTextMeasurer(source: string, optionsJson: string | null | undefined, measurer: HostTextMeasurer): string;
317
833
  edgeGeometryJsonWithTextMeasurer(source: string, optionsJson: string | null | undefined, measurer: HostTextMeasurer): string;
318
834
  free(): void;
@@ -320,6 +836,58 @@ export interface WasmRenderSessionBinding {
320
836
  export interface WasmRenderSessionConstructor {
321
837
  new (iconPacksJson?: string | null): WasmRenderSessionBinding;
322
838
  }
839
+ /** Redraw settings for frozen parse facts. Prepare again to change configuration or theme. */
840
+ export type PreparedSourceOutputOptions = BindingVersionOptions & {
841
+ /** Relative deadline for this output, in milliseconds. */
842
+ timeout_ms?: number;
843
+ resources?: ResourceOptions;
844
+ environment?: RenderEnvironmentOptions;
845
+ layout?: LayoutOptions;
846
+ svg?: SvgOptions;
847
+ };
848
+ export type HostTextMeasurerPreparedSourceOutputOptions = Omit<PreparedSourceOutputOptions, "environment"> & {
849
+ environment?: Omit<RenderEnvironmentOptions, "text_measurement">;
850
+ };
851
+ export interface BrowserPreparedSource {
852
+ renderSvg(options?: PreparedSourceOutputOptions | string): string;
853
+ renderSvgResult(options?: PreparedSourceOutputOptions | string): SvgRenderResult;
854
+ layoutJson(options?: PreparedSourceOutputOptions | string): string;
855
+ edgeGeometryJson(options?: PreparedSourceOutputOptions | string): string;
856
+ renderSvgWithTextMeasurer(measurer: HostTextMeasurer, options?: HostTextMeasurerPreparedSourceOutputOptions | string): string;
857
+ renderSvgResultWithTextMeasurer(measurer: HostTextMeasurer, options?: HostTextMeasurerPreparedSourceOutputOptions | string): SvgRenderResult;
858
+ layoutJsonWithTextMeasurer(measurer: HostTextMeasurer, options?: HostTextMeasurerPreparedSourceOutputOptions | string): string;
859
+ edgeGeometryJsonWithTextMeasurer(measurer: HostTextMeasurer, options?: HostTextMeasurerPreparedSourceOutputOptions | string): string;
860
+ dispose(): void;
861
+ }
862
+ export interface WasmPreparedSourceBinding {
863
+ renderSvg(optionsJson?: string | null): string;
864
+ renderSvgResult(optionsJson?: string | null): SvgRenderResult;
865
+ layoutJson(optionsJson?: string | null): string;
866
+ edgeGeometryJson(optionsJson?: string | null): string;
867
+ renderSvgWithTextMeasurer(optionsJson: string | null | undefined, measurer: HostTextMeasurer): string;
868
+ renderSvgResultWithTextMeasurer(optionsJson: string | null | undefined, measurer: HostTextMeasurer): SvgRenderResult;
869
+ layoutJsonWithTextMeasurer(optionsJson: string | null | undefined, measurer: HostTextMeasurer): string;
870
+ edgeGeometryJsonWithTextMeasurer(optionsJson: string | null | undefined, measurer: HostTextMeasurer): string;
871
+ free(): void;
872
+ }
873
+ export interface WasmPreparedSourceConstructor {
874
+ new (source: string, optionsJson?: string | null): WasmPreparedSourceBinding;
875
+ }
876
+ export type ThemeResourceLimitId = "max_theme_encoded_bytes" | "max_theme_base64_bytes" | "max_font_asset_compressed_bytes" | "max_font_asset_decoded_bytes" | "max_font_catalog_decoded_bytes" | "max_font_assets" | "max_font_faces" | "max_font_tables" | "max_font_aliases" | "max_font_decoded_expansion_ratio" | "max_effect_graphs" | "max_effect_primitives_per_graph" | "max_effect_bindings" | "max_effect_offset_magnitude" | "max_effect_filter_region_magnitude" | "max_effect_blur_magnitude" | "max_effect_displacement_scale" | "max_effect_turbulence_octaves";
877
+ export interface ThemeAuthoringResourceOptions {
878
+ profile?: ResourceProfile;
879
+ limits?: Partial<Record<ThemeResourceLimitId, number>>;
880
+ }
881
+ type ThemeAuthoringAnalysisOptions = Omit<AnalysisBindingOptions, "resources"> & {
882
+ resources?: ThemeAuthoringResourceOptions;
883
+ };
884
+ export type ThemeAuthoringOptions = BindingVersionOptions & AnalysisBindingRoot<ThemeAuthoringAnalysisOptions> & CommonBindingFields & SvgBindingFields;
885
+ type HostTextMeasurerEnvironmentOptions = Omit<RenderEnvironmentOptions, "text_measurement"> & {
886
+ text_measurement?: never;
887
+ };
888
+ export type HostTextMeasurerSvgBindingOptions = CommonBindingOptions & Omit<SvgBindingFields, "environment"> & {
889
+ environment?: HostTextMeasurerEnvironmentOptions;
890
+ };
323
891
  export type BindingOptions = SvgBindingOptions;
324
892
  export interface HostTextMeasureRequest {
325
893
  operation: HostTextMeasurementOperation;
@@ -499,6 +1067,24 @@ export interface AnalysisDiagramSyntaxFacts {
499
1067
  expected_syntax: AnalysisExpectedSyntaxFacts[];
500
1068
  }
501
1069
  export type DiagramParseDisposition = "parsed" | "recovered" | "unavailable";
1070
+ export interface SourceAppearanceDeclaration {
1071
+ readonly value: string;
1072
+ readonly origin: {
1073
+ readonly kind: "frontmatter";
1074
+ } | {
1075
+ readonly kind: "directive";
1076
+ readonly directive_index: number;
1077
+ };
1078
+ readonly construct_span: Readonly<AnalysisByteSpan>;
1079
+ }
1080
+ export type SourceAppearanceSummary = {
1081
+ readonly state: "unknown";
1082
+ } | {
1083
+ readonly state: "known";
1084
+ readonly theme: SourceAppearanceDeclaration | null;
1085
+ readonly font: SourceAppearanceDeclaration | null;
1086
+ readonly look: SourceAppearanceDeclaration | null;
1087
+ };
502
1088
  export interface AnalysisDiagramFacts {
503
1089
  source_id: string;
504
1090
  index: number;
@@ -510,11 +1096,68 @@ export interface AnalysisDiagramFacts {
510
1096
  fence_delimiter?: AnalysisFenceDelimiterFacts | null;
511
1097
  parse_disposition: DiagramParseDisposition;
512
1098
  syntax: AnalysisDiagramSyntaxFacts;
1099
+ appearance: SourceAppearanceSummary;
513
1100
  }
514
1101
  export interface AnalysisFactsResult extends AnalysisPayloadFields {
515
- version: 2;
1102
+ version: 3;
516
1103
  diagrams: AnalysisDiagramFacts[];
517
1104
  }
1105
+ /**
1106
+ * An actual render explanation with open identifiers, not a portability certificate.
1107
+ * Rule diagnostics may describe partially applied rules; only `property`, when present, names
1108
+ * a specific property. Source paths are RFC 6901 pointers relative to the named recipe payload
1109
+ * (`design` or `complete_spec`). Generated defaults and Rust input may have no source paths.
1110
+ */
1111
+ export interface ThemeDiagnostic {
1112
+ code: string;
1113
+ subject: string;
1114
+ target?: string | null;
1115
+ property?: string | null;
1116
+ source_document?: string | null;
1117
+ source_paths: string[];
1118
+ generated: boolean;
1119
+ }
1120
+ /** Renderer-owned outcome, with open status/reason IDs for forward-compatible consumers. */
1121
+ export interface ThemeExecutionEvidenceV2 {
1122
+ version: 2;
1123
+ family_id: string;
1124
+ theme_status: string;
1125
+ output_mutated: boolean;
1126
+ target_kind: string;
1127
+ target_status: string;
1128
+ target_reason_ids: string[];
1129
+ font_source: string;
1130
+ materialized_theme: ThemeName | null;
1131
+ /** Absent means not supplied. An empty list does not establish portability. */
1132
+ diagnostics?: ThemeDiagnostic[];
1133
+ }
1134
+ /** Unknown versions stay opaque. Never treat an unknown status or version as portable. */
1135
+ export type ThemeExecutionEvidence = ThemeExecutionEvidenceV2 | {
1136
+ version: number;
1137
+ [key: string]: unknown;
1138
+ };
1139
+ /** Actual family placement width, before SVG viewport scaling. */
1140
+ export interface LayoutAdaptationObservation {
1141
+ mode: "fit-width";
1142
+ requested_width: number;
1143
+ actual_width: number;
1144
+ overflowed: boolean;
1145
+ }
1146
+ /** Existing binding metadata for the exact SVG returned by the same execution. */
1147
+ export interface SvgRenderMetadata {
1148
+ version: 1;
1149
+ operation_id: "svg";
1150
+ media_type: "image/svg+xml";
1151
+ runtime_policy: string;
1152
+ byte_length: number;
1153
+ theme_execution_evidence: ThemeExecutionEvidence;
1154
+ layout_adaptation?: LayoutAdaptationObservation;
1155
+ [key: string]: unknown;
1156
+ }
1157
+ export interface SvgRenderResult {
1158
+ svg: string;
1159
+ metadata: SvgRenderMetadata;
1160
+ }
518
1161
  /**
519
1162
  * Capability plan for one SVG render request.
520
1163
  *
@@ -525,23 +1168,18 @@ export interface SvgPlanResult {
525
1168
  schema_version: 1;
526
1169
  planned_operation_id: "svg";
527
1170
  diagram_type: string;
528
- presentation_profile_id: string | null;
529
- presentation_aspects: SvgPlanPresentationAspect[];
530
1171
  required_capability_ids: string[];
531
1172
  missing_capability_ids: string[];
1173
+ supported_layout_adaptation_ids: ("none" | "fit-width")[];
532
1174
  ready: boolean;
533
1175
  }
534
- export interface SvgPlanPresentationAspect {
535
- id: string;
536
- state: string;
537
- required_capability_id: string | null;
538
- }
539
1176
  export interface AvailableDiagramDetectionFacts {
540
1177
  readonly status: "available";
541
1178
  readonly validity: "valid" | "recoverable-invalid";
542
1179
  readonly diagramType: DiagramType;
543
1180
  readonly syntaxId: string;
544
1181
  readonly effectiveLayoutId: string;
1182
+ readonly appearance?: SourceAppearanceSummary;
545
1183
  }
546
1184
  export interface UnavailableDiagramDetectionFacts {
547
1185
  readonly status: "unavailable";
@@ -549,6 +1187,7 @@ export interface UnavailableDiagramDetectionFacts {
549
1187
  readonly diagramType: null;
550
1188
  readonly syntaxId: null;
551
1189
  readonly effectiveLayoutId: null;
1190
+ readonly appearance?: SourceAppearanceSummary;
552
1191
  }
553
1192
  export type DiagramDetectionFacts = AvailableDiagramDetectionFacts | UnavailableDiagramDetectionFacts;
554
1193
  export interface EditorPosition {
@@ -715,11 +1354,14 @@ export interface MermanWasmModuleBase {
715
1354
  default: (input?: WasmBindgenInitEnvelope) => Promise<unknown>;
716
1355
  }
717
1356
  export interface MermanWasmModule extends MermanWasmModuleBase {
718
- RenderSession?: WasmRenderSessionConstructor;
719
1357
  EditorSession?: WasmEditorSessionConstructor;
1358
+ PreparedSource?: WasmPreparedSourceConstructor;
1359
+ RenderSession?: WasmRenderSessionConstructor;
720
1360
  transportApiVersion: () => number;
721
1361
  packageVersion: () => string;
722
1362
  renderSvg: (source: string, optionsJson?: string | null) => string;
1363
+ renderSvgResult: (source: string, optionsJson?: string | null) => SvgRenderResult;
1364
+ renderSvgResultWithTextMeasurer?: (source: string, optionsJson: string | null | undefined, measurer: HostTextMeasurer) => SvgRenderResult;
723
1365
  edgeGeometryJson: (source: string, optionsJson?: string | null) => string;
724
1366
  edgeGeometryJsonWithTextMeasurer?: (source: string, optionsJson: string | null | undefined, measurer: HostTextMeasurer) => string;
725
1367
  svgPlanJson: (source: string, optionsJson?: string | null) => SvgPlanResult;
@@ -749,7 +1391,10 @@ export interface MermanWasmModule extends MermanWasmModuleBase {
749
1391
  asciiSupportedDiagrams: () => string[];
750
1392
  asciiCapabilities: () => AsciiCapability[];
751
1393
  runtimeCatalog: () => RuntimeCatalog;
752
- presentationCatalog: () => PresentationCatalog;
1394
+ themeCatalog: () => ThemeCatalog;
1395
+ materializeTheme: (designJson: string, optionsJson?: string | null) => MaterializedThemeWireV1;
1396
+ describeThemeSupport: (queryJson: string, optionsJson?: string | null) => ThemeCapabilityDescriptor;
1397
+ exportThemePreset: (presetId: string, optionsJson?: string | null) => ThemeRecipeV1;
753
1398
  diagramFamilyCapabilities: () => DiagramFamilyCapability[];
754
1399
  lintRuleCatalog?: () => LintRuleCatalogResponse;
755
1400
  supportedDiagrams: () => string[];
@@ -761,4 +1406,36 @@ export interface MermanInitOptions<Module extends MermanWasmModuleBase = MermanW
761
1406
  wasm?: MermanWasmSource | Promise<MermanWasmSource>;
762
1407
  }
763
1408
  export type MermanInitInput<Module extends MermanWasmModuleBase = MermanWasmModule> = MermanWasmLoader<Module> | MermanInitOptions<Module>;
1409
+ /** A persistent mount keeps its last successful drawing when a newer request fails. */
1410
+ export type MountedDiagramStatus = "pending" | "rendering" | "ready" | "failed" | "destroyed";
1411
+ export interface MountDiagramOptions {
1412
+ /** Frozen parse inputs and output defaults. Changing these options prepares a new snapshot. */
1413
+ prepareOptions?: SvgBindingOptions & {
1414
+ svg?: Omit<SvgOptions, "diagram_id"> & {
1415
+ diagram_id?: never;
1416
+ };
1417
+ };
1418
+ /** Fresh redraw settings. The mount owns svg.diagram_id and fit-width container_width. */
1419
+ outputOptions?: Omit<PreparedSourceOutputOptions, "svg"> & {
1420
+ svg?: Omit<SvgOptions, "diagram_id"> & {
1421
+ diagram_id?: never;
1422
+ };
1423
+ };
1424
+ /** Browser measurement is opt-in; a supplied callback uses the existing host provider. */
1425
+ textMeasurement?: "deterministic" | "browser" | HostTextMeasurer;
1426
+ onRender?: (result: SvgRenderResult, mount: MountedDiagram) => void;
1427
+ onError?: (error: unknown, mount: MountedDiagram) => void;
1428
+ }
1429
+ export interface MountedDiagram {
1430
+ readonly source: string;
1431
+ readonly result: SvgRenderResult | null;
1432
+ readonly error: unknown;
1433
+ readonly status: MountedDiagramStatus;
1434
+ /** Omitted options retain the current options; supplied options replace them completely. */
1435
+ update(source: string, options?: MountDiagramOptions): void;
1436
+ /** Refresh after external typography changes or adoption into another Document. */
1437
+ refresh(): void;
1438
+ /** Releases resources and leaves the last published DOM in place. Idempotent. */
1439
+ destroy(): void;
1440
+ }
764
1441
  //# sourceMappingURL=public-types.d.ts.map