New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mscgenjs

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mscgenjs - npm Package Compare versions

Comparing version 1.9.11 to 1.10.0

render/astmassage/normalizeoptions.js

5

doc/msgenny.md

@@ -89,5 +89,2 @@ # MsGenny

<table>

@@ -153,3 +150,3 @@ <tr><th>feature</th><th>MscGen</th><th>MsGenny</th></tr>

<td>hscale, arcgradient, width, wordwraparcs </td>
<td>same as mscgen, plus "watermark" (which works as in xù)</td>
<td>same as mscgen, plus "wordwrapentities", "wordwrapboxes" and "watermark" (which work as in xù)</td>
</tr>

@@ -156,0 +153,0 @@ <tr>

12

doc/xu.md

@@ -143,2 +143,10 @@ # Xù - an MscGen super set

### autowrapping options
MscGen has an option to automatically wrap text on regular arcs
(`wordwraparcs`), which is off by default. Text in any box
(`note`, `box`, `rbox` and `abox`) always automatically wraps to fit into
the box.
In addition Xù and MsGenny
### title - for tool tips

@@ -162,4 +170,4 @@

b =>> b [
label="self reference",
title="Title for a self referencing arc"
label="self reference",
title="Title for a self referencing arc"
];

@@ -166,0 +174,0 @@ }

@@ -95,3 +95,3 @@ /* istanbul ignore else */

version: "1.9.11",
version: "1.10.0",

