mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
New version
This commit is contained in:
parent
8258fb059c
commit
a611ff3abd
12
dist/mermaid.js
vendored
12
dist/mermaid.js
vendored
@ -38070,6 +38070,15 @@ exports.version = function(){
|
||||
exports.encodeEntities = function(text){
|
||||
var txt = text;
|
||||
|
||||
txt = txt.replace(/style.*:\S*#.*;/g,function(s,t,u){
|
||||
var innerTxt = s.substring(0,s.length-1);
|
||||
return innerTxt;
|
||||
});
|
||||
txt = txt.replace(/classDef.*:\S*#.*;/g,function(s,t,u){
|
||||
var innerTxt = s.substring(0,s.length-1);
|
||||
return innerTxt;
|
||||
});
|
||||
|
||||
txt = txt.replace(/#\w+\;/g,function(s,t,u){
|
||||
var innerTxt = s.substring(1,s.length-1);
|
||||
|
||||
@ -38150,7 +38159,7 @@ var render = function(id, txt, cb, container){
|
||||
.append('g');
|
||||
}
|
||||
|
||||
|
||||
window.txt = txt;
|
||||
txt = exports.encodeEntities(txt);
|
||||
//console.warn('mermaid encode: ');
|
||||
//console.warn(txt);
|
||||
@ -38160,6 +38169,7 @@ var render = function(id, txt, cb, container){
|
||||
var classes = {};
|
||||
switch(graphType){
|
||||
case 'graph':
|
||||
|
||||
flowRenderer.setConf(config.flowchart);
|
||||
flowRenderer.draw(txt, id, false);
|
||||
if(config.cloneCssStyles){
|
||||
|
4
dist/mermaid.min.js
vendored
4
dist/mermaid.min.js
vendored
File diff suppressed because one or more lines are too long
12
dist/mermaid.slim.js
vendored
12
dist/mermaid.slim.js
vendored
@ -28854,6 +28854,15 @@ exports.version = function(){
|
||||
exports.encodeEntities = function(text){
|
||||
var txt = text;
|
||||
|
||||
txt = txt.replace(/style.*:\S*#.*;/g,function(s,t,u){
|
||||
var innerTxt = s.substring(0,s.length-1);
|
||||
return innerTxt;
|
||||
});
|
||||
txt = txt.replace(/classDef.*:\S*#.*;/g,function(s,t,u){
|
||||
var innerTxt = s.substring(0,s.length-1);
|
||||
return innerTxt;
|
||||
});
|
||||
|
||||
txt = txt.replace(/#\w+\;/g,function(s,t,u){
|
||||
var innerTxt = s.substring(1,s.length-1);
|
||||
|
||||
@ -28934,7 +28943,7 @@ var render = function(id, txt, cb, container){
|
||||
.append('g');
|
||||
}
|
||||
|
||||
|
||||
window.txt = txt;
|
||||
txt = exports.encodeEntities(txt);
|
||||
//console.warn('mermaid encode: ');
|
||||
//console.warn(txt);
|
||||
@ -28944,6 +28953,7 @@ var render = function(id, txt, cb, container){
|
||||
var classes = {};
|
||||
switch(graphType){
|
||||
case 'graph':
|
||||
|
||||
flowRenderer.setConf(config.flowchart);
|
||||
flowRenderer.draw(txt, id, false);
|
||||
if(config.cloneCssStyles){
|
||||
|
4
dist/mermaid.slim.min.js
vendored
4
dist/mermaid.slim.min.js
vendored
File diff suppressed because one or more lines are too long
12
dist/mermaidAPI.js
vendored
12
dist/mermaidAPI.js
vendored
@ -37355,6 +37355,15 @@ exports.version = function(){
|
||||
exports.encodeEntities = function(text){
|
||||
var txt = text;
|
||||
|
||||
txt = txt.replace(/style.*:\S*#.*;/g,function(s,t,u){
|
||||
var innerTxt = s.substring(0,s.length-1);
|
||||
return innerTxt;
|
||||
});
|
||||
txt = txt.replace(/classDef.*:\S*#.*;/g,function(s,t,u){
|
||||
var innerTxt = s.substring(0,s.length-1);
|
||||
return innerTxt;
|
||||
});
|
||||
|
||||
txt = txt.replace(/#\w+\;/g,function(s,t,u){
|
||||
var innerTxt = s.substring(1,s.length-1);
|
||||
|
||||
@ -37435,7 +37444,7 @@ var render = function(id, txt, cb, container){
|
||||
.append('g');
|
||||
}
|
||||
|
||||
|
||||
window.txt = txt;
|
||||
txt = exports.encodeEntities(txt);
|
||||
//console.warn('mermaid encode: ');
|
||||
//console.warn(txt);
|
||||
@ -37445,6 +37454,7 @@ var render = function(id, txt, cb, container){
|
||||
var classes = {};
|
||||
switch(graphType){
|
||||
case 'graph':
|
||||
|
||||
flowRenderer.setConf(config.flowchart);
|
||||
flowRenderer.draw(txt, id, false);
|
||||
if(config.cloneCssStyles){
|
||||
|
14
dist/mermaidAPI.slim.js
vendored
14
dist/mermaidAPI.slim.js
vendored
File diff suppressed because one or more lines are too long
2
dist/mermaidAPI.slim.min.js
vendored
2
dist/mermaidAPI.slim.min.js
vendored
File diff suppressed because one or more lines are too long
53
dist/www/javascripts/lib/mermaid.js
vendored
53
dist/www/javascripts/lib/mermaid.js
vendored
@ -37451,6 +37451,7 @@ module.exports.mermaidAPI = mermaidAPI;
|
||||
* @param nodes a css selector or an array of nodes
|
||||
*/
|
||||
var init = function () {
|
||||
var conf= mermaidAPI.getConfig();
|
||||
log.debug('Starting rendering diagrams');
|
||||
var nodes;
|
||||
if(arguments.length >= 2){
|
||||
@ -37471,7 +37472,6 @@ var init = function () {
|
||||
callback = arguments[arguments.length-1];
|
||||
log.debug('Callback function found');
|
||||
}else{
|
||||
var conf= mermaidAPI.getConfig();
|
||||
if(typeof conf.mermaid !== 'undefined'){
|
||||
if(typeof conf.mermaid.callback === 'function'){
|
||||
callback = conf.mermaid.callback;
|
||||
@ -37775,10 +37775,12 @@ Logger.levels = {
|
||||
warn: 3,
|
||||
error: 4,
|
||||
fatal: 5,
|
||||
default:1
|
||||
default:5
|
||||
};
|
||||
|
||||
exports.create = function(type, options) {
|
||||
exports.setLogLevel = function(level){
|
||||
Logger.levels.default = level;
|
||||
}
|
||||
exports.create = function(options) {
|
||||
return new Logger(options);
|
||||
};
|
||||
}).call(this,_dereq_("1YiZ5S"))
|
||||
@ -37814,7 +37816,7 @@ var ganttParser = _dereq_('./diagrams/gantt/parser/gantt');
|
||||
var ganttDb = _dereq_('./diagrams/gantt/ganttDb');
|
||||
var d3 = _dereq_('./d3');
|
||||
var nextId = 0;
|
||||
var log = _dereq_('./logger').create();
|
||||
|
||||
|
||||
/**
|
||||
* ## Configuration
|
||||
@ -37828,6 +37830,15 @@ var log = _dereq_('./logger').create();
|
||||
* ```
|
||||
*/
|
||||
var config = {
|
||||
/**
|
||||
* logLevel , decides the amount of logging to be used.
|
||||
* * debug: 1
|
||||
* * info: 2
|
||||
* * warn: 3
|
||||
* * error: 4
|
||||
* * fatal: 5
|
||||
*/
|
||||
logLevel: 3,
|
||||
/**
|
||||
* **cloneCssStyles** - This options controls whether or not the css rules should be copied into the generated svg
|
||||
*/
|
||||
@ -38002,6 +38013,8 @@ var config = {
|
||||
}
|
||||
};
|
||||
|
||||
var log = _dereq_('./logger').create({level:config.logLevel});
|
||||
|
||||
/**
|
||||
* ## parse
|
||||
* Function that parses a mermaid diagram definition. If parsing fails the parseError callback is called and an error is
|
||||
@ -38057,7 +38070,14 @@ exports.version = function(){
|
||||
exports.encodeEntities = function(text){
|
||||
var txt = text;
|
||||
|
||||
txt = txt.replace(/#\w*;?/g,function(s,t,u){
|
||||
txt = txt.replace(/[style|classDef].*:\S*#.*;/g,function(s,t,u){
|
||||
|
||||
var innerTxt = s.substring(0,s.length-1);
|
||||
return innerTxt;
|
||||
|
||||
});
|
||||
|
||||
txt = txt.replace(/#\w+\;/g,function(s,t,u){
|
||||
var innerTxt = s.substring(1,s.length-1);
|
||||
|
||||
var isInt = /^\+?\d+$/.test(innerTxt);
|
||||
@ -38137,7 +38157,7 @@ var render = function(id, txt, cb, container){
|
||||
.append('g');
|
||||
}
|
||||
|
||||
|
||||
window.txt = txt;
|
||||
txt = exports.encodeEntities(txt);
|
||||
//console.warn('mermaid encode: ');
|
||||
//console.warn(txt);
|
||||
@ -38147,6 +38167,7 @@ var render = function(id, txt, cb, container){
|
||||
var classes = {};
|
||||
switch(graphType){
|
||||
case 'graph':
|
||||
|
||||
flowRenderer.setConf(config.flowchart);
|
||||
flowRenderer.draw(txt, id, false);
|
||||
if(config.cloneCssStyles){
|
||||
@ -38184,6 +38205,10 @@ var render = function(id, txt, cb, container){
|
||||
break;
|
||||
}
|
||||
|
||||
d3.select('#d'+id).selectAll('foreignobject div').attr('xmlns','http://www.w3.org/1999/xhtml');
|
||||
|
||||
|
||||
|
||||
// Fix for when the base tag is used
|
||||
var svgCode = d3.select('#d'+id).node().innerHTML.replace(/url\(#arrowhead/g,'url('+ window.location.protocol+'//'+location.host+location.pathname +'#arrowhead','g');
|
||||
|
||||
@ -38226,7 +38251,7 @@ var setConf = function(cnf){
|
||||
|
||||
var j;
|
||||
for(j=0;j<lvl2Keys.length;j++) {
|
||||
//log.debug('Setting conf ',lvl1Keys[i],'-',lvl2Keys[j]);
|
||||
log.debug('Setting conf ',lvl1Keys[i],'-',lvl2Keys[j]);
|
||||
if(typeof config[lvl1Keys[i]] === 'undefined'){
|
||||
|
||||
config[lvl1Keys[i]] = {};
|
||||
@ -38240,6 +38265,7 @@ var setConf = function(cnf){
|
||||
}
|
||||
};
|
||||
exports.initialize = function(options){
|
||||
log.debug('Initializing mermaidAPI');
|
||||
// Update default config with options supplied at initialization
|
||||
if(typeof options === 'object'){
|
||||
setConf(options);
|
||||
@ -38292,20 +38318,11 @@ var log = _dereq_('./logger').create();
|
||||
* @returns {string} A graph definition key
|
||||
*/
|
||||
module.exports.detectType = function(text,a){
|
||||
text = text.replace(/^\s*%%.*\n/g,'\n');
|
||||
if(text.match(/^\s*sequenceDiagram/)){
|
||||
return "sequenceDiagram";
|
||||
}
|
||||
|
||||
if(text.match(/^\s*sequence/)){
|
||||
/* ```mermaid
|
||||
graph TB
|
||||
a-->b
|
||||
b-->c
|
||||
```
|
||||
*/
|
||||
return "sequence";
|
||||
}
|
||||
|
||||
if(text.match(/^\s*digraph/)) {
|
||||
//log.debug('Detected dot syntax');
|
||||
return "dotGraph";
|
||||
|
@ -1,4 +1,5 @@
|
||||
var gulp = require('gulp');
|
||||
var bump = require('gulp-bump');
|
||||
|
||||
gulp.task('bump', function(){
|
||||
gulp.src('./bw.json')
|
||||
@ -28,7 +29,7 @@ gulp.task('tag', function() {
|
||||
|
||||
function inc(importance) {
|
||||
// get all the files to bump version in
|
||||
return gulp.src(['./package.json', './bower.json'])
|
||||
return gulp.src(['./package.json'])
|
||||
// bump the version number in those files
|
||||
.pipe(bump({type: importance}))
|
||||
// save it back to filesystem
|
||||
|
@ -227,13 +227,19 @@ function executeInPage(data) {
|
||||
el.appendChild(elContent)
|
||||
|
||||
document.body.appendChild(el)
|
||||
|
||||
if(typeof sequenceConfig !== undefined && sequenceConfig !== 'undefined'){
|
||||
sc = document.createElement("script")
|
||||
scContent = document.createTextNode('mermaid.sequenceConfig = JSON.parse(' + JSON.stringify(sequenceConfig) + ');')
|
||||
sc.appendChild(scContent)
|
||||
mermaid.initialize({
|
||||
sequenceDiagram:{useMaxWidth:false}
|
||||
});
|
||||
|
||||
document.body.appendChild(sc)
|
||||
if(typeof sequenceConfig !== undefined && sequenceConfig !== 'undefined'){
|
||||
//sc = document.createElement("script")
|
||||
//scContent = document.createTextNode('mermaid.sequenceConfig = JSON.parse(' + JSON.stringify(sequenceConfig) + ');')
|
||||
//sc.appendChild(scContent)
|
||||
|
||||
//document.body.appendChild(sc)
|
||||
mermaid.initialize({
|
||||
sequenceDiagram:JSON.parse(sequenceConfig)
|
||||
});
|
||||
}
|
||||
|
||||
if(typeof ganttConfig !== undefined && ganttConfig !== 'undefined'){
|
||||
@ -250,9 +256,7 @@ function executeInPage(data) {
|
||||
document.body.appendChild(sc)
|
||||
}
|
||||
|
||||
mermaid.initialize({
|
||||
sequenceDiagram:{useMaxWidth:false}
|
||||
});
|
||||
|
||||
mermaid.init();
|
||||
|
||||
svg = document.querySelector('svg')
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mermaid",
|
||||
"version": "0.5.1",
|
||||
"version": "0.5.2",
|
||||
"description": "Markdownish syntax for generating flowcharts, sequence diagrams and gantt charts.",
|
||||
"main": "src/mermaid.js",
|
||||
"keywords": [
|
||||
@ -15,8 +15,8 @@
|
||||
},
|
||||
"scripts": {
|
||||
"watch": "watchify src/mermaid.js -o dist/mermaid.js",
|
||||
"doc" : "rm -r build;rm -r dist/www;gulp vartree;cp dist/www/all.html ../mermaid-pages/index.html;cp dist/mermaid.js ../mermaid-pages/javascripts/lib;cp dist/mermaid.forest.css ../mermaid-pages/stylesheets",
|
||||
"test" : "./node_modules/.bin/gulp dist && ./node_modules/.bin/gulp test"
|
||||
"doc": "rm -r build;rm -r dist/www;gulp vartree;cp dist/www/all.html ../mermaid-pages/index.html;cp dist/mermaid.js ../mermaid-pages/javascripts/lib;cp dist/mermaid.forest.css ../mermaid-pages/stylesheets",
|
||||
"test": "./node_modules/.bin/gulp dist && ./node_modules/.bin/gulp test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -282,6 +282,15 @@ exports.version = function(){
|
||||
exports.encodeEntities = function(text){
|
||||
var txt = text;
|
||||
|
||||
txt = txt.replace(/style.*:\S*#.*;/g,function(s,t,u){
|
||||
var innerTxt = s.substring(0,s.length-1);
|
||||
return innerTxt;
|
||||
});
|
||||
txt = txt.replace(/classDef.*:\S*#.*;/g,function(s,t,u){
|
||||
var innerTxt = s.substring(0,s.length-1);
|
||||
return innerTxt;
|
||||
});
|
||||
|
||||
txt = txt.replace(/#\w+\;/g,function(s,t,u){
|
||||
var innerTxt = s.substring(1,s.length-1);
|
||||
|
||||
@ -362,7 +371,7 @@ var render = function(id, txt, cb, container){
|
||||
.append('g');
|
||||
}
|
||||
|
||||
|
||||
window.txt = txt;
|
||||
txt = exports.encodeEntities(txt);
|
||||
//console.warn('mermaid encode: ');
|
||||
//console.warn(txt);
|
||||
@ -372,6 +381,7 @@ var render = function(id, txt, cb, container){
|
||||
var classes = {};
|
||||
switch(graphType){
|
||||
case 'graph':
|
||||
|
||||
flowRenderer.setConf(config.flowchart);
|
||||
flowRenderer.draw(txt, id, false);
|
||||
if(config.cloneCssStyles){
|
||||
|
@ -27,14 +27,5 @@
|
||||
Ali#45;ce->>John: Hello John, how are you? #60;
|
||||
John-->>Alice: Great!#quot;
|
||||
</div>
|
||||
<div class="mermaid" id="i211">
|
||||
graph LR;
|
||||
A[Hard edge]-->|Link text|B(Round edge);
|
||||
B-->C{Decision};
|
||||
C-->|One|D[Result one];
|
||||
C-->|Two|E[Result two];
|
||||
classDef pink fill:#f9f,stroke:#333,stroke-width:4px;
|
||||
class C pink;
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -3,9 +3,10 @@
|
||||
"diagramMarginY": 10,
|
||||
"actorMargin": 50,
|
||||
"width": 150,
|
||||
"height": 165,
|
||||
"height": 15,
|
||||
"boxMargin": 10,
|
||||
"boxTextMargin": 5,
|
||||
"noteMargin": 10,
|
||||
"messageMargin": 35
|
||||
"messageMargin": 35,
|
||||
"mirrorActors":false
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
|
||||
<script src="../dist/mermaid.js"></script>
|
||||
<script src="../dist/mermaid.051.js"></script>
|
||||
<script>
|
||||
var config = {
|
||||
startOnLoad:true,
|
||||
@ -41,7 +41,7 @@
|
||||
graph LR
|
||||
|
||||
%% Example diagram
|
||||
A[Square Rect] -- Link text --> B((Circle))
|
||||
A[Square Rect] -- Link text --> B((Circle));
|
||||
A --> C(Round Rect)
|
||||
click A coolAction
|
||||
B --> D{Rhombus}
|
||||
@ -162,28 +162,20 @@
|
||||
class sq,e green
|
||||
class di orange
|
||||
</div>
|
||||
<div class="mermaid2">
|
||||
<div class="mermaid">
|
||||
graph TB
|
||||
subgraph
|
||||
subgraph f
|
||||
sq[Square shape]-->ci((Circle shape))
|
||||
od>Odd shape]---|Two line<br>edge comment|ro
|
||||
end
|
||||
subgraph
|
||||
od2>Really long text in an Odd shape]-->od3>Really long text with linebreak<br>in an Odd shape];
|
||||
di{Diamond is <br/> broken}-->ro(Rounded<br>square<br>shape);
|
||||
od2>Really long text in an Odd shape]-->od3>Really long text with linebreak<br>in an Odd shape]
|
||||
di{Diamond is broken}-->ro(Rounded squar shape);
|
||||
di-->ro2(Rounded square shape)
|
||||
end
|
||||
%% Comments after double percent signs
|
||||
subgraph
|
||||
e((Inner / circle))-->f(,.?!+-*ز);
|
||||
cyr[Cyrillic]-->cyr2((Circle shape Начало));
|
||||
A[Object foo,bar]-->B(Thing)
|
||||
end
|
||||
style e red;
|
||||
classDef green fill:#9f6,stroke:#333,stroke-width:2px;
|
||||
class green sq
|
||||
|
||||
</div>
|
||||
<div class="mermaid2">
|
||||
<div class="mermaid">
|
||||
graph LR;
|
||||
A(Central Message Router);
|
||||
B(R TD);
|
||||
|
@ -2,8 +2,8 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
|
||||
<script src="../dist/mermaid.full.js"></script>
|
||||
<link rel="stylesheet" href="../dist/mermaid.css"/>
|
||||
<script src="../dist/mermaid.js"></script>
|
||||
<script>
|
||||
var mermaid_config = {
|
||||
startOnLoad:true,
|
||||
@ -16,15 +16,15 @@
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.node-square {
|
||||
.node-square > rect {
|
||||
stroke-width: 4px;
|
||||
stroke: #339933;
|
||||
fill: #999900;
|
||||
font-weight: 300;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serf;
|
||||
font-size: 14px; }
|
||||
.node-circle { stroke-width: 0.5px; stroke: #339999; fill: #009900; }
|
||||
.node-odd-override { stroke-width: 3.5px; stroke: #339900; fill: #009999; }
|
||||
.node-circle > rect{ stroke-width: 0.5px; stroke: #339999; fill: #009900; }
|
||||
.node-odd-override > polygon{ stroke-width: 3.5px; stroke: #339900; fill: #009999; }
|
||||
.node-odd { stroke-width: 3.5px; stroke: #339900; fill: #009999; }
|
||||
|
||||
</style>
|
||||
@ -94,8 +94,8 @@
|
||||
e-->ninl;
|
||||
e1-->ninl;
|
||||
e2-->ninl;
|
||||
classDef node-e1 fill:#990066,stroke:#666622;
|
||||
classDef node-e2 fill:#990066,stroke:#666622;
|
||||
classDef node-e1 fill:#990066,stroke:#666622
|
||||
classDef node-e2 fill:#990066,stroke:#666622
|
||||
</pre>
|
||||
|
||||
<div class="mermaid">
|
||||
@ -120,23 +120,23 @@
|
||||
cyr-->|Complex<br>multiline<br>edge label|ncdef;
|
||||
class cyr node-cyr;
|
||||
class od2 node-odd-override;
|
||||
classDef node-odd-override fill:#BB00BB,stroke:#666622;
|
||||
classDef node-cyr fill:#BB0099,stroke:#666622;
|
||||
classDef node-odd-override fill:#BB00BB,stroke:#666622
|
||||
classDef node-cyr fill:#BB0099,stroke:#666622
|
||||
|
||||
e1[Class node-cyr<br />defined by classDef<br />and inline style];
|
||||
class e1 node-e1;
|
||||
style e1 fill:#FF0000;
|
||||
style e1 fill:#FF0000
|
||||
e2>Class node-odd-override<br />defined in page CSS<br />and defined by classDef<br />and inline style];
|
||||
class e2 node-e2;
|
||||
style e2 fill:#FF0000;
|
||||
style e2 fill:#FF0000
|
||||
e((Inline style in<br />graph definition));
|
||||
style e fill:#FF0000;
|
||||
style e fill:#FF0000
|
||||
ninl[Inline style];
|
||||
e-->ninl;
|
||||
e1-->ninl;
|
||||
e2-->ninl;
|
||||
classDef node-e1 fill:#990066,stroke:#666622;
|
||||
classDef node-e2 fill:#990066,stroke:#666622;
|
||||
classDef node-e1 fill:#990066,stroke:#666622
|
||||
classDef node-e2 fill:#990066,stroke:#666622
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
|
||||
<script src="../dist/mermaid.full.js"></script>
|
||||
<script src="../dist/mermaid.js"></script>
|
||||
<script>
|
||||
var mermaid_config = {
|
||||
startOnLoad:true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user