Repository navigation
feat(c4): AddElementTag/AddRelTag styling for the unified renderer - #7862
filipsajdak wants to merge 8 commits into
Conversation
🦋 Changeset detectedLatest commit: b83e908 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@mermaid-js/examples
mermaid
@mermaid-js/layout-elk
@mermaid-js/layout-tidy-tree
@mermaid-js/mermaid-zenuml
@mermaid-js/parser
@mermaid-js/tiny
commit: |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #7862 +/- ##
===========================================
+ Coverage 77.79% 77.91% +0.11%
===========================================
Files 409 412 +3
Lines 30328 30509 +181
Branches 5175 5213 +38
===========================================
+ Hits 23595 23771 +176
- Misses 5410 5411 +1
- Partials 1323 1327 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
|
Heads-up: following @aloisklink's review on #7842, Track 1 has switched from the opt-in-flag approach to an in-place migration sliced by rendering layer (shapes -> edges -> layout) - see the updated plan in #7849. This slice is paused for now. Its branch is preserved as an archive tag ( |
0294276 to
86c3a2c
Compare
Converts the legacy C4 db state (c4ShapeArray / boundaries / rels) into the unified renderer LayoutData format: elements become nodes (db variants use cylinder, queue variants use h-cyl), boundaries become isGroup clusters with parentId nesting, and rels become edges. UpdateElementStyle and UpdateRelStyle map onto cssStyles/style/labelStyle preserving legacy semantics. Default fills come from the existing c4 config color keys so the palette matches the legacy renderer. Kept in a separate file so the legacy c4Db keeps its exact shape. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds an opt-in renderer for C4 diagrams that goes through the unified rendering pipeline (dagre by default, other algorithms such as ELK via registerLayoutLoaders), replacing the legacy statement-order grid with a real layout algorithm. The legacy row-based renderer stays the default, so existing diagrams render byte-identical unless the flag is set. - c4Renderer-unified.ts: renders getData() output via render() - c4Diagram.ts: dispatches between legacy and unified renderer - styles.js: CSS for the unified path (nodes, dashed boundary clusters, edges, edge labels, title), theme-variable driven - config.schema.yaml: new c4.useUnifiedRenderer flag (default false) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Renders C4 Person and Person_Ext elements with the classic C4 notation (circular head over a rounded box body) instead of a plain rectangle. The shape is registered in the shared shape registry as c4-person so other diagrams can reuse it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Covers nested boundaries, UpdateElementStyle/UpdateRelStyle, db and queue shape variants, nested deployment nodes, and guards the rendered viewBox dimensions against layout blowups. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add the C4-PlantUML macros AddElementTag(tagName, ?bgColor,
?fontColor, ?borderColor, ?shape) and AddRelTag(tagName, ?textColor,
?lineColor) to the grammar and store the definitions in the db
(getElementTags/getRelTags, reset in clear).
The unified renderer resolves the $tags of every element, boundary
and rel against the defined tags ('+' separated per C4-PlantUML,
commas accepted) and applies the tag colors between the per-type
config palette and the per-element UpdateElementStyle/UpdateRelStyle
overrides. Tag names are also exposed as c4-tag-<name> css classes on
the nodes for user styling. The legacy renderer ignores tags, as
documented.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
86c3a2c to
b83e908
Compare
|
Closing this PR. It was part of the original opt-in feature-slice approach for the C4 unified renderer. Following @aloisklink's review on #7842, that approach was superseded by an in-place migration sliced by rendering layer (shapes -> edges -> layout), tracked in #7849 (#7842 shapes, #7883 edges, layout PR to follow). This feature will be re-introduced on top of the migrated renderer once the layout slice lands. The branch is preserved as an archive tag ( |
Summary
Adds
AddElementTag(...)/AddRelTag(...)styling to C4 diagrams in the unified renderer: elements and relationships carrying a tag pick up the tag'sbgColor/fontColor/borderColor/shape(elements) ortextColor/lineColor(rels). Tag styles compose with per-element styles and the config palette. Legacy renderer behaviour is unchanged.Stacked on #7842 (opt-in unified renderer) - draft until #7842 merges; the diff carries #7842's commits until then. Base slice for clickable
$linkandSHOW_LEGEND(). Tracked in #7849.Slice commits (review by commit):
feat(c4): style elements and rels via AddElementTag and AddRelTag(+ parser/layout specs)chore(c4): add changeset🤖 Generated with Claude Code