@@ -98,0 +98,0 @@ getAllowedValues: function() {

{
"name": "mscgenjs",
"version": "1.9.11",
"version": "1.10.0",
"description": "Implementation of MscGen in JavaScript",

@@ -14,3 +14,3 @@ "main": "index.js",

"dependency-cruiser": "2.1.1",
"eslint": "3.18.0",
"eslint": "3.19.0",
"istanbul": "0.4.5",

@@ -21,3 +21,3 @@ "js-makedepend": "2.2.2",

"mocha": "3.2.0",
"npm-check-updates": "2.10.4",
"npm-check-updates": "2.10.5",
"nsp": "2.6.3",

@@ -24,0 +24,0 @@ "pegjs": "0.10.0",

@@ -16,7 +16,8 @@ /* istanbul ignore else */

var asttransform = require("./asttransform");
var aggregatekind = require("./aggregatekind");
var normalizekind = require("./normalizekind");
var _ = require("../../lib/lodash/lodash.custom");
var escape = require("../textutensils/escape");
var asttransform = require("./asttransform");
var aggregatekind = require("./aggregatekind");
var normalizekind = require("./normalizekind");
var normalizeoptions = require("./normalizeoptions");
var _ = require("../../lib/lodash/lodash.custom");
var escape = require("../textutensils/escape");

@@ -249,2 +250,3 @@ var gMaxDepth = 0;

flatten : function(pAST) {
pAST.options = normalizeoptions(pAST.options);
return asttransform.transform(

@@ -251,0 +253,0 @@ _unwind(pAST),

@@ -55,4 +55,4 @@ /* istanbul ignore else */

},
getNoEntityLines: function(pLabel, pFontSize){
return renderlabels.splitLabel(pLabel, "box", gEntityDims.width, pFontSize).length;
getNoEntityLines: function(pLabel, pFontSize, pOptions){
return renderlabels.splitLabel(pLabel, "entity", gEntityDims.width, pFontSize, pOptions).length;
}

@@ -59,0 +59,0 @@ };

@@ -123,5 +123,5 @@ /* istanbul ignore else */

function renderASTMain(pAST){
renderEntities(pAST.entities);
renderEntities(pAST.entities, pAST.options);
rowmemory.clear(entities.getDims().height, gChart.arcRowHeight);
renderArcRows(pAST.arcs, pAST.entities);
renderArcRows(pAST.arcs, pAST.entities, pAST.options);
if (gChart.mirrorEntitiesOnBottom){

@@ -277,7 +277,7 @@ renderEntitiesOnBottom(pAST.entities);

*/
function getMaxEntityHeight(pEntities){
function getMaxEntityHeight(pEntities, pOptions){
var lHighestEntity = pEntities[0];
var lHWM = 2;
pEntities.forEach(function(pEntity){
var lNoEntityLines = entities.getNoEntityLines(pEntity.label, constants.FONT_SIZE);
var lNoEntityLines = entities.getNoEntityLines(pEntity.label, constants.FONT_SIZE, pOptions);
if (lNoEntityLines > lHWM){

@@ -293,3 +293,3 @@ lHWM = lNoEntityLines;

svgutensils.getBBox(
renderEntity(lHighestEntity)
renderEntity(lHighestEntity, 0, pOptions)
).height

@@ -301,3 +301,3 @@ );

function renderEntity(pEntity, pX) {
function renderEntity(pEntity, pX, pOptions) {
var lGroup = svgelementfactory.createGroup();

@@ -316,3 +316,8 @@ var lBBox = entities.getDims();

renderlabels.createLabel(
pEntity,
_.defaults(
pEntity,
{
kind: "entity"
}
),
{

@@ -323,5 +328,3 @@ x:lBBox.x,

},
{
kind: "entity"
}
pOptions
)

@@ -366,3 +369,3 @@ );

*/
function renderEntities(pEntities) {
function renderEntities(pEntities, pOptions) {
var lEntityXPos = 0;

@@ -372,6 +375,6 @@ var lEntityGroup = svgelementfactory.createGroup(idmanager.get("entities"));

if (pEntities) {
entities.setHeight(getMaxEntityHeight(pEntities) + constants.LINE_WIDTH * 2);
entities.setHeight(getMaxEntityHeight(pEntities, pOptions) + constants.LINE_WIDTH * 2);
pEntities.forEach(function(pEntity){
lEntityGroup.appendChild(renderEntity(pEntity, lEntityXPos));
lEntityGroup.appendChild(renderEntity(pEntity, lEntityXPos, pOptions));
entities.setX(pEntity, lEntityXPos);

@@ -392,3 +395,3 @@ lEntityXPos += entities.getDims().interEntitySpacing;

function renderBroadcastArc(pArc, pEntities, lRowMemory, pY) {
function renderBroadcastArc(pArc, pEntities, lRowMemory, pY, pOptions) {
var xTo = 0;

@@ -405,3 +408,3 @@ var lLabel = pArc.label;

xTo = entities.getX(pEntity.name);
lElement = createArc(pArc, xFrom, xTo, pY);
lElement = createArc(pArc, xFrom, xTo, pY, pOptions);
lRowMemory.push({

@@ -417,3 +420,3 @@ layer : gChart.layer.sequence,

function renderRegularArc(pArc, pEntities, pRowMemory, pY){
function renderRegularArc(pArc, pEntities, pRowMemory, pY, pOptions){
var lElement = {};

@@ -423,3 +426,3 @@

if (pArc.to === "*") { // it's a broadcast arc
renderBroadcastArc(pArc, pEntities, pRowMemory, pY);
renderBroadcastArc(pArc, pEntities, pRowMemory, pY, pOptions);
/* creates a label on the current line, smack in the middle */

@@ -434,7 +437,9 @@ lElement =

},
{
alignAround : true,
ownBackground : true,
wordWrapArcs : gChart.wordWrapArcs
}
_.defaults(
_.cloneDeep(pOptions),
{
alignAround : true,
ownBackground : true
}
)
);

@@ -452,3 +457,4 @@ pRowMemory.push({

entities.getX(pArc.to),
pY
pY,
pOptions
);

@@ -465,3 +471,3 @@ pRowMemory.push({

function getArcRowHeight (pArcRow, pRowNumber, pEntities) {
function getArcRowHeight (pArcRow, pRowNumber, pEntities, pOptions) {
var lRetval = 0;

@@ -477,3 +483,3 @@

case ("box"):
lElement = createBox(entities.getOAndD(pArc.from, pArc.to), pArc, 0);
lElement = createBox(entities.getOAndD(pArc.from, pArc.to), pArc, 0, pOptions);
break;

@@ -484,3 +490,3 @@ case ("inline_expression"):

default:
lElement = renderRegularArc(pArc, pEntities, [], 0);
lElement = renderRegularArc(pArc, pEntities, [], 0, pOptions);
}// switch

@@ -497,3 +503,3 @@

function renderArcRow (pArcRow, pRowNumber, pEntities){
function renderArcRow (pArcRow, pRowNumber, pEntities, pOptions){
var lArcRowClass = "arcrow";

@@ -506,3 +512,3 @@ var lRowMemory = [];

rowmemory.get(pRowNumber).height,
getArcRowHeight(pArcRow, pRowNumber, pEntities)
getArcRowHeight(pArcRow, pRowNumber, pEntities, pOptions)
)

@@ -529,3 +535,4 @@ );

pArc,
rowmemory.get(pRowNumber).y
rowmemory.get(pRowNumber).y,
pOptions
);

@@ -554,3 +561,4 @@ lRowMemory.push({

lRowMemory,
rowmemory.get(pRowNumber).y
rowmemory.get(pRowNumber).y,
pOptions
);

@@ -588,3 +596,3 @@ }// switch

*/
function renderArcRows(pArcRows, pEntities) {
function renderArcRows(pArcRows, pEntities, pOptions) {
gInlineExpressionMemory = [];

@@ -604,3 +612,3 @@

for (var i = 0; i < pArcRows.length; i++){
renderArcRow(pArcRows[i], i, pEntities);
renderArcRow(pArcRows[i], i, pEntities, pOptions);
}

@@ -651,3 +659,3 @@ // pArcRows.forEach(renderArcRow);

ownBackground: false,
wordWrapArcs: gChart.wordWrapArcs
wordwraparcs: gChart.wordWrapArcs
}

@@ -828,3 +836,3 @@ );

function createArc(pArc, pFrom, pTo, pY) {
function createArc(pArc, pFrom, pTo, pY, pOptions) {
var lGroup = svgelementfactory.createGroup();

@@ -855,8 +863,10 @@ var lClass = "arc ";

},
{
alignLeft: true,
alignAbove: true,
ownBackground: true,
wordWrapArcs: gChart.wordWrapArcs
}
_.defaults(
_.cloneDeep(pOptions),
{
alignLeft: true,
alignAbove: true,
ownBackground: true
}
)
)

@@ -884,8 +894,10 @@ );

{x: pFrom, y: pY, width: pTo - pFrom},
{
alignAround: true,
alignAbove: (gChart.regularArcTextVerticalAlignment === "above"),
ownBackground: true,
wordWrapArcs: gChart.wordWrapArcs
}
_.defaults(
_.cloneDeep(pOptions),
{
alignAround: true,
alignAbove: (gChart.regularArcTextVerticalAlignment === "above"),
ownBackground: true
}
)
)

@@ -917,3 +929,3 @@ );

{x:lArcStart, y:pY, width:lArcEnd},
{ownBackground:true, wordWrapArcs: gChart.wordWrapArcs}
{ownBackground:true, wordwraparcs: gChart.wordWrapArcs}
);

@@ -1010,3 +1022,3 @@ }

*/
function createBox(pOAndD, pArc, pY) {
function createBox(pOAndD, pArc, pY, pOptions) {
/* begin: same as createInlineExpressionBox */

@@ -1024,3 +1036,3 @@ var lMaxDepthCorrection = gChart.maxDepth * 2 * constants.LINE_WIDTH;

var lBox = {};
var lTextGroup = renderlabels.createLabel(pArc, {x:lStart, y:pY, width:lWidth});
var lTextGroup = renderlabels.createLabel(pArc, {x:lStart, y:pY, width:lWidth}, pOptions);
var lTextBBox = svgutensils.getBBox(lTextGroup);

@@ -1027,0 +1039,0 @@ var lHeight = Math.max(lTextBBox.height + 2 * constants.LINE_WIDTH, gChart.arcRowHeight - 2 * constants.LINE_WIDTH);

@@ -119,3 +119,3 @@ /* istanbul ignore else */

constants.FONT_SIZE,
pOptions ? pOptions.wordWrapArcs : false
pOptions
);

@@ -183,4 +183,8 @@ var lText = {};

function _splitLabel(pLabel, pKind, pWidth, pFontSize, pWordWrapArcs) {
if ("box" === aggregatekind.getAggregate(pKind) || typeof pKind === 'undefined' || pWordWrapArcs){
function _splitLabel(pLabel, pKind, pWidth, pFontSize, pOptions) {
if (("box" === aggregatekind.getAggregate(pKind) && pOptions.wordwrapboxes) ||
("entity" === pKind && pOptions.wordwrapentities) ||
("box" !== aggregatekind.getAggregate(pKind) && "entity" !== pKind && pOptions.wordwraparcs) ||
typeof pKind === 'undefined'
){
return wrap.wrap(pLabel, _determineMaxTextWidthInChars(pWidth, pFontSize));

@@ -215,3 +219,3 @@ } else {

* @param <number> - pFontSize (in px)
* @param <bool> - pWordWrapArcs
* @param <object> - options (the one ones heeded: wordwraparcs, wordwrapentities, wordwrapboxes)
* @return <array of strings> - lLines

@@ -218,0 +222,0 @@ */

@@ -30,16 +30,16 @@ /* istanbul ignore else */

/*
This file is part of mscgen_js.
This file is part of mscgen_js.
mscgen_js is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
mscgen_js is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
mscgen_js is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
mscgen_js is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with mscgen_js. If not, see <http://www.gnu.org/licenses/>.
*/
You should have received a copy of the GNU General Public License
along with mscgen_js. If not, see <http://www.gnu.org/licenses/>.
*/

@@ -26,3 +26,3 @@ /*

"renderKindfn" : renderKind,
"supportedOptions" : ["hscale", "width", "arcgradient", "wordwraparcs", "watermark", "mirrorentitiesonbottom"],
"supportedOptions" : ["hscale", "width", "arcgradient", "wordwraparcs", "watermark", "wordwrapentities", "wordwrapboxes"],
"supportedEntityAttributes" : ["label"],

@@ -29,0 +29,0 @@ "supportedArcAttributes" : ["label"],

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 too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc