@zombie-mermaid/mermaid-parser 3.2.0 → 4.1.0

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.
package/src/index.ts CHANGED
@@ -2,8 +2,9 @@
2
2
  // @zombie-mermaid/mermaid-parser — per-type diagram parsers
3
3
  //
4
4
  // Class, ER, sequence, and XY chart diagrams have no shared generic model
5
- // the way flowcharts/state diagrams do (`MermaidGraph`, parsed by the
6
- // umbrella's own `src/parser.ts`). Both `svg-renderer` and `ascii-renderer`
5
+ // the way flowcharts/state diagrams do (`MermaidGraph`, parsed by
6
+ // `flowchart-parser.ts` here, moved from the umbrella's `src/parser.ts`
7
+ // under #1318 so both renderers share one copy). Both `svg-renderer` and `ascii-renderer`
7
8
  // import each type's parse function and types directly — confirmed by grep
8
9
  // (zombie-mermaid#624, umbrella #620, `monorepo-conversion-scoping.md`
9
10
  // finding 2) — so this package's public API is every per-type parse
@@ -54,3 +55,4 @@ export * from './xychart/types.ts'
54
55
  export * from './xychart/colors.ts'
55
56
 
56
57
  export * from './expanded-shapes.ts'
58
+ export * from './flowchart-parser.ts'
@@ -216,6 +216,8 @@ export interface Activation {
216
216
  topY: number
217
217
  bottomY: number
218
218
  width: number
219
+ /** Nesting level on this actor's lifeline: 0 for the outermost bar, 1 for a bar opened while one is already active, and so on */
220
+ depth: number
219
221
  }
220
222
 
221
223
  export interface PositionedBlock {
@@ -4,7 +4,9 @@
4
4
  // Generates monochromatic shades from the theme accent color.
5
5
  // Series 0 = accent (or blue fallback). Series 1+ are darker/lighter
6
6
  // shades of the same hue with subtle hue drift to stay in the same
7
- // color family (like navy ↔ cyan from blue).
7
+ // color family (like navy ↔ cyan from blue). Hue drifts toward navy for
8
+ // darker shades and toward cyan for lighter ones, so neighbouring series
9
+ // do not collapse into two near-identical blues (#1244).
8
10
  //
9
11
  // Used by both the SVG and ASCII renderers.
10
12
  // ============================================================================
@@ -101,7 +103,7 @@ export function isDarkBackground(bgHex: string): boolean {
101
103
  * Get the hex color for a series index.
102
104
  * Index 0 returns the accent color as-is.
103
105
  * Index 1+ alternate between darker and lighter shades of the same hue
104
- * with subtle hue drift (±8-12° per tier) to stay in the same family.
106
+ * with subtle hue drift (-8° per tier for darker, -12° for lighter) to stay in the same family.
105
107
  *
106
108
  * When `bgColor` is provided, shade direction adapts to the background:
107
109
  * - Light bg: odd = darker, even = lighter (default)
@@ -128,8 +130,12 @@ export function getSeriesColor(
128
130
  const dark = safeBg && isDarkBackground(safeBg) ? !oddIndex : oddIndex
129
131
  const l = dark ? Math.max(25, 48 - tier * 13) : Math.min(78, 55 + tier * 11)
130
132
 
131
- // Subtle hue drift: darker shades shift slightly negative, lighter shift positive
132
- const hShift = (dark ? -8 : 12) * tier
133
+ // Subtle hue drift: darker shades shift slightly negative (toward navy),
134
+ // lighter shades shift negative too (toward sky/cyan). The lighter shade
135
+ // used to drift positive (toward indigo), which landed series 2 within a
136
+ // few ΔE of series 0 (#1244); drifting the other way keeps the three first
137
+ // series distinct in hue as well as lightness.
138
+ const hShift = (dark ? -8 : -12) * tier
133
139
  const newH = (((h + hShift) % 360) + 360) % 360
134
140
 
135
141
  return hslToHex(newH, chartS, l)