Render log diagrams with @joycostudio/trazo instead of Mermaid#151
Render log diagrams with @joycostudio/trazo instead of Mermaid#151justkahdri wants to merge 7 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| note over C: Blank screen… | ||
| S->>S: await getCart() — 200ms |
There was a problem hiding this comment.
Diagram labels are rendered as visible SVG text for readers, and the team's style rule prohibits em dashes in any user-visible text, replacing them with a colon, comma, or parentheses instead. Two instances appear here (await getCart() — 200ms, await getFlags() — 150ms), and the pattern repeats elsewhere in this file (Static Shell — built at build time, served from CDN) and in 08-webgl-scroll-sync.mdx (the two edge labels D (delta) — JS animates scrollTop... and D (delta) — JS reads scrollY...).
Rule Used: Do not use em dashes (—) in prose, frontmatter des... (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: content/logs/07-nextjs-promises-ppr.mdx
Line: 383-384
Comment:
**Em dashes in diagram labels**
Diagram labels are rendered as visible SVG text for readers, and the team's style rule prohibits em dashes in any user-visible text, replacing them with a colon, comma, or parentheses instead. Two instances appear here (`await getCart() — 200ms`, `await getFlags() — 150ms`), and the pattern repeats elsewhere in this file (`Static Shell — built at build time, served from CDN`) and in `08-webgl-scroll-sync.mdx` (the two edge labels `D (delta) — JS animates scrollTop...` and `D (delta) — JS reads scrollY...`).
**Rule Used:** Do not use em dashes (—) in prose, frontmatter des... ([source](greptile.json))
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Replace every Mermaid diagram in the two log articles with the trazo layout engine, authored as DSL string literals through a new <Diagram> MDX component that auto-detects the language (flow / sequence / block / git) and runs the matching pure layout server-side. - add @joycostudio/trazo@^0.2.0 and components/flow.tsx (<Diagram>) - wire <Diagram> into mdx-components - 07: 2 flow charts, 2 sequence diagrams, 2 subgraph flows, 1 static shell flow (was block-beta, now flow TD per review) - 08: flow charts with subgraphs, sequence diagrams, multi-line labels - flowchart edges use --- (neutral path) / === (colored path), no arrowheads; arrowheads only on sequence messages where direction is intrinsic Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
#157) * Upgrade trazo to 0.4.0 and frame log diagrams full-width - Bump @joycostudio/trazo 0.3 -> 0.4.0; adopt first-class theming (joycoTheme paired via themeFlowOptions/themeGitOptions + <Graph theme>) - Migrate deprecated `streamed` role to `info` in log diagrams - Render <Diagram> as a full-width framed figure: hatch-textured canvas, accent Badge title + `N{article}-{index}` number tag - Inject the log number per page via getMDXComponents; number each illustration with an explicit `index` - Pin --trazo-bg to --card so node-box strokes match the frame surface Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix(logs): AA-legible trazo diagram labels + keep renderer server-only Diagram label text now pairs each chart fill with a contrast-checked foreground (--chart-N-foreground) that trazo's token fallback wires to both lane slots (lane-2..6 → chart-1..5) and chart-backed roles (success → chart-2, info → chart-3, warning → chart-4). Fixes the `info` role rendering dark text on the dark chart-3 fill (~2.2:1), the radio theme's chart-2 mismatch, and the dead --trazo-streamed-foreground var. Values chosen from real WCAG ratios per theme; every pair now clears AA except dark chart-1, whose fill lightness sits in a dead zone no text color can fix. Also in flow.tsx: - move <figcaption> to be the first child of <figure> (HTML content model); all overlays are absolutely positioned, so no visual change - derive layout options from graphTheme instead of joycoTheme so both halves of the theme come from one object - import 'server-only' to enforce at build time that the trazo layout engine never leaks into a client bundle Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * Update mdx-components.tsx Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Em dashes inside trazo/mermaid diagram DSL labels swapped for `:` or parenthesised clauses so labels read cleanly in the rendered diagrams. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…ming The trazo git graph rendered branches in near-identical blues and never showed the commit letters (A, B, S, …) the prose refers to, which made the phantom-merge-conflicts illustrations confusing. Restore them as plain-text ASCII graphs (letters + branch lanes) via a new `ascii` mode on <Diagram> that keeps the framed, numbered illustration wrapper. Also improves the trazo git DSL path (still available for future use): horizontal orientation (git-log-style left→right timeline), labels above the lane, and a contrasting lane pair so branches are distinguishable. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Additive release (new `textCase` theme knob + inline `code` chips in flow-node labels); non-breaking, no code changes required. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
f3c6cb2 to
ad28c3a
Compare
Leftover from an earlier trazo-exploration session (feature-request notes and a git-DSL test scratch); not part of the app. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
What
Replaces every Mermaid diagram in the two diagram-heavy log articles with the
@joycostudio/trazolayout engine, authored as DSL string literals through a new<Diagram>MDX component.<Diagram>takes the DSL source as a template-literal child, auto-detects the language from the first line (flow/sequence/block/git), and runs the matching pure layout server-side — it's a React Server Component, so the diagrams ship zero client JS (unlike the old<Mermaid>which rendered client-side via themermaidbundle).Changes
@joycostudio/trazo@^0.2.0components/flow.tsxexporting<Diagram>, wired intomdx-components.tsx07-nextjs-promises-ppr.mdx— 7 diagrams: flow charts, 2 sequence diagrams, 2 subgraph flows, and the static-shell layout (nowflow TD)08-webgl-scroll-sync.mdx— 10 diagrams: flow charts with subgraphs, sequence diagrams, multi-line labelsConventions
---(neutral path) and===(colored path) — no arrowheads. Arrowheads appear only on sequence-diagram messages, where direction (->>/-->>) is intrinsic to the diagram.Verification
tsc --noEmit— cleanFollow-ups (out of scope here)
components/mermaid.tsx, themermaiddependency, andremarkMdxMermaidinsource.config.tsare now unused in content but left in place — safe to remove in a separate cleanup.components/flow.tsxexportsDiagram(notFlow); the filename could be renamed todiagram.tsxlater to avoid churn here.🤖 Generated with Claude Code
Greptile Summary
This PR replaces all Mermaid diagrams in the two diagram-heavy log articles with
@joycostudio/trazoDSL via a new<Diagram>RSC, and extends trazo theming to four additional log articles that previously used static images. The<Diagram>component runs layout server-side, ships zero client JS, and wiresarticleNumberthroughgetMDXComponentsfor per-article figure numbering.components/flow.tsx: new RSC that auto-detects DSL language, dispatches to the matching trazo parser/layout, and renders either a<Graph>SVG or an ASCII<pre>block inside a styled<figure>.app/styles/theming.css: adds--chart-N-foregroundand--trazo-error-foregroundtokens across all four themes so saturated trazo nodes pass contrast checks.07-nextjs-promises-ppr.mdxand08-webgl-scroll-sync.mdxconverted from Mermaid fenced blocks to<Diagram>JSX; static images in11,12, and14also replaced.Confidence Score: 5/5
Safe to merge; the core component and all diagram conversions are correct. The two style-rule nits are cosmetic and do not affect rendering or behaviour.
The new
DiagramRSC is well-structured: server-only, typed, error-throwing on parse failures, and correctly themed. All 17 MDX diagram blocks were converted without data loss. The only findings are em-dash violations in a diagram title and CSS comments, neither of which affects runtime output.content/logs/12-the-render-pipeline.mdx(em dash in title prop) andapp/styles/theming.css(em dashes in comments).Important Files Changed
Diagramcomponent wrapping@joycostudio/trazo: detects DSL lang, lays out graph server-side, renders via<Graph>or ASCII<pre>. Error handling, theming, and tag generation look correct.Diagramto the MDX component map, threaded witharticleNumberfrom the page-levelopts. Clean change.{ logNumber }as the second arg togetMDXComponentssoDiagramreceivesarticleNumberfor per-article numbering tags.<Diagram>DSL; edge styles and node roles look consistent with stated conventions.<Diagram>DSL; bidirectional<==>edge on diagram 3 and arrowhead-->on diagram 11 deviate from the stated no-arrowhead convention but appear intentional.cry --> layoutedge uses-->to emphasise the forced-reflow cycle back to layout.titleprop contains an em dash in violation of the no-em-dash rule.asciidiagrams and one flow diagram replace bash code blocks; backslashes correctly escaped in template literals.--chart-N-foregroundand--trazo-error-foregroundtokens for all four themes; three new CSS comments use em dashes in violation of the house style rule.@joycostudio/trazo@^0.5.0dependency.Reviews (2): Last reviewed commit: "chore: remove stray trazo scratch notes ..." | Re-trigger Greptile
Context used: