New release

This commit is contained in:
knsv 2015-06-21 17:26:19 +02:00
parent 50219cf2d9
commit 0dc983d04a
13 changed files with 125 additions and 62 deletions

12
dist/mermaid.css vendored
View File

@ -15,10 +15,10 @@
stroke: #333333;
}
.cluster rect {
fill: #ffffde;
rx: 40;
stroke: #aaaa33;
stroke-width: 1px;
fill: #ffffde !important;
rx: 4 !important;
stroke: #aaaa33 !important;
stroke-width: 1px !important;
}
.cluster text {
fill: #333333;
@ -254,3 +254,7 @@ text {
font-family: 'trebuchet ms', verdana, arial;
font-size: 14px;
}
.mermaid {
width:1200px;
}

View File

@ -17,10 +17,10 @@
stroke-width: 1.5px;
}
.cluster rect {
fill: #cdffb2;
rx: 4;
stroke: #6eaa49;
stroke-width: 1px;
fill: #cdffb2 !important;
rx: 4 !important;
stroke: #6eaa49 !important;
stroke-width: 1px !important;
}
.cluster text {
fill: #333333;

28
dist/mermaid.js vendored
View File

@ -24950,7 +24950,7 @@ process.chdir = function (dir) {
},{}],86:[function(require,module,exports){
module.exports={
"name": "mermaid",
"version": "0.5.0",
"version": "0.5.1",
"description": "Markdownish syntax for generating flowcharts, sequence diagrams and gantt charts.",
"main": "src/mermaid.js",
"keywords": [
@ -25035,7 +25035,7 @@ module.exports={
"marked": "^0.3.2",
"mock-browser": "^0.90.27",
"path": "^0.4.9",
"phantomjs": "^1.9.12",
"phantomjs": "^1.9.17",
"proxyquire": "^1.3.1",
"require-dir": "^0.3.0",
"rewire": "^2.1.3",
@ -26467,6 +26467,7 @@ exports.getClasses = function (text, isDot) {
if(typeof(classes.default) === 'undefined') {
classes.default = {id:'default'};
classes.default.styles = ['fill:#ffa','stroke:#666','stroke-width:3px'];
classes.default.clusterStyles = ['rx:4px','fill: rgb(255, 255, 222)','rx: 4px','stroke: rgb(170, 170, 51)','stroke-width: 1px'];
classes.default.nodeLabelStyles = ['fill:#000','stroke:none','font-weight:300','font-family:"Helvetica Neue",Helvetica,Arial,sans-serf','font-size:14px'];
classes.default.edgeLabelStyles = ['fill:#000','stroke:none','font-weight:300','font-family:"Helvetica Neue",Helvetica,Arial,sans-serf','font-size:14px'];
}
@ -28800,7 +28801,7 @@ var getStartDate = function(prevTime, dateFormat, str){
}else{
console.log('Invalid date:'+str);
console.log('With date format:'+dateFormat.trim());
console.log('----');
//console.log('----');
}
// Default date - now
@ -28978,16 +28979,18 @@ var w;
module.exports.draw = function (text, id) {
gantt.yy.clear();
gantt.parse(text);
var elem = document.getElementById(id);
w = elem.parentElement.offsetWidth;
console.log('id='+id,' w='+w);
console.log(elem.parentElement);
if (typeof w === 'undefined') {
w = 1200;
}
if(typeof conf.useWidth !== 'undefined'){
w = conf.useWidth;
}
var taskArray = gantt.yy.getTasks();
// Set height based on number of tasks
@ -29035,6 +29038,10 @@ module.exports.draw = function (text, id) {
makeGant(taskArray, w, h);
if(typeof conf.useWidth !== 'undefined'){
elem.setAttribute('width', w);
}
var title = svg.append("text")
.text(gantt.yy.getTitle())
@ -31096,7 +31103,6 @@ var drawMessage = function(elem, startx, stopx, verticalPos, msg){
textWidth = textElem[0][0].getBBox().width;
}
else{
console.log(textElem[0][0].getBoundingClientRect());
//textWidth = getBBox(textElem).width; //.getComputedTextLength()
textWidth = textElem[0][0].getBoundingClientRect();
//textWidth = textElem[0][0].getComputedTextLength();
@ -31597,8 +31603,13 @@ var init = function () {
if(typeof mermaid_config !== 'undefined'){
mermaidAPI.initialize(mermaid_config);
}
if(typeof mermaid.ganttConfig !== 'undefined'){
mermaidAPI.initialize({gantt:mermaid.ganttConfig});
}
var insertSvg = function(svgCode){
element.innerHTML = svgCode;
};
@ -32084,6 +32095,9 @@ module.exports.cloneCssStyles = function(svg, classes){
if (classes.default.edgeLabelStyles instanceof Array) {
defaultStyles += "#" + svg.id.trim() + ' .edgeLabel text ' + ' { ' + classes[className].edgeLabelStyles.join("; ") + '; }\n';
}
if (classes.default.clusterStyles instanceof Array) {
defaultStyles += "#" + svg.id.trim() + ' .cluster rect ' + ' { ' + classes[className].clusterStyles.join("; ") + '; }\n';
}
} else {
if (classes[className].styles instanceof Array) {
embeddedStyles += "#" + svg.id.trim() + ' .' + className + ' { ' + classes[className].styles.join("; ") + '; }\n';

6
dist/mermaid.min.js vendored

File diff suppressed because one or more lines are too long

28
dist/mermaid.slim.js vendored
View File

@ -15734,7 +15734,7 @@ process.chdir = function (dir) {
},{}],85:[function(require,module,exports){
module.exports={
"name": "mermaid",
"version": "0.5.0",
"version": "0.5.1",
"description": "Markdownish syntax for generating flowcharts, sequence diagrams and gantt charts.",
"main": "src/mermaid.js",
"keywords": [
@ -15819,7 +15819,7 @@ module.exports={
"marked": "^0.3.2",
"mock-browser": "^0.90.27",
"path": "^0.4.9",
"phantomjs": "^1.9.12",
"phantomjs": "^1.9.17",
"proxyquire": "^1.3.1",
"require-dir": "^0.3.0",
"rewire": "^2.1.3",
@ -17251,6 +17251,7 @@ exports.getClasses = function (text, isDot) {
if(typeof(classes.default) === 'undefined') {
classes.default = {id:'default'};
classes.default.styles = ['fill:#ffa','stroke:#666','stroke-width:3px'];
classes.default.clusterStyles = ['rx:4px','fill: rgb(255, 255, 222)','rx: 4px','stroke: rgb(170, 170, 51)','stroke-width: 1px'];
classes.default.nodeLabelStyles = ['fill:#000','stroke:none','font-weight:300','font-family:"Helvetica Neue",Helvetica,Arial,sans-serf','font-size:14px'];
classes.default.edgeLabelStyles = ['fill:#000','stroke:none','font-weight:300','font-family:"Helvetica Neue",Helvetica,Arial,sans-serf','font-size:14px'];
}
@ -19584,7 +19585,7 @@ var getStartDate = function(prevTime, dateFormat, str){
}else{
console.log('Invalid date:'+str);
console.log('With date format:'+dateFormat.trim());
console.log('----');
//console.log('----');
}
// Default date - now
@ -19762,16 +19763,18 @@ var w;
module.exports.draw = function (text, id) {
gantt.yy.clear();
gantt.parse(text);
var elem = document.getElementById(id);
w = elem.parentElement.offsetWidth;
console.log('id='+id,' w='+w);
console.log(elem.parentElement);
if (typeof w === 'undefined') {
w = 1200;
}
if(typeof conf.useWidth !== 'undefined'){
w = conf.useWidth;
}
var taskArray = gantt.yy.getTasks();
// Set height based on number of tasks
@ -19819,6 +19822,10 @@ module.exports.draw = function (text, id) {
makeGant(taskArray, w, h);
if(typeof conf.useWidth !== 'undefined'){
elem.setAttribute('width', w);
}
var title = svg.append("text")
.text(gantt.yy.getTitle())
@ -21880,7 +21887,6 @@ var drawMessage = function(elem, startx, stopx, verticalPos, msg){
textWidth = textElem[0][0].getBBox().width;
}
else{
console.log(textElem[0][0].getBoundingClientRect());
//textWidth = getBBox(textElem).width; //.getComputedTextLength()
textWidth = textElem[0][0].getBoundingClientRect();
//textWidth = textElem[0][0].getComputedTextLength();
@ -22381,8 +22387,13 @@ var init = function () {
if(typeof mermaid_config !== 'undefined'){
mermaidAPI.initialize(mermaid_config);
}
if(typeof mermaid.ganttConfig !== 'undefined'){
mermaidAPI.initialize({gantt:mermaid.ganttConfig});
}
var insertSvg = function(svgCode){
element.innerHTML = svgCode;
};
@ -22868,6 +22879,9 @@ module.exports.cloneCssStyles = function(svg, classes){
if (classes.default.edgeLabelStyles instanceof Array) {
defaultStyles += "#" + svg.id.trim() + ' .edgeLabel text ' + ' { ' + classes[className].edgeLabelStyles.join("; ") + '; }\n';
}
if (classes.default.clusterStyles instanceof Array) {
defaultStyles += "#" + svg.id.trim() + ' .cluster rect ' + ' { ' + classes[className].clusterStyles.join("; ") + '; }\n';
}
} else {
if (classes[className].styles instanceof Array) {
embeddedStyles += "#" + svg.id.trim() + ' .' + className + ' { ' + classes[className].styles.join("; ") + '; }\n';

File diff suppressed because one or more lines are too long

23
dist/mermaidAPI.js vendored
View File

@ -24617,7 +24617,7 @@ process.chdir = function (dir) {
},{}],85:[function(require,module,exports){
module.exports={
"name": "mermaid",
"version": "0.5.0",
"version": "0.5.1",
"description": "Markdownish syntax for generating flowcharts, sequence diagrams and gantt charts.",
"main": "src/mermaid.js",
"keywords": [
@ -24702,7 +24702,7 @@ module.exports={
"marked": "^0.3.2",
"mock-browser": "^0.90.27",
"path": "^0.4.9",
"phantomjs": "^1.9.12",
"phantomjs": "^1.9.17",
"proxyquire": "^1.3.1",
"require-dir": "^0.3.0",
"rewire": "^2.1.3",
@ -26134,6 +26134,7 @@ exports.getClasses = function (text, isDot) {
if(typeof(classes.default) === 'undefined') {
classes.default = {id:'default'};
classes.default.styles = ['fill:#ffa','stroke:#666','stroke-width:3px'];
classes.default.clusterStyles = ['rx:4px','fill: rgb(255, 255, 222)','rx: 4px','stroke: rgb(170, 170, 51)','stroke-width: 1px'];
classes.default.nodeLabelStyles = ['fill:#000','stroke:none','font-weight:300','font-family:"Helvetica Neue",Helvetica,Arial,sans-serf','font-size:14px'];
classes.default.edgeLabelStyles = ['fill:#000','stroke:none','font-weight:300','font-family:"Helvetica Neue",Helvetica,Arial,sans-serf','font-size:14px'];
}
@ -28467,7 +28468,7 @@ var getStartDate = function(prevTime, dateFormat, str){
}else{
console.log('Invalid date:'+str);
console.log('With date format:'+dateFormat.trim());
console.log('----');
//console.log('----');
}
// Default date - now
@ -28645,16 +28646,18 @@ var w;
module.exports.draw = function (text, id) {
gantt.yy.clear();
gantt.parse(text);
var elem = document.getElementById(id);
w = elem.parentElement.offsetWidth;
console.log('id='+id,' w='+w);
console.log(elem.parentElement);
if (typeof w === 'undefined') {
w = 1200;
}
if(typeof conf.useWidth !== 'undefined'){
w = conf.useWidth;
}
var taskArray = gantt.yy.getTasks();
// Set height based on number of tasks
@ -28702,6 +28705,10 @@ module.exports.draw = function (text, id) {
makeGant(taskArray, w, h);
if(typeof conf.useWidth !== 'undefined'){
elem.setAttribute('width', w);
}
var title = svg.append("text")
.text(gantt.yy.getTitle())
@ -30763,7 +30770,6 @@ var drawMessage = function(elem, startx, stopx, verticalPos, msg){
textWidth = textElem[0][0].getBBox().width;
}
else{
console.log(textElem[0][0].getBoundingClientRect());
//textWidth = getBBox(textElem).width; //.getComputedTextLength()
textWidth = textElem[0][0].getBoundingClientRect();
//textWidth = textElem[0][0].getComputedTextLength();
@ -31572,6 +31578,9 @@ module.exports.cloneCssStyles = function(svg, classes){
if (classes.default.edgeLabelStyles instanceof Array) {
defaultStyles += "#" + svg.id.trim() + ' .edgeLabel text ' + ' { ' + classes[className].edgeLabelStyles.join("; ") + '; }\n';
}
if (classes.default.clusterStyles instanceof Array) {
defaultStyles += "#" + svg.id.trim() + ' .cluster rect ' + ' { ' + classes[className].clusterStyles.join("; ") + '; }\n';
}
} else {
if (classes[className].styles instanceof Array) {
embeddedStyles += "#" + svg.id.trim() + ' .' + className + ' { ' + classes[className].styles.join("; ") + '; }\n';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -42,9 +42,13 @@ var page = webpage.create()
}
, log = logger(options.verbose)
// If no css is suuplied make sure a fixed witdth is given to the gant renderer
if(phantom.args[3] !== ''){
options.ganttConfig.useWidth = 1200;
}
console.log('options');
console.log(phantom.args.length);
//console.log('options');
//console.log(options.css);
page.content = [
'<html>'
@ -68,9 +72,7 @@ files.forEach(function(file) {
, oParser = new DOMParser()
, oDOM
, svgContent
, allElements
console.log('Gantconfig: '+options.ganttConfig);
, allElements;
// this JS is executed in this statement is sandboxed, even though it doesn't
// look like it. we need to serialize then unserialize the svgContent that's
@ -102,7 +104,7 @@ files.forEach(function(file) {
}
if (options.svg) {
var serialize = new XMLSerializer()
var serialize = new XMLSerializer();
fs.write(
options.outputDir + fs.separator + filename + '.svg'
, serialize.serializeToString(oDOM)
@ -239,13 +241,22 @@ function executeInPage(data) {
document.body.appendChild(sc)
}else{
console.log('NO gantt config');
sc = document.createElement("script")
scContent = document.createTextNode('mermaid.ganttConfig = {useWidth:1200};')
sc.appendChild(scContent)
document.body.appendChild(sc)
}
mermaid.initialize({
sequenceDiagram:{useMaxWidth:false}
});
mermaid.init();
svg = document.querySelector('svg')
svgValue = xmlSerializer.serializeToString(svg)
//console.log(document.body.outerHTML);
return svgValue
}

View File

@ -1,6 +1,6 @@
{
"name": "mermaid",
"version": "0.5.0",
"version": "0.5.1",
"description": "Markdownish syntax for generating flowcharts, sequence diagrams and gantt charts.",
"main": "src/mermaid.js",
"keywords": [
@ -85,7 +85,7 @@
"marked": "^0.3.2",
"mock-browser": "^0.90.27",
"path": "^0.4.9",
"phantomjs": "^1.9.12",
"phantomjs": "^1.9.17",
"proxyquire": "^1.3.1",
"require-dir": "^0.3.0",
"rewire": "^2.1.3",

View File

@ -3,7 +3,9 @@ body {
background: #fcfcfe;
font-family: Helvetica;
}
.mermaid {
/* width:400px;*/
}
.actor {
stroke: #CCCCFF;
fill: #ECECFF;

View File

@ -25,8 +25,8 @@
}
</style>
<lnk rel="stylesheet" href="seq.css"/>
<lnk rel="stylesheet" href="https://raw.githubusercontent.com/knsv/mermaid/master/dist/mermaid.forest.css"/>
<link rel="stylesheet" href="../dist/mermaid.css"/>
<lnk rel="stylesheet" href="https://raw.githubusercontent.com/knsv/mermaid/master/dist/mermaid.fores.css"/>
<link rel="stylesheet" href="../dist/mermaid.forest.css"/>
</head>
<body>
<h1>Issue 141</h1>
@ -259,7 +259,7 @@ graph LR;
a -- e;
}
</pre>
<div class="mermaid2">
<div class="mermaid">
digraph
{
a -> b -> c -- d -> e;