mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-09 18:39:41 +02:00
Merge branch 'develop' into 3358-blocks-diagram
This commit is contained in:
@@ -63,6 +63,17 @@ module.exports = {
|
|||||||
minimumDescriptionLength: 10,
|
minimumDescriptionLength: 10,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
'@typescript-eslint/naming-convention': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
selector: 'typeLike',
|
||||||
|
format: ['PascalCase'],
|
||||||
|
custom: {
|
||||||
|
regex: '^I[A-Z]',
|
||||||
|
match: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
'json/*': ['error', 'allowComments'],
|
'json/*': ['error', 'allowComments'],
|
||||||
'@cspell/spellchecker': [
|
'@cspell/spellchecker': [
|
||||||
'error',
|
'error',
|
||||||
|
@@ -375,6 +375,26 @@ context('Sequence diagram', () => {
|
|||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
it('should have actor-top and actor-bottom classes on top and bottom actor box and symbol', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
sequenceDiagram
|
||||||
|
actor Bob
|
||||||
|
Alice->>Bob: Hi Bob
|
||||||
|
Bob->>Alice: Hi Alice
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
cy.get('.actor').should('have.class', 'actor-top');
|
||||||
|
cy.get('.actor-man').should('have.class', 'actor-top');
|
||||||
|
cy.get('.actor.actor-top').should('not.have.class', 'actor-bottom');
|
||||||
|
cy.get('.actor-man.actor-top').should('not.have.class', 'actor-bottom');
|
||||||
|
|
||||||
|
cy.get('.actor').should('have.class', 'actor-bottom');
|
||||||
|
cy.get('.actor-man').should('have.class', 'actor-bottom');
|
||||||
|
cy.get('.actor.actor-bottom').should('not.have.class', 'actor-top');
|
||||||
|
cy.get('.actor-man.actor-bottom').should('not.have.class', 'actor-top');
|
||||||
|
});
|
||||||
it('should render long notes left of actor', () => {
|
it('should render long notes left of actor', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
|
@@ -741,9 +741,11 @@ Styling of a sequence diagram is done by defining a number of css classes. Durin
|
|||||||
### Classes used
|
### Classes used
|
||||||
|
|
||||||
| Class | Description |
|
| Class | Description |
|
||||||
| ------------ | ----------------------------------------------------------- |
|
| ------------ | -------------------------------------------------------------- |
|
||||||
| actor | Style for the actor box at the top of the diagram. |
|
| actor | Styles for the actor box. |
|
||||||
| text.actor | Styles for text in the actor box at the top of the diagram. |
|
| actor-top | Styles for the actor figure/ box at the top of the diagram. |
|
||||||
|
| actor-bottom | Styles for the actor figure/ box at the bottom of the diagram. |
|
||||||
|
| text.actor | Styles for text in the actor box. |
|
||||||
| actor-line | The vertical line for an actor. |
|
| actor-line | The vertical line for an actor. |
|
||||||
| messageLine0 | Styles for the solid message line. |
|
| messageLine0 | Styles for the solid message line. |
|
||||||
| messageLine1 | Styles for the dotted message line. |
|
| messageLine1 | Styles for the dotted message line. |
|
||||||
|
@@ -53,7 +53,7 @@ export interface QuadrantBuildType {
|
|||||||
borderLines?: QuadrantLineType[];
|
borderLines?: QuadrantLineType[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface quadrantBuilderData {
|
export interface QuadrantBuilderData {
|
||||||
titleText: string;
|
titleText: string;
|
||||||
quadrant1Text: string;
|
quadrant1Text: string;
|
||||||
quadrant2Text: string;
|
quadrant2Text: string;
|
||||||
@@ -116,7 +116,7 @@ interface CalculateSpaceData {
|
|||||||
export class QuadrantBuilder {
|
export class QuadrantBuilder {
|
||||||
private config: QuadrantBuilderConfig;
|
private config: QuadrantBuilderConfig;
|
||||||
private themeConfig: QuadrantBuilderThemeConfig;
|
private themeConfig: QuadrantBuilderThemeConfig;
|
||||||
private data: quadrantBuilderData;
|
private data: QuadrantBuilderData;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.config = this.getDefaultConfig();
|
this.config = this.getDefaultConfig();
|
||||||
@@ -124,7 +124,7 @@ export class QuadrantBuilder {
|
|||||||
this.data = this.getDefaultData();
|
this.data = this.getDefaultData();
|
||||||
}
|
}
|
||||||
|
|
||||||
getDefaultData(): quadrantBuilderData {
|
getDefaultData(): QuadrantBuilderData {
|
||||||
return {
|
return {
|
||||||
titleText: '',
|
titleText: '',
|
||||||
quadrant1Text: '',
|
quadrant1Text: '',
|
||||||
@@ -194,7 +194,7 @@ export class QuadrantBuilder {
|
|||||||
log.info('clear called');
|
log.info('clear called');
|
||||||
}
|
}
|
||||||
|
|
||||||
setData(data: Partial<quadrantBuilderData>) {
|
setData(data: Partial<QuadrantBuilderData>) {
|
||||||
this.data = { ...this.data, ...data };
|
this.data = { ...this.data, ...data };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,6 +5,8 @@ import { ZERO_WIDTH_SPACE, parseFontSize } from '../../utils.js';
|
|||||||
import { sanitizeUrl } from '@braintree/sanitize-url';
|
import { sanitizeUrl } from '@braintree/sanitize-url';
|
||||||
|
|
||||||
export const ACTOR_TYPE_WIDTH = 18 * 2;
|
export const ACTOR_TYPE_WIDTH = 18 * 2;
|
||||||
|
const TOP_ACTOR_CLASS = 'actor-top';
|
||||||
|
const BOTTOM_ACTOR_CLASS = 'actor-bottom';
|
||||||
|
|
||||||
export const drawRect = function (elem, rectData) {
|
export const drawRect = function (elem, rectData) {
|
||||||
return svgDrawCommon.drawRect(elem, rectData);
|
return svgDrawCommon.drawRect(elem, rectData);
|
||||||
@@ -319,6 +321,11 @@ const drawActorTypeParticipant = function (elem, actor, conf, isFooter) {
|
|||||||
} else {
|
} else {
|
||||||
rect.fill = '#eaeaea';
|
rect.fill = '#eaeaea';
|
||||||
}
|
}
|
||||||
|
if (isFooter) {
|
||||||
|
cssclass += ` ${BOTTOM_ACTOR_CLASS}`;
|
||||||
|
} else {
|
||||||
|
cssclass += ` ${TOP_ACTOR_CLASS}`;
|
||||||
|
}
|
||||||
rect.x = actor.x;
|
rect.x = actor.x;
|
||||||
rect.y = actorY;
|
rect.y = actorY;
|
||||||
rect.width = actor.width;
|
rect.width = actor.width;
|
||||||
@@ -383,7 +390,13 @@ const drawActorTypeActor = function (elem, actor, conf, isFooter) {
|
|||||||
actor.actorCnt = actorCnt;
|
actor.actorCnt = actorCnt;
|
||||||
}
|
}
|
||||||
const actElem = elem.append('g');
|
const actElem = elem.append('g');
|
||||||
actElem.attr('class', 'actor-man');
|
let cssClass = 'actor-man';
|
||||||
|
if (isFooter) {
|
||||||
|
cssClass += ` ${BOTTOM_ACTOR_CLASS}`;
|
||||||
|
} else {
|
||||||
|
cssClass += ` ${TOP_ACTOR_CLASS}`;
|
||||||
|
}
|
||||||
|
actElem.attr('class', cssClass);
|
||||||
|
|
||||||
const rect = svgDrawCommon.getNoteRect();
|
const rect = svgDrawCommon.getNoteRect();
|
||||||
rect.x = actor.x;
|
rect.x = actor.x;
|
||||||
|
@@ -519,9 +519,11 @@ Styling of a sequence diagram is done by defining a number of css classes. Durin
|
|||||||
### Classes used
|
### Classes used
|
||||||
|
|
||||||
| Class | Description |
|
| Class | Description |
|
||||||
| ------------ | ----------------------------------------------------------- |
|
| ------------ | -------------------------------------------------------------- |
|
||||||
| actor | Style for the actor box at the top of the diagram. |
|
| actor | Styles for the actor box. |
|
||||||
| text.actor | Styles for text in the actor box at the top of the diagram. |
|
| actor-top | Styles for the actor figure/ box at the top of the diagram. |
|
||||||
|
| actor-bottom | Styles for the actor figure/ box at the bottom of the diagram. |
|
||||||
|
| text.actor | Styles for text in the actor box. |
|
||||||
| actor-line | The vertical line for an actor. |
|
| actor-line | The vertical line for an actor. |
|
||||||
| messageLine0 | Styles for the solid message line. |
|
| messageLine0 | Styles for the solid message line. |
|
||||||
| messageLine1 | Styles for the dotted message line. |
|
| messageLine1 | Styles for the dotted message line. |
|
||||||
|
Reference in New Issue
Block a user