UNPKG

2.57 kBTypeScriptView Raw
1import type { DiagramDB } from '../../diagram-api/types.js';
2import type { BlockConfig, Block, ClassDef } from './blockTypes.js';
3/**
4 * Called when the parser comes across a (style) class definition
5 * @example classDef my-style fill:#f96;
6 *
7 * @param id - the id of this (style) class
8 * @param styleAttributes - the string with 1 or more style attributes (each separated by a comma)
9 */
10export declare const addStyleClass: (id: string, styleAttributes?: string) => void;
11/**
12 * Called when the parser comes across a style definition
13 * @example style my-block-id fill:#f96;
14 *
15 * @param id - the id of the block to style
16 * @param styles - the string with 1 or more style attributes (each separated by a comma)
17 */
18export declare const addStyle2Node: (id: string, styles?: string) => void;
19/**
20 * Add a CSS/style class to the block with the given id.
21 * If the block isn't already in the list of known blocks, add it.
22 * Might be called by parser when a CSS/style class should be applied to a block
23 *
24 * @param itemIds - The id or a list of ids of the item(s) to apply the css class to
25 * @param cssClassName - CSS class name
26 */
27export declare const setCssClass: (itemIds: string, cssClassName: string) => void;
28export 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";
29export declare function edgeTypeStr2Type(typeStr: string): string;
30export declare function edgeStrToEdgeData(typeStr: string): string;
31export declare const generateId: () => string;
32/**
33 * Return all of the style classes
34 */
35export declare const getClasses: () => Record<string, ClassDef>;
36declare const db: {
37 readonly getConfig: () => BlockConfig | undefined;
38 readonly typeStr2Type: typeof typeStr2Type;
39 readonly edgeTypeStr2Type: typeof edgeTypeStr2Type;
40 readonly edgeStrToEdgeData: typeof edgeStrToEdgeData;
41 readonly getLogger: () => Console;
42 readonly getBlocksFlat: () => Block[];
43 readonly getBlocks: () => Block[];
44 readonly getEdges: () => Block[];
45 readonly setHierarchy: (block: Block[]) => void;
46 readonly getBlock: (id: string) => Block;
47 readonly setBlock: (block: Block) => void;
48 readonly getColumns: (blockId: string) => number;
49 readonly getClasses: () => Record<string, ClassDef>;
50 readonly clear: () => void;
51 readonly generateId: () => string;
52};
53export type BlockDB = typeof db & DiagramDB;
54export default db;