Skip to content

v2.0.0 — Native everywhere

Choose a tag to compare

@clintecker clintecker released this 20 Jul 22:11
· 17 commits to main since this release
c0b969f

MermaidKit now renders natively on five platforms — macOS/iOS, Linux, Android, Windows/.NET, and WebAssembly — from one Swift layout core. The Swift package's public API is additive (no breaking changes); the major bump marks the platform expansion. Android, Windows, and .NET ship as their own 0.1.0 artifacts.

Native everywhere

  • Android — the android/ Gradle module renders all 30 types with a Kotlin Canvas. A SceneWire model + SceneRenderer, a JNI bridge (MermaidNative over a per-ABI libmermaidkit.so), the device measure seam (Paint.measureText through JNI), Material theming (MermaidTheme.fromMaterial), a Compose MermaidDiagram + classic MermaidView, contentDescription from the narration, and a stripped multi-ABI AAR — verified on an android-34 emulator in CI.

    MermaidDiagram("flowchart LR\n A[Start] --> B[End]", Modifier.fillMaxWidth())
  • Windows / .NET — the windows/ library renders with SkiaSharp (real Skia, a fidelity match for Android; no SVG fallback): a SceneWire model, a SceneRenderer over SKCanvas, and a P/Invoke bridge (MermaidNative over a Swift-built MermaidKitCShared.dll). Gated on windows-latest.

    var scene = MermaidNative.Scene("flowchart LR\n A[Start] --> B[End]");
    new SceneRenderer().Draw(scene, canvas);
  • WebAssembly — the platform-free core compiles to wasm32-unknown-wasi and emits SVG (or a Canvas2D scene) in the browser.

Proven byte-identical

A conformance harness + CI gate run the same fixtures through the core on all five platforms and assert one signature. Reaching byte-identity caught and fixed two real cross-platform determinism bugs — a Double→JSON formatting difference between Foundation implementations (fixed via 1/256-grid coordinate quantization), and a ceil that amplified a 1-ULP sin/cos difference in pie tessellation.

C ABI additions

mmk_scene_json_themed + ThemeWire (theme a scene with caller colors); a dynamic MermaidKitCShared product (the Windows DLL); WASI/Bionic portability guards.

Full detail in CHANGELOG.md and the platform notes under docs/notes/.