This commit is contained in:
nik
2025-10-03 22:27:28 +03:00
parent 829fad0e17
commit 871cf7e792
16520 changed files with 2967597 additions and 3 deletions

View File

@@ -0,0 +1,10 @@
import type { MermaidConfig } from '../../config.type.js';
import type { Edge, NodeData, StateStmt, StyleClass } from './stateDb.js';
/**
* Create a standard string for the dom ID of an item.
* If a type is given, insert that before the counter, preceded by the type spacer
*
*/
export declare function stateDomId(itemId?: string, counter?: number, type?: string | null, typeSpacer?: string): string;
export declare const dataFetcher: (parent: StateStmt | undefined, parsedItem: StateStmt, diagramStates: Map<string, StateStmt>, nodes: NodeData[], edges: Edge[], altFlag: boolean, look: MermaidConfig["look"], classes: Map<string, StyleClass>) => void;
export declare const reset: () => void;

14
node_modules/mermaid/dist/diagrams/state/shapes.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
export function drawStartState(g: any): any;
export function drawDivider(g: any): any;
export function drawSimpleState(g: any, stateDef: any): any;
export function drawDescrState(g: any, stateDef: any): any;
export function addTitleAndBox(g: any, stateDef: any, altBkg: any): any;
export function drawText(elem: any, textData: any): any;
export function drawNote(text: any, g: any): any;
export function drawState(elem: any, stateDef: any): {
id: any;
label: any;
width: number;
height: number;
};
export function drawEdge(elem: any, path: any, relation: any): void;

View File

@@ -0,0 +1,88 @@
/**
* Constants common to all State Diagram code
*/
export declare const DEFAULT_DIAGRAM_DIRECTION = "TB";
export declare const DEFAULT_NESTED_DOC_DIR = "TB";
export declare const STMT_DIRECTION = "dir";
export declare const STMT_STATE = "state";
export declare const STMT_ROOT = "root";
export declare const STMT_RELATION = "relation";
export declare const STMT_CLASSDEF = "classDef";
export declare const STMT_STYLEDEF = "style";
export declare const STMT_APPLYCLASS = "applyClass";
export declare const DEFAULT_STATE_TYPE = "default";
export declare const DIVIDER_TYPE = "divider";
export declare const G_EDGE_STYLE = "fill:none";
export declare const G_EDGE_ARROWHEADSTYLE = "fill: #333";
export declare const G_EDGE_LABELPOS = "c";
export declare const G_EDGE_LABELTYPE = "text";
export declare const G_EDGE_THICKNESS = "normal";
export declare const SHAPE_STATE = "rect";
export declare const SHAPE_STATE_WITH_DESC = "rectWithTitle";
export declare const SHAPE_START = "stateStart";
export declare const SHAPE_END = "stateEnd";
export declare const SHAPE_DIVIDER = "divider";
export declare const SHAPE_GROUP = "roundedWithTitle";
export declare const SHAPE_NOTE = "note";
export declare const SHAPE_NOTEGROUP = "noteGroup";
export declare const CSS_DIAGRAM = "statediagram";
export declare const CSS_STATE = "state";
export declare const CSS_DIAGRAM_STATE = "statediagram-state";
export declare const CSS_EDGE = "transition";
export declare const CSS_NOTE = "note";
export declare const CSS_NOTE_EDGE = "note-edge";
export declare const CSS_EDGE_NOTE_EDGE = "transition note-edge";
export declare const CSS_DIAGRAM_NOTE = "statediagram-note";
export declare const CSS_CLUSTER = "cluster";
export declare const CSS_DIAGRAM_CLUSTER = "statediagram-cluster";
export declare const CSS_CLUSTER_ALT = "cluster-alt";
export declare const CSS_DIAGRAM_CLUSTER_ALT = "statediagram-cluster-alt";
export declare const PARENT = "parent";
export declare const NOTE = "note";
export declare const DOMID_STATE = "state";
export declare const DOMID_TYPE_SPACER = "----";
export declare const NOTE_ID = "----note";
export declare const PARENT_ID = "----parent";
declare const _default: {
DEFAULT_DIAGRAM_DIRECTION: string;
DEFAULT_NESTED_DOC_DIR: string;
STMT_STATE: string;
STMT_RELATION: string;
STMT_CLASSDEF: string;
STMT_STYLEDEF: string;
STMT_APPLYCLASS: string;
DEFAULT_STATE_TYPE: string;
DIVIDER_TYPE: string;
G_EDGE_STYLE: string;
G_EDGE_ARROWHEADSTYLE: string;
G_EDGE_LABELPOS: string;
G_EDGE_LABELTYPE: string;
G_EDGE_THICKNESS: string;
CSS_EDGE: string;
CSS_DIAGRAM: string;
SHAPE_STATE: string;
SHAPE_STATE_WITH_DESC: string;
SHAPE_START: string;
SHAPE_END: string;
SHAPE_DIVIDER: string;
SHAPE_GROUP: string;
SHAPE_NOTE: string;
SHAPE_NOTEGROUP: string;
CSS_STATE: string;
CSS_DIAGRAM_STATE: string;
CSS_NOTE: string;
CSS_NOTE_EDGE: string;
CSS_EDGE_NOTE_EDGE: string;
CSS_DIAGRAM_NOTE: string;
CSS_CLUSTER: string;
CSS_DIAGRAM_CLUSTER: string;
CSS_CLUSTER_ALT: string;
CSS_DIAGRAM_CLUSTER_ALT: string;
PARENT: string;
NOTE: string;
DOMID_STATE: string;
DOMID_TYPE_SPACER: string;
NOTE_ID: string;
PARENT_ID: string;
};
export default _default;

