Skip to content

Commit

Permalink
Merge pull request #3051 from mermaid-js/3050_setTitle_rename
Browse files Browse the repository at this point in the history
#3050 Renaming setTitle to setAccTitle
  • Loading branch information
knsv committed May 17, 2022
2 parents 3cb37ab + a387852 commit 0fd1156
Show file tree
Hide file tree
Showing 26 changed files with 42 additions and 60 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.json
Expand Up @@ -15,9 +15,9 @@
},
"extends": [
"eslint:recommended",
"plugin:jsdoc/recommended",
//"plugin:jsdoc/recommended",
"plugin:json/recommended",
"plugin:markdown/recommended",
// "plugin:markdown/recommended",
"plugin:prettier/recommended"
],
"plugins": ["html", "jest", "jsdoc", "json", "prettier"],
Expand Down
4 changes: 2 additions & 2 deletions src/commonDb.js
Expand Up @@ -9,7 +9,7 @@ export const clear = function () {
description = '';
};

export const setTitle = function (txt) {
export const setAccTitle = function (txt) {
title = sanitizeText(txt).replace(/^\s+/g, '');
};

Expand All @@ -26,7 +26,7 @@ export const getAccDescription = function () {
};

export default {
setTitle,
setAccTitle,
getTitle,
getAccDescription,
setAccDescription,
Expand Down
4 changes: 2 additions & 2 deletions src/diagrams/class/classDb.js
Expand Up @@ -5,7 +5,7 @@ import common from '../common/common';
import utils from '../../utils';
import mermaidAPI from '../../mermaidAPI';
import {
setTitle,
setAccTitle,
getTitle,
getAccDescription,
setAccDescription,
Expand Down Expand Up @@ -355,7 +355,7 @@ const setDirection = (dir) => {

export default {
parseDirective,
setTitle,
setAccTitle,
getTitle,
getAccDescription,
setAccDescription,
Expand Down
2 changes: 1 addition & 1 deletion src/diagrams/class/parser/classDiagram.jison
Expand Up @@ -263,7 +263,7 @@ statement
| cssClassStatement
| directive
| direction
| acc_title acc_title_value { $$=$2.trim();yy.setTitle($$); }
| acc_title acc_title_value { $$=$2.trim();yy.setAccTitle($$); }
| acc_descr acc_descr_value { $$=$2.trim();yy.setAccDescription($$); }
| acc_descr_multiline_value { $$=$1.trim();yy.setAccDescription($$); }
;
Expand Down
4 changes: 2 additions & 2 deletions src/diagrams/er/erDb.js
Expand Up @@ -3,7 +3,7 @@ import mermaidAPI from '../../mermaidAPI';
import * as configApi from '../../config';
import common from '../common/common';
import {
setTitle,
setAccTitle,
getTitle,
getAccDescription,
setAccDescription,
Expand Down Expand Up @@ -93,7 +93,7 @@ export default {
addRelationship,
getRelationships,
clear,
setTitle,
setAccTitle,
getTitle,
setAccDescription,
getAccDescription,
Expand Down
4 changes: 2 additions & 2 deletions src/diagrams/er/parser/erDiagram.jison
Expand Up @@ -94,8 +94,8 @@ statement
}
| entityName BLOCK_START BLOCK_STOP { yy.addEntity($1); }
| entityName { yy.addEntity($1); }
| title title_value { $$=$2.trim();yy.setTitle($$); }
| acc_title acc_title_value { $$=$2.trim();yy.setTitle($$); }
| title title_value { $$=$2.trim();yy.setAccTitle($$); }
| acc_title acc_title_value { $$=$2.trim();yy.setAccTitle($$); }
| acc_descr acc_descr_value { $$=$2.trim();yy.setAccDescription($$); }
| acc_descr_multiline_value { $$=$1.trim();yy.setAccDescription($$); }
;
Expand Down
4 changes: 2 additions & 2 deletions src/diagrams/flowchart/flowDb.js
Expand Up @@ -5,7 +5,7 @@ import common from '../common/common';
import mermaidAPI from '../../mermaidAPI';
import { log } from '../../logger';
import {
setTitle,
setAccTitle,
getTitle,
getAccDescription,
setAccDescription,
Expand Down Expand Up @@ -746,7 +746,7 @@ const makeUniq = (sg, allSubgraphs) => {
export default {
parseDirective,
defaultConfig: () => configApi.defaultConfig.flowchart,
setTitle,
setAccTitle,
getTitle,
getAccDescription,
setAccDescription,
Expand Down
2 changes: 1 addition & 1 deletion src/diagrams/flowchart/parser/flow.jison
Expand Up @@ -348,7 +348,7 @@ statement
| subgraph separator document end
{$$=yy.addSubGraph(undefined,$3,undefined);}
| direction
| acc_title acc_title_value { $$=$2.trim();yy.setTitle($$); }
| acc_title acc_title_value { $$=$2.trim();yy.setAccTitle($$); }
| acc_descr acc_descr_value { $$=$2.trim();yy.setAccDescription($$); }
| acc_descr_multiline_value { $$=$1.trim();yy.setAccDescription($$); }
;
Expand Down
4 changes: 2 additions & 2 deletions src/diagrams/gantt/ganttDb.js
Expand Up @@ -6,7 +6,7 @@ import utils from '../../utils';
import mermaidAPI from '../../mermaidAPI';
import common from '../common/common';
import {
setTitle,
setAccTitle,
getTitle,
getAccDescription,
setAccDescription,
Expand Down Expand Up @@ -641,7 +641,7 @@ export default {
getAxisFormat,
setTodayMarker,
getTodayMarker,
setTitle,
setAccTitle,
getTitle,
setAccDescription,
getAccDescription,
Expand Down
2 changes: 1 addition & 1 deletion src/diagrams/gantt/ganttDb.spec.js
Expand Up @@ -177,7 +177,7 @@ describe('when using the ganttDb', function () {
});

it('should maintain the order in which tasks are created', function () {
ganttDb.setTitle('Project Execution');
ganttDb.setAccTitle('Project Execution');
ganttDb.setDateFormat('YYYY-MM-DD');
ganttDb.addSection('section A section');
ganttDb.addTask('Completed task', 'done, des1, 2014-01-06,2014-01-08');
Expand Down
4 changes: 2 additions & 2 deletions src/diagrams/gantt/parser/gantt.jison
Expand Up @@ -128,8 +128,8 @@ statement
| excludes {yy.setExcludes($1.substr(9));$$=$1.substr(9);}
| includes {yy.setIncludes($1.substr(9));$$=$1.substr(9);}
| todayMarker {yy.setTodayMarker($1.substr(12));$$=$1.substr(12);}
| title {yy.setTitle($1.substr(6));$$=$1.substr(6);}
| acc_title acc_title_value { $$=$2.trim();yy.setTitle($$); }
| title {yy.setAccTitle($1.substr(6));$$=$1.substr(6);}
| acc_title acc_title_value { $$=$2.trim();yy.setAccTitle($$); }
| acc_descr acc_descr_value { $$=$2.trim();yy.setAccDescription($$); }
| acc_descr_multiline_value { $$=$1.trim();yy.setAccDescription($$); } | section {yy.addSection($1.substr(8));$$=$1.substr(8);}
| clickStatement
Expand Down
5 changes: 3 additions & 2 deletions src/diagrams/git/gitGraphAst.js
Expand Up @@ -5,7 +5,7 @@ import * as configApi from '../../config';
import { getConfig } from '../../config';
import common from '../common/common';
import {
setTitle,
setAccTitle,
getTitle,
getAccDescription,
setAccDescription,
Expand All @@ -25,6 +25,7 @@ let direction = 'LR';
let seq = 0;

function getId() {
// eslint-disable-line
return random({ length: 7 });
}

Expand Down Expand Up @@ -411,7 +412,7 @@ export default {
getCurrentBranch,
getDirection,
getHead,
setTitle,
setAccTitle,
getTitle,
getAccDescription,
setAccDescription,
Expand Down
2 changes: 1 addition & 1 deletion src/diagrams/git/parser/gitGraph.jison
Expand Up @@ -102,7 +102,7 @@ line
statement
: commitStatement
| mergeStatement
| acc_title acc_title_value { $$=$2.trim();yy.setTitle($$); }
| acc_title acc_title_value { $$=$2.trim();yy.setAccTitle($$); }
| acc_descr acc_descr_value { $$=$2.trim();yy.setAccDescription($$); }
| acc_descr_multiline_value { $$=$1.trim();yy.setAccDescription($$); } | section {yy.addSection($1.substr(8));$$=$1.substr(8);}
| branchStatement
Expand Down
2 changes: 1 addition & 1 deletion src/diagrams/pie/parser/pie.jison
Expand Up @@ -70,7 +70,7 @@ statement
:
| txt value { yy.addSection($1,yy.cleanupValue($2)); }
| title title_value { $$=$2.trim();yy.setPieTitle($$); }
| acc_title acc_title_value { $$=$2.trim();yy.setTitle($$); }
| acc_title acc_title_value { $$=$2.trim();yy.setAccTitle($$); }
| acc_descr acc_descr_value { $$=$2.trim();yy.setAccDescription($$); }
| acc_descr_multiline_value { $$=$1.trim();yy.setAccDescription($$); } | section {yy.addSection($1.substr(8));$$=$1.substr(8);}
| directive
Expand Down
4 changes: 2 additions & 2 deletions src/diagrams/pie/pieDb.js
Expand Up @@ -3,7 +3,7 @@ import mermaidAPI from '../../mermaidAPI';
import * as configApi from '../../config';
import common from '../common/common';
import {
setTitle,
setAccTitle,
getTitle,
getAccDescription,
setAccDescription,
Expand Down Expand Up @@ -68,7 +68,7 @@ export default {
getSections,
cleanupValue,
clear,
setTitle,
setAccTitle,
getTitle,
setPieTitle,
getPieTitle,
Expand Down
2 changes: 1 addition & 1 deletion src/diagrams/requirement/parser/requirementDiagram.jison
Expand Up @@ -101,7 +101,7 @@ start
directive
: openDirective typeDirective closeDirective
| openDirective typeDirective ':' argDirective closeDirective
| acc_title acc_title_value { $$=$2.trim();yy.setTitle($$); }
| acc_title acc_title_value { $$=$2.trim();yy.setAccTitle($$); }
| acc_descr acc_descr_value { $$=$2.trim();yy.setAccDescription($$); }
| acc_descr_multiline_value { $$=$1.trim();yy.setAccDescription($$); }
;
Expand Down
4 changes: 2 additions & 2 deletions src/diagrams/requirement/requirementDb.js
Expand Up @@ -3,7 +3,7 @@ import { log } from '../../logger';
import mermaidAPI from '../../mermaidAPI';
import common from '../common/common';
import {
setTitle,
setAccTitle,
getTitle,
getAccDescription,
setAccDescription,
Expand Down Expand Up @@ -162,7 +162,7 @@ export default {
setNewReqText,
setNewReqRisk,
setNewReqVerifyMethod,
setTitle,
setAccTitle,
getTitle,
setAccDescription,
getAccDescription,
Expand Down
2 changes: 1 addition & 1 deletion src/diagrams/sequence/parser/sequenceDiagram.jison
Expand Up @@ -138,7 +138,7 @@ statement
| details_statement 'NEWLINE'
| title {yy.setDiagramTitle($1.substring(6));$$=$1.substring(6);}
| legacy_title {yy.setDiagramTitle($1.substring(7));$$=$1.substring(7);}
| acc_title acc_title_value { $$=$2.trim();yy.setTitle($$); }
| acc_title acc_title_value { $$=$2.trim();yy.setAccTitle($$); }
| acc_descr acc_descr_value { $$=$2.trim();yy.setAccDescription($$); }
| acc_descr_multiline_value { $$=$1.trim();yy.setAccDescription($$); }
| 'loop' restOfLine document end
Expand Down
8 changes: 4 additions & 4 deletions src/diagrams/sequence/sequenceDb.js
Expand Up @@ -3,7 +3,7 @@ import * as configApi from '../../config';
import { log } from '../../logger';
import { sanitizeText } from '../common/common';
import {
setTitle,
setAccTitle,
getTitle,
getAccDescription,
setAccDescription,
Expand Down Expand Up @@ -417,8 +417,8 @@ export const apply = function (param) {
case 'altEnd':
addSignal(undefined, undefined, undefined, param.signalType);
break;
case 'setTitle':
setTitle(param.text);
case 'setAccTitle':
setAccTitle(param.text);
break;
case 'parStart':
addSignal(undefined, undefined, param.parText, param.signalType);
Expand Down Expand Up @@ -460,7 +460,7 @@ export default {
ARROWTYPE,
PLACEMENT,
addNote,
setTitle,
setAccTitle,
setDiagramTitle,
apply,
setAccDescription,
Expand Down
2 changes: 1 addition & 1 deletion src/diagrams/state/parser/stateDiagram.jison
Expand Up @@ -204,7 +204,7 @@ statement
| note NOTE_TEXT AS ID
| directive
| direction
| acc_title acc_title_value { $$=$2.trim();yy.setTitle($$); }
| acc_title acc_title_value { $$=$2.trim();yy.setAccTitle($$); }
| acc_descr acc_descr_value { $$=$2.trim();yy.setAccDescription($$); }
| acc_descr_multiline_value { $$=$1.trim();yy.setAccDescription($$); } ;

Expand Down
4 changes: 2 additions & 2 deletions src/diagrams/state/stateDb.js
Expand Up @@ -4,7 +4,7 @@ import mermaidAPI from '../../mermaidAPI';
import common from '../common/common';
import * as configApi from '../../config';
import {
setTitle,
setAccTitle,
getTitle,
getAccDescription,
setAccDescription,
Expand Down Expand Up @@ -294,7 +294,7 @@ export default {
extract,
trimColon,
getTitle,
setTitle,
setAccTitle,
getAccDescription,
setAccDescription,
};
4 changes: 2 additions & 2 deletions src/diagrams/user-journey/journeyDb.js
Expand Up @@ -2,7 +2,7 @@ import mermaidAPI from '../../mermaidAPI';
import * as configApi from '../../config';
import common from '../common/common';
import {
setTitle,
setAccTitle,
getTitle,
getAccDescription,
setAccDescription,
Expand Down Expand Up @@ -126,7 +126,7 @@ export default {
parseDirective,
getConfig: () => configApi.getConfig().journey,
clear,
setTitle,
setAccTitle,
getTitle,
setAccDescription,
getAccDescription,
Expand Down
2 changes: 1 addition & 1 deletion src/diagrams/user-journey/journeyDb.spec.js
Expand Up @@ -43,7 +43,7 @@ describe('when using the journeyDb', function () {
});

describe('tasks and actors should be added', function () {
journeyDb.setTitle('Shopping');
journeyDb.setAccTitle('Shopping');
journeyDb.setAccDescription('A user journey for family shopping');
journeyDb.addSection('Journey to the shops');
journeyDb.addTask('Get car keys', ':5:Dad');
Expand Down
4 changes: 2 additions & 2 deletions src/diagrams/user-journey/parser/journey.jison
Expand Up @@ -73,8 +73,8 @@ directive
;

statement
: title {yy.setTitle($1.substr(6));$$=$1.substr(6);}
| acc_title acc_title_value { $$=$2.trim();yy.setTitle($$); }
: title {yy.setAccTitle($1.substr(6));$$=$1.substr(6);}
| acc_title acc_title_value { $$=$2.trim();yy.setAccTitle($$); }
| acc_descr acc_descr_value { $$=$2.trim();yy.setAccDescription($$); }
| acc_descr_multiline_value { $$=$1.trim();yy.setAccDescription($$); }
| section {yy.addSection($1.substr(8));$$=$1.substr(8);}
Expand Down
1 change: 0 additions & 1 deletion src/styles.js
Expand Up @@ -31,7 +31,6 @@ const themes = {
export const calcThemeVariables = (theme, userOverRides) => theme.calcColors(userOverRides);

const getStyles = (type, userStyles, options) => {
//console.warn('options in styles: ', options);
return ` {
font-family: ${options.fontFamily};
font-size: ${options.fontSize};
Expand Down
18 changes: 0 additions & 18 deletions src/themes/theme-base.js
Expand Up @@ -10,33 +10,15 @@ class Theme {
this.background = '#f4f4f4';
this.darkMode = false;

// this.background = '#0c0c0c';
// this.darkMode = true;
this.primaryColor = '#fff4dd';
// this.background = '#0c0c0c';
// this.primaryColor = '#1f1f00';

this.noteBkgColor = '#fff5ad';
this.noteTextColor = '#333';

// dark

// this.primaryColor = '#034694';
// this.primaryColor = '#f2ee7e';
// this.primaryColor = '#9f33be';
// this.primaryColor = '#f0fff0';
// this.primaryColor = '#fa255e';
// this.primaryColor = '#ECECFF';

// this.secondaryColor = '#c39ea0';
// this.tertiaryColor = '#f8e5e5';

// this.secondaryColor = '#dfdfde';
// this.tertiaryColor = '#CCCCFF';

this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
this.fontSize = '16px';
// this.updateColors();
}
updateColors() {
// The || is to make sure that if the variable has been defiend by a user override that value is to be used
Expand Down

0 comments on commit 0fd1156

Please sign in to comment.