feat: domain-node Mermaid flowchart popup#100
Conversation
…popup Introduces the design for a bottom slide-up popup that renders a Mermaid flowchart of each domain node's internal business logic. Source is generated offline by the domain-analyzer agent and persisted under domainMeta.mermaid; dashboard is a pure renderer with lazy-imported mermaid. Covers schema extension, agent pipeline changes, popup collision avoidance, fullscreen modal, error handling and fallbacks, theme integration, and testing strategy. Also ignores .superpowers/ (Visual Companion session artifacts). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
20 tasks across 14 phases covering schema extension, agent prompts, dashboard test infrastructure bootstrap, mermaid rendering, popup/modal components, collision-avoiding position hook, integration wiring, and manual acceptance. Follows TDD with commits per task. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds onThemeChange subscription API to allow components to react when theme changes. Listeners are called after applyTheme() updates CSS variables, enabling re-renders of theme-dependent content like Mermaid SVGs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements MermaidRenderer with loading, success (SVG), parse-error (pre+copy), and chunk-error (retry) states; dynamic mermaid import for lazy chunking; theme-reactive via onThemeChange. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements the MermaidFlowchartPopup component with header (node name, enlarge/close buttons), mermaid rendering via MermaidRenderer, empty state, and slide-up animation. Adds ResizeObserver polyfill to test setup.ts for JSDOM compatibility. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ivity - Add aria-modal to popup and modal dialogs - Add focus trap in modal (focuses close button on open, restores on close) - Add test for chunk load error fallback path - Subscribe popup position hook to ReactFlow viewport state so it re-runs on pan/zoom Addresses Important issues 1, 2, 4 from the final code review.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… cleaner modal labels Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add PanZoomScroll wrapper component that enables click-and-drag panning of the Mermaid SVG in both the popup and fullscreen modal, while preserving existing scroll-wheel and scrollbar behavior.
useMaxWidth:true was forcing SVG to shrink-fit container width — wide diagrams never actually overflowed horizontally, so scrollLeft stayed at 0 and the pan handler could only move vertically. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@codex review this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c48501726
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const topLeft = rf.flowToScreenPosition({ | ||
| x: n.position.x, | ||
| y: n.position.y, | ||
| }); | ||
| const bottomRight = rf.flowToScreenPosition({ |
There was a problem hiding this comment.
Normalize node coords to popup container before intersecting
This collision check mixes coordinate spaces: flowToScreenPosition returns screen/viewport pixels, while popupRect is computed in popup-container local coordinates (0..container.width/height). When the ReactFlow canvas is offset from the page origin, intersections are miscomputed, so the hook can pick a “free” candidate that still overlaps nodes (or reject valid positions). Convert node bounds into the same container-local space (for example by subtracting the container's bounding rect) before calling aabbIntersect.
Useful? React with 👍 / 👎.
| }, | ||
| "devDependencies": { | ||
| "@types/node": "^22.0.0", | ||
| "mermaid": "^10.9.0", |
There was a problem hiding this comment.
Promote mermaid to runtime dependency for validator script
The new scripts/validate-mermaid.mjs imports mermaid at runtime, and assemble-reviewer now invokes that script during graph assembly, but mermaid is declared only in devDependencies. In installs that omit dev deps (common for packaged/production usage), the validator fails with ERR_MODULE_NOT_FOUND, which breaks Mermaid dry-run validation in this feature path. mermaid should be listed under dependencies for this package.
Useful? React with 👍 / 👎.
validate-mermaid.mjs imports mermaid at runtime and assemble-reviewer invokes that script during graph assembly, so mermaid cannot live in devDependencies — installs that omit dev deps would fail with ERR_MODULE_NOT_FOUND. Regenerated pnpm-lock.yaml to match (also unblocks CI's --frozen-lockfile install). Addresses Codex review P1. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
flowToScreenPosition returns viewport pixels; popupRect was built in popup-container local space. When the ReactFlow canvas was offset from the page origin the AABB intersect mixed coordinate frames — some candidates that still overlapped a node tested as "free", others that were actually free were rejected. Extend ContainerBounds with optional left/top (container viewport origin) and subtract that offset from each node rect before the intersect. MermaidFlowchartPopup now passes getBoundingClientRect() origin and refreshes it on window scroll/resize so the offset stays current when the page shifts. Addresses Codex review P2. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Without an include filter, vitest run from the skill package root walks into packages/dashboard and executes its tests under the default node env. The dashboard tests (new in this PR) use @testing-library/ react and assume JSDOM, so they all failed with "document is not defined" once CI got past the frozen-lockfile install. Restrict discovery to src/**/*.test.ts — dashboard tests keep running under their own packages/dashboard/vitest.config.ts via `pnpm --filter @understand-anything/dashboard test`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Awesome, it would be nice if you can have the pop out frame larger. Like half 3/5 of the full screen? Then the expand version bigger. |
|
Hi, seems that you miss understand the |
Summary
domainnode on the Domain graph → 480×260 slide-up popup with a Mermaid flowchart of the node's internal business logic (nodes = logical steps, arrows labeled with API calls where applicable)domain-analyzerand persisted todomainMeta.mermaid;assemble-reviewerdry-run-validates via newscripts/validate-mermaid.mjs; dashboard lazy-importsmermaidso the main bundle is unaffectedonThemeChangesubscription re-renders the SVG when the user switches themesDesign docs
docs/superpowers/specs/2026-04-20-mermaid-service-flowchart-design.mddocs/superpowers/plans/2026-04-20-mermaid-service-flowchart.mdWhat's new
packages/core): optionalDomainMeta.mermaid: stringfield (z.string().min(1).optional(),.passthrough()preserves it through sanitization)understand-anything-plugin/):scripts/validate-mermaid.mjsJSONL-in/out dry-run parserdomain-analyzer.mdemits Mermaid flowcharts with API labels on edges (5–15 nodes per domain);assemble-reviewer.mdstrips invalid entries with[mermaid-invalid]logpackages/dashboard):MermaidRenderer,MermaidFlowchartPopup,MermaidFlowchartModaluseMermaidPopupPosition(5-candidate collision avoidance; reactive to ReactFlow viewport)themes/mermaid-theme.ts(CSS vars → Mermaid themeVariables)mermaidPopupNodeId,mermaidModalOpen+ 4 actionsDomainClusterNodetriggers popup;DomainGraphViewmounts popup/modal;setViewModeauto-closes on non-domain viewonThemeChangenotificationsaria-modal=\"true\"on both dialogs; modal focuses close button on open and restores focus on closeTest plan
pnpm --filter @understand-anything/core build— successpnpm --filter @understand-anything/dashboard build— success; `mermaid` is in a separate lazy chunk (verified by inspectingdist/assets/)mermaidfield missing;<pre>fallback on parse error/understand --fullon a real project and confirm agent emitsdomainMeta.mermaidNon-goals / known limitations
domainnode type in v1 (notflow/step)flowchart TDdiagram type;sequenceDiagram/classDiagram/stateDiagramdeferredmermaidis a production dep of dashboard — acceptable while dashboard is\"private\": trueVersion
Bumped
2.3.1 → 2.4.0across all four version files perCLAUDE.md§Versioning.result
🤖 Generated with Claude Code