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,144 @@
import type { ClassRelation, ClassNode, ClassNote, ClassMap, NamespaceMap, NamespaceNode } from './classTypes.js';
export declare const setClassLabel: (_id: string, label: string) => void;
/**
* Function called by parser when a node definition has been found.
*
* @param id - Id of the class to add
* @public
*/
export declare const addClass: (_id: string) => void;
/**
* Function to lookup domId from id in the graph definition.
*
* @param id - class ID to lookup
* @public
*/
export declare const lookUpDomId: (_id: string) => string;
export declare const clear: () => void;
export declare const getClass: (id: string) => ClassNode;
export declare const getClasses: () => ClassMap;
export declare const getRelations: () => ClassRelation[];
export declare const getNotes: () => ClassNote[];
export declare const addRelation: (relation: ClassRelation) => void;
/**
* Adds an annotation to the specified class Annotations mark special properties of the given type
* (like 'interface' or 'service')
*
* @param className - The class name
* @param annotation - The name of the annotation without any brackets
* @public
*/
export declare const addAnnotation: (className: string, annotation: string) => void;
/**
* Adds a member to the specified class
*
* @param className - The class name
* @param member - The full name of the member. If the member is enclosed in `<<brackets>>` it is
* treated as an annotation If the member is ending with a closing bracket ) it is treated as a
* method Otherwise the member will be treated as a normal property
* @public
*/
export declare const addMember: (className: string, member: string) => void;
export declare const addMembers: (className: string, members: string[]) => void;
export declare const addNote: (text: string, className: string) => void;
export declare const cleanupLabel: (label: string) => string;
/**
* Called by parser when assigning cssClass to a class
*
* @param ids - Comma separated list of ids
* @param className - Class to add
*/
export declare const setCssClass: (ids: string, className: string) => void;
export declare const getTooltip: (id: string, namespace?: string) => string | undefined;
/**
* Called by parser when a link is found. Adds the URL to the vertex data.
*
* @param ids - Comma separated list of ids
* @param linkStr - URL to create a link for
* @param target - Target of the link, _blank by default as originally defined in the svgDraw.js file
*/
export declare const setLink: (ids: string, linkStr: string, target: string) => void;
/**
* Called by parser when a click definition is found. Registers an event handler.
*
* @param ids - Comma separated list of ids
* @param functionName - Function to be called on click
* @param functionArgs - Function args the function should be called with
*/
export declare const setClickEvent: (ids: string, functionName: string, functionArgs: string) => void;
export declare const bindFunctions: (element: Element) => void;
export declare const lineType: {
LINE: number;
DOTTED_LINE: number;
};
export declare const relationType: {
AGGREGATION: number;
EXTENSION: number;
COMPOSITION: number;
DEPENDENCY: number;
LOLLIPOP: number;
};
/**
* Function called by parser when a namespace definition has been found.
*
* @param id - Id of the namespace to add
* @public
*/
export declare const addNamespace: (id: string) => void;
/**
* Function called by parser when a namespace definition has been found.
*
* @param id - Id of the namespace to add
* @param classNames - Ids of the class to add
* @public
*/
export declare const addClassesToNamespace: (id: string, classNames: string[]) => void;
export declare const setCssStyle: (id: string, styles: string[]) => void;
declare const _default: {
setAccTitle: (txt: string) => void;
getAccTitle: () => string;
getAccDescription: () => string;
setAccDescription: (txt: string) => void;
getConfig: () => import("../../config.type.js").ClassDiagramConfig | undefined;
addClass: (_id: string) => void;
bindFunctions: (element: Element) => void;
clear: () => void;
getClass: (id: string) => ClassNode;
getClasses: () => ClassMap;
getNotes: () => ClassNote[];
addAnnotation: (className: string, annotation: string) => void;
addNote: (text: string, className: string) => void;
getRelations: () => ClassRelation[];
addRelation: (relation: ClassRelation) => void;
getDirection: () => string;
setDirection: (dir: string) => void;
addMember: (className: string, member: string) => void;
addMembers: (className: string, members: string[]) => void;
cleanupLabel: (label: string) => string;
lineType: {
LINE: number;
DOTTED_LINE: number;
};
relationType: {
AGGREGATION: number;
EXTENSION: number;
COMPOSITION: number;
DEPENDENCY: number;
LOLLIPOP: number;
};
setClickEvent: (ids: string, functionName: string, functionArgs: string) => void;
setCssClass: (ids: string, className: string) => void;
setLink: (ids: string, linkStr: string, target: string) => void;
getTooltip: (id: string, namespace?: string | undefined) => string | undefined;
setTooltip: (ids: string, tooltip?: string | undefined) => void;
lookUpDomId: (_id: string) => string;
setDiagramTitle: (txt: string) => void;
getDiagramTitle: () => string;
setClassLabel: (_id: string, label: string) => void;
addNamespace: (id: string) => void;
addClassesToNamespace: (id: string, classNames: string[]) => void;
getNamespace: (name: string) => NamespaceNode;
getNamespaces: () => NamespaceMap;
setCssStyle: (id: string, styles: string[]) => void;
};
export default _default;

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

