@zombie-mermaid/svg-renderer 3.1.0 → 3.2.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/dist/index.d.cts CHANGED
@@ -168,6 +168,9 @@ export declare function directionToElk(dir: Direction | undefined, fallback: Elk
168
168
  * single fixed orientation, matching Mermaid's own TB class rendering —
169
169
  * which `../class/layout.ts` relies on to put a `note for X` above its
170
170
  * class.
171
+ * - **C4** — `DOWN`. `C4Diagram.direction` is never set by the parser (C4
172
+ * sources have no direction statement), only by `RenderOptions.direction`,
173
+ * so an unset one is the top-down layout every C4 diagram is drawn in.
171
174
  * - **ER** — `RIGHT`. An ER diagram's `direction` is optional
172
175
  * (`ErDiagram.direction?`), left `undefined` when the source has no
173
176
  * `direction` statement, and this renderer has always laid those out
@@ -186,6 +189,7 @@ export declare const ELK_DIRECTION_FALLBACK: {
186
189
  readonly state: "DOWN";
187
190
  readonly class: "DOWN";
188
191
  readonly er: "RIGHT";
192
+ readonly c4: "DOWN";
189
193
  };
190
194
 
191
195
  /** The four values ELK's `elk.direction` option accepts in this codebase. */
@@ -304,6 +308,14 @@ export declare type FontSizes = {
304
308
  [K in keyof typeof FONT_SIZES]: number;
305
309
  };
306
310
 
311
+ /**
312
+ * Format a set of evenly-spaced tick values with enough decimal places to
313
+ * keep every label distinct. Precision comes from the tick step, not the
314
+ * magnitude of the value: a 0.5 step around 100 needs one decimal, or
315
+ * 99.5 and 100.5 both collapse into neighbouring whole numbers.
316
+ */
317
+ export declare function formatTickLabels(ticks: number[]): string[];
318
+
307
319
  /** Vertical gap between a subgraph header band and the content area below it (px).
308
320
  * Without this, nested subgraph headers sit flush against their parent's header band.
309
321
  * Increased from 8 to 12 to provide more clearance for edges routing near headers. */
@@ -351,6 +363,9 @@ export declare const MONO_FONT: "'JetBrains Mono'";
351
363
  /** Full CSS fallback chain for monospace text */
352
364
  export declare const MONO_FONT_STACK: "'JetBrains Mono', 'SF Mono', 'Fira Code', ui-monospace, monospace";
353
365
 
366
+ /** Generate "nice" tick values for a numeric range */
367
+ export declare function niceTickValues(min: number, max: number): number[];
368
+
354
369
  /** Padding inside node shapes */
355
370
  export declare const NODE_PADDING: {
356
371
  /** Horizontal padding inside rectangles/rounded/stadium (increased from 16 for better label fit) */
@@ -552,6 +567,11 @@ export declare function resolveCssColors(svg: string, colors: DiagramColors): st
552
567
  */
553
568
  export declare function resolveFontSizes(overrides?: FontSizeOptions): FontSizes;
554
569
 
570
+ export declare function smoothCurvePath(points: Array<{
571
+ x: number;
572
+ y: number;
573
+ }>): string;
574
+
555
575
  /** Stroke widths per element type (in px) */
556
576
  export declare const STROKE_WIDTHS: {
557
577
  readonly outerBox: 1;
package/dist/index.d.ts CHANGED
@@ -168,6 +168,9 @@ export declare function directionToElk(dir: Direction | undefined, fallback: Elk
168
168
  * single fixed orientation, matching Mermaid's own TB class rendering —
169
169
  * which `../class/layout.ts` relies on to put a `note for X` above its
170
170
  * class.
171
+ * - **C4** — `DOWN`. `C4Diagram.direction` is never set by the parser (C4
172
+ * sources have no direction statement), only by `RenderOptions.direction`,
173
+ * so an unset one is the top-down layout every C4 diagram is drawn in.
171
174
  * - **ER** — `RIGHT`. An ER diagram's `direction` is optional
172
175
  * (`ErDiagram.direction?`), left `undefined` when the source has no
173
176
  * `direction` statement, and this renderer has always laid those out
@@ -186,6 +189,7 @@ export declare const ELK_DIRECTION_FALLBACK: {
186
189
  readonly state: "DOWN";
187
190
  readonly class: "DOWN";
188
191
  readonly er: "RIGHT";
192
+ readonly c4: "DOWN";
189
193
  };
190
194
 
191
195
  /** The four values ELK's `elk.direction` option accepts in this codebase. */
@@ -304,6 +308,14 @@ export declare type FontSizes = {
304
308
  [K in keyof typeof FONT_SIZES]: number;
305
309
  };
306
310
 
311
+ /**
312
+ * Format a set of evenly-spaced tick values with enough decimal places to
313
+ * keep every label distinct. Precision comes from the tick step, not the
314
+ * magnitude of the value: a 0.5 step around 100 needs one decimal, or
315
+ * 99.5 and 100.5 both collapse into neighbouring whole numbers.
316
+ */
317
+ export declare function formatTickLabels(ticks: number[]): string[];
318
+
307
319
  /** Vertical gap between a subgraph header band and the content area below it (px).
308
320
  * Without this, nested subgraph headers sit flush against their parent's header band.
309
321
  * Increased from 8 to 12 to provide more clearance for edges routing near headers. */
@@ -351,6 +363,9 @@ export declare const MONO_FONT: "'JetBrains Mono'";
351
363
  /** Full CSS fallback chain for monospace text */
352
364
  export declare const MONO_FONT_STACK: "'JetBrains Mono', 'SF Mono', 'Fira Code', ui-monospace, monospace";
353
365
 
366
+ /** Generate "nice" tick values for a numeric range */
367
+ export declare function niceTickValues(min: number, max: number): number[];
368
+
354
369
  /** Padding inside node shapes */
355
370
  export declare const NODE_PADDING: {
356
371
  /** Horizontal padding inside rectangles/rounded/stadium (increased from 16 for better label fit) */
@@ -552,6 +567,11 @@ export declare function resolveCssColors(svg: string, colors: DiagramColors): st
552
567
  */
553
568
  export declare function resolveFontSizes(overrides?: FontSizeOptions): FontSizes;
554
569
 
570
+ export declare function smoothCurvePath(points: Array<{
571
+ x: number;
572
+ y: number;
573
+ }>): string;
574
+
555
575
  /** Stroke widths per element type (in px) */
556
576
  export declare const STROKE_WIDTHS: {
557
577
  readonly outerBox: 1;