Christoph Cullmann 2024-04-28 17:33:09 +02:00
parent 4b35583782
commit e77051ccc4
1987 changed files with 1147290 additions and 5648 deletions

View file

@ -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;

View file

@ -0,0 +1,3 @@
import type { ExternalDiagramDefinition } from '../../diagram-api/types.js';
declare const plugin: ExternalDiagramDefinition;
export default plugin;

View file

@ -0,0 +1,2 @@
import type { DiagramDefinition } from '../../diagram-api/types.js';
export declare const diagram: DiagramDefinition;

View file

@ -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;

View file

@ -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';

View file

@ -0,0 +1 @@
export declare const prepareTextForParsing: (text: string) => string;

View file

@ -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 {};

View file

@ -0,0 +1 @@
export {};

View file

@ -0,0 +1 @@
export {};

View file

@ -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 {};

View file

@ -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;