mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-23 17:29:54 +02:00
fix: Remove duplicates, add documentation, rename legacyAlias
Co-authored-by: Alois Klink <alois@aloisklink.com>
This commit is contained in:
@@ -64,8 +64,14 @@ export interface ShapeDefinition {
|
|||||||
name: string;
|
name: string;
|
||||||
shortName: string;
|
shortName: string;
|
||||||
description: string;
|
description: string;
|
||||||
|
/**
|
||||||
|
* Aliases can include descriptive names, other short names, etc.
|
||||||
|
*/
|
||||||
aliases?: string[];
|
aliases?: string[];
|
||||||
legacyAliases?: string[];
|
/**
|
||||||
|
* These are names used by mermaid before the introduction of new shapes. These will not be in standard formats, and shouldn't be used by the users
|
||||||
|
*/
|
||||||
|
internalAliases?: string[];
|
||||||
handler: ShapeHandler;
|
handler: ShapeHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +146,7 @@ export const shapesDefs: ShapeDefinition[] = [
|
|||||||
shortName: 'lean-r',
|
shortName: 'lean-r',
|
||||||
description: 'Represents input or output',
|
description: 'Represents input or output',
|
||||||
aliases: ['lean-right', 'in-out'],
|
aliases: ['lean-right', 'in-out'],
|
||||||
legacyAliases: ['lean_right'],
|
internalAliases: ['lean_right'],
|
||||||
handler: lean_right,
|
handler: lean_right,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -149,7 +155,7 @@ export const shapesDefs: ShapeDefinition[] = [
|
|||||||
shortName: 'lean-l',
|
shortName: 'lean-l',
|
||||||
description: 'Represents output or input',
|
description: 'Represents output or input',
|
||||||
aliases: ['lean-left', 'out-in'],
|
aliases: ['lean-left', 'out-in'],
|
||||||
legacyAliases: ['lean_left'],
|
internalAliases: ['lean_left'],
|
||||||
handler: lean_left,
|
handler: lean_left,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -166,7 +172,7 @@ export const shapesDefs: ShapeDefinition[] = [
|
|||||||
shortName: 'trap-t',
|
shortName: 'trap-t',
|
||||||
description: 'Represents a manual task',
|
description: 'Represents a manual task',
|
||||||
aliases: ['manual', 'trapezoid-top', 'inv-trapezoid'],
|
aliases: ['manual', 'trapezoid-top', 'inv-trapezoid'],
|
||||||
legacyAliases: ['inv_trapezoid'],
|
internalAliases: ['inv_trapezoid'],
|
||||||
handler: inv_trapezoid,
|
handler: inv_trapezoid,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -175,7 +181,7 @@ export const shapesDefs: ShapeDefinition[] = [
|
|||||||
shortName: 'dbl-circ',
|
shortName: 'dbl-circ',
|
||||||
description: 'Represents a stop point',
|
description: 'Represents a stop point',
|
||||||
aliases: ['double-circle'],
|
aliases: ['double-circle'],
|
||||||
legacyAliases: ['doublecircle'],
|
internalAliases: ['doublecircle'],
|
||||||
handler: doublecircle,
|
handler: doublecircle,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -420,7 +426,7 @@ export const shapesDefs: ShapeDefinition[] = [
|
|||||||
name: 'Odd',
|
name: 'Odd',
|
||||||
shortName: 'odd',
|
shortName: 'odd',
|
||||||
description: 'Odd shape',
|
description: 'Odd shape',
|
||||||
legacyAliases: ['rect_left_inv_arrow'],
|
internalAliases: ['rect_left_inv_arrow'],
|
||||||
handler: rect_left_inv_arrow,
|
handler: rect_left_inv_arrow,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -438,16 +444,11 @@ const generateShapeMap = () => {
|
|||||||
const shapeMap: Record<string, ShapeHandler> = {
|
const shapeMap: Record<string, ShapeHandler> = {
|
||||||
// States
|
// States
|
||||||
state,
|
state,
|
||||||
stateStart,
|
|
||||||
stateEnd,
|
|
||||||
forkJoin,
|
|
||||||
choice,
|
choice,
|
||||||
note,
|
note,
|
||||||
|
|
||||||
// Rectangles
|
// Rectangles
|
||||||
rectWithTitle,
|
rectWithTitle,
|
||||||
roundedRect,
|
|
||||||
squareRect,
|
|
||||||
labelRect,
|
labelRect,
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
@@ -464,7 +465,7 @@ const generateShapeMap = () => {
|
|||||||
for (const alias of [
|
for (const alias of [
|
||||||
shape.shortName,
|
shape.shortName,
|
||||||
...(shape.aliases ?? []),
|
...(shape.aliases ?? []),
|
||||||
...(shape.legacyAliases ?? []),
|
...(shape.internalAliases ?? []),
|
||||||
]) {
|
]) {
|
||||||
shapeMap[alias] = shape.handler;
|
shapeMap[alias] = shape.handler;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user