The mermaid stage inherits EXPOSE 80 from official nginx while nginx.conf
listens on 8080. Advertise 8080 so inspect and publish match the real
listen port.
Instead of leaving the config empty, the editor now manages the theme: after every validation and on site light/dark changes, syncManagedTheme sets it to the diagram type's own mermaid default (the config section's theme, e.g. redux-color for flowcharts, else the global default) or, in dark mode, the redux -dark variant (redux-dark-color) or dark.
Only editor-set themes are replaced: a missing theme, the global default, a section default or any of their dark variants (isManagedTheme). A theme the user chose, such as forest, is never touched.
Detector ids that do not match their config section (flowchart-v2, flowchart-elk, classDiagram, stateDiagram, xychart, railroadAbnf/Ebnf/Peg) are aliased in mermaid.ts; ids without a section (wardley, zenuml) use the global default.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Mermaid 12 picks its own theme, look and layout per diagram type, so the editor no longer needs to pin a theme. defaultState.mermaid is now `{}`.
- clearDefaultThemeConfig (migration v1): a persisted config whose only key is "theme": "default" is cleared to {} once; anything else is the user's and is left alone.
- toggleDarkTheme: light mode removes the site-managed theme instead of re-pinning "default"; dark mode still sets "dark". User-chosen themes are untouched.
- The migration registry is resolved lazily: the state module imports util.ts, which imports the migrations, so the registry cannot read state exports while the module graph is still initialising.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Bump mermaid ^11.17.2 -> ^12.0.0, @mermaid-js/layout-tidy-tree ^0.2.2 -> ^1.0.0, @mermaid-js/mermaid-zenuml ^0.2.3 -> ^1.0.0 and @mermaid-js/examples ^1.4.0 -> ^2.0.0.
Drop @mermaid-js/layout-elk: mermaid 12 bundles ELK and registers it automatically, so the separate package would only ship a second copy of the layout engine.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diagram source only comes from #code: or #pako:/#base64: state so it
stays out of query strings, logs, and Referer.
Co-authored-by: Cursor <cursoragent@cursor.com>
Add sandbox to copied iframe snippets, carry web-component body code in
#code: instead of ?code=, lock src to the embed.js origin, and make the
async currentScript fallback / dimension sanitization safe. Reuse a
store-free PanZoomToolbar on /embed and keep ToggleGroup values from
clearing on re-click.
Co-authored-by: Cursor <cursoragent@cursor.com>
Address review feedback: static/embed.js is now generated from
src/embed-loader.ts via a small Vite lib-mode config (pnpm build:embed,
chained into dev and build). The generated file is gitignored, and the
source is covered by svelte-check and eslint.
Add an /embed route that renders diagrams as a self-contained widget:
pan/zoom toolbar, light/dark chrome toggle, and attribution footer. It
accepts the same #pako: hashes as share links plus query params (code,
config, theme, look, mode, controls, grid, pan, zoom), runs with
securityLevel strict, silently strips unsafe config, and never touches
localStorage or rewrites the URL.
- static/embed.js: dependency-free <mermaid-embed> web component
- Share dialog: embed section with live preview and copyable iframe /
web-component snippets
- render core extracted to renderView.ts, shared by View and the new
props-driven EmbedView; config sanitization extracted to sanitize.ts
- routes moved into an (app) group so /embed skips the app layout
(URLs unchanged)
The updated @codemirror/view (6.43.6) and @codemirror/language (6.12.4)
require @codemirror/state@6.7.1, but the direct dependency stayed at
^6.6.0, leaving two copies of @codemirror/state in the tree. This broke
the svelte-check type check (6.6.0 EditorState not assignable to 6.7.1)
and the editor at runtime (Playwright timeouts). Aligning the direct
dependency dedupes to a single 6.7.1.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Bump mermaid (11.15.0 -> 11.16.0), @mermaid-js/examples (1.2.0 -> 1.3.0),
and @mermaid-js/layout-elk (0.2.1 -> 0.2.2) to their latest versions.
Also update the Renovate config so mermaid-related packages are grouped
into a single PR, fire on any schedule (not just earlyMondays), and no
longer mix into the all-non-major group. The previous "^mermaid" pattern
missed the scoped @mermaid-js/* packages.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>