255
node_modules/mermaid/dist/diagrams/state/stateDb.d.ts generated vendored Normal file
View File

@@ -0,0 +1,255 @@
import type { MermaidConfig } from '../../config.type.js';
interface BaseStmt {
stmt: 'applyClass' | 'classDef' | 'dir' | 'relation' | 'state' | 'style' | 'root' | 'default' | 'click';
}
interface ApplyClassStmt extends BaseStmt {
stmt: 'applyClass';
id: string;
styleClass: string;
}
interface ClassDefStmt extends BaseStmt {
stmt: 'classDef';
id: string;
classes: string;
}
interface DirectionStmt extends BaseStmt {
stmt: 'dir';
value: 'TB' | 'BT' | 'RL' | 'LR';
}
interface RelationStmt extends BaseStmt {
stmt: 'relation';
state1: StateStmt;
state2: StateStmt;
description?: string;
}
export interface StateStmt extends BaseStmt {
stmt: 'state' | 'default';
id: string;
type: 'default' | 'fork' | 'join' | 'choice' | 'divider' | 'start' | 'end';
description?: string;
descriptions?: string[];
doc?: Stmt[];
note?: Note;
start?: boolean;
classes?: string[];
styles?: string[];
textStyles?: string[];
}
interface StyleStmt extends BaseStmt {
stmt: 'style';
id: string;
styleClass: string;
}
export interface RootStmt {
id: 'root';
stmt: 'root';
doc?: Stmt[];
}
export interface ClickStmt extends BaseStmt {
stmt: 'click';
id: string;
url: string;
tooltip: string;
}
interface Note {
position?: 'left of' | 'right of';
text: string;
}
export type Stmt = ApplyClassStmt | ClassDefStmt | DirectionStmt | RelationStmt | StateStmt | StyleStmt | RootStmt | ClickStmt;
interface DiagramEdge {
id1: string;
id2: string;
relationTitle?: string;
}
export interface StyleClass {
id: string;
styles: string[];
textStyles: string[];
}
export interface NodeData {
labelStyle?: string;
shape: string;
label?: string | string[];
cssClasses: string;
cssCompiledStyles?: string[];
cssStyles: string[];
id: string;
dir?: string;
domId?: string;
type?: string;
isGroup?: boolean;
padding?: number;
rx?: number;
ry?: number;
look?: MermaidConfig['look'];
parentId?: string;
centerLabel?: boolean;
position?: string;
description?: string | string[];
}
export interface Edge {
id: string;
start: string;
end: string;
arrowhead: string;
arrowTypeEnd: string;
style: string;
labelStyle: string;
label?: string;
arrowheadStyle: string;
labelpos: string;
labelType: string;
thickness: string;
classes: string;
look: MermaidConfig['look'];
}
export declare class StateDB {
private version;
private nodes;
private edges;
private rootDoc;
private classes;
private documents;
private currentDocument;
private startEndCount;
private dividerCnt;
private links;
static readonly relationType: {
readonly AGGREGATION: 0;
readonly EXTENSION: 1;
readonly COMPOSITION: 2;
readonly DEPENDENCY: 3;
};
constructor(version: 1 | 2);
/**
* Convert all of the statements (stmts) that were parsed into states and relationships.
* This is done because a state diagram may have nested sections,
* where each section is a 'document' and has its own set of statements.
* Ex: the section within a fork has its own statements, and incoming and outgoing statements
* refer to the fork as a whole (document).
* See the parser grammar: the definition of a document is a document then a 'line', where a line can be a statement.
* This will push the statement into the list of statements for the current document.
*/
extract(statements: Stmt[] | {
doc: Stmt[];
}): void;
private handleStyleDef;
setRootDoc(o: Stmt[]): void;
docTranslator(parent: RootStmt | StateStmt, node: Stmt, first: boolean): void;
private getRootDocV2;
/**
* Function called by parser when a node definition has been found.
*
* @param descr - description for the state. Can be a string or a list or strings
* @param classes - class styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 class, convert it to an array of that 1 class.
* @param styles - styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 style, convert it to an array of that 1 style.
* @param textStyles - text styles to apply to this state. Can be a string (1 text test) or an array of text styles. If it's just 1 text style, convert it to an array of that 1 text style.
*/
addState(id: string, type?: StateStmt['type'], doc?: Stmt[] | undefined, descr?: string | string[] | undefined, note?: Note | undefined, classes?: string | string[] | undefined, styles?: string | string[] | undefined, textStyles?: string | string[] | undefined): void;
clear(saveCommon?: boolean): void;
getState(id: string): StateStmt | undefined;
getStates(): Map<string, StateStmt>;
logDocuments(): void;
getRelations(): DiagramEdge[];
/**
* Adds a clickable link to a state.
*/
addLink(stateId: string, url: string, tooltip: string): void;
/**
* Get all registered links.
*/
getLinks(): Map<string, {
url: string;
tooltip: string;
}>;
/**
* If the id is a start node ( [*] ), then return a new id constructed from
* the start node name and the current start node count.
* else return the given id
*/
startIdIfNeeded(id?: string): string;
/**
* If the id is a start node ( [*] ), then return the start type ('start')
* else return the given type
*/
startTypeIfNeeded(id?: string, type?: StateStmt['type']): "join" | "default" | "start" | "end" | "divider" | "choice" | "fork";
/**
* If the id is an end node ( [*] ), then return a new id constructed from
* the end node name and the current start_end node count.
* else return the given id
*/
endIdIfNeeded(id?: string): string;
/**
* If the id is an end node ( [*] ), then return the end type
* else return the given type
*
*/
endTypeIfNeeded(id?: string, type?: StateStmt['type']): "join" | "default" | "start" | "end" | "divider" | "choice" | "fork";
addRelationObjs(item1: StateStmt, item2: StateStmt, relationTitle?: string): void;
/**
* Add a relation between two items. The items may be full objects or just the string id of a state.
*/
addRelation(item1: string | StateStmt, item2: string | StateStmt, title?: string): void;
addDescription(id: string, descr: string): void;
cleanupLabel(label: string): string;
getDividerId(): string;
/**
* 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)
*/
addStyleClass(id: string, styleAttributes?: string): void;
getClasses(): Map<string, StyleClass>;
/**
* Add a (style) class or css class to a state with the given id.
* If the state isn't already in the list of known states, add it.
* Might be called by parser when a style class or CSS class should be applied to a state
*
* @param itemIds - The id or a list of ids of the item(s) to apply the css class to
* @param cssClassName - CSS class name
*/
setCssClass(itemIds: string, cssClassName: string): void;
/**
* Add a style to a state with the given id.
* @example style stateId fill:#f9f,stroke:#333,stroke-width:4px
* where 'style' is the keyword
* stateId is the id of a state
* the rest of the string is the styleText (all of the attributes to be applied to the state)
*
* @param itemId - The id of item to apply the style to
* @param styleText - the text of the attributes for the style
*/
setStyle(itemId: string, styleText: string): void;
/**
* Add a text style to a state with the given id
*
* @param itemId - The id of item to apply the css class to
* @param cssClassName - CSS class name
*/
setTextStyle(itemId: string, cssClassName: string): void;
/**
* Finds the direction statement in the root document.
* @returns the direction statement if present
*/
private getDirectionStatement;
getDirection(): "TB" | "BT" | "LR" | "RL";
setDirection(dir: DirectionStmt['value']): void;
trimColon(str: string): string;
getData(): {
nodes: NodeData[];
edges: Edge[];
other: {};
config: MermaidConfig;
direction: string;
};
getConfig(): import("../../config.type.js").StateDiagramConfig | undefined;
getAccTitle: () => string;
setAccTitle: (txt: string) => void;
getAccDescription: () => string;
setAccDescription: (txt: string) => void;
setDiagramTitle: (txt: string) => void;
getDiagramTitle: () => string;
}
export {};

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,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,2 @@
import type { DiagramDefinition } from '../../diagram-api/types.js';
export declare const diagram: DiagramDefinition;

