@jarenjs/mermaid 0.46.5 → 0.49.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,8 +12,10 @@ import { MermaidParseError } from '../errors.js';
12
12
  import { layoutFlowchart } from '../layout/flowchart.js';
13
13
  import { layoutState } from '../layout/state.js';
14
14
  import { layoutSequence } from '../layout/sequence.js';
15
+ import { layoutGantt } from '../layout/gantt.js';
15
16
  import { renderFlowchart } from './flowchart.js';
16
17
  import { renderSequence } from './sequence.js';
18
+ import { renderGantt } from './gantt.js';
17
19
  import { renderPie, renderStructured, renderPlaceholder, structuredSections } from './misc.js';
18
20
  import { errorVnode } from './error.js';
19
21
 
@@ -28,6 +30,7 @@ export function layoutDiagram(doc) {
28
30
  case 'flowchart': return layoutFlowchart(doc.ast);
29
31
  case 'state': return layoutState(doc.ast);
30
32
  case 'sequence': return layoutSequence(doc.ast);
33
+ case 'gantt': return layoutGantt(doc.ast);
31
34
  default: return null;
32
35
  }
33
36
  }
@@ -62,9 +65,10 @@ export function diagramToVnode(docOrSource, options = {}) {
62
65
  return renderSequence(layoutSequence(doc.ast), theme, hash);
63
66
  case 'pie':
64
67
  return renderPie(doc.ast, theme, hash);
68
+ case 'gantt':
69
+ return renderGantt(layoutGantt(doc.ast, options), theme, hash);
65
70
  case 'class':
66
- case 'er':
67
- case 'gantt': {
71
+ case 'er': {
68
72
  const { title, sections } = structuredSections(doc.diagram, doc.ast);
69
73
  return renderStructured(title, sections, theme, hash);
70
74
  }
@@ -3,7 +3,7 @@
3
3
  * @file Renderers for the first-class types beyond flowchart and
4
4
  * sequence, and an honest placeholder for the deferred secondary
5
5
  * types. Pie is
6
- * a real chart; class/ER/state/gantt render as structured panels — a
6
+ * a real chart; class and ER render as structured panels — a
7
7
  * readable, geometry-light view that renders without error and so counts
8
8
  * honestly in the coverage scorecard. Secondary types (mindmap,
9
9
  * gitGraph, journey, timeline) render a labeled "not yet laid out"
@@ -120,16 +120,8 @@ export function structuredSections(diagram, ast) {
120
120
  }
121
121
  return { title: 'Entity–relationship', sections };
122
122
  }
123
- // state diagrams left this path for the graph layout; a stray call
124
- // must fail loudly rather than quietly resurrect the old panel
125
- if (diagram !== 'gantt') {
126
- throw new Error(`structuredSections: '${diagram}' is not a structured-panel type`);
127
- }
128
- return {
129
- title: 'Gantt' + (ast.meta.title ? ': ' + ast.meta.title : ''),
130
- sections: ast.sections.map((s) => ({
131
- heading: s.name ?? 'tasks',
132
- rows: s.tasks.map((tk) => `${tk.name} — ${tk.info}`),
133
- })),
134
- };
123
+ // state diagrams left this path for the graph layout, and gantt left
124
+ // it for the real timeline (`layout/gantt.js`); a stray call must fail
125
+ // loudly rather than quietly resurrect the old panel
126
+ throw new Error(`structuredSections: '${diagram}' is not a structured-panel type`);
135
127
  }
@@ -82,6 +82,27 @@
82
82
  .mermaid .mm-note rect { fill: var(--mm-note-fill); stroke: var(--mm-note-stroke); }
83
83
  .mermaid .mm-note text { fill: var(--mm-note-text); }
84
84
 
85
+ /* Gantt reuses the vocabulary rather than adding a second one: a bar is a
86
+ node, a done bar an activation, a critical bar a note, the grid a cluster
87
+ edge. A status class is therefore both the theme hook and the hit-test
88
+ handle a host reads off `data-id`. */
89
+ .mermaid.mm-gantt .mm-gantt-band { fill: var(--mm-cluster-fill); }
90
+ .mermaid.mm-gantt .mm-gantt-excluded { fill: var(--mm-activation-fill); }
91
+ .mermaid.mm-gantt .mm-gantt-grid { stroke: var(--mm-cluster-stroke); }
92
+ .mermaid.mm-gantt .mm-gantt-axis { stroke: var(--mm-line-color); }
93
+ .mermaid.mm-gantt .mm-gantt-link { stroke: var(--mm-line-color); }
94
+ .mermaid.mm-gantt .mm-gantt-tick,
95
+ .mermaid.mm-gantt .mm-gantt-label,
96
+ .mermaid.mm-gantt .mm-gantt-section,
97
+ .mermaid.mm-gantt .mm-gantt-title { fill: var(--mm-node-text); }
98
+ .mermaid.mm-gantt .mm-gantt-shape { fill: var(--mm-node-fill); stroke: var(--mm-node-stroke); }
99
+ .mermaid.mm-gantt .mm-gantt-done .mm-gantt-shape {
100
+ fill: var(--mm-activation-fill); stroke: var(--mm-activation-stroke);
101
+ }
102
+ .mermaid.mm-gantt .mm-gantt-crit .mm-gantt-shape {
103
+ fill: var(--mm-note-fill); stroke: var(--mm-note-stroke);
104
+ }
105
+
85
106
  .mermaid.mm-error { font-family: monospace; }
86
107
  .mermaid .mm-error-box { fill: var(--mm-err-fill); stroke: var(--mm-err-stroke); }
87
108
  .mermaid .mm-error-title { fill: var(--mm-err-title); }