Repository navigation
ui: full-screen diagram preview that zooms around what is on screen, inert diagrams - #32591
Merged
allozaur merged 3 commits intoNov 20, 2026
Merged
Conversation
Pele turns a node with `click ... href` into a live link, where Mermaid's strict security level left diagrams without links. Unwrap every link in Pele's output, keeping its children, so the inline block, the live-preview editor, the preview dialog and the downloaded svg stay inert. The Diagrams story's flowchart now carries click directives and its play test checks that no link or href is left. Assisted-by: Claude (Opus 5.5 Medium)
The diagram preview dialog fills the window on every device. The preview places the diagram from its top left corner, so a zoom keeps a screen point fixed: the wheel and a trackpad pinch zoom around the pointer, the buttons and +/- keys around the middle of the screen, wherever the diagram has been panned to. Two-finger pinch, double-click and arrow keys work too. The diagram opens fitted and keeps fitting until panned or zoomed; Reset view fits it again. Adds MermaidPreview and DialogMermaidPreview stories with play tests and a unit test for the zoom math. Assisted-by: Claude (Opus 5.5 Medium)
Assisted-by: Claude (Opus 5.5 Medium)
allozaur
marked this pull request as ready for review
November 19, 2026 16:44
ServeurpersoCom
approved these changes
Nov 20, 2026
Kidplayer666
pushed a commit
to Kidplayer666/llama.cpp
that referenced
this pull request
Nov 20, 2026
…inert diagrams (ggml-org#32591) * ui: keep Pele diagrams inert Pele turns a node with `click ... href` into a live link, where Mermaid's strict security level left diagrams without links. Unwrap every link in Pele's output, keeping its children, so the inline block, the live-preview editor, the preview dialog and the downloaded svg stay inert. The Diagrams story's flowchart now carries click directives and its play test checks that no link or href is left. Assisted-by: Claude (Opus 5.5 Medium) * ui: open diagrams full screen, zoom around what is on screen The diagram preview dialog fills the window on every device. The preview places the diagram from its top left corner, so a zoom keeps a screen point fixed: the wheel and a trackpad pinch zoom around the pointer, the buttons and +/- keys around the middle of the screen, wherever the diagram has been panned to. Two-finger pinch, double-click and arrow keys work too. The diagram opens fitted and keeps fitting until panned or zoomed; Reset view fits it again. Adds MermaidPreview and DialogMermaidPreview stories with play tests and a unit test for the zoom math. Assisted-by: Claude (Opus 5.5 Medium) * ui: add a diagrams trace to the demo fixtures Assisted-by: Claude (Opus 5.5 Medium)
Annieren
pushed a commit
to Annieren/llama.cpp-upstream
that referenced
this pull request
Nov 23, 2026
…inert diagrams (ggml-org#32591) * ui: keep Pele diagrams inert Pele turns a node with `click ... href` into a live link, where Mermaid's strict security level left diagrams without links. Unwrap every link in Pele's output, keeping its children, so the inline block, the live-preview editor, the preview dialog and the downloaded svg stay inert. The Diagrams story's flowchart now carries click directives and its play test checks that no link or href is left. Assisted-by: Claude (Opus 5.5 Medium) * ui: open diagrams full screen, zoom around what is on screen The diagram preview dialog fills the window on every device. The preview places the diagram from its top left corner, so a zoom keeps a screen point fixed: the wheel and a trackpad pinch zoom around the pointer, the buttons and +/- keys around the middle of the screen, wherever the diagram has been panned to. Two-finger pinch, double-click and arrow keys work too. The diagram opens fitted and keeps fitting until panned or zoomed; Reset view fits it again. Adds MermaidPreview and DialogMermaidPreview stories with play tests and a unit test for the zoom math. Assisted-by: Claude (Opus 5.5 Medium) * ui: add a diagrams trace to the demo fixtures Assisted-by: Claude (Opus 5.5 Medium)
Nindaleth
pushed a commit
to Nindaleth/llama.cpp
that referenced
this pull request
Nov 26, 2026
…inert diagrams (ggml-org#32591) * ui: keep Pele diagrams inert Pele turns a node with `click ... href` into a live link, where Mermaid's strict security level left diagrams without links. Unwrap every link in Pele's output, keeping its children, so the inline block, the live-preview editor, the preview dialog and the downloaded svg stay inert. The Diagrams story's flowchart now carries click directives and its play test checks that no link or href is left. Assisted-by: Claude (Opus 5.5 Medium) * ui: open diagrams full screen, zoom around what is on screen The diagram preview dialog fills the window on every device. The preview places the diagram from its top left corner, so a zoom keeps a screen point fixed: the wheel and a trackpad pinch zoom around the pointer, the buttons and +/- keys around the middle of the screen, wherever the diagram has been panned to. Two-finger pinch, double-click and arrow keys work too. The diagram opens fitted and keeps fitting until panned or zoomed; Reset view fits it again. Adds MermaidPreview and DialogMermaidPreview stories with play tests and a unit test for the zoom math. Assisted-by: Claude (Opus 5.5 Medium) * ui: add a diagrams trace to the demo fixtures Assisted-by: Claude (Opus 5.5 Medium)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
The diagram preview opens full screen, and zooming follows what you're looking at: the pointer for the wheel or a pinch, the middle of the screen for the buttons, wherever the diagram has been panned to. Diagrams also stay inert again: a
clickdirective no longer turns a node into a live link. Follows up #32555 (review).Demo
Recorded at faddbad; click the preview for the full video.
Additional information
Cause
securityLevel: 'strict', which left diagrams without links. Pele wraps a node withclick A href "…"in<a href="…">(withtarget="_blank"when given). It already dropsjavascript:URLs, ignoresclick … calland emits no event handlers, so the link is the only interactive part.What changed
DialogMermaidPreviewfills the window on every device; on phones it keeps clear of the status bar and the home indicator as other dialogs do.MermaidPreviewplaces the diagram from its top left corner, so a zoom can keep any screen point fixed. The math is indiagram-viewport.ts:+/-keys zoom around the middle of the screen, by 1.25×;0) fits it again.renderMermaidDiagrams()unwraps every<a>in Pele's output, keeping its children. The inline block, the live preview of the markdown editor, the preview dialog and the downloaded SVG all take the diagram from there, so none of them has a link.MermaidPreviewstories (flowchart, wide, small and sequence diagrams) and aDialogMermaidPreviewstory. The flowchart in theMarkdownContentDiagrams story getsclick … hrefandclick … calldirectives.Testing
In
ui/apps/chat, afternpm ci:npm run check,npm run lint, the unit, client and Storybook tests andnpm run buildpass.diagram-viewport.test.ts: zooming keeps the point under the pointer or the middle of the screen in place, also after a pan and at the scale limits; fitting shrinks a large diagram and grows a small one up to the cap; wheel and pinch factors.MermaidPreviewFlowchart story's play test zooms with the wheel and checks the point under the pointer stays put, pans, zooms out with the button and checks the middle of the screen stays put, and checks that Reset view fits the diagram again. The Wide diagram story checks that fitting shrinks it.DialogMermaidPreviewstory checks that the dialog fills the window. TheMarkdownContentDiagrams story checks that no<a>orhrefis left in the rendered diagrams (this fails without the unwrapping) and that its preview button opens the full-screen preview.Not checked on a real phone or with a real trackpad pinch.
Demo script
Requirements
Claude (Opus 5.5 Medium)