mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-21 06:53:17 +08:00
chore: Cleanup types
This commit is contained in:
parent
60266289e0
commit
65a08efa00
@ -20,7 +20,7 @@ const MERMAID_DOM_ID_PREFIX = 'flowchart-';
|
|||||||
let vertexCounter = 0;
|
let vertexCounter = 0;
|
||||||
let config = getConfig();
|
let config = getConfig();
|
||||||
let vertices: Record<string, FlowVertex> = {};
|
let vertices: Record<string, FlowVertex> = {};
|
||||||
let edges: any[] & { defaultInterpolate?: string; defaultStyle?: string } = [];
|
let edges: FlowEdge[] & { defaultInterpolate?: string; defaultStyle?: string[] } = [];
|
||||||
let classes: Record<string, FlowClass> = {};
|
let classes: Record<string, FlowClass> = {};
|
||||||
let subGraphs: FlowSubGraph[] = [];
|
let subGraphs: FlowSubGraph[] = [];
|
||||||
let subGraphLookup: Record<string, FlowSubGraph> = {};
|
let subGraphLookup: Record<string, FlowSubGraph> = {};
|
||||||
@ -59,8 +59,8 @@ export const addVertex = function (
|
|||||||
_id: string,
|
_id: string,
|
||||||
textObj: FlowText,
|
textObj: FlowText,
|
||||||
type: 'group',
|
type: 'group',
|
||||||
style: any[],
|
style: string[],
|
||||||
classes: any[],
|
classes: string[],
|
||||||
dir: string,
|
dir: string,
|
||||||
props = {}
|
props = {}
|
||||||
) {
|
) {
|
||||||
@ -128,9 +128,6 @@ export const addVertex = function (
|
|||||||
export const addSingleLink = function (_start: string, _end: string, type: any) {
|
export const addSingleLink = function (_start: string, _end: string, type: any) {
|
||||||
const start = _start;
|
const start = _start;
|
||||||
const end = _end;
|
const end = _end;
|
||||||
// if (start[0].match(/\d/)) start = MERMAID_DOM_ID_PREFIX + start;
|
|
||||||
// if (end[0].match(/\d/)) end = MERMAID_DOM_ID_PREFIX + end;
|
|
||||||
// log.info('Got edge...', start, end);
|
|
||||||
|
|
||||||
const edge: FlowEdge = { start: start, end: end, type: undefined, text: '', labelType: 'text' };
|
const edge: FlowEdge = { start: start, end: end, type: undefined, text: '', labelType: 'text' };
|
||||||
log.info('abc78 Got edge...', edge);
|
log.info('abc78 Got edge...', edge);
|
||||||
@ -160,7 +157,7 @@ export const addSingleLink = function (_start: string, _end: string, type: any)
|
|||||||
edges.push(edge);
|
edges.push(edge);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const addLink = function (_start: string[], _end: string[], type: any) {
|
export const addLink = function (_start: string[], _end: string[], type: unknown) {
|
||||||
log.info('addLink', _start, _end, type);
|
log.info('addLink', _start, _end, type);
|
||||||
for (const start of _start) {
|
for (const start of _start) {
|
||||||
for (const end of _end) {
|
for (const end of _end) {
|
||||||
@ -190,7 +187,7 @@ export const updateLinkInterpolate = function (
|
|||||||
* Updates a link with a style
|
* Updates a link with a style
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export const updateLink = function (positions: ('default' | number)[], style: any) {
|
export const updateLink = function (positions: ('default' | number)[], style: string[]) {
|
||||||
positions.forEach(function (pos) {
|
positions.forEach(function (pos) {
|
||||||
if (typeof pos === 'number' && pos >= edges.length) {
|
if (typeof pos === 'number' && pos >= edges.length) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
export interface FlowVertex {
|
export interface FlowVertex {
|
||||||
|
classes: string[];
|
||||||
|
dir?: string;
|
||||||
|
domId: string;
|
||||||
|
haveCallback?: boolean;
|
||||||
id: string;
|
id: string;
|
||||||
labelType: 'text';
|
labelType: 'text';
|
||||||
dir?: string;
|
|
||||||
props?: any;
|
|
||||||
type?: string;
|
|
||||||
text?: string;
|
|
||||||
link?: string;
|
link?: string;
|
||||||
linkTarget?: string;
|
linkTarget?: string;
|
||||||
haveCallback?: boolean;
|
props?: any;
|
||||||
domId: string;
|
styles: string[];
|
||||||
styles: any[];
|
text?: string;
|
||||||
classes: any[];
|
type?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FlowText {
|
export interface FlowText {
|
||||||
@ -21,8 +21,10 @@ export interface FlowText {
|
|||||||
export interface FlowEdge {
|
export interface FlowEdge {
|
||||||
start: string;
|
start: string;
|
||||||
end: string;
|
end: string;
|
||||||
|
interpolate?: string;
|
||||||
type?: string;
|
type?: string;
|
||||||
stroke?: string;
|
stroke?: string;
|
||||||
|
style?: string[];
|
||||||
length?: number;
|
length?: number;
|
||||||
text: string;
|
text: string;
|
||||||
labelType: 'text';
|
labelType: 'text';
|
||||||
@ -35,16 +37,17 @@ export interface FlowClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface FlowSubGraph {
|
export interface FlowSubGraph {
|
||||||
id: string;
|
|
||||||
nodes: string[];
|
|
||||||
title: string;
|
|
||||||
classes: string[];
|
classes: string[];
|
||||||
dir?: string;
|
dir?: string;
|
||||||
|
id: string;
|
||||||
labelType: string;
|
labelType: string;
|
||||||
|
nodes: string[];
|
||||||
|
title: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FlowLink {
|
export interface FlowLink {
|
||||||
type: string;
|
|
||||||
stroke: string;
|
|
||||||
length?: number;
|
length?: number;
|
||||||
|
stroke: string;
|
||||||
|
type: string;
|
||||||
|
text?: string;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user