View File

@@ -0,0 +1,18 @@
import type { DiagramStyleClassDef } from '../../diagram-api/types.js';
/**
* Get the direction from the statement items.
* Look through all of the documents (docs) in the parsedItems
* Because is a _document_ direction, the default direction is not necessarily the same as the overall default _diagram_ direction.
* @param parsedItem - the parsed statement item to look through
* @param defaultDir - the direction to use if none is found
* @returns The direction to use
*/
export declare const getDir: (parsedItem: any, defaultDir?: string) => string;
export declare const getClasses: (text: string, diagramObj: any) => Map<string, DiagramStyleClassDef>;
export declare const draw: (text: string, id: string, _version: string, diag: any) => Promise<void>;
declare const _default: {
getClasses: (text: string, diagramObj: any) => Map<string, DiagramStyleClassDef>;
draw: (text: string, id: string, _version: string, diag: any) => Promise<void>;
getDir: (parsedItem: any, defaultDir?: string) => string;
};
export default _default;

View File

@@ -0,0 +1,7 @@
export function setConf(): void;
export function draw(text: any, id: any, _version: any, diagObj: any): void;
declare namespace _default {
export { setConf };
export { draw };
}
export default _default;

2
node_modules/mermaid/dist/diagrams/state/styles.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export default getStyles;
declare function getStyles(options: any): string;