Skip to content

feat(superdeck): replace flutter_mermaid with mermaid_core - #117

Merged
leoafarias merged 4 commits into
refactor/playground-wizard-onlyfrom
feat/superdeck-mermaid-core
Sep 21, 2026
Merged

leoafarias merged 4 commits into
refactor/playground-wizard-onlyfrom
feat/superdeck-mermaid-core

Conversation

@leoafarias

Copy link
Copy Markdown
Collaborator

Summary

  • Replace flutter_mermaid 0.1.0 with exact mermaid_core and mermaid_flutter 0.3.0 dependencies.
  • Restore class, state, ER, journey, and other supported diagram families with fitted sizing, semantics, transparent theming, and capture-readiness failures.
  • Reject the two known silent-partial flowchart inputs through a narrow attributed validator patch, and document the decision in ADR 0001.

Stack

  • Depends on refactor/playground-wizard-only; review only the commits in this PR boundary.

Validation

  • fvm dart run melos run analyze --no-select — passed
  • fvm dart run melos run test --no-select — passed as part of the 2,142-test stack verification
  • Mermaid corpus and strict-flowchart suites — passed
  • Chromium smoke suite — 7/7 passed
  • Release web bundle delta — +0.62 MB compressed, below the ADR's 1.5 MB reconsideration threshold

Platform note

  • Playwright WebKit could not install its macOS-15 ARM build on the macOS 27 ARM host. The blocker and follow-up are recorded in the ADR and maintainer status.

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 6c56e80):

https://superdeck-dev--pr117-feat-superdeck-merma-n217muay.web.app

(expires Wed, 21 Oct 2026 20:43:37 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bd68fc230762285849207e7e120aaf87cd4ca2f9

@leoafarias
leoafarias added this pull request to stack #119 September 21, 2026 20:28
Replaces `flutter_mermaid` 0.1.0 with `mermaid_flutter` 0.3.0 and its
pure-Dart `mermaid_core`, keeping `MermaidCodeBlock` as the only place
the renderer is named.

What changes for a deck:

- Class, state, entity-relationship and user-journey diagrams render
  again. They were documented before the build plugin was removed and
  have been unsupported since. Mind maps, Git graphs, C4, quadrant and
  the rest of the port's 28 families come with them.
- A diagram that cannot be parsed reports the line it failed on, instead
  of "Unable to parse diagram" with no location.
- `%%{init: ...}%%` directives and frontmatter configuration are honoured.
- Diagram colours are derived from the app's Material colour scheme
  rather than a fixed light/dark preset, over a transparent background.
- Diagram nodes carry semantics, so a diagram is not an unlabelled
  picture to a screen reader or to browser automation.

Capture and export:

- `keepLastGoodSceneOnError` is off. The package keeps the previous
  drawing on a parse error, which suits a live editor; a slide is a
  finished artefact, so it shows the error instead of a stale diagram.
- A failed diagram reports `SlideCaptureReadiness.fail`, so a PDF export
  stops and names the slide rather than writing a page without it.
- The diagram scales down to the width its Markdown block was given and
  keeps its natural aspect ratio.

The demo deck gains a Mermaid slide, so the path is exercised by the
demo, the integration test and the browser smoke run rather than only by
unit tests.
…tely

mermaid_core 0.3.0 accepts two flowchart inputs that mermaid.js 12
rejects, and renders something plausible instead of reporting them:

  graph TD
    A[Start --> B[Finish]     one node labelled "Start --> B[Finish"
    A ~~> B                   two nodes, the edge drawn invisible

Both lose part of the author's diagram without saying so. A slide cannot
afford that, so `checkMermaidSource` runs before rendering and reports
them with the failing line.

The check is upstream's own flowchart parser, vendored verbatim under
`markdown/mermaid/vendor/` with its MIT licence and the source commit,
and tightened in exactly the two marked places. Using their grammar
rather than a SuperDeck pattern matcher is what keeps quoted labels
(`A["array [0]"]`), the real invisible link (`~~~`), subgraphs, shapes,
`classDef`, `linkStyle`, `click`, init directives and frontmatter
working — all asserted. Other diagram families are left to the renderer,
which already reports what it cannot parse.

Adds a corpus test that renders every Mermaid fence in the guide, the
demo deck and the skills reference, so a documented diagram cannot stop
rendering unnoticed.
Moves the decision record into `docs/maintainers/adr/`, marks it
Accepted, and replaces the pre-decision spike plan with what was
actually delivered, including the vendored two-case patch and what the
delivery deliberately did not do.

Drops the assumptions about a live editor: the playground's file-backed
editor is gone, so keeping the last good scene while an author types is
no longer a SuperDeck use case, and the four concerns are restated as
runtime diagrams, deck previews, derived thumbnails, and the deck-owned
artwork of a saved deck.
@leoafarias
leoafarias force-pushed the feat/superdeck-mermaid-core branch from f8785b2 to b32aa49 Compare September 21, 2026 20:32
@leoafarias
leoafarias merged commit ad665aa into main Sep 21, 2026
6 checks passed
@leoafarias
leoafarias deleted the feat/superdeck-mermaid-core branch September 21, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant