summaryrefslogtreecommitdiff
path: root/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder
diff options
context:
space:
mode:
Diffstat (limited to 'themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder')
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/axis/bandAxis.d.ts12
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/axis/baseAxis.d.ts38
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/axis/index.d.ts12
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/axis/linearAxis.d.ts11
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/chartTitle.d.ts16
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/plot/barPlot.d.ts12
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/plot/index.d.ts20
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/plot/linePlot.d.ts11
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/index.d.ts5
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/interfaces.d.ts132
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/orchestrator.d.ts12
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/textDimensionCalculator.d.ts10
12 files changed, 291 insertions, 0 deletions
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/axis/bandAxis.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/axis/bandAxis.d.ts
new file mode 100644
index 0000000..91cea40
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/axis/bandAxis.d.ts
@@ -0,0 +1,12 @@
+import type { TextDimensionCalculator } from '../../textDimensionCalculator.js';
+import { BaseAxis } from './baseAxis.js';
+import type { XYChartAxisThemeConfig, XYChartAxisConfig } from '../../interfaces.js';
+export declare class BandAxis extends BaseAxis {
+ private scale;
+ private categories;
+ constructor(axisConfig: XYChartAxisConfig, axisThemeConfig: XYChartAxisThemeConfig, categories: string[], title: string, textDimensionCalculator: TextDimensionCalculator);
+ setRange(range: [number, number]): void;
+ recalculateScale(): void;
+ getTickValues(): (string | number)[];
+ getScaleValue(value: string): number;
+}
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/axis/baseAxis.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/axis/baseAxis.d.ts
new file mode 100644
index 0000000..fca4df7
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/axis/baseAxis.d.ts
@@ -0,0 +1,38 @@
+import type { BoundingRect, Dimension, DrawableElem, Point, XYChartAxisConfig, XYChartAxisThemeConfig } from '../../interfaces.js';
+import type { TextDimensionCalculator } from '../../textDimensionCalculator.js';
+import type { Axis, AxisPosition } from './index.js';
+export declare abstract class BaseAxis implements Axis {
+ protected axisConfig: XYChartAxisConfig;
+ protected title: string;
+ protected textDimensionCalculator: TextDimensionCalculator;
+ protected axisThemeConfig: XYChartAxisThemeConfig;
+ protected boundingRect: BoundingRect;
+ protected axisPosition: AxisPosition;
+ private range;
+ protected showTitle: boolean;
+ protected showLabel: boolean;
+ protected showTick: boolean;
+ protected showAxisLine: boolean;
+ protected outerPadding: number;
+ protected titleTextHeight: number;
+ protected labelTextHeight: number;
+ constructor(axisConfig: XYChartAxisConfig, title: string, textDimensionCalculator: TextDimensionCalculator, axisThemeConfig: XYChartAxisThemeConfig);
+ setRange(range: [number, number]): void;
+ getRange(): [number, number];
+ setAxisPosition(axisPosition: AxisPosition): void;
+ abstract getScaleValue(value: number | string): number;
+ abstract recalculateScale(): void;
+ abstract getTickValues(): Array<string | number>;
+ getTickDistance(): number;
+ getAxisOuterPadding(): number;
+ private getLabelDimension;
+ recalculateOuterPaddingToDrawBar(): void;
+ private calculateSpaceIfDrawnHorizontally;
+ private calculateSpaceIfDrawnVertical;
+ calculateSpace(availableSpace: Dimension): Dimension;
+ setBoundingBoxXY(point: Point): void;
+ private getDrawableElementsForLeftAxis;
+ private getDrawableElementsForBottomAxis;
+ private getDrawableElementsForTopAxis;
+ getDrawableElements(): DrawableElem[];
+}
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/axis/index.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/axis/index.d.ts
new file mode 100644
index 0000000..c982214
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/axis/index.d.ts
@@ -0,0 +1,12 @@
+import type { Group } from '../../../../../diagram-api/types.js';
+import type { AxisDataType, ChartComponent, XYChartAxisConfig, XYChartAxisThemeConfig } from '../../interfaces.js';
+export type AxisPosition = 'left' | 'right' | 'top' | 'bottom';
+export interface Axis extends ChartComponent {
+ getScaleValue(value: string | number): number;
+ setAxisPosition(axisPosition: AxisPosition): void;
+ getAxisOuterPadding(): number;
+ getTickDistance(): number;
+ recalculateOuterPaddingToDrawBar(): void;
+ setRange(range: [number, number]): void;
+}
+export declare function getAxis(data: AxisDataType, axisConfig: XYChartAxisConfig, axisThemeConfig: XYChartAxisThemeConfig, tmpSVGGroup: Group): Axis;
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/axis/linearAxis.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/axis/linearAxis.d.ts
new file mode 100644
index 0000000..869b751
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/axis/linearAxis.d.ts
@@ -0,0 +1,11 @@
+import type { TextDimensionCalculator } from '../../textDimensionCalculator.js';
+import { BaseAxis } from './baseAxis.js';
+import type { XYChartAxisThemeConfig, XYChartAxisConfig } from '../../interfaces.js';
+export declare class LinearAxis extends BaseAxis {
+ private scale;
+ private domain;
+ constructor(axisConfig: XYChartAxisConfig, axisThemeConfig: XYChartAxisThemeConfig, domain: [number, number], title: string, textDimensionCalculator: TextDimensionCalculator);
+ getTickValues(): (string | number)[];
+ recalculateScale(): void;
+ getScaleValue(value: number): number;
+}
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/chartTitle.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/chartTitle.d.ts
new file mode 100644
index 0000000..6e249a3
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/chartTitle.d.ts
@@ -0,0 +1,16 @@
+import type { Group } from '../../../../diagram-api/types.js';
+import type { ChartComponent, Dimension, DrawableElem, Point, XYChartData, XYChartThemeConfig, XYChartConfig } from '../interfaces.js';
+import type { TextDimensionCalculator } from '../textDimensionCalculator.js';
+export declare class ChartTitle implements ChartComponent {
+ private textDimensionCalculator;
+ private chartConfig;
+ private chartData;
+ private chartThemeConfig;
+ private boundingRect;
+ private showChartTitle;
+ constructor(textDimensionCalculator: TextDimensionCalculator, chartConfig: XYChartConfig, chartData: XYChartData, chartThemeConfig: XYChartThemeConfig);
+ setBoundingBoxXY(point: Point): void;
+ calculateSpace(availableSpace: Dimension): Dimension;
+ getDrawableElements(): DrawableElem[];
+}
+export declare function getChartTitleComponent(chartConfig: XYChartConfig, chartData: XYChartData, chartThemeConfig: XYChartThemeConfig, tmpSVGGroup: Group): ChartComponent;
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/plot/barPlot.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/plot/barPlot.d.ts
new file mode 100644
index 0000000..60bc08e
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/plot/barPlot.d.ts
@@ -0,0 +1,12 @@
+import type { BarPlotData, BoundingRect, DrawableElem, XYChartConfig } from '../../interfaces.js';
+import type { Axis } from '../axis/index.js';
+export declare class BarPlot {
+ private barData;
+ private boundingRect;
+ private xAxis;
+ private yAxis;
+ private orientation;
+ private plotIndex;
+ constructor(barData: BarPlotData, boundingRect: BoundingRect, xAxis: Axis, yAxis: Axis, orientation: XYChartConfig['chartOrientation'], plotIndex: number);
+ getDrawableElement(): DrawableElem[];
+}
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/plot/index.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/plot/index.d.ts
new file mode 100644
index 0000000..ae8b5a0
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/plot/index.d.ts
@@ -0,0 +1,20 @@
+import type { XYChartData, Dimension, DrawableElem, Point, XYChartThemeConfig, XYChartConfig } from '../../interfaces.js';
+import type { Axis } from '../axis/index.js';
+import type { ChartComponent } from '../../interfaces.js';
+export interface Plot extends ChartComponent {
+ setAxes(xAxis: Axis, yAxis: Axis): void;
+}
+export declare class BasePlot implements Plot {
+ private chartConfig;
+ private chartData;
+ private chartThemeConfig;
+ private boundingRect;
+ private xAxis?;
+ private yAxis?;
+ constructor(chartConfig: XYChartConfig, chartData: XYChartData, chartThemeConfig: XYChartThemeConfig);
+ setAxes(xAxis: Axis, yAxis: Axis): void;
+ setBoundingBoxXY(point: Point): void;
+ calculateSpace(availableSpace: Dimension): Dimension;
+ getDrawableElements(): DrawableElem[];
+}
+export declare function getPlotComponent(chartConfig: XYChartConfig, chartData: XYChartData, chartThemeConfig: XYChartThemeConfig): Plot;
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/plot/linePlot.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/plot/linePlot.d.ts
new file mode 100644
index 0000000..bc268c3
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/components/plot/linePlot.d.ts
@@ -0,0 +1,11 @@
+import type { DrawableElem, LinePlotData, XYChartConfig } from '../../interfaces.js';
+import type { Axis } from '../axis/index.js';
+export declare class LinePlot {
+ private plotData;
+ private xAxis;
+ private yAxis;
+ private orientation;
+ private plotIndex;
+ constructor(plotData: LinePlotData, xAxis: Axis, yAxis: Axis, orientation: XYChartConfig['chartOrientation'], plotIndex: number);
+ getDrawableElement(): DrawableElem[];
+}
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/index.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/index.d.ts
new file mode 100644
index 0000000..f7d33b8
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/index.d.ts
@@ -0,0 +1,5 @@
+import type { Group } from '../../../diagram-api/types.js';
+import type { DrawableElem, XYChartConfig, XYChartData, XYChartThemeConfig } from './interfaces.js';
+export declare class XYChartBuilder {
+ static build(config: XYChartConfig, chartData: XYChartData, chartThemeConfig: XYChartThemeConfig, tmpSVGGroup: Group): DrawableElem[];
+}
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/interfaces.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/interfaces.d.ts
new file mode 100644
index 0000000..bbf7194
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/interfaces.d.ts
@@ -0,0 +1,132 @@
+export interface XYChartAxisThemeConfig {
+ titleColor: string;
+ labelColor: string;
+ tickColor: string;
+ axisLineColor: string;
+}
+export interface XYChartThemeConfig {
+ backgroundColor: string;
+ titleColor: string;
+ xAxisLabelColor: string;
+ xAxisTitleColor: string;
+ xAxisTickColor: string;
+ xAxisLineColor: string;
+ yAxisLabelColor: string;
+ yAxisTitleColor: string;
+ yAxisTickColor: string;
+ yAxisLineColor: string;
+ plotColorPalette: string;
+}
+export interface ChartComponent {
+ calculateSpace(availableSpace: Dimension): Dimension;
+ setBoundingBoxXY(point: Point): void;
+ getDrawableElements(): DrawableElem[];
+}
+export type SimplePlotDataType = [string, number][];
+export interface LinePlotData {
+ type: 'line';
+ strokeFill: string;
+ strokeWidth: number;
+ data: SimplePlotDataType;
+}
+export interface BarPlotData {
+ type: 'bar';
+ fill: string;
+ data: SimplePlotDataType;
+}
+export type PlotData = LinePlotData | BarPlotData;
+export declare function isBarPlot(data: PlotData): data is BarPlotData;
+export interface BandAxisDataType {
+ type: 'band';
+ title: string;
+ categories: string[];
+}
+export interface LinearAxisDataType {
+ type: 'linear';
+ title: string;
+ min: number;
+ max: number;
+}
+export type AxisDataType = LinearAxisDataType | BandAxisDataType;
+export declare function isBandAxisData(data: AxisDataType): data is BandAxisDataType;
+export declare function isLinearAxisData(data: AxisDataType): data is LinearAxisDataType;
+/**
+ * For now we are keeping this configs as we are removing the required fields while generating the config.type.ts file
+ * we should remove `XYChartAxisConfig` and `XYChartConfig` after we started using required fields
+ */
+export interface XYChartAxisConfig {
+ showLabel: boolean;
+ labelFontSize: number;
+ labelPadding: number;
+ showTitle: boolean;
+ titleFontSize: number;
+ titlePadding: number;
+ showTick: boolean;
+ tickLength: number;
+ tickWidth: number;
+ showAxisLine: boolean;
+ axisLineWidth: number;
+}
+export interface XYChartConfig {
+ width: number;
+ height: number;
+ titleFontSize: number;
+ titlePadding: number;
+ showTitle: boolean;
+ xAxis: XYChartAxisConfig;
+ yAxis: XYChartAxisConfig;
+ chartOrientation: 'vertical' | 'horizontal';
+ plotReservedSpacePercent: number;
+}
+export interface XYChartData {
+ xAxis: AxisDataType;
+ yAxis: AxisDataType;
+ title: string;
+ plots: PlotData[];
+}
+export interface Dimension {
+ width: number;
+ height: number;
+}
+export interface BoundingRect extends Point, Dimension {
+}
+export interface Point {
+ x: number;
+ y: number;
+}
+export type TextHorizontalPos = 'left' | 'center' | 'right';
+export type TextVerticalPos = 'top' | 'middle';
+export interface RectElem extends Point {
+ width: number;
+ height: number;
+ fill: string;
+ strokeWidth: number;
+ strokeFill: string;
+}
+export interface TextElem extends Point {
+ text: string;
+ fill: string;
+ verticalPos: TextVerticalPos;
+ horizontalPos: TextHorizontalPos;
+ fontSize: number;
+ rotation: number;
+}
+export interface PathElem {
+ path: string;
+ fill?: string;
+ strokeWidth: number;
+ strokeFill: string;
+}
+export type DrawableElem = {
+ groupTexts: string[];
+ type: 'rect';
+ data: RectElem[];
+} | {
+ groupTexts: string[];
+ type: 'text';
+ data: TextElem[];
+} | {
+ groupTexts: string[];
+ type: 'path';
+ data: PathElem[];
+};
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/orchestrator.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/orchestrator.d.ts
new file mode 100644
index 0000000..30bbb82
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/orchestrator.d.ts
@@ -0,0 +1,12 @@
+import type { DrawableElem, XYChartConfig, XYChartData, XYChartThemeConfig } from './interfaces.js';
+import type { Group } from '../../../diagram-api/types.js';
+export declare class Orchestrator {
+ private chartConfig;
+ private chartData;
+ private componentStore;
+ constructor(chartConfig: XYChartConfig, chartData: XYChartData, chartThemeConfig: XYChartThemeConfig, tmpSVGGroup: Group);
+ private calculateVerticalSpace;
+ private calculateHorizontalSpace;
+ private calculateSpace;
+ getDrawableElement(): DrawableElem[];
+}
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/textDimensionCalculator.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/textDimensionCalculator.d.ts
new file mode 100644
index 0000000..e648b03
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/xychart/chartBuilder/textDimensionCalculator.d.ts
@@ -0,0 +1,10 @@
+import type { Dimension } from './interfaces.js';
+import type { Group } from '../../../diagram-api/types.js';
+export interface TextDimensionCalculator {
+ getMaxDimension(texts: string[], fontSize: number): Dimension;
+}
+export declare class TextDimensionCalculatorWithFont implements TextDimensionCalculator {
+ private parentGroup;
+ constructor(parentGroup: Group);
+ getMaxDimension(texts: string[], fontSize: number): Dimension;
+}