View file

@ -0,0 +1,57 @@
import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';
import type { ClassRelation, ClassNote, ClassMap, NamespaceMap } from './classTypes.js';
/**
* Function that adds the vertices found during parsing to the graph to be rendered.
*
* @param namespaces - Object containing the vertices.
* @param g - The graph that is to be drawn.
* @param _id - id of the graph
* @param diagObj - The diagram object
*/
export declare const addNamespaces: (namespaces: NamespaceMap, g: graphlib.Graph, _id: string, diagObj: any) => void;
/**
* Function that adds the vertices found during parsing to the graph to be rendered.
*
* @param classes - Object containing the vertices.
* @param g - The graph that is to be drawn.
* @param _id - id of the graph
* @param diagObj - The diagram object
* @param parent - id of the parent namespace, if it exists
*/
export declare const addClasses: (classes: ClassMap, g: graphlib.Graph, _id: string, diagObj: any, parent?: string) => void;
/**
* Function that adds the additional vertices (notes) found during parsing to the graph to be rendered.
*
* @param notes - Object containing the additional vertices (notes).
* @param g - The graph that is to be drawn.
* @param startEdgeId - starting index for note edge
* @param classes - Classes
*/
export declare const addNotes: (notes: ClassNote[], g: graphlib.Graph, startEdgeId: number, classes: ClassMap) => void;
/**
* Add edges to graph based on parsed graph definition
*
* @param relations -
* @param g - The graph object
*/
export declare const addRelations: (relations: ClassRelation[], g: graphlib.Graph) => void;
/**
* Merges the value of `conf` with the passed `cnf`
*
* @param cnf - Config to merge
*/
export declare const setConf: (cnf: any) => void;
/**
* Draws a class diagram in the tag with id: id based on the definition in text.
*
* @param text -
* @param id -
* @param _version -
* @param diagObj -
*/
export declare const draw: (text: string, id: string, _version: string, diagObj: any) => Promise<void>;
declare const _default: {
setConf: (cnf: any) => void;
draw: (text: string, id: string, _version: string, diagObj: any) => Promise<void>;
};
export default _default;

View file

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

View file

@ -0,0 +1,78 @@
export interface ClassNode {
id: string;
type: string;
label: string;
cssClasses: string[];
methods: ClassMember[];
members: ClassMember[];
annotations: string[];
domId: string;
styles: string[];
parent?: string;
link?: string;
linkTarget?: string;
haveCallback?: boolean;
tooltip?: string;
}
export type Visibility = '#' | '+' | '~' | '-' | '';
export declare const visibilityValues: string[];
/**
* Parses and stores class diagram member variables/methods.
*
*/
export declare class ClassMember {
id: string;
cssStyle: string;
memberType: 'method' | 'attribute';
visibility: Visibility;
/**
* denote if static or to determine which css class to apply to the node
* @defaultValue ''
*/
classifier: string;
/**
* parameters for method
* @defaultValue ''
*/
parameters: string;
/**
* return type for method
* @defaultValue ''
*/
returnType: string;
constructor(input: string, memberType: 'method' | 'attribute');
getDisplayDetails(): {
displayText: string;
cssStyle: string;
};
parseMember(input: string): void;
parseClassifier(): "" | "font-style:italic;" | "text-decoration:underline;";
}
export interface ClassNote {
id: string;
class: string;
text: string;
}
export type ClassRelation = {
id1: string;
id2: string;
relationTitle1: string;
relationTitle2: string;
type: string;
title: string;
text: string;
style: string[];
relation: {
type1: number;
type2: number;
lineType: number;
};
};
export interface NamespaceNode {
id: string;
domId: string;
classes: ClassMap;
children: NamespaceMap;
}
export type ClassMap = Record<string, ClassNode>;
export type NamespaceMap = Record<string, NamespaceNode>;

View file

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

View file

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

View file

@ -0,0 +1,25 @@
export function drawEdge(elem: any, path: any, relation: any, conf: any, diagObj: any): void;
export function drawClass(elem: SVGSVGElement, classDef: any, conf: any, diagObj: any): {
id: any;
label: any;
width: number;
height: number;
};
export function getClassTitleString(classDef: any): any;
export function drawNote(elem: SVGSVGElement, note: {
id: string;
text: string;
class: string;
}, conf: any, diagObj: any): {
id: string;
text: string;
width: number;
height: number;
};
declare namespace _default {
export { getClassTitleString };
export { drawClass };
export { drawEdge };
export { drawNote };
}
export default _default;