Merge branch 'develop' into sidv/fixRunAsync

* develop:
  Update docs
  fix: fix exports
  Doc (typo): remove duplicate "be"
  💄 section width now covers all tasks
This commit is contained in:
Sidharth Vinod
2023-02-24 20:54:55 +05:30
5 changed files with 20 additions and 5 deletions

View File

@@ -595,7 +595,7 @@ It is possible to get a sequence number attached to each arrow in a sequence dia
</script> </script>
``` ```
It can also be be turned on via the diagram code as in the diagram: It can also be turned on via the diagram code as in the diagram:
```mermaid-example ```mermaid-example
sequenceDiagram sequenceDiagram

View File

@@ -7,8 +7,8 @@
"types": "./dist/mermaid.d.ts", "types": "./dist/mermaid.d.ts",
"exports": { "exports": {
".": { ".": {
"import": "./dist/mermaid.core.mjs", "types": "./dist/mermaid.d.ts",
"types": "./dist/mermaid.d.ts" "import": "./dist/mermaid.core.mjs"
}, },
"./*": "./*" "./*": "./*"
}, },

View File

@@ -224,6 +224,17 @@ export const drawTasks = function (diagram, tasks, verticalPos) {
num = sectionNumber % fills.length; num = sectionNumber % fills.length;
colour = textColours[sectionNumber % textColours.length]; colour = textColours[sectionNumber % textColours.length];
// count how many consecutive tasks have the same section
let taskInSectionCount = 0;
const currentSection = task.section;
for (let taskIndex = i; taskIndex < tasks.length; taskIndex++) {
if (tasks[taskIndex].section == currentSection) {
taskInSectionCount = taskInSectionCount + 1;
} else {
break;
}
}
const section = { const section = {
x: i * conf.taskMargin + i * conf.width + LEFT_MARGIN, x: i * conf.taskMargin + i * conf.width + LEFT_MARGIN,
y: 50, y: 50,
@@ -231,6 +242,7 @@ export const drawTasks = function (diagram, tasks, verticalPos) {
fill, fill,
num, num,
colour, colour,
taskCount: taskInSectionCount,
}; };
svgDraw.drawSection(diagram, section, conf); svgDraw.drawSection(diagram, section, conf);

View File

@@ -196,7 +196,10 @@ export const drawSection = function (elem, section, conf) {
rect.x = section.x; rect.x = section.x;
rect.y = section.y; rect.y = section.y;
rect.fill = section.fill; rect.fill = section.fill;
rect.width = conf.width; // section width covers all nested tasks
rect.width =
conf.width * section.taskCount + // width of the tasks
conf.diagramMarginX * (section.taskCount - 1); // width of space between tasks
rect.height = conf.height; rect.height = conf.height;
rect.class = 'journey-section section-type-' + section.num; rect.class = 'journey-section section-type-' + section.num;
rect.rx = 3; rect.rx = 3;

View File

@@ -418,7 +418,7 @@ It is possible to get a sequence number attached to each arrow in a sequence dia
</script> </script>
``` ```
It can also be be turned on via the diagram code as in the diagram: It can also be turned on via the diagram code as in the diagram:
```mermaid-example ```mermaid-example
sequenceDiagram sequenceDiagram