Comparing version 2.1.0-beta-1 to 3.0.0-beta-0
@@ -59,3 +59,3 @@ "use strict"; | ||
}, | ||
version: "2.1.0-beta-0", | ||
version: "3.0.0-beta-0", | ||
getAllowedValues() { | ||
@@ -62,0 +62,0 @@ return allowedvalues_1.default; |
@@ -20,5 +20,9 @@ "use strict"; | ||
const svgutensils_1 = __importDefault(require("./svgutensils")); | ||
//#endregion | ||
//#region const | ||
const PAD_VERTICAL = 3; | ||
const DEFAULT_ARCROW_HEIGHT = 38; // chart only | ||
const DEFAULT_ARC_GRADIENT = 0; // chart only | ||
//#endregion | ||
//#region global variables | ||
/* sensible default - get overwritten in bootstrap */ | ||
@@ -43,5 +47,7 @@ const gChart = Object.seal({ | ||
let gInlineExpressionMemory = []; | ||
//#endregion | ||
function getParentElement(pWindow, pParentElementId) { | ||
return pWindow.document.getElementById(pParentElementId) || pWindow.document.body; | ||
} | ||
//#region render level 0 & 1 | ||
function render(pAST, pWindow, pParentElementId, pRenderOptions) { | ||
@@ -85,2 +91,3 @@ const lFlattenedAST = Object.freeze(flatten_1.default.flatten(pAST)); | ||
} | ||
//#endregion | ||
function createLayerShortcuts(pDocument) { | ||
@@ -180,3 +187,3 @@ return { | ||
} | ||
/* ----------------------START entity shizzle-------------------------------- */ | ||
//#region entities | ||
function renderEntitiesOnBottom(pEntities, pOptions) { | ||
@@ -219,3 +226,3 @@ const lLifeLineSpacerY = rowmemory_1.default.getLast().y + (rowmemory_1.default.getLast().height + gChart.arcRowHeight) / 2; | ||
} | ||
/* ------------------------END entity shizzle-------------------------------- */ | ||
//#endregion | ||
function renderBroadcastArc(pArc, pEntities, pRowMemory, pRowNumber, pOptions) { | ||
@@ -377,3 +384,3 @@ let xTo = 0; | ||
renderInlineExpressions(gInlineExpressionMemory); | ||
} // function | ||
} | ||
/** | ||
@@ -429,2 +436,22 @@ * renderInlineExpressionLabel() - renders the label of an inline expression | ||
} | ||
function createInlineExpressionBox(pOAndD, pArc, pHeight, pY) { | ||
/* begin: same as createBox */ | ||
const lMaxDepthCorrection = gChart.maxDepth * 2 * constants_1.default.LINE_WIDTH; | ||
const lWidth = (pOAndD.to - pOAndD.from) + | ||
entities_1.default.getDims().interEntitySpacing - 2 * constants_1.default.LINE_WIDTH - lMaxDepthCorrection; // px | ||
const lStart = pOAndD.from - | ||
((entities_1.default.getDims().interEntitySpacing - 2 * constants_1.default.LINE_WIDTH - lMaxDepthCorrection) / 2); | ||
/* end: same as createBox */ | ||
const lArcDepthCorrection = (gChart.maxDepth - pArc.depth) * 2 * constants_1.default.LINE_WIDTH; | ||
return index_1.default.createRect({ | ||
width: lWidth + lArcDepthCorrection * 2, | ||
height: pHeight ? pHeight : gChart.arcRowHeight - 2 * constants_1.default.LINE_WIDTH, | ||
x: lStart - lArcDepthCorrection, | ||
y: pY, | ||
}, { | ||
class: `box inline_expression ${pArc.kind}`, | ||
color: pArc.linecolor, | ||
bgColor: pArc.textbgcolor, | ||
}); | ||
} | ||
function renderInlineExpressions(pInlineExpressions) { | ||
@@ -666,22 +693,2 @@ pInlineExpressions.forEach((pInlineExpression) => { | ||
} | ||
function createInlineExpressionBox(pOAndD, pArc, pHeight, pY) { | ||
/* begin: same as createBox */ | ||
const lMaxDepthCorrection = gChart.maxDepth * 2 * constants_1.default.LINE_WIDTH; | ||
const lWidth = (pOAndD.to - pOAndD.from) + | ||
entities_1.default.getDims().interEntitySpacing - 2 * constants_1.default.LINE_WIDTH - lMaxDepthCorrection; // px | ||
const lStart = pOAndD.from - | ||
((entities_1.default.getDims().interEntitySpacing - 2 * constants_1.default.LINE_WIDTH - lMaxDepthCorrection) / 2); | ||
/* end: same as createBox */ | ||
const lArcDepthCorrection = (gChart.maxDepth - pArc.depth) * 2 * constants_1.default.LINE_WIDTH; | ||
return index_1.default.createRect({ | ||
width: lWidth + lArcDepthCorrection * 2, | ||
height: pHeight ? pHeight : gChart.arcRowHeight - 2 * constants_1.default.LINE_WIDTH, | ||
x: lStart - lArcDepthCorrection, | ||
y: pY, | ||
}, { | ||
class: `box inline_expression ${pArc.kind}`, | ||
color: pArc.linecolor, | ||
bgColor: pArc.textbgcolor, | ||
}); | ||
} | ||
/** | ||
@@ -766,7 +773,7 @@ * creates an element representing a box (box, abox, rbox, note) | ||
* | ||
* @param {object} pAST - the abstract syntax tree | ||
* @param {window} pWindow - the browser window to put the svg in | ||
* @param {mscgenjsast.ISequenceChart} pAST - the abstract syntax tree | ||
* @param {Window} pWindow - the browser window to put the svg in | ||
* @param {string} pParentElementId - the id of the parent element in which | ||
* to put the __svg_output element | ||
* @param {object} pOptions | ||
* @param {INormalizedRenderOptions} pOptions | ||
* - styleAdditions: valid css that augments the default style | ||
@@ -773,0 +780,0 @@ * - additionalTemplate: a named (baked in) template. Current values: |
@@ -53,3 +53,3 @@ "use strict"; | ||
} | ||
function _getBBox(pElement) { | ||
function getBBox(pElement) { | ||
/* istanbul ignore if */ | ||
@@ -76,3 +76,3 @@ if (typeof (pElement.getBBox) === "function") { | ||
*/ | ||
return _getBBox(index_1.default.createText("\u00C1jy\u00CE9\u0192@\uD83D\uDCA9", { | ||
return getBBox(index_1.default.createText("\u00C1jy\u00CE9\u0192@\uD83D\uDCA9", { | ||
x: 0, | ||
@@ -82,3 +82,3 @@ y: 0, | ||
} | ||
function _removeRenderedSVGFromElement(pElementId) { | ||
function removeRenderedSVGFromElement(pElementId) { | ||
idmanager_1.default.setPrefix(pElementId); | ||
@@ -100,3 +100,3 @@ const lChildElement = gDocument.getElementById(idmanager_1.default.get()); | ||
}, | ||
removeRenderedSVGFromElement: _removeRenderedSVGFromElement, | ||
removeRenderedSVGFromElement, | ||
/** | ||
@@ -114,3 +114,3 @@ * Returns the bounding box of the passed element. | ||
*/ | ||
getBBox: _getBBox, | ||
getBBox, | ||
/** | ||
@@ -117,0 +117,0 @@ * Returns the height in pixels necessary for rendering characters |
@@ -37,10 +37,10 @@ "use strict"; | ||
/* rendering comments within comments, that are eventually output | ||
* to doxygen html - don't think that's going to be necessary | ||
* or desired functionality. If it is remember to be able to | ||
* - have a solution for nested comments (otherwise: interesting results) | ||
* - have a solution for comments that have an other meaning (# this is | ||
* a comment -> doxygen translates this as markdown title) | ||
* - handling languages different from c/ java/ d that have alternative | ||
* comment/ documentation sections | ||
*/ | ||
* to doxygen html - don't think that's going to be necessary | ||
* or desired functionality. If it is remember to be able to | ||
* - have a solution for nested comments (otherwise: interesting results) | ||
* - have a solution for comments that have an other meaning (# this is | ||
* a comment -> doxygen translates this as markdown title) | ||
* - handling languages different from c/ java/ d that have alternative | ||
* comment/ documentation sections | ||
*/ | ||
return ""; | ||
@@ -47,0 +47,0 @@ } |
{ | ||
"name": "mscgenjs", | ||
"version": "2.1.0-beta-1", | ||
"version": "3.0.0-beta-0", | ||
"description": "Sequence chart rendering library", | ||
@@ -21,10 +21,10 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@types/node": "10.5.2", | ||
"@types/node": "10.5.7", | ||
"chai": "4.1.2", | ||
"chai-xml": "0.3.2", | ||
"dependency-cruiser": "4.3.1", | ||
"jest": "23.4.1", | ||
"jest-json-schema": "2.0.0", | ||
"dependency-cruiser": "4.3.2", | ||
"jest": "23.4.2", | ||
"jest-json-schema": "2.0.1", | ||
"js-makedepend": "3.0.2", | ||
"jsdom": "11.11.0", | ||
"jsdom": "11.12.0", | ||
"npm-run-all": "4.1.3", | ||
@@ -34,8 +34,8 @@ "pegjs": "0.10.0", | ||
"shx": "0.3.2", | ||
"ts-jest": "23.0.1", | ||
"ts-jest": "23.1.3", | ||
"ts-loader": "4.4.2", | ||
"tslint": "5.11.0", | ||
"typescript": "2.9.2", | ||
"typescript": "3.0.1", | ||
"upem": "1.0.0", | ||
"webpack": "4.16.1", | ||
"webpack": "4.16.5", | ||
"webpack-cli": "3.1.0" | ||
@@ -94,5 +94,6 @@ }, | ||
"transform": { | ||
"\\.(ts)$": "<rootDir>/node_modules/ts-jest/preprocessor.js" | ||
"\\.(ts)$": "ts-jest" | ||
}, | ||
"testRegex": "test.*\\.spec\\.(ts|js)$", | ||
"testURL": "http://localhost", | ||
"collectCoverage": true, | ||
@@ -99,0 +100,0 @@ "coverageReporters": [ |
@@ -47,3 +47,3 @@ # mscgen_js - core package | ||
// commonjs | ||
var mscgenjs = require('mscgenjs'); | ||
const mscgenjs = require('mscgenjs'); | ||
``` | ||
@@ -54,16 +54,9 @@ | ||
// e.g. an electron shell without a minifier. | ||
var mscgenjs = require('mscgenjs/index-lazy'); | ||
const mscgenjs = require('mscgenjs/dist/index-lazy'); | ||
``` | ||
```javascript | ||
// commonjs, only for use with webpack > 2, as long as | ||
// issue [webpack/webpack#5316](https://github.com/webpack/webpack/issues/5316) | ||
// remains unresolved | ||
var mscgenjs = require('mscgenjs/dist/webpack-issue-5316-workaround'); | ||
``` | ||
```javascript | ||
// requirejs - assuming the module is in your root and you're loading from | ||
// node_modules. | ||
define(['./node_modules/mscgenjs/src/index'], function(mscgenjs){ | ||
define(['./node_modules/mscgenjs/dist/index.min'], function(mscgenjs){ | ||
// your code here | ||
@@ -74,6 +67,11 @@ }); | ||
define(function(require){ | ||
var mscgenjs = require("./node_modules/mscgenjs/index"); | ||
var mscgenjs = require("./node_modules/mscgenjs/dist/index.min"); | ||
// your code here | ||
}); | ||
``` | ||
> Previously, as a workaround for webpack | ||
> issue [webpack/webpack#5316](https://github.com/webpack/webpack/issues/5316) | ||
> you needed to include `webpack-issue-5316-workaround` from the | ||
> `dist` folder. That's not necessary anymore; using `require('mscgenjs')` | ||
> works fine. | ||
@@ -80,0 +78,0 @@ ### Use it |
Sorry, the diff of this file is too big to display
15826
750363
274