Comparing version 1.3.4 to 1.3.5
{ | ||
"name": "mscgenjs", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "Implementation of MscGen in JavaScript", | ||
@@ -15,11 +15,11 @@ "main": "index.js", | ||
"codecov.io": "0.1.6", | ||
"istanbul": "0.4.2", | ||
"js-makedepend": "0.2.1", | ||
"istanbul": "0.4.3", | ||
"js-makedepend": "0.2.3", | ||
"jscs": "2.11.0", | ||
"jsdom": "8.2.0", | ||
"jsdom": "8.3.0", | ||
"jshint": "2.9.1", | ||
"lodash-cli": "4.6.1", | ||
"lodash-cli": "4.9.0", | ||
"mocha": "2.4.5", | ||
"npm-check-updates": "2.6.1", | ||
"nsp": "2.2.2", | ||
"nsp": "2.3.0", | ||
"pegjs": "0.9.0", | ||
@@ -26,0 +26,0 @@ "plato": "1.5.0" |
@@ -64,6 +64,6 @@ /* jshint undef:true */ | ||
function _renderAST(pAST, pSource, pParentElementId, pWindow) { | ||
function _renderAST(pAST, pSource, pParentElementId, pWindow, pStyleAdditions) { | ||
var lAST = flatten.flatten(pAST); | ||
renderASTPre(lAST, pSource, pParentElementId, pWindow); | ||
renderASTPre(lAST, pSource, pParentElementId, pWindow, pStyleAdditions); | ||
renderASTMain(lAST); | ||
@@ -79,6 +79,12 @@ renderASTPost(lAST); | ||
function renderASTPre(pAST, pSource, pParentElementId, pWindow){ | ||
function renderASTPre(pAST, pSource, pParentElementId, pWindow, pStyleAdditions){ | ||
id.setPrefix(pParentElementId); | ||
gChart.document = skel.bootstrap(pParentElementId, id.get(), mark.getMarkerDefs(id.get(), pAST), pWindow); | ||
gChart.document = skel.bootstrap( | ||
pParentElementId, | ||
id.get(), | ||
mark.getMarkerDefs(id.get(), pAST), | ||
pStyleAdditions, | ||
pWindow | ||
); | ||
svgutl.init(gChart.document); | ||
@@ -496,3 +502,3 @@ initializeChart(gChart, pAST.depth); | ||
if (pEntity.linecolor) { | ||
lLine.setAttribute("style", "stroke : " + pEntity.linecolor + ";"); | ||
lLine.setAttribute("style", "stroke:" + pEntity.linecolor + ";"); | ||
} | ||
@@ -672,3 +678,3 @@ lGroup.appendChild(lLine); | ||
if (pArc.linecolor) { | ||
lLine.setAttribute("style", "stroke: " + pArc.linecolor + ";"); | ||
lLine.setAttribute("style", "stroke:" + pArc.linecolor + ";"); | ||
} | ||
@@ -725,3 +731,13 @@ | ||
var lArcDepthCorrection = (gChart.maxDepth - pArc.depth ) * 2 * C.LINE_WIDTH; | ||
lBox = fact.createRect({width: lWidth + lArcDepthCorrection * 2, height: lHeight, x: lStart - lArcDepthCorrection, y: 0}, "box inline_expression " + pArc.kind, pArc.linecolor, pArc.textbgcolor); | ||
lBox = fact.createRect( | ||
{ | ||
width: lWidth + lArcDepthCorrection * 2, | ||
height: lHeight, | ||
x: lStart - lArcDepthCorrection, | ||
y: 0 | ||
}, | ||
"box inline_expression " + pArc.kind, | ||
pArc.linecolor, | ||
pArc.textbgcolor | ||
); | ||
} | ||
@@ -761,2 +777,3 @@ lGroup.appendChild(lBox); | ||
* @param {window} pWindow - the browser window to put the svg in | ||
* @param {string} pStyleAdditions - valid css that augments the default style | ||
*/ | ||
@@ -763,0 +780,0 @@ renderAST : _renderAST |
@@ -42,3 +42,3 @@ /* jshint undef:true */ | ||
if (pTextbgcolor) { | ||
lRect.setAttribute("style", "fill: " + pTextbgcolor + "; stroke:" + pTextbgcolor + ";"); | ||
lRect.setAttribute("style", "fill:" + pTextbgcolor + "; stroke:" + pTextbgcolor + ";"); | ||
} | ||
@@ -45,0 +45,0 @@ return lRect; |
@@ -12,3 +12,3 @@ /* jshint undef:true */ | ||
define(["./svgelementfactory", "./constants"], function(fact, C) { | ||
define(["./svgelementfactory", "./constants", "./csstemplates"], function(fact, C, csstemplates) { | ||
/** | ||
@@ -49,10 +49,10 @@ * sets up a skeleton svg, with the skeleton for rendering an msc ready | ||
function setupStyle() { | ||
function setupStyle(pStyleAdditions) { | ||
var lStyle = gDocument.createElement("style"); | ||
lStyle.setAttribute("type", "text/css"); | ||
lStyle.appendChild(gDocument.createTextNode(setupStyleElement())); | ||
lStyle.appendChild(gDocument.createTextNode(setupStyleElement(pStyleAdditions))); | ||
return lStyle; | ||
} | ||
function setupDefs(pElementId, pMarkerDefs) { | ||
function setupDefs(pElementId, pMarkerDefs, pStyleAdditions) { | ||
/* definitions - which will include style, markers and an element | ||
@@ -62,3 +62,3 @@ * to put "dynamic" definitions in | ||
var lDefs = fact.createDefs(); | ||
lDefs.appendChild(setupStyle()); | ||
lDefs.appendChild(setupStyle(pStyleAdditions)); | ||
lDefs = setupMarkers(lDefs, pMarkerDefs); | ||
@@ -86,3 +86,3 @@ lDefs.appendChild(fact.createGroup(pElementId + "__defs")); | ||
function _bootstrap(pParentElementId, pSvgElementId, pMarkerDefs, pWindow) { | ||
function _bootstrap(pParentElementId, pSvgElementId, pMarkerDefs, pStyleAdditions, pWindow) { | ||
@@ -97,3 +97,3 @@ gDocument = _init(pWindow); | ||
lSkeletonSvg.appendChild(fact.createDesc(pSvgElementId + "__msc_source")); | ||
lSkeletonSvg.appendChild(setupDefs(pSvgElementId, pMarkerDefs)); | ||
lSkeletonSvg.appendChild(setupDefs(pSvgElementId, pMarkerDefs, pStyleAdditions)); | ||
lSkeletonSvg.appendChild(setupBody(pSvgElementId)); | ||
@@ -105,95 +105,7 @@ lParent.appendChild(lSkeletonSvg); | ||
function setupStyleElement(pVerbose) { | ||
/*jshint multistr:true */ | ||
/* jshint -W030 */ /* jshint -W033 */ | ||
var lRetval = "\ | ||
svg{\ | ||
font-family:Helvetica,sans-serif;\ | ||
font-size:" + C.FONT_SIZE + "px;\ | ||
font-weight:normal;\ | ||
font-style:normal;\ | ||
text-decoration:none;\ | ||
background-color:white;\ | ||
stroke:black;\ | ||
color:black;\ | ||
}\ | ||
rect{\ | ||
fill:none;\ | ||
stroke:black;\ | ||
stroke-width:"+ C.LINE_WIDTH + ";\ | ||
}\ | ||
rect.entity{\ | ||
fill:white;\ | ||
}\ | ||
rect.label-text-background{\ | ||
fill:white;\ | ||
stroke:white;\ | ||
stroke-width:0;\ | ||
}\ | ||
rect.bglayer{\ | ||
fill:white;\ | ||
stroke:white;\ | ||
stroke-width:0;\ | ||
}\ | ||
line{\ | ||
stroke:black;\ | ||
stroke-width:"+ C.LINE_WIDTH + ";\ | ||
}\ | ||
line.return{\ | ||
stroke-dasharray:5,2;\ | ||
}\ | ||
line.comment{\ | ||
stroke-dasharray:5,2;\ | ||
}\ | ||
line.inline_expression_divider{\ | ||
stroke-dasharray:10,5;\ | ||
}\ | ||
text{\ | ||
color:inherit;\ | ||
stroke:none;\ | ||
text-anchor:middle;\ | ||
}\ | ||
text.entity-text{\ | ||
text-decoration:underline;\ | ||
}\ | ||
text.anchor-start{\ | ||
text-anchor:start;\ | ||
}\ | ||
text.box-text{\ | ||
}\ | ||
path{\ | ||
stroke:black;\ | ||
color:black;\ | ||
stroke-width:"+ C.LINE_WIDTH + ";\ | ||
fill:none;\ | ||
}\ | ||
.arrow-marker{\ | ||
overflow:visible;\ | ||
}\ | ||
.arrow-style{\ | ||
stroke-width:1;\ | ||
}\ | ||
.arcrowomit{\ | ||
stroke-dasharray:2,2;\ | ||
}\ | ||
rect.box, path.box{\ | ||
fill:white;\ | ||
}\ | ||
.inherit{\ | ||
stroke:inherit;\ | ||
color:inherit;\ | ||
}\ | ||
.inherit-fill{\ | ||
fill:inherit;\ | ||
}\ | ||
.watermark{\ | ||
stroke:black;\ | ||
color:black;\ | ||
fill:black;\ | ||
font-size: 48pt;\ | ||
font-weight:bold;\ | ||
opacity:0.14;\ | ||
}"; | ||
/* jshint +W030 */ /* jshint +W033 */ | ||
return !!pVerbose ? lRetval.replace(/[\ ]{12}/g, "\n ") : lRetval.replace(/[\ ]+/g, ""); | ||
function setupStyleElement(pStyleAdditions) { | ||
return csstemplates.baseTemplate({ | ||
fontSize : C.FONT_SIZE, | ||
lineWidth: C.LINE_WIDTH | ||
}) + (!!pStyleAdditions ? pStyleAdditions : ""); | ||
} | ||
@@ -208,2 +120,4 @@ return { | ||
* @param {string} pSvgElementId | ||
* @param {object} pMarkerDefs | ||
* @param {string} pStyleAdditions | ||
* @param {window} pWindow | ||
@@ -210,0 +124,0 @@ */ |
@@ -12,3 +12,3 @@ /* jshint undef:true */ | ||
define(["./constants", "./svglowlevelfactory", "./geometry.js"], function(C, factll, math) { | ||
define(["./constants", "./svglowlevelfactory", "./geometry"], function(C, factll, math) { | ||
/** | ||
@@ -163,4 +163,4 @@ * Renders individual elements in sequence charts | ||
/* superscript style could also be super or a number (1em) or a % (100%) */ | ||
var lSuperscriptStyle = "vertical-align : text-top;"; | ||
lSuperscriptStyle += "font-size: 0.7em; text-anchor: start;"; | ||
var lSuperscriptStyle = "vertical-align:text-top;"; | ||
lSuperscriptStyle += "font-size:0.7em;text-anchor:start;"; | ||
@@ -379,3 +379,3 @@ function _createABox(pBBox, pClass, pColor, pBgColor) { | ||
{ | ||
style: "stroke-dasharray:100,1; stroke : " + pColor||"black" | ||
style: "stroke-dasharray:100,1;stroke:" + pColor||"black" | ||
} | ||
@@ -382,0 +382,0 @@ ) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1774527
167
35857
12