summaryrefslogtreecommitdiff
path: root/themes/blowfish/assets/lib/mermaid/diagrams/block
diff options
context:
space:
mode:
authorChristoph Cullmann <cullmann@kde.org>2024-04-28 17:33:09 +0200
committerChristoph Cullmann <cullmann@kde.org>2024-04-28 17:33:09 +0200
commite77051ccc4b47951bfa4fde2be436b1bb2fb113b (patch)
treef0b75ee3521da9c8cd39dac4359212348f70e4e8 /themes/blowfish/assets/lib/mermaid/diagrams/block
parent4b355837824ac2422d371acef790f0f4249255c7 (diff)
use https://github.com/nunocoracao/blowfish.git
Diffstat (limited to 'themes/blowfish/assets/lib/mermaid/diagrams/block')
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/block/blockDB.d.ts54
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/block/blockDetector.d.ts3
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/block/blockDiagram.d.ts2
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/block/blockRenderer.d.ts15
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/block/blockTypes.d.ts36
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/block/blockUtils.d.ts1
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/block/layout.d.ts13
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/block/layout.spec.d.ts1
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/block/parser/block.spec.d.ts1
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/block/renderHelpers.d.ts10
-rw-r--r--themes/blowfish/assets/lib/mermaid/diagrams/block/styles.d.ts18
11 files changed, 154 insertions, 0 deletions
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/block/blockDB.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/block/blockDB.d.ts
new file mode 100644
index 0000000..2db398e
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/block/blockDB.d.ts
@@ -0,0 +1,54 @@
+import type { DiagramDB } from '../../diagram-api/types.js';
+import type { BlockConfig, Block, ClassDef } from './blockTypes.js';
+/**
+ * Called when the parser comes across a (style) class definition
+ * @example classDef my-style fill:#f96;
+ *
+ * @param id - the id of this (style) class
+ * @param styleAttributes - the string with 1 or more style attributes (each separated by a comma)
+ */
+export declare const addStyleClass: (id: string, styleAttributes?: string) => void;
+/**
+ * Called when the parser comes across a style definition
+ * @example style my-block-id fill:#f96;
+ *
+ * @param id - the id of the block to style
+ * @param styles - the string with 1 or more style attributes (each separated by a comma)
+ */
+export declare const addStyle2Node: (id: string, styles?: string) => void;
+/**
+ * Add a CSS/style class to the block with the given id.
+ * If the block isn't already in the list of known blocks, add it.
+ * Might be called by parser when a CSS/style class should be applied to a block
+ *
+ * @param itemIds - The id or a list of ids of the item(s) to apply the css class to
+ * @param cssClassName - CSS class name
+ */
+export declare const setCssClass: (itemIds: string, cssClassName: string) => void;
+export declare function typeStr2Type(typeStr: string): "circle" | "round" | "square" | "diamond" | "hexagon" | "rect_left_inv_arrow" | "lean_right" | "lean_left" | "trapezoid" | "inv_trapezoid" | "stadium" | "subroutine" | "cylinder" | "na" | "block_arrow" | "doublecircle";
+export declare function edgeTypeStr2Type(typeStr: string): string;
+export declare function edgeStrToEdgeData(typeStr: string): string;
+export declare const generateId: () => string;
+/**
+ * Return all of the style classes
+ */
+export declare const getClasses: () => Record<string, ClassDef>;
+declare const db: {
+ readonly getConfig: () => BlockConfig | undefined;
+ readonly typeStr2Type: typeof typeStr2Type;
+ readonly edgeTypeStr2Type: typeof edgeTypeStr2Type;
+ readonly edgeStrToEdgeData: typeof edgeStrToEdgeData;
+ readonly getLogger: () => Console;
+ readonly getBlocksFlat: () => Block[];
+ readonly getBlocks: () => Block[];
+ readonly getEdges: () => Block[];
+ readonly setHierarchy: (block: Block[]) => void;
+ readonly getBlock: (id: string) => Block;
+ readonly setBlock: (block: Block) => void;
+ readonly getColumns: (blockId: string) => number;
+ readonly getClasses: () => Record<string, ClassDef>;
+ readonly clear: () => void;
+ readonly generateId: () => string;
+};
+export type BlockDB = typeof db & DiagramDB;
+export default db;
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/block/blockDetector.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/block/blockDetector.d.ts
new file mode 100644
index 0000000..46efe84
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/block/blockDetector.d.ts
@@ -0,0 +1,3 @@
+import type { ExternalDiagramDefinition } from '../../diagram-api/types.js';
+declare const plugin: ExternalDiagramDefinition;
+export default plugin;
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/block/blockDiagram.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/block/blockDiagram.d.ts
new file mode 100644
index 0000000..f7aaea1
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/block/blockDiagram.d.ts
@@ -0,0 +1,2 @@
+import type { DiagramDefinition } from '../../diagram-api/types.js';
+export declare const diagram: DiagramDefinition;
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/block/blockRenderer.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/block/blockRenderer.d.ts
new file mode 100644
index 0000000..1220b0f
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/block/blockRenderer.d.ts
@@ -0,0 +1,15 @@
+import type { Diagram } from '../../Diagram.js';
+/**
+ * Returns the all the styles from classDef statements in the graph definition.
+ *
+ * @param text - The text with the classes
+ * @param diagObj - The diagram object
+ * @returns ClassDef - The styles
+ */
+export declare const getClasses: (text: any, diagObj: any) => any;
+export declare const draw: (text: string, id: string, _version: string, diagObj: Diagram) => Promise<void>;
+declare const _default: {
+ draw: (text: string, id: string, _version: string, diagObj: Diagram) => Promise<void>;
+ getClasses: (text: any, diagObj: any) => any;
+};
+export default _default;
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/block/blockTypes.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/block/blockTypes.d.ts
new file mode 100644
index 0000000..f43189e
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/block/blockTypes.d.ts
@@ -0,0 +1,36 @@
+export type { BlockDiagramConfig as BlockConfig } from '../../config.type.js';
+export type BlockType = 'na' | 'column-setting' | 'edge' | 'round' | 'block_arrow' | 'space' | 'square' | 'diamond' | 'hexagon' | 'odd' | 'lean_right' | 'lean_left' | 'trapezoid' | 'inv_trapezoid' | 'rect_left_inv_arrow' | 'odd_right' | 'circle' | 'ellipse' | 'stadium' | 'subroutine' | 'cylinder' | 'group' | 'doublecircle' | 'classDef' | 'applyClass' | 'applyStyles' | 'composite';
+export interface Block {
+ start?: string;
+ end?: string;
+ arrowTypeEnd?: string;
+ arrowTypeStart?: string;
+ width?: number;
+ id: string;
+ label?: string;
+ intersect?: any;
+ parent?: Block;
+ type?: BlockType;
+ children: Block[];
+ size?: {
+ width: number;
+ height: number;
+ x: number;
+ y: number;
+ };
+ node?: any;
+ columns?: number;
+ classes?: string[];
+ directions?: string[];
+ css?: string;
+ styleClass?: string;
+ styles?: string[];
+ stylesStr?: string;
+ widthInColumns?: number;
+}
+export interface ClassDef {
+ id: string;
+ textStyles: string[];
+ styles: string[];
+}
+export type Direction = 'up' | 'down' | 'left' | 'right' | 'x' | 'y';
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/block/blockUtils.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/block/blockUtils.d.ts
new file mode 100644
index 0000000..e9448d4
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/block/blockUtils.d.ts
@@ -0,0 +1 @@
+export declare const prepareTextForParsing: (text: string) => string;
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/block/layout.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/block/layout.d.ts
new file mode 100644
index 0000000..1a2c54e
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/block/layout.d.ts
@@ -0,0 +1,13 @@
+import type { BlockDB } from './blockDB.js';
+interface BlockPosition {
+ px: number;
+ py: number;
+}
+export declare function calculateBlockPosition(columns: number, position: number): BlockPosition;
+export declare function layout(db: BlockDB): {
+ x: number;
+ y: number;
+ width: number;
+ height: number;
+} | undefined;
+export {};
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/block/layout.spec.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/block/layout.spec.d.ts
new file mode 100644
index 0000000..cb0ff5c
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/block/layout.spec.d.ts
@@ -0,0 +1 @@
+export {};
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/block/parser/block.spec.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/block/parser/block.spec.d.ts
new file mode 100644
index 0000000..cb0ff5c
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/block/parser/block.spec.d.ts
@@ -0,0 +1 @@
+export {};
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/block/renderHelpers.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/block/renderHelpers.d.ts
new file mode 100644
index 0000000..8157bdf
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/block/renderHelpers.d.ts
@@ -0,0 +1,10 @@
+import type { Block } from './blockTypes.js';
+import type { BlockDB } from './blockDB.js';
+declare function calculateBlockSize(elem: d3.Selection<SVGGElement, unknown, HTMLElement, any>, block: any, db: any): Promise<void>;
+type ActionFun = typeof calculateBlockSize;
+export declare function insertBlockPositioned(elem: any, block: Block, db: any): Promise<void>;
+export declare function performOperations(elem: d3.Selection<SVGGElement, unknown, HTMLElement, any>, blocks: Block[], db: BlockDB, operation: ActionFun): Promise<void>;
+export declare function calculateBlockSizes(elem: any, blocks: Block[], db: BlockDB): Promise<void>;
+export declare function insertBlocks(elem: d3.Selection<SVGGElement, unknown, HTMLElement, any>, blocks: Block[], db: BlockDB): Promise<void>;
+export declare function insertEdges(elem: any, edges: Block[], blocks: Block[], db: BlockDB, id: string): Promise<void>;
+export {};
diff --git a/themes/blowfish/assets/lib/mermaid/diagrams/block/styles.d.ts b/themes/blowfish/assets/lib/mermaid/diagrams/block/styles.d.ts
new file mode 100644
index 0000000..14b3769
--- /dev/null
+++ b/themes/blowfish/assets/lib/mermaid/diagrams/block/styles.d.ts
@@ -0,0 +1,18 @@
+/** Returns the styles given options */
+export interface BlockChartStyleOptions {
+ arrowheadColor: string;
+ border2: string;
+ clusterBkg: string;
+ clusterBorder: string;
+ edgeLabelBackground: string;
+ fontFamily: string;
+ lineColor: string;
+ mainBkg: string;
+ nodeBorder: string;
+ nodeTextColor: string;
+ tertiaryColor: string;
+ textColor: string;
+ titleColor: string;
+}
+declare const getStyles: (options: BlockChartStyleOptions) => string;
+export default getStyles;