2020-07-17 15:57:02 +02:00
|
|
|
import classDiagram from './diagrams/class/styles';
|
2020-07-20 14:13:05 +02:00
|
|
|
import er from './diagrams/er/styles';
|
2022-09-02 14:05:31 +02:00
|
|
|
import error from './diagrams/error/styles';
|
2020-07-17 15:57:02 +02:00
|
|
|
import flowchart from './diagrams/flowchart/styles';
|
|
|
|
import gantt from './diagrams/gantt/styles';
|
2022-04-07 18:22:06 +02:00
|
|
|
import gitGraph from './diagrams/git/styles';
|
2020-07-17 15:57:02 +02:00
|
|
|
import info from './diagrams/info/styles';
|
|
|
|
import pie from './diagrams/pie/styles';
|
2022-02-10 20:32:21 +01:00
|
|
|
import requirement from './diagrams/requirement/styles';
|
2020-07-17 15:57:02 +02:00
|
|
|
import sequence from './diagrams/sequence/styles';
|
|
|
|
import stateDiagram from './diagrams/state/styles';
|
|
|
|
import journey from './diagrams/user-journey/styles';
|
Add C4Context diagram. Compatible with C4-PlantUML syntax.
```
C4Context
title System Context diagram for Internet Banking System
Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")
Person(customerB, "Banking Customer B")
Person_Ext(customerC, "Banking Customer C")
System(SystemAA, "Internet Banking System", "Allows customers to view information about their bank accounts, and make payments.")
Person(customerD, "Banking Customer D", "A customer of the bank, <br/> with personal bank accounts.")
Enterprise_Boundary(b1, "BankBoundary") {
SystemDb_Ext(SystemE, "Mainframe Banking System", "Stores all of the core banking information about customers, accounts, transactions, etc.")
System_Boundary(b2, "BankBoundary2") {
System(SystemA, "Banking System A")
System(SystemB, "Banking System B", "A system of the bank, with personal bank accounts.")
}
System_Ext(SystemC, "E-mail system", "The internal Microsoft Exchange e-mail system.")
SystemDb(SystemD, "Banking System D Database", "A system of the bank, with personal bank accounts.")
Boundary(b3, "BankBoundary3", "boundary") {
SystemQueue(SystemF, "Banking System F Queue", "A system of the bank, with personal bank accounts.")
SystemQueue_Ext(SystemG, "Banking System G Queue", "A system of the bank, with personal bank accounts.")
}
}
BiRel(customerA, SystemAA, "Uses")
BiRel(SystemAA, SystemE, "Uses")
Rel(SystemAA, SystemC, "Sends e-mails", "SMTP")
Rel(SystemC, customerA, "Sends e-mails to")
```
2022-05-15 13:21:16 +08:00
|
|
|
import c4 from './diagrams/c4/styles';
|
2022-06-21 21:17:53 +02:00
|
|
|
import { log } from './logger';
|
2020-07-16 20:27:42 +02:00
|
|
|
|
|
|
|
const themes = {
|
2020-07-17 15:57:02 +02:00
|
|
|
flowchart,
|
|
|
|
'flowchart-v2': flowchart,
|
|
|
|
sequence,
|
|
|
|
gantt,
|
2020-07-23 06:03:04 -04:00
|
|
|
classDiagram,
|
2020-07-22 19:25:26 +02:00
|
|
|
'classDiagram-v2': classDiagram,
|
2020-07-23 05:57:15 -04:00
|
|
|
class: classDiagram,
|
2020-07-17 15:57:02 +02:00
|
|
|
stateDiagram,
|
|
|
|
state: stateDiagram,
|
2022-04-07 18:22:06 +02:00
|
|
|
gitGraph,
|
2020-07-17 15:57:02 +02:00
|
|
|
info,
|
|
|
|
pie,
|
|
|
|
er,
|
2022-09-02 14:05:31 +02:00
|
|
|
error,
|
2022-02-10 20:32:21 +01:00
|
|
|
journey,
|
|
|
|
requirement,
|
Add C4Context diagram. Compatible with C4-PlantUML syntax.
```
C4Context
title System Context diagram for Internet Banking System
Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")
Person(customerB, "Banking Customer B")
Person_Ext(customerC, "Banking Customer C")
System(SystemAA, "Internet Banking System", "Allows customers to view information about their bank accounts, and make payments.")
Person(customerD, "Banking Customer D", "A customer of the bank, <br/> with personal bank accounts.")
Enterprise_Boundary(b1, "BankBoundary") {
SystemDb_Ext(SystemE, "Mainframe Banking System", "Stores all of the core banking information about customers, accounts, transactions, etc.")
System_Boundary(b2, "BankBoundary2") {
System(SystemA, "Banking System A")
System(SystemB, "Banking System B", "A system of the bank, with personal bank accounts.")
}
System_Ext(SystemC, "E-mail system", "The internal Microsoft Exchange e-mail system.")
SystemDb(SystemD, "Banking System D Database", "A system of the bank, with personal bank accounts.")
Boundary(b3, "BankBoundary3", "boundary") {
SystemQueue(SystemF, "Banking System F Queue", "A system of the bank, with personal bank accounts.")
SystemQueue_Ext(SystemG, "Banking System G Queue", "A system of the bank, with personal bank accounts.")
}
}
BiRel(customerA, SystemAA, "Uses")
BiRel(SystemAA, SystemE, "Uses")
Rel(SystemAA, SystemC, "Sends e-mails", "SMTP")
Rel(SystemC, customerA, "Sends e-mails to")
```
2022-05-15 13:21:16 +08:00
|
|
|
c4,
|
2020-07-16 20:27:42 +02:00
|
|
|
};
|
|
|
|
|
2022-06-21 21:17:53 +02:00
|
|
|
export const calcThemeVariables = (theme, userOverRides) => {
|
|
|
|
log.info('userOverides', userOverRides);
|
|
|
|
return theme.calcColors(userOverRides);
|
|
|
|
};
|
2020-07-19 15:02:53 +02:00
|
|
|
|
|
|
|
const getStyles = (type, userStyles, options) => {
|
|
|
|
return ` {
|
2020-07-17 15:57:02 +02:00
|
|
|
font-family: ${options.fontFamily};
|
|
|
|
font-size: ${options.fontSize};
|
2020-07-20 09:44:09 +02:00
|
|
|
fill: ${options.textColor}
|
2020-07-16 20:27:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Classes common for multiple diagrams */
|
|
|
|
|
|
|
|
.error-icon {
|
|
|
|
fill: ${options.errorBkgColor};
|
|
|
|
}
|
|
|
|
.error-text {
|
|
|
|
fill: ${options.errorTextColor};
|
|
|
|
stroke: ${options.errorTextColor};
|
|
|
|
}
|
|
|
|
|
|
|
|
.edge-thickness-normal {
|
|
|
|
stroke-width: 2px;
|
|
|
|
}
|
|
|
|
.edge-thickness-thick {
|
|
|
|
stroke-width: 3.5px
|
|
|
|
}
|
|
|
|
.edge-pattern-solid {
|
|
|
|
stroke-dasharray: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.edge-pattern-dashed{
|
|
|
|
stroke-dasharray: 3;
|
|
|
|
}
|
|
|
|
.edge-pattern-dotted {
|
|
|
|
stroke-dasharray: 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
.marker {
|
|
|
|
fill: ${options.lineColor};
|
2022-02-10 20:32:21 +01:00
|
|
|
stroke: ${options.lineColor};
|
2020-07-16 20:27:42 +02:00
|
|
|
}
|
|
|
|
.marker.cross {
|
|
|
|
stroke: ${options.lineColor};
|
|
|
|
}
|
|
|
|
|
|
|
|
svg {
|
2020-07-17 15:57:02 +02:00
|
|
|
font-family: ${options.fontFamily};
|
|
|
|
font-size: ${options.fontSize};
|
2020-07-16 20:27:42 +02:00
|
|
|
}
|
|
|
|
|
2020-07-16 23:39:38 +02:00
|
|
|
${themes[type](options)}
|
2020-07-16 20:27:42 +02:00
|
|
|
|
|
|
|
${userStyles}
|
|
|
|
`;
|
2020-07-19 15:02:53 +02:00
|
|
|
};
|
2020-07-16 20:27:42 +02:00
|
|
|
|
|
|
|
export default getStyles;
|