Skip to content

Commit 562da84

Browse files
author
Fergus Bisset
committed
Some tweaks to the Mermaid component for documentation
1 parent 41cfb8f commit 562da84

File tree

2 files changed

+345
-17
lines changed

2 files changed

+345
-17
lines changed

src/components/_internal/Mermaid.scss

Lines changed: 154 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
--mermaid-node-extra-padding-y: 0;
2929

3030
/* Extra padding to apply to the SVG viewBox (in px) to avoid edge clipping */
31-
--mermaid-svg-extra-padding-x: 6;
32-
--mermaid-svg-extra-padding-y: 4;
31+
--mermaid-svg-extra-padding-x: 20;
32+
--mermaid-svg-extra-padding-y: 16;
3333

3434
/* Edge label sizing controls */
3535
--mermaid-edge-label-padding-x: 4;
@@ -47,14 +47,8 @@
4747
line-height: 1.3;
4848
position: relative;
4949

50-
/* Scroll hint (fade) */
51-
mask-image: linear-gradient(
52-
to right,
53-
transparent 0,
54-
#000 24px,
55-
#000 calc(100% - 24px),
56-
transparent 100%
57-
);
50+
/* Scroll hint (fade) - removed to prevent edge clipping */
51+
/* Use overflow-x: auto for horizontal scrolling instead */
5852
}
5953

6054
/* Optional utility variants to quickly tweak padding per-diagram */
@@ -77,6 +71,9 @@
7771
.mermaid-diagram.is-airy {
7872
--mermaid-node-base-padding-x: 24;
7973
--mermaid-node-base-padding-y: 16;
74+
--mermaid-svg-extra-padding-x: 32;
75+
--mermaid-svg-extra-padding-y: 24;
76+
padding: nhs.$nhs-fdp-spacing-5; // Extra container padding
8077
}
8178

8279
.mermaid-error {
@@ -255,13 +252,160 @@
255252
}
256253
}
257254

255+
/* Lifecycle diagram specific styles */
256+
.node.lifecycle-start {
257+
rect, polygon, circle, ellipse {
258+
fill: #e1f5fe !important; /* Light blue */
259+
stroke: #01579b !important;
260+
}
261+
text { fill: #01579b !important; }
262+
263+
.nodeLabel {
264+
color: #01579b !important;
265+
}
266+
}
267+
268+
.node.lifecycle-ready {
269+
rect, polygon, circle, ellipse {
270+
fill: #c8e6c9 !important; /* Light green */
271+
stroke: #1b5e20 !important;
272+
}
273+
text { fill: #1b5e20 !important; }
274+
275+
.nodeLabel {
276+
color: #1b5e20 !important;
277+
}
278+
}
279+
280+
.node.lifecycle-error {
281+
282+
rect, polygon, circle, ellipse {
283+
fill: #ffcdd2 !important; /* Light red */
284+
stroke: #b71c1c !important;
285+
}
286+
text { fill: #b71c1c !important; }
287+
288+
.nodeLabel {
289+
color: #b71c1c !important;
290+
}
291+
}
292+
293+
.node.lifecycle-phase {
294+
rect, polygon, circle, ellipse {
295+
fill: #fff9c4 !important; /* Yellow */
296+
stroke: #f57f17 !important;
297+
}
298+
text { fill: #f57f17 !important; }
299+
300+
.nodeLabel {
301+
color: #f57f17 !important;
302+
}
303+
}
304+
305+
.node.lifecycle-user-action {
306+
rect, polygon, circle, ellipse {
307+
fill: #f8bbd0 !important; /* Pink */
308+
stroke: #880e4f !important;
309+
}
310+
text { fill: #880e4f !important; }
311+
312+
.nodeLabel {
313+
color: #880e4f !important;
314+
}
315+
}
316+
317+
.node.lifecycle-complete {
318+
rect, polygon, circle, ellipse {
319+
fill: #d1c4e9 !important; /* Light purple */
320+
stroke: #4a148c !important;
321+
}
322+
text { fill: #4a148c !important; }
323+
324+
.nodeLabel {
325+
color: #4a148c !important;
326+
}
327+
}
328+
329+
.node.lifecycle-announce {
330+
rect, polygon, circle, ellipse {
331+
fill: #b2dfdb !important; /* Light teal */
332+
stroke: #004d40 !important;
333+
}
334+
text { fill: #004d40 !important; }
335+
336+
.nodeLabel {
337+
color: #004d40 !important;
338+
}
339+
}
340+
341+
.node.initPhase {
342+
rect, polygon, circle, ellipse {
343+
fill: #fff3e0 !important; /* Light orange */
344+
stroke: #ff6f00 !important;
345+
stroke-width: 2px !important;
346+
}
347+
text { fill: #e65100 !important; }
348+
349+
.nodeLabel {
350+
color: #e65100 !important;
351+
}
352+
}
353+
354+
.node.sortPhase {
355+
rect, polygon, circle, ellipse {
356+
fill: #e8eaf6 !important; /* Light indigo */
357+
stroke: #3f51b5 !important;
358+
stroke-width: 2px !important;
359+
}
360+
text { fill: #1a237e !important; }
361+
362+
.nodeLabel {
363+
color: #1a237e !important;
364+
}
365+
}
366+
367+
.node.domPhase {
368+
rect, polygon, circle, ellipse {
369+
fill: #e0f2f1 !important; /* Light teal */
370+
stroke: #009688 !important;
371+
stroke-width: 2px !important;
372+
}
373+
text { fill: #004d40 !important; }
374+
375+
.nodeLabel {
376+
color: #004d40 !important;
377+
}
378+
}
379+
258380
/* Edges */
259381
.edgePath {
260382
path.path {
261383
stroke: var(--_mm-border) !important;
262384
stroke-width: 1.2px !important;
263385
}
264386
}
387+
388+
/* Markers (arrowheads) - ensure they render on top and are visible */
389+
marker {
390+
overflow: visible !important;
391+
392+
path {
393+
fill: var(--_mm-border) !important;
394+
stroke: var(--_mm-border) !important;
395+
}
396+
}
397+
398+
/* Ensure markers render above nodes by adjusting SVG rendering order */
399+
defs {
400+
marker {
401+
/* Markers are defined in defs, ensure they're styled */
402+
path {
403+
fill: var(--_mm-border) !important;
404+
stroke: none !important;
405+
}
406+
}
407+
}
408+
265409
.edgeLabel {
266410
background-color: nhs.$nhs-fdp-color-primary-white !important; /* optional background */
267411
overflow: visible !important; /* allow expansion */

0 commit comments

Comments
